@@ -84,11 +84,11 @@ |
||
84 | 84 | private function registerBindings() |
85 | 85 | { |
86 | 86 | $this->app->bind('CbCaio\ImgAttacher\Contracts\AttacherImageContract', |
87 | - 'CbCaio\ImgAttacher\Models\AttacherImage'); |
|
87 | + 'CbCaio\ImgAttacher\Models\AttacherImage'); |
|
88 | 88 | $this->app->bind('CbCaio\ImgAttacher\Contracts\FilePathManagerContract', |
89 | - 'CbCaio\ImgAttacher\Managers\FilePathManager'); |
|
89 | + 'CbCaio\ImgAttacher\Managers\FilePathManager'); |
|
90 | 90 | $this->app->bind('CbCaio\ImgAttacher\Contracts\FileManagerContract', |
91 | - 'CbCaio\ImgAttacher\Managers\FileManager'); |
|
91 | + 'CbCaio\ImgAttacher\Managers\FileManager'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | private function registerFileManager() |
@@ -27,15 +27,15 @@ discard block |
||
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_file_name), |
|
32 | + __DIR__.'/../../resources/database/migrations/'.$migration_file_name |
|
33 | + => database_path('migrations/'.$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(); |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | |
59 | 59 | private function registerEvents() |
60 | 60 | { |
61 | - AttacherImage::saving(function ($model) { |
|
62 | - if ( ! app('img-attacher')->writeImage($model)) { |
|
61 | + AttacherImage::saving(function($model) { |
|
62 | + if ( ! app('img-attacher')->writeImage($model)) { |
|
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | return true; |
66 | 66 | }); |
67 | 67 | |
68 | - AttacherImage::deleting(function ($model) { |
|
69 | - if ( ! app('img-attacher')->deleteImages($model)) { |
|
68 | + AttacherImage::deleting(function($model) { |
|
69 | + if ( ! app('img-attacher')->deleteImages($model)) { |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | return true; |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | |
98 | 98 | private function registerFilePathManager() |
99 | 99 | { |
100 | - $this->app->singleton('img-attacher.FilePathManager', function () |
|
100 | + $this->app->singleton('img-attacher.FilePathManager', function() |
|
101 | 101 | { |
102 | 102 | $config = config('img-attacher'); |
103 | 103 | |
104 | - return new FilePathManager($config['path_to_save'],$config['base_url'], $config['processing_styles_routines']); |
|
104 | + return new FilePathManager($config['path_to_save'], $config['base_url'], $config['processing_styles_routines']); |
|
105 | 105 | }); |
106 | 106 | } |
107 | 107 | |
108 | 108 | private function registerImageProcessor() |
109 | 109 | { |
110 | - $this->app->singleton('img-attacher.ImageProcessor','CbCaio\ImgAttacher\Processors\ImageProcessor' ); |
|
110 | + $this->app->singleton('img-attacher.ImageProcessor', 'CbCaio\ImgAttacher\Processors\ImageProcessor'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | 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 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * @param AttacherImageContract $attacherImage |
39 | 39 | * @param string $style |
40 | - * @return mixed|string |
|
40 | + * @return string |
|
41 | 41 | */ |
42 | 42 | public function parsePath(AttacherImageContract $attacherImage, $style) |
43 | 43 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * @param AttacherImageContract $attacherImage |
53 | 53 | * @param string $string |
54 | - * @return mixed |
|
54 | + * @return string |
|
55 | 55 | */ |
56 | 56 | public function parseOwnerClass(AttacherImageContract $attacherImage, $string) |
57 | 57 | { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @param AttacherImageContract $attacherImage |
79 | 79 | * @param string $string |
80 | - * @return mixed |
|
80 | + * @return string |
|
81 | 81 | */ |
82 | 82 | public function parseAttributes(AttacherImageContract $attacherImage, $string) |
83 | 83 | { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function parseOwnerClass(AttacherImageContract $attacherImage, $string) |
57 | 57 | { |
58 | - if (!empty($attacherImage->getOwnerType())) |
|
58 | + if ( ! empty($attacherImage->getOwnerType())) |
|
59 | 59 | { |
60 | 60 | $owner_class_name = preg_split('/\\\\/', $attacherImage->getOwnerType())[1]; |
61 | 61 | $string = preg_replace('/:owner_class\b/', $owner_class_name, $string); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | if (strpos($string, $key) !== FALSE) |
87 | 87 | { |
88 | - $string = preg_replace("/$key" . '\b/', $attacherImage->getAttribute($value), $string); |
|
88 | + $string = preg_replace("/$key".'\b/', $attacherImage->getAttribute($value), $string); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function parseUrl(AttacherImageContract $attacherImage, $style = NULL) |
138 | 138 | { |
139 | - $url = $this->getBaseUrl() . $this->parsePath($attacherImage, $style); |
|
139 | + $url = $this->getBaseUrl().$this->parsePath($attacherImage, $style); |
|
140 | 140 | $url = preg_replace('~(^|[^:])//+~', '\\1/', $url); |
141 | 141 | |
142 | 142 | return url($url); |
@@ -197,7 +197,7 @@ |
||
197 | 197 | */ |
198 | 198 | public function setFileNameAttribute($name) |
199 | 199 | { |
200 | - $file_name = str_slug(pathinfo($name, PATHINFO_FILENAME)) . '.' . pathinfo($name, PATHINFO_EXTENSION); |
|
200 | + $file_name = str_slug(pathinfo($name, PATHINFO_FILENAME)).'.'.pathinfo($name, PATHINFO_EXTENSION); |
|
201 | 201 | |
202 | 202 | $this->attributes['file_name'] = $file_name; |
203 | 203 |
@@ -52,7 +52,7 @@ |
||
52 | 52 | foreach ($styles_to_be_applied as $style_name => $method) |
53 | 53 | { |
54 | 54 | $image = $this->applyStyle($attacherImage, $method); |
55 | - $collection_of_images->put($style_name,$image); |
|
55 | + $collection_of_images->put($style_name, $image); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | return $collection_of_images; |
@@ -20,19 +20,19 @@ |
||
20 | 20 | 'processing_styles_routines' => [ |
21 | 21 | 'default_routine' => |
22 | 22 | [ |
23 | - 'original_style' => function ($image) { |
|
23 | + 'original_style' => function($image) { |
|
24 | 24 | return $image; |
25 | 25 | }, |
26 | - 'original_style2' => function ($image) { |
|
26 | + 'original_style2' => function($image) { |
|
27 | 27 | return $image; |
28 | 28 | }, |
29 | 29 | ], |
30 | 30 | 'default_routine2' => |
31 | 31 | [ |
32 | - 'original_style3' => function ($image) { |
|
32 | + 'original_style3' => function($image) { |
|
33 | 33 | return $image; |
34 | 34 | }, |
35 | - 'original_style4' => function ($image) { |
|
35 | + 'original_style4' => function($image) { |
|
36 | 36 | return $image; |
37 | 37 | }, |
38 | 38 | ], |
@@ -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(); |