From 70b9622c9747e79311eb72db027f487b4915bef9 Mon Sep 17 00:00:00 2001 From: Nicolas Widart Date: Sun, 28 Dec 2014 12:25:26 +0100 Subject: [PATCH] Conform to PSR2 coding standards --- Config/thumbnails.php | 4 +- Console/RefreshThumbnailCommand.php | 1 - .../2014_10_26_162751_create_files_table.php | 56 +++++++++---------- ..._162811_create_file_translations_table.php | 1 - Database/Seeders/MediaDatabaseSeeder.php | 2 - Entities/File.php | 2 +- Helpers/FileHelper.php | 2 +- Http/Controllers/Admin/MediaController.php | 10 ++-- Http/Controllers/Api/MediaController.php | 2 +- Http/routes.php | 6 +- Image/Facade/Imagy.php | 5 +- Image/ImageFactoryInterface.php | 2 +- Image/ImageHandlerInterface.php | 4 +- Image/ImageServiceProvider.php | 5 +- Image/Imagy.php | 48 ++++++++-------- Image/Intervention/InterventionFactory.php | 6 +- Image/Intervention/Manipulations/Blur.php | 6 +- .../Intervention/Manipulations/Brightness.php | 6 +- Image/Intervention/Manipulations/Colorize.php | 4 +- Image/Intervention/Manipulations/Contrast.php | 6 +- Image/Intervention/Manipulations/Crop.php | 4 +- Image/Intervention/Manipulations/Fit.php | 6 +- Image/Intervention/Manipulations/Flip.php | 6 +- Image/Intervention/Manipulations/Gamma.php | 6 +- .../Intervention/Manipulations/Greyscale.php | 4 +- Image/Intervention/Manipulations/Heighten.php | 4 +- Image/Intervention/Manipulations/Invert.php | 4 +- .../Manipulations/LimitColors.php | 6 +- Image/Intervention/Manipulations/Opacity.php | 6 +- .../Intervention/Manipulations/Orientate.php | 4 +- Image/Intervention/Manipulations/Pixelate.php | 6 +- Image/Intervention/Manipulations/Resize.php | 4 +- Image/Intervention/Manipulations/Rotate.php | 6 +- Image/Intervention/Manipulations/Sharpen.php | 6 +- Image/Intervention/Manipulations/Trim.php | 4 +- Image/Intervention/Manipulations/Widen.php | 6 +- Image/ThumbnailsManager.php | 7 ++- Providers/MediaServiceProvider.php | 9 +-- Providers/RouteServiceProvider.php | 3 +- .../Eloquent/EloquentFileRepository.php | 4 +- Repositories/FileRepository.php | 2 +- Resources/lang/en/media.php | 6 +- Resources/lang/fr/media.php | 6 +- Resources/views/admin/edit.blade.php | 2 +- Resources/views/admin/grid.blade.php | 2 +- Resources/views/admin/index.blade.php | 4 +- Services/FileService.php | 8 +-- Tests/FileHelperTest.php | 2 +- Tests/ImagyTest.php | 12 ++-- start.php | 2 +- 50 files changed, 162 insertions(+), 167 deletions(-) diff --git a/Config/thumbnails.php b/Config/thumbnails.php index 76b0cd38..4928832c 100644 --- a/Config/thumbnails.php +++ b/Config/thumbnails.php @@ -5,9 +5,9 @@ 'fit' => [ 'width' => 50, 'height' => 50, - 'callback' => function($constraint) { + 'callback' => function ($constraint) { $constraint->upsize(); - } + }, ], ] ]; diff --git a/Console/RefreshThumbnailCommand.php b/Console/RefreshThumbnailCommand.php index 44c8f4bb..833895f5 100644 --- a/Console/RefreshThumbnailCommand.php +++ b/Console/RefreshThumbnailCommand.php @@ -39,5 +39,4 @@ public function fire() $this->info('All thumbnails refreshed'); } - } diff --git a/Database/Migrations/2014_10_26_162751_create_files_table.php b/Database/Migrations/2014_10_26_162751_create_files_table.php index 96beb4ae..976816a6 100644 --- a/Database/Migrations/2014_10_26_162751_create_files_table.php +++ b/Database/Migrations/2014_10_26_162751_create_files_table.php @@ -3,36 +3,34 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class CreateFilesTable extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('files', function(Blueprint $table) - { +class CreateFilesTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('files', function (Blueprint $table) { $table->increments('id'); - $table->string('filename'); - $table->string('path'); - $table->string('extension'); - $table->string('mimetype'); - $table->string('filesize'); - $table->integer('folder_id')->unsigned(); + $table->string('filename'); + $table->string('path'); + $table->string('extension'); + $table->string('mimetype'); + $table->string('filesize'); + $table->integer('folder_id')->unsigned(); $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('files'); - } + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('files'); + } } diff --git a/Database/Migrations/2014_10_26_162811_create_file_translations_table.php b/Database/Migrations/2014_10_26_162811_create_file_translations_table.php index 1d481635..f56234d2 100644 --- a/Database/Migrations/2014_10_26_162811_create_file_translations_table.php +++ b/Database/Migrations/2014_10_26_162811_create_file_translations_table.php @@ -36,5 +36,4 @@ public function down() { Schema::drop('file_translations'); } - } diff --git a/Database/Seeders/MediaDatabaseSeeder.php b/Database/Seeders/MediaDatabaseSeeder.php index 1c05908d..80223574 100644 --- a/Database/Seeders/MediaDatabaseSeeder.php +++ b/Database/Seeders/MediaDatabaseSeeder.php @@ -5,7 +5,6 @@ class MediaDatabaseSeeder extends Seeder { - /** * Run the database seeds. * @@ -15,5 +14,4 @@ public function run() { Model::unguard(); } - } diff --git a/Entities/File.php b/Entities/File.php index 3de41fb7..5f749878 100644 --- a/Entities/File.php +++ b/Entities/File.php @@ -19,6 +19,6 @@ class File extends Model 'width', 'height', 'filesize', - 'folder_id' + 'folder_id', ]; } diff --git a/Helpers/FileHelper.php b/Helpers/FileHelper.php index 611fc785..c803a0cf 100644 --- a/Helpers/FileHelper.php +++ b/Helpers/FileHelper.php @@ -11,7 +11,7 @@ public static function slug($name) $name = Str::slug($name); - return $name . $extension; + return $name.$extension; } /** diff --git a/Http/Controllers/Admin/MediaController.php b/Http/Controllers/Admin/MediaController.php index 15f261e1..6fe34518 100644 --- a/Http/Controllers/Admin/MediaController.php +++ b/Http/Controllers/Admin/MediaController.php @@ -76,7 +76,7 @@ public function store() /** * Show the form for editing the specified resource. * - * @param File $file + * @param File $file * @return Response */ public function edit(File $file) @@ -87,8 +87,8 @@ public function edit(File $file) /** * Update the specified resource in storage. * - * @param File $file - * @param UpdateMediaRequest $request + * @param File $file + * @param UpdateMediaRequest $request * @return Response */ public function update(File $file, UpdateMediaRequest $request) @@ -96,13 +96,14 @@ public function update(File $file, UpdateMediaRequest $request) $this->file->update($file, $request->all()); Flash::success(trans('media::messages.file updated')); + return Redirect::route('dashboard.media.index'); } /** * Remove the specified resource from storage. * - * @param File $file + * @param File $file * @internal param int $id * @return Response */ @@ -112,6 +113,7 @@ public function destroy(File $file) $this->file->destroy($file); Flash::success(trans('media::messages.file deleted')); + return Redirect::route('dashboard.media.index'); } } diff --git a/Http/Controllers/Api/MediaController.php b/Http/Controllers/Api/MediaController.php index 9b129ee0..23810890 100644 --- a/Http/Controllers/Api/MediaController.php +++ b/Http/Controllers/Api/MediaController.php @@ -19,7 +19,7 @@ public function __construct(FileService $fileService) /** * Store a newly created resource in storage. * - * @param UploadMediaRequest $request + * @param UploadMediaRequest $request * @return Response */ public function store(UploadMediaRequest $request) diff --git a/Http/routes.php b/Http/routes.php index d0efcc83..1d155f6f 100644 --- a/Http/routes.php +++ b/Http/routes.php @@ -4,10 +4,8 @@ $router->model('media', 'Modules\Media\Entities\File'); -$router->group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'LaravelLocalizationRedirectFilter|auth.admin|permissions'], function(Router $router) -{ - $router->group(['prefix' => Config::get('core::core.admin-prefix'), 'namespace' => 'Modules\Media\Http\Controllers'], function(Router $router) - { +$router->group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'LaravelLocalizationRedirectFilter|auth.admin|permissions'], function (Router $router) { + $router->group(['prefix' => Config::get('core::core.admin-prefix'), 'namespace' => 'Modules\Media\Http\Controllers'], function (Router $router) { $router->resource('media', 'Admin\MediaController', ['except' => ['show'], 'names' => [ 'index' => 'dashboard.media.index', 'create' => 'dashboard.media.create', diff --git a/Image/Facade/Imagy.php b/Image/Facade/Imagy.php index 8188a6d8..b9655b5f 100644 --- a/Image/Facade/Imagy.php +++ b/Image/Facade/Imagy.php @@ -4,5 +4,8 @@ class Imagy extends Facade { - protected static function getFacadeAccessor() { return 'imagy'; } + protected static function getFacadeAccessor() + { + return 'imagy'; + } } diff --git a/Image/ImageFactoryInterface.php b/Image/ImageFactoryInterface.php index 8ceaeea7..e25db28a 100644 --- a/Image/ImageFactoryInterface.php +++ b/Image/ImageFactoryInterface.php @@ -4,7 +4,7 @@ interface ImageFactoryInterface { /** * Return a new Manipulation class - * @param string $manipulation + * @param string $manipulation * @return \Modules\Media\Image\ImageHandlerInterface */ public function make($manipulation); diff --git a/Image/ImageHandlerInterface.php b/Image/ImageHandlerInterface.php index 9033cb6e..58008b05 100644 --- a/Image/ImageHandlerInterface.php +++ b/Image/ImageHandlerInterface.php @@ -4,8 +4,8 @@ interface ImageHandlerInterface { /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options); diff --git a/Image/ImageServiceProvider.php b/Image/ImageServiceProvider.php index 8a9d2a12..9726c92d 100644 --- a/Image/ImageServiceProvider.php +++ b/Image/ImageServiceProvider.php @@ -24,14 +24,13 @@ public function register() ); $this->app['imagy'] = $this->app->share(function ($app) { - $factory = new InterventionFactory; + $factory = new InterventionFactory(); $thumbnailManager = new ThumbnailsManager($app['config'], $app['modules']); return new Imagy($factory, $thumbnailManager, $app['config']); }); - $this->app->booting(function() - { + $this->app->booting(function () { $loader = AliasLoader::getInstance(); $loader->alias('Imagy', 'Modules\Media\Image\Facade\Imagy'); }); diff --git a/Image/Imagy.php b/Image/Imagy.php index 8d0a3bef..b1b14224 100644 --- a/Image/Imagy.php +++ b/Image/Imagy.php @@ -35,8 +35,8 @@ class Imagy /** * @param ImageFactoryInterface $imageFactory - * @param ThumbnailsManager $manager - * @param Repository $config + * @param ThumbnailsManager $manager + * @param Repository $config */ public function __construct(ImageFactoryInterface $imageFactory, ThumbnailsManager $manager, Repository $config) { @@ -49,9 +49,9 @@ public function __construct(ImageFactoryInterface $imageFactory, ThumbnailsManag /** * Get an image in the given thumbnail options - * @param string $path - * @param string $thumbnail - * @param bool $forceCreate + * @param string $path + * @param string $thumbnail + * @param bool $forceCreate * @return string */ public function get($path, $thumbnail, $forceCreate = false) @@ -60,7 +60,7 @@ public function get($path, $thumbnail, $forceCreate = false) return; } - $filename = $this->config->get('media::config.files-path') . $this->newFilename($path, $thumbnail); + $filename = $this->config->get('media::config.files-path').$this->newFilename($path, $thumbnail); if ($this->returnCreatedFile($filename, $forceCreate)) { return $filename; @@ -73,8 +73,8 @@ public function get($path, $thumbnail, $forceCreate = false) /** * Return the thumbnail path - * @param string $originalImage - * @param string $thumbnail + * @param string $originalImage + * @param string $thumbnail * @return string */ public function getThumbnail($originalImage, $thumbnail) @@ -83,7 +83,7 @@ public function getThumbnail($originalImage, $thumbnail) return $originalImage; } - return $this->config->get('media::config.files-path') . $this->newFilename($originalImage, $thumbnail); + return $this->config->get('media::config.files-path').$this->newFilename($originalImage, $thumbnail); } /** @@ -97,8 +97,8 @@ public function createAll($path) } foreach ($this->manager->all() as $thumbName => $filters) { - $image = $this->image->make(public_path() . $path); - $filename = $this->config->get('media::config.files-path') . $this->newFilename($path, $thumbName); + $image = $this->image->make(public_path().$path); + $filename = $this->config->get('media::config.files-path').$this->newFilename($path, $thumbName); foreach ($filters as $manipulation => $options) { $image = $this->imageFactory->make($manipulation)->handle($image, $options); } @@ -117,18 +117,18 @@ private function newFilename($path, $thumbnail) { $filename = pathinfo($path, PATHINFO_FILENAME); - return $filename . '_' . $thumbnail . '.' . pathinfo($path, PATHINFO_EXTENSION); + return $filename.'_'.$thumbnail.'.'.pathinfo($path, PATHINFO_EXTENSION); } /** * Return the already created file if it exists and force create is false - * @param string $filename - * @param bool $forceCreate + * @param string $filename + * @param bool $forceCreate * @return bool */ private function returnCreatedFile($filename, $forceCreate) { - return $this->finder->isFile(public_path() . $filename) && !$forceCreate; + return $this->finder->isFile(public_path().$filename) && !$forceCreate; } /** @@ -138,18 +138,18 @@ private function returnCreatedFile($filename, $forceCreate) */ private function writeImage($filename, $image) { - $this->finder->put(public_path() . $filename, $image); + $this->finder->put(public_path().$filename, $image); } /** * Make a new image - * @param string $path - * @param string $filename + * @param string $path + * @param string $filename * @param string null $thumbnail */ private function makeNew($path, $filename, $thumbnail) { - $image = $this->image->make(public_path() . $path); + $image = $this->image->make(public_path().$path); foreach ($this->manager->find($thumbnail) as $manipulation => $options) { $image = $this->imageFactory->make($manipulation)->handle($image, $options); @@ -161,7 +161,7 @@ private function makeNew($path, $filename, $thumbnail) /** * Check if the given path is en image - * @param string $path + * @param string $path * @return bool */ public function isImage($path) @@ -181,15 +181,15 @@ public function deleteAllFor(File $file) return $this->finder->delete($file->path); } - $paths[] = public_path() . $file->path; + $paths[] = public_path().$file->path; $fileName = pathinfo($file->path, PATHINFO_FILENAME); $extension = pathinfo($file->path, PATHINFO_EXTENSION); foreach ($this->manager->all() as $thumbnail => $filters) { - $paths[] = public_path() . $this->config->get( + $paths[] = public_path().$this->config->get( 'media::config.files-path' - ) . "{$fileName}_{$thumbnail}.{$extension}"; + )."{$fileName}_{$thumbnail}.{$extension}"; } + return $this->finder->delete($paths); } - } diff --git a/Image/Intervention/InterventionFactory.php b/Image/Intervention/InterventionFactory.php index 23481fe7..813c48b1 100644 --- a/Image/Intervention/InterventionFactory.php +++ b/Image/Intervention/InterventionFactory.php @@ -5,13 +5,13 @@ class InterventionFactory implements ImageFactoryInterface { /** - * @param string $manipulation + * @param string $manipulation * @return \Modules\Media\Image\ImageHandlerInterface */ public function make($manipulation) { - $class = 'Modules\\Media\\Image\\Intervention\\Manipulations\\'. ucfirst($manipulation); + $class = 'Modules\\Media\\Image\\Intervention\\Manipulations\\'.ucfirst($manipulation); - return new $class; + return new $class(); } } diff --git a/Image/Intervention/Manipulations/Blur.php b/Image/Intervention/Manipulations/Blur.php index 021e4a5d..54972230 100644 --- a/Image/Intervention/Manipulations/Blur.php +++ b/Image/Intervention/Manipulations/Blur.php @@ -5,13 +5,13 @@ class Blur implements ImageHandlerInterface { private $defaults = [ - 'amount' => 1 + 'amount' => 1, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Brightness.php b/Image/Intervention/Manipulations/Brightness.php index 2746d522..db6489e5 100644 --- a/Image/Intervention/Manipulations/Brightness.php +++ b/Image/Intervention/Manipulations/Brightness.php @@ -5,13 +5,13 @@ class Brightness implements ImageHandlerInterface { private $defaults = [ - 'level' => 1 + 'level' => 1, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Colorize.php b/Image/Intervention/Manipulations/Colorize.php index 6268bab3..9f0cc7bd 100644 --- a/Image/Intervention/Manipulations/Colorize.php +++ b/Image/Intervention/Manipulations/Colorize.php @@ -12,8 +12,8 @@ class Colorize implements ImageHandlerInterface /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Contrast.php b/Image/Intervention/Manipulations/Contrast.php index acc7818e..6a5043f7 100644 --- a/Image/Intervention/Manipulations/Contrast.php +++ b/Image/Intervention/Manipulations/Contrast.php @@ -5,13 +5,13 @@ class Contrast implements ImageHandlerInterface { private $defaults = [ - 'level' => 0 + 'level' => 0, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Crop.php b/Image/Intervention/Manipulations/Crop.php index b4a645c2..2ea5e4d5 100644 --- a/Image/Intervention/Manipulations/Crop.php +++ b/Image/Intervention/Manipulations/Crop.php @@ -13,8 +13,8 @@ class Crop implements ImageHandlerInterface /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return mixed */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Fit.php b/Image/Intervention/Manipulations/Fit.php index fba4759d..df936fc5 100644 --- a/Image/Intervention/Manipulations/Fit.php +++ b/Image/Intervention/Manipulations/Fit.php @@ -7,13 +7,13 @@ class Fit implements ImageHandlerInterface private $defaults = [ 'width' => 100, 'height' => null, - 'position' => 'center' + 'position' => 'center', ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Flip.php b/Image/Intervention/Manipulations/Flip.php index aee52b9f..910c1a22 100644 --- a/Image/Intervention/Manipulations/Flip.php +++ b/Image/Intervention/Manipulations/Flip.php @@ -5,13 +5,13 @@ class Flip implements ImageHandlerInterface { private $defaults = [ - 'mode' => 'h' + 'mode' => 'h', ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Gamma.php b/Image/Intervention/Manipulations/Gamma.php index 9bbe67c8..dbb24abc 100644 --- a/Image/Intervention/Manipulations/Gamma.php +++ b/Image/Intervention/Manipulations/Gamma.php @@ -5,13 +5,13 @@ class Gamma implements ImageHandlerInterface { private $defaults = [ - 'correction' => 0 + 'correction' => 0, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Greyscale.php b/Image/Intervention/Manipulations/Greyscale.php index b55003e8..63fde0cc 100644 --- a/Image/Intervention/Manipulations/Greyscale.php +++ b/Image/Intervention/Manipulations/Greyscale.php @@ -6,8 +6,8 @@ class Greyscale implements ImageHandlerInterface { /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Heighten.php b/Image/Intervention/Manipulations/Heighten.php index 978dd29a..15665148 100644 --- a/Image/Intervention/Manipulations/Heighten.php +++ b/Image/Intervention/Manipulations/Heighten.php @@ -10,8 +10,8 @@ class Heighten implements ImageHandlerInterface /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Invert.php b/Image/Intervention/Manipulations/Invert.php index 2f1f9451..e8cffe8a 100644 --- a/Image/Intervention/Manipulations/Invert.php +++ b/Image/Intervention/Manipulations/Invert.php @@ -6,8 +6,8 @@ class Invert implements ImageHandlerInterface { /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/LimitColors.php b/Image/Intervention/Manipulations/LimitColors.php index 13f90974..2e6b019b 100644 --- a/Image/Intervention/Manipulations/LimitColors.php +++ b/Image/Intervention/Manipulations/LimitColors.php @@ -6,13 +6,13 @@ class LimitColors implements ImageHandlerInterface { private $defaults = [ 'count' => 255, - 'matte' => null + 'matte' => null, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Opacity.php b/Image/Intervention/Manipulations/Opacity.php index c8f217f2..a4b12a24 100644 --- a/Image/Intervention/Manipulations/Opacity.php +++ b/Image/Intervention/Manipulations/Opacity.php @@ -5,13 +5,13 @@ class Opacity implements ImageHandlerInterface { private $defaults = [ - 'transparency' => 50 + 'transparency' => 50, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Orientate.php b/Image/Intervention/Manipulations/Orientate.php index b97981d5..fc56f35b 100644 --- a/Image/Intervention/Manipulations/Orientate.php +++ b/Image/Intervention/Manipulations/Orientate.php @@ -6,8 +6,8 @@ class Orientate implements ImageHandlerInterface { /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Pixelate.php b/Image/Intervention/Manipulations/Pixelate.php index b5476e57..a41be87e 100644 --- a/Image/Intervention/Manipulations/Pixelate.php +++ b/Image/Intervention/Manipulations/Pixelate.php @@ -5,13 +5,13 @@ class Pixelate implements ImageHandlerInterface { private $defaults = [ - 'size' => 0 + 'size' => 0, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Resize.php b/Image/Intervention/Manipulations/Resize.php index 0af13f6d..9004c451 100644 --- a/Image/Intervention/Manipulations/Resize.php +++ b/Image/Intervention/Manipulations/Resize.php @@ -11,8 +11,8 @@ class Resize implements ImageHandlerInterface /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Rotate.php b/Image/Intervention/Manipulations/Rotate.php index bbab91a2..51e98285 100644 --- a/Image/Intervention/Manipulations/Rotate.php +++ b/Image/Intervention/Manipulations/Rotate.php @@ -6,13 +6,13 @@ class Rotate implements ImageHandlerInterface { private $defaults = [ 'angle' => 45, - 'bgcolor' => '#000000' + 'bgcolor' => '#000000', ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Sharpen.php b/Image/Intervention/Manipulations/Sharpen.php index 0009b8c9..957260d1 100644 --- a/Image/Intervention/Manipulations/Sharpen.php +++ b/Image/Intervention/Manipulations/Sharpen.php @@ -5,13 +5,13 @@ class Sharpen implements ImageHandlerInterface { private $defaults = [ - 'amount' => 10 + 'amount' => 10, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Trim.php b/Image/Intervention/Manipulations/Trim.php index 64b7b430..89a6675b 100644 --- a/Image/Intervention/Manipulations/Trim.php +++ b/Image/Intervention/Manipulations/Trim.php @@ -13,8 +13,8 @@ class Trim implements ImageHandlerInterface /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/Intervention/Manipulations/Widen.php b/Image/Intervention/Manipulations/Widen.php index 5810487d..b32dd993 100644 --- a/Image/Intervention/Manipulations/Widen.php +++ b/Image/Intervention/Manipulations/Widen.php @@ -5,13 +5,13 @@ class Widen implements ImageHandlerInterface { private $defaults = [ - 'width' => 0 + 'width' => 0, ]; /** * Handle the image manipulation request - * @param \Intervention\Image\Image $image - * @param array $options + * @param \Intervention\Image\Image $image + * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) diff --git a/Image/ThumbnailsManager.php b/Image/ThumbnailsManager.php index 6ceba398..ca64542a 100644 --- a/Image/ThumbnailsManager.php +++ b/Image/ThumbnailsManager.php @@ -30,8 +30,10 @@ public function all() { $thumbnails = []; foreach ($this->module->enabled() as $enabledModule) { - $configuration = $this->config->get(strtolower($enabledModule->getName()) . '::thumbnails'); - if (!is_null($configuration)) $thumbnails = array_merge($thumbnails, $configuration); + $configuration = $this->config->get(strtolower($enabledModule->getName()).'::thumbnails'); + if (!is_null($configuration)) { + $thumbnails = array_merge($thumbnails, $configuration); + } } return $thumbnails; @@ -49,5 +51,4 @@ public function find($thumbnail) } } } - } diff --git a/Providers/MediaServiceProvider.php b/Providers/MediaServiceProvider.php index 46c1fc08..015edc48 100644 --- a/Providers/MediaServiceProvider.php +++ b/Providers/MediaServiceProvider.php @@ -44,8 +44,8 @@ private function registerBindings() { $this->app->bind( 'Modules\Media\Repositories\FileRepository', - function($app) { - return new EloquentFileRepository(new File, $app['filesystem.disk']); + function ($app) { + return new EloquentFileRepository(new File(), $app['filesystem.disk']); } ); } @@ -63,9 +63,10 @@ private function registerCommands() */ private function registerRefreshCommand() { - $this->app->bindShared('command.media.refresh', function($app) { + $this->app->bindShared('command.media.refresh', function ($app) { $thumbnailManager = new ThumbnailsManager($app['config'], $app['modules']); - $imagy = new Imagy(new InterventionFactory, $thumbnailManager, $app['config']); + $imagy = new Imagy(new InterventionFactory(), $thumbnailManager, $app['config']); + return new RefreshThumbnailCommand($imagy, $app['Modules\Media\Repositories\FileRepository']); }); diff --git a/Providers/RouteServiceProvider.php b/Providers/RouteServiceProvider.php index 71ec4945..c53e662a 100644 --- a/Providers/RouteServiceProvider.php +++ b/Providers/RouteServiceProvider.php @@ -41,7 +41,6 @@ public function before(Router $router) */ public function map(Router $router) { - require __DIR__ . '/../Http/routes.php'; + require __DIR__.'/../Http/routes.php'; } - } diff --git a/Repositories/Eloquent/EloquentFileRepository.php b/Repositories/Eloquent/EloquentFileRepository.php index 5b5d606d..8c7cc139 100644 --- a/Repositories/Eloquent/EloquentFileRepository.php +++ b/Repositories/Eloquent/EloquentFileRepository.php @@ -10,7 +10,7 @@ class EloquentFileRepository extends EloquentBaseRepository implements FileRepos { /** * Update a resource - * @param File $file + * @param File $file * @param $data * @return mixed */ @@ -23,7 +23,7 @@ public function update($file, $data) /** * Create a file row from the given file - * @param UploadedFile $file + * @param UploadedFile $file * @return mixed */ public function createFromFile(UploadedFile $file) diff --git a/Repositories/FileRepository.php b/Repositories/FileRepository.php index bb1ff5d4..827bd8f5 100644 --- a/Repositories/FileRepository.php +++ b/Repositories/FileRepository.php @@ -7,7 +7,7 @@ interface FileRepository extends BaseRepository { /** * Create a file row from the given file - * @param UploadedFile $file + * @param UploadedFile $file * @return mixed */ public function createFromFile(UploadedFile $file); diff --git a/Resources/lang/en/media.php b/Resources/lang/en/media.php index 79deff8b..91f2d160 100644 --- a/Resources/lang/en/media.php +++ b/Resources/lang/en/media.php @@ -3,15 +3,15 @@ return [ 'title' => [ 'media' => 'Media', - 'edit media' => 'Edit media' + 'edit media' => 'Edit media', ], 'breadcrumb' => [ - 'media' => 'Media' + 'media' => 'Media', ], 'table' => [ 'filename' => 'Filename', 'width' => 'Width', - 'height' => 'Height' + 'height' => 'Height', ], 'form' => [ 'alt_attribute' => 'Alt attribute', diff --git a/Resources/lang/fr/media.php b/Resources/lang/fr/media.php index 89860168..c3c336b6 100644 --- a/Resources/lang/fr/media.php +++ b/Resources/lang/fr/media.php @@ -3,15 +3,15 @@ return [ 'title' => [ 'media' => 'Média', - 'edit media' => 'Edition de média' + 'edit media' => 'Edition de média', ], 'breadcrumb' => [ - 'media' => 'Média' + 'media' => 'Média', ], 'table' => [ 'filename' => 'Nom de fichier', 'width' => 'Largeur', - 'height' => 'Hauteur' + 'height' => 'Hauteur', ], 'choose file' => 'Choissisez un fichier', 'insert' => 'Sélectionner ce fichier', diff --git a/Resources/views/admin/edit.blade.php b/Resources/views/admin/edit.blade.php index ba5caf8c..4177805b 100644 --- a/Resources/views/admin/edit.blade.php +++ b/Resources/views/admin/edit.blade.php @@ -19,7 +19,7 @@ @include('core::partials.form-tab-headers')
- $language): ?> + $language): ?>
@include('media::admin.partials.edit-fields', ['lang' => $locale]) diff --git a/Resources/views/admin/grid.blade.php b/Resources/views/admin/grid.blade.php index 2ab1c1f4..2694eaea 100644 --- a/Resources/views/admin/grid.blade.php +++ b/Resources/views/admin/grid.blade.php @@ -16,7 +16,7 @@
    - +
  • {{ trans('media::media.insert') }} diff --git a/Resources/views/admin/index.blade.php b/Resources/views/admin/index.blade.php index dd341bdb..c858df26 100644 --- a/Resources/views/admin/index.blade.php +++ b/Resources/views/admin/index.blade.php @@ -43,7 +43,7 @@ - + @@ -83,7 +83,7 @@
- +