@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * @return mixed owner model |
|
| 44 | + * @return \Illuminate\Database\Eloquent\Relations\MorphTo owner model |
|
| 45 | 45 | */ |
| 46 | 46 | public function owner() |
| 47 | 47 | { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * @return bool | null |
|
| 106 | + * @return null|boolean | null |
|
| 107 | 107 | */ |
| 108 | 108 | public function filenameIsDifferentFromOriginal() |
| 109 | 109 | { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | - * @return UploadedFile |
|
| 146 | + * @return AbstractAttacherImage |
|
| 147 | 147 | */ |
| 148 | 148 | public function setUploadedFile(UploadedFile $file) |
| 149 | 149 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $this->setDifferentFilename(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if (!is_null($processing_style_routine)) |
|
| 35 | + if ( ! is_null($processing_style_routine)) |
|
| 36 | 36 | { |
| 37 | 37 | $this->setProcessingStyleRoutine($processing_style_routine); |
| 38 | 38 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function setFileNameAttribute($name) |
| 194 | 194 | { |
| 195 | - $file_name = str_slug(pathinfo($name, PATHINFO_FILENAME)) . '.' . pathinfo($name, PATHINFO_EXTENSION); |
|
| 195 | + $file_name = str_slug(pathinfo($name, PATHINFO_FILENAME)).'.'.pathinfo($name, PATHINFO_EXTENSION); |
|
| 196 | 196 | |
| 197 | 197 | $this->attributes['file_name'] = $file_name; |
| 198 | 198 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | 'processing_styles' => [ |
| 11 | 11 | 'default_routine' => |
| 12 | 12 | [ |
| 13 | - 'original_style' => function ($image) { |
|
| 13 | + 'original_style' => function($image) { |
|
| 14 | 14 | return $image; |
| 15 | 15 | }, |
| 16 | 16 | ] |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - Schema::create('attacher_images', function (Blueprint $table) |
|
| 17 | + Schema::create('attacher_images', function(Blueprint $table) |
|
| 18 | 18 | { |
| 19 | 19 | $table->increments('id'); |
| 20 | 20 | $table->unsignedInteger('owner_id')->index(); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function parseUrl(AttacherImageContract $attacherImage, $style) |
| 130 | 130 | { |
| 131 | - $url = $this->getBaseUrl() . $this->parse($attacherImage, $style); |
|
| 131 | + $url = $this->getBaseUrl().$this->parse($attacherImage, $style); |
|
| 132 | 132 | $url = preg_replace('~(^|[^:])//+~', '\\1/', $url); |
| 133 | 133 | |
| 134 | 134 | return url($url); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | if (strpos($string, $key) !== FALSE) |
| 163 | 163 | { |
| 164 | - $string = preg_replace("/$key" . '\b/', $attacherImage->getAttribute($value), $string); |
|
| 164 | + $string = preg_replace("/$key".'\b/', $attacherImage->getAttribute($value), $string); |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $imageProcessor = $this->getImageProcessor(); |
| 52 | 52 | $processing_style_routine = $this->extractStyleRoutineMethods($attacherImage); |
| 53 | 53 | |
| 54 | - if ( empty($processing_style_routine) ) |
|
| 54 | + if (empty($processing_style_routine)) |
|
| 55 | 55 | return false; |
| 56 | 56 | |
| 57 | 57 | foreach ($processing_style_routine as $style_name => $method) |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | public function extractStyleRoutineMethods(AttacherImageContract $attacherImage) |
| 114 | 114 | { |
| 115 | 115 | $style_routine = |
| 116 | - $this->getImageProcessor()->getProcessingStyleRoutine($attacherImage,$this->processing_styles); |
|
| 116 | + $this->getImageProcessor()->getProcessingStyleRoutine($attacherImage, $this->processing_styles); |
|
| 117 | 117 | |
| 118 | 118 | return empty($style_routine) ? head($this->processing_styles) : $style_routine; |
| 119 | 119 | |
@@ -22,20 +22,20 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function boot() |
| 24 | 24 | { |
| 25 | - $migration_timestamp = \Carbon\Carbon::now()->format('Y_m_d') . '_000000_'; |
|
| 25 | + $migration_timestamp = \Carbon\Carbon::now()->format('Y_m_d').'_000000_'; |
|
| 26 | 26 | $migration_file_name = 'create_attacher_images_table.php'; |
| 27 | 27 | |
| 28 | 28 | $this->publishes( |
| 29 | 29 | [ |
| 30 | - __DIR__ . '/../../resources/config/img-attacher.php' |
|
| 30 | + __DIR__.'/../../resources/config/img-attacher.php' |
|
| 31 | 31 | => config_path('img-attacher.php'), |
| 32 | - __DIR__ . '/../../resources/database/migrations/' . $migration_file_name |
|
| 33 | - => database_path('migrations/' . $migration_timestamp . $migration_file_name), |
|
| 32 | + __DIR__.'/../../resources/database/migrations/'.$migration_file_name |
|
| 33 | + => database_path('migrations/'.$migration_timestamp.$migration_file_name), |
|
| 34 | 34 | ] |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | $this->mergeConfigFrom( |
| 38 | - __DIR__ . '/../../resources/config/img-attacher.php', 'img-attacher' |
|
| 38 | + __DIR__.'/../../resources/config/img-attacher.php', 'img-attacher' |
|
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | $this->registerEvents(); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function register() |
| 50 | 50 | { |
| 51 | - config(['config/img-attacher.php',]); |
|
| 51 | + config(['config/img-attacher.php', ]); |
|
| 52 | 52 | $this->registerBindings(); |
| 53 | 53 | $this->registerDependencies(); |
| 54 | 54 | $this->registerAttacherManager(); |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | private function registerEvents() |
| 61 | 61 | { |
| 62 | - AttacherImage::saving(function ($model) { |
|
| 63 | - if ( ! app('img-attacher')->writeImage($model)) { |
|
| 62 | + AttacherImage::saving(function($model) { |
|
| 63 | + if ( ! app('img-attacher')->writeImage($model)) { |
|
| 64 | 64 | return false; |
| 65 | 65 | } |
| 66 | 66 | return true; |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | - AttacherImage::deleting(function ($model) { |
|
| 70 | - if ( ! app('img-attacher')->deleteImages($model)) { |
|
| 69 | + AttacherImage::deleting(function($model) { |
|
| 70 | + if ( ! app('img-attacher')->deleteImages($model)) { |
|
| 71 | 71 | return false; |
| 72 | 72 | } |
| 73 | 73 | return true; |
@@ -98,17 +98,17 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | private function registerFilePathManager() |
| 100 | 100 | { |
| 101 | - $this->app->singleton('img-attacher.FilePathManager', function () |
|
| 101 | + $this->app->singleton('img-attacher.FilePathManager', function() |
|
| 102 | 102 | { |
| 103 | 103 | $config = config('img-attacher'); |
| 104 | 104 | |
| 105 | - return new FilePathManager($config['path_to_save'],$config['base_url']); |
|
| 105 | + return new FilePathManager($config['path_to_save'], $config['base_url']); |
|
| 106 | 106 | }); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | private function registerImageProcessor() |
| 110 | 110 | { |
| 111 | - $this->app->singleton('img-attacher.ImageProcessor','CbCaio\ImgAttacher\Processors\ImageProcessor' ); |
|
| 111 | + $this->app->singleton('img-attacher.ImageProcessor', 'CbCaio\ImgAttacher\Processors\ImageProcessor'); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | private function registerDependencies() |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | public function hasImage() |
| 63 | 63 | { |
| 64 | - return !is_null($this->getImage()); |
|
| 64 | + return ! is_null($this->getImage()); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |