Skip to content

Commit

Permalink
Moving the file and folder movers inside their own namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Oct 10, 2017
1 parent 6bc5522 commit bc7a09b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Modules/Media/Http/Controllers/Api/MoveMediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Modules\Media\Http\Requests\MoveMediaRequest;
use Modules\Media\Repositories\FileRepository;
use Modules\Media\Repositories\FolderRepository;
use Modules\Media\Services\FileMover;
use Modules\Media\Services\FolderMover;
use Modules\Media\Services\Movers\FileMover;
use Modules\Media\Services\Movers\FolderMover;

class MoveMediaController extends Controller
{
Expand Down Expand Up @@ -49,7 +49,7 @@ public function __invoke(MoveMediaRequest $request)
$failedMoves = 0;
foreach ($request->get('files') as $file) {
$file = $this->file->find($file['id']);

// $this->>mover->move($file, $destination)
if ($file->is_folder === false) {
if ($this->fileMover->move($file, $destination) === false) {
$failedMoves++;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Modules\Media\Services;
namespace Modules\Media\Services\Movers;

use Illuminate\Contracts\Filesystem\Factory;
use League\Flysystem\FileExistsException;
Expand All @@ -9,9 +9,8 @@
use Modules\Media\Image\ThumbnailManager;
use Modules\Media\Repositories\FileRepository;
use Modules\Media\Repositories\FolderRepository;
use Modules\Media\ValueObjects\MediaPath;

class FileMover implements Mover
final class FileMover implements MoverInterface
{
/**
* All the different images types where thumbnails should be created
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace Modules\Media\Services;
namespace Modules\Media\Services\Movers;

use Illuminate\Contracts\Filesystem\Factory;
use League\Flysystem\FileExistsException;
use Modules\Media\Entities\File;
use Modules\Media\Repositories\FileRepository;
use Modules\Media\Repositories\FolderRepository;

final class FolderMover implements Mover
final class FolderMover implements MoverInterface
{
/**
* @var Factory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Modules\Media\Services;
namespace Modules\Media\Services\Movers;

use Modules\Media\Entities\File;

interface Mover
interface MoverInterface
{
public function move(File $file, File $destination) : bool;
}
2 changes: 1 addition & 1 deletion Modules/Media/Tests/FileMoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Modules\Media\Entities\File;
use Modules\Media\Repositories\FileRepository;
use Modules\Media\Repositories\FolderRepository;
use Modules\Media\Services\FileMover;
use Modules\Media\Services\Movers\FileMover;
use Modules\Media\Services\FileService;

final class FileMoverTest extends MediaTestCase
Expand Down
2 changes: 1 addition & 1 deletion Modules/Media/Tests/FolderMoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Modules\Media\Entities\File;
use Modules\Media\Repositories\FolderRepository;
use Modules\Media\Services\FileService;
use Modules\Media\Services\FolderMover;
use Modules\Media\Services\Movers\FolderMover;

final class FolderMoverTest extends MediaTestCase
{
Expand Down

0 comments on commit bc7a09b

Please sign in to comment.