@@ -70,11 +70,11 @@ |
||
70 | 70 | $stub = isset($stub) ? $stub : $this->stub; |
71 | 71 | $path = config('repository.generator.stubsOverridePath', __DIR__); |
72 | 72 | |
73 | - if (! file_exists($path.'/Stubs/'.$stub.'.stub')) { |
|
73 | + if (!file_exists($path.'/Stubs/'.$stub.'.stub')) { |
|
74 | 74 | $path = __DIR__; |
75 | 75 | } |
76 | 76 | |
77 | - return ( new Stub($path.'/Stubs/'.$stub.'.stub', $this->getReplacements()) )->render(); |
|
77 | + return (new Stub($path.'/Stubs/'.$stub.'.stub', $this->getReplacements()))->render(); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | public function getReplacements() |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @author Milkmeowo <[email protected]> |
8 | 8 | */ |
9 | -if (! function_exists('is_lumen')) { |
|
9 | +if (!function_exists('is_lumen')) { |
|
10 | 10 | /** |
11 | 11 | * Checks whether or not the application is Lumen. |
12 | 12 | * |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | return $is_lumen; |
21 | 21 | } |
22 | 22 | } |
23 | -if (! function_exists('is_laravel')) { |
|
23 | +if (!function_exists('is_laravel')) { |
|
24 | 24 | /** |
25 | 25 | * Checks whether or not the application is Laravel. |
26 | 26 | * |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function is_laravel() |
30 | 30 | { |
31 | - return ! is_lumen(); |
|
31 | + return !is_lumen(); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if (! function_exists('app_path')) { |
|
35 | +if (!function_exists('app_path')) { |
|
36 | 36 | /** |
37 | 37 | * Get the path to the application folder. |
38 | 38 | * |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -if (! function_exists('bcrypt')) { |
|
49 | +if (!function_exists('bcrypt')) { |
|
50 | 50 | /** |
51 | 51 | * Hash the given value. |
52 | 52 | * |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | -if (! function_exists('smart_get_client_ip')) { |
|
64 | +if (!function_exists('smart_get_client_ip')) { |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @return array|string |
@@ -168,6 +168,11 @@ discard block |
||
168 | 168 | $this->generateFile($path, $stub, $namespace); |
169 | 169 | } |
170 | 170 | |
171 | + /** |
|
172 | + * @param string $path |
|
173 | + * @param string $stub |
|
174 | + * @param null|string $namespace |
|
175 | + */ |
|
171 | 176 | public function generateFile($path, $stub, $namespace) |
172 | 177 | { |
173 | 178 | if (! $this->filesystem->exists($path) || $this->confirm($path.' already exists! Continue?')) { |
@@ -197,6 +202,9 @@ discard block |
||
197 | 202 | return $path.'/Stubs/base/'.$stub.'.stub'; |
198 | 203 | } |
199 | 204 | |
205 | + /** |
|
206 | + * @param string $stub |
|
207 | + */ |
|
200 | 208 | public function getStub($stub) |
201 | 209 | { |
202 | 210 | return $this->filesystem->get($this->getPath($stub)); |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | |
171 | 171 | public function generateFile($path, $stub, $namespace) |
172 | 172 | { |
173 | - if (! $this->filesystem->exists($path) || $this->confirm($path.' already exists! Continue?')) { |
|
173 | + if (!$this->filesystem->exists($path) || $this->confirm($path.' already exists! Continue?')) { |
|
174 | 174 | $content = str_replace('$NAMESPACE$', $namespace, $stub); |
175 | 175 | |
176 | - if (! $this->filesystem->isDirectory($dir = dirname($path))) { |
|
176 | + if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
|
177 | 177 | $this->filesystem->makeDirectory($dir, 0777, true, true); |
178 | 178 | } |
179 | 179 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $path = config('repository.generator.stubsOverridePath', $defaultPath); |
191 | 191 | |
192 | 192 | // rollback |
193 | - if (! file_exists($path.'/Stubs/base/'.$stub.'.stub')) { |
|
193 | + if (!file_exists($path.'/Stubs/base/'.$stub.'.stub')) { |
|
194 | 194 | $path = $defaultPath; |
195 | 195 | } |
196 | 196 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function validateCreate(array $attributes) |
36 | 36 | { |
37 | - if (! is_null($this->validator)) { |
|
37 | + if (!is_null($this->validator)) { |
|
38 | 38 | $this->validator->with($attributes)->passesOrFail(ValidatorInterface::RULE_CREATE); |
39 | 39 | } |
40 | 40 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function validateUpdate(array $attributes) |
46 | 46 | { |
47 | - if (! is_null($this->validator)) { |
|
47 | + if (!is_null($this->validator)) { |
|
48 | 48 | $this->validator->with($attributes)->passesOrFail(ValidatorInterface::RULE_UPDATE); |
49 | 49 | } |
50 | 50 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function makeModel() |
94 | 94 | { |
95 | 95 | $model = $this->relateModel ? $this->relation() : $this->app->make($this->model()); |
96 | - if (! ($model instanceof Model || $model instanceof Relation)) { |
|
96 | + if (!($model instanceof Model || $model instanceof Relation)) { |
|
97 | 97 | throw new RepositoryException('Class '.get_class($model).' must be an instance of Illuminate\\Database\\Eloquent\\Model'); |
98 | 98 | } |
99 | 99 |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | { |
101 | 101 | $ip = smart_get_client_ip(); |
102 | 102 | |
103 | - if (! $this->isDirty(static::UPDATED_IP) && $this->hasTableColumn(static::UPDATED_IP)) { |
|
103 | + if (!$this->isDirty(static::UPDATED_IP) && $this->hasTableColumn(static::UPDATED_IP)) { |
|
104 | 104 | $this->{static::UPDATED_IP} = $ip; |
105 | 105 | } |
106 | 106 | |
107 | - if (! $this->exists && ! $this->isDirty(static::CREATED_IP) && $this->hasTableColumn(static::CREATED_IP)) { |
|
107 | + if (!$this->exists && !$this->isDirty(static::CREATED_IP) && $this->hasTableColumn(static::CREATED_IP)) { |
|
108 | 108 | $this->{static::CREATED_IP} = $ip; |
109 | 109 | } |
110 | 110 | } |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | protected function updateUsers() |
128 | 128 | { |
129 | 129 | $user_id = $this->getAuthUserId(); |
130 | - if (! ($user_id > 0)) { |
|
130 | + if (!($user_id > 0)) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | - if (! $this->isDirty(static::UPDATED_BY) && $this->hasTableColumn(static::UPDATED_BY)) { |
|
134 | + if (!$this->isDirty(static::UPDATED_BY) && $this->hasTableColumn(static::UPDATED_BY)) { |
|
135 | 135 | $this->{static::UPDATED_BY} = $user_id; |
136 | 136 | } |
137 | 137 | |
138 | - if (! $this->exists && ! $this->isDirty(static::CREATED_BY) && $this->hasTableColumn(static::CREATED_BY)) { |
|
138 | + if (!$this->exists && !$this->isDirty(static::CREATED_BY) && $this->hasTableColumn(static::CREATED_BY)) { |
|
139 | 139 | $this->{static::CREATED_BY} = $user_id; |
140 | 140 | } |
141 | 141 | } |