@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * @param string $file |
9 | 9 | */ |
10 | - function register_annotation_file(string $file) |
|
10 | + function register_annotation_file (string $file) |
|
11 | 11 | { |
12 | 12 | if (!is_file($file)) { |
13 | 13 | return false; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Retrieve all annotations of a giving object |
22 | 22 | */ |
23 | 23 | if (!function_exists('get_class_annotations')) { |
24 | - function get_class_annotations($element, $annotation = null) |
|
24 | + function get_class_annotations ($element, $annotation = null) |
|
25 | 25 | { |
26 | 26 | $class = $element; |
27 | 27 | if (is_object($element)) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * Retrieve annotations of a especific property of a giving object |
40 | 40 | */ |
41 | 41 | if (!function_exists('get_property_annotations')) { |
42 | - function get_property_annotations($element, $property = null, $annotation = null) |
|
42 | + function get_property_annotations ($element, $property = null, $annotation = null) |
|
43 | 43 | { |
44 | 44 | $class = $element; |
45 | 45 | if (is_object($element) && !($element instanceof \ReflectionClass)) { |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | |
58 | 58 | $reflectClass = new \ReflectionClass($class); |
59 | 59 | $reflectProperties = $reflectClass->getProperties(); |
60 | - $annotations = []; |
|
60 | + $annotations = [ ]; |
|
61 | 61 | foreach ($reflectProperties as $property) { |
62 | - $annotations[$property->getName()] = get_property_annotations($reflectClass, $property, $annotation); |
|
62 | + $annotations[ $property->getName() ] = get_property_annotations($reflectClass, $property, $annotation); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $annotations; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | /** |
9 | 9 | * @param string $file |
10 | 10 | */ |
11 | - function register_annotation_file(string $file) |
|
11 | + function register_annotation_file (string $file) |
|
12 | 12 | { |
13 | 13 | if (!is_file($file)) { |
14 | 14 | return false; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @param string $dir |
27 | 27 | */ |
28 | - function register_annotation_dir(string $dir) |
|
28 | + function register_annotation_dir (string $dir) |
|
29 | 29 | { |
30 | 30 | if (!is_dir($dir)) { |
31 | 31 | return false; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $handle = opendir($dir); |
35 | 35 | while ($path = readdir($handle)) { |
36 | - $toRegisterPath = implode(DIRECTORY_SEPARATOR, [$dir, $path]); |
|
36 | + $toRegisterPath = implode(DIRECTORY_SEPARATOR, [ $dir, $path ]); |
|
37 | 37 | register_annotation_file($toRegisterPath); |
38 | 38 | } |
39 | 39 | |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | * Default binding a repository interface to a concret class |
46 | 46 | */ |
47 | 47 | if (!function_exists('bind_repository_interface')) { |
48 | - function bind_repository_interface(string $repositoryInterface, string $repository, string $entity) |
|
48 | + function bind_repository_interface (string $repositoryInterface, string $repository, string $entity) |
|
49 | 49 | { |
50 | 50 | app()->bind($repositoryInterface, function ($app) use ($repository, $entity) { |
51 | 51 | return new $repository( |
52 | - $app['em'], |
|
53 | - $app['em']->getClassMetaData($entity) |
|
52 | + $app[ 'em' ], |
|
53 | + $app[ 'em' ]->getClassMetaData($entity) |
|
54 | 54 | ); |
55 | 55 | }); |
56 | 56 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * Dump and die. |
61 | 61 | */ |
62 | 62 | if (!function_exists('dd')) { |
63 | - function dd() |
|
63 | + function dd () |
|
64 | 64 | { |
65 | 65 | $args = func_get_args(); |
66 | 66 | foreach ($args as $arg) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * Print and die |
75 | 75 | */ |
76 | 76 | if (!function_exists('pd')) { |
77 | - function pd() |
|
77 | + function pd () |
|
78 | 78 | { |
79 | 79 | $args = func_get_args(); |
80 | 80 | foreach ($args as $arg) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * Dump and return |
89 | 89 | */ |
90 | 90 | if (!function_exists('dr')) { |
91 | - function dr() |
|
91 | + function dr () |
|
92 | 92 | { |
93 | 93 | $args = func_get_args(); |
94 | 94 | $result = ''; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param string $version = 'v1' |
123 | 123 | * @param bool $abort = true |
124 | 124 | */ |
125 | - function bdClassExists(string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
125 | + function bdClassExists (string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
126 | 126 | { |
127 | 127 | $entityClass = config('bludata.generator.rootNamespace').'\\'.$folder.'\\'.$version.'\\'.$className; |
128 | 128 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param string $version = 'v1' |
150 | 150 | * @param bool $abort = true |
151 | 151 | */ |
152 | - function bdInterfaceExists(string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
152 | + function bdInterfaceExists (string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
153 | 153 | { |
154 | 154 | $entityClass = config('bludata.generator.rootNamespace').'\\'.$folder.'\\'.$version.'\\'.$className; |
155 | 155 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param string $version = 'v1' |
172 | 172 | * @param bool $abort = true |
173 | 173 | */ |
174 | - function bdInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
174 | + function bdInterfaceClass (string $className, string $version = 'v1', bool $abort = true) |
|
175 | 175 | { |
176 | 176 | return bdInterfaceExists(config('bludata.generator.paths.interfaces'), $className.'Interface', $version, $abort); |
177 | 177 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @param string $version = 'v1' |
184 | 184 | * @param bool $abort = true |
185 | 185 | */ |
186 | - function bdContractClass(string $className, string $version = 'v1', bool $abort = true) |
|
186 | + function bdContractClass (string $className, string $version = 'v1', bool $abort = true) |
|
187 | 187 | { |
188 | 188 | return bdInterfaceExists(config('bludata.generator.paths.contracts'), $className.'Interface', $version, $abort); |
189 | 189 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param string $version = 'v1' |
196 | 196 | * @param bool $abort = true |
197 | 197 | */ |
198 | - function bdContract(string $className, string $version = 'v1', bool $abort = true) |
|
198 | + function bdContract (string $className, string $version = 'v1', bool $abort = true) |
|
199 | 199 | { |
200 | 200 | return app(bdContractClass($className, $version, $abort)); |
201 | 201 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param string $version = 'v1' |
208 | 208 | * @param bool $abort = true |
209 | 209 | */ |
210 | - function bdRepositoryInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
210 | + function bdRepositoryInterfaceClass (string $className, string $version = 'v1', bool $abort = true) |
|
211 | 211 | { |
212 | 212 | return bdInterfaceClass($className.'Repository', $version, $abort); |
213 | 213 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @param string $version = 'v1' |
220 | 220 | * @param bool $abort = true |
221 | 221 | */ |
222 | - function bdRepositoryClass(string $className, string $version = 'v1', bool $abort = true) |
|
222 | + function bdRepositoryClass (string $className, string $version = 'v1', bool $abort = true) |
|
223 | 223 | { |
224 | 224 | return bdClassExists(config('bludata.generator.paths.repositories'), $className.'Repository', $version, $abort); |
225 | 225 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param string $version = 'v1' |
232 | 232 | * @param bool $abort = true |
233 | 233 | */ |
234 | - function bdRepository(string $className, string $version = 'v1', bool $abort = true) |
|
234 | + function bdRepository (string $className, string $version = 'v1', bool $abort = true) |
|
235 | 235 | { |
236 | 236 | return app(bdRepositoryInterfaceClass($className, $version, $abort)); |
237 | 237 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @param string $version = 'v1' |
244 | 244 | * @param bool $abort = true |
245 | 245 | */ |
246 | - function bdServiceInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
246 | + function bdServiceInterfaceClass (string $className, string $version = 'v1', bool $abort = true) |
|
247 | 247 | { |
248 | 248 | return bdInterfaceClass($className.'Service', $version, $abort); |
249 | 249 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @param string $version = 'v1' |
256 | 256 | * @param bool $abort = true |
257 | 257 | */ |
258 | - function bdServiceClass(string $className, string $version = 'v1', bool $abort = true) |
|
258 | + function bdServiceClass (string $className, string $version = 'v1', bool $abort = true) |
|
259 | 259 | { |
260 | 260 | return bdClassExists(config('bludata.generator.paths.services'), $className.'Service', $version, $abort); |
261 | 261 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @param string $version = 'v1' |
268 | 268 | * @param bool $abort = true |
269 | 269 | */ |
270 | - function bdService(string $className, string $version = 'v1', bool $abort = true) |
|
270 | + function bdService (string $className, string $version = 'v1', bool $abort = true) |
|
271 | 271 | { |
272 | 272 | return app(bdServiceInterfaceClass($className, $version, $abort)); |
273 | 273 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @param string $version = 'v1' |
280 | 280 | * @param bool $abort = true |
281 | 281 | */ |
282 | - function bdEntityClass(string $className, string $version = 'v1', bool $abort = true) |
|
282 | + function bdEntityClass (string $className, string $version = 'v1', bool $abort = true) |
|
283 | 283 | { |
284 | 284 | return bdClassExists(config('bludata.generator.paths.entities'), $className, $version, $abort); |
285 | 285 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @param string $version = 'v1' |
292 | 292 | * @param bool $abort = true |
293 | 293 | */ |
294 | - function bdEntity(string $className, string $version = 'v1', bool $abort = true) |
|
294 | + function bdEntity (string $className, string $version = 'v1', bool $abort = true) |
|
295 | 295 | { |
296 | 296 | return app(bdEntityClass($className, $version, $abort)); |
297 | 297 | } |
@@ -8,62 +8,62 @@ |
||
8 | 8 | |
9 | 9 | class BaseApplication extends Application |
10 | 10 | { |
11 | - public function publicRoutes(string $uri, string $controller, Closure $routes = null, array $options = []) |
|
11 | + public function publicRoutes (string $uri, string $controller, Closure $routes = null, array $options = [ ]) |
|
12 | 12 | { |
13 | - $options['only'] = $options['only'] ?? ['index', 'show', 'destroyed']; |
|
13 | + $options[ 'only' ] = $options[ 'only' ] ?? [ 'index', 'show', 'destroyed' ]; |
|
14 | 14 | |
15 | 15 | return $this->resourceRoutes($uri, $controller, $routes, $options); |
16 | 16 | } |
17 | 17 | |
18 | - public function routesWithPermission(string $uri, string $controller, Closure $routes = null, array $options = []) |
|
18 | + public function routesWithPermission (string $uri, string $controller, Closure $routes = null, array $options = [ ]) |
|
19 | 19 | { |
20 | - $options['only'] = $options['only'] ?? ['store', 'update', 'destroyed', 'restoreDestroyed']; |
|
20 | + $options[ 'only' ] = $options[ 'only' ] ?? [ 'store', 'update', 'destroyed', 'restoreDestroyed' ]; |
|
21 | 21 | |
22 | 22 | return $this->resourceRoutes($uri, $controller, $routes, $options); |
23 | 23 | } |
24 | 24 | |
25 | - public function resourceRoutes(string $uri, string $controller, Closure $routes = null, array $options = []) |
|
25 | + public function resourceRoutes (string $uri, string $controller, Closure $routes = null, array $options = [ ]) |
|
26 | 26 | { |
27 | - $options['name'] = $options['name'] ?? $uri; |
|
28 | - $options['only'] = $options['only'] ?? []; |
|
29 | - $options['except'] = $options['except'] ?? []; |
|
27 | + $options[ 'name' ] = $options[ 'name' ] ?? $uri; |
|
28 | + $options[ 'only' ] = $options[ 'only' ] ?? [ ]; |
|
29 | + $options[ 'except' ] = $options[ 'except' ] ?? [ ]; |
|
30 | 30 | |
31 | - $exceptAll = isset($options['except'][0]) && $options['except'][0] == '*'; |
|
31 | + $exceptAll = isset($options[ 'except' ][ 0 ]) && $options[ 'except' ][ 0 ] == '*'; |
|
32 | 32 | |
33 | 33 | if (!$exceptAll) { |
34 | - if (in_array('index', $options['only']) && !in_array('index', $options['except'])) { |
|
34 | + if (in_array('index', $options[ 'only' ]) && !in_array('index', $options[ 'except' ])) { |
|
35 | 35 | Route::get($uri, $controller.'@index') |
36 | - ->name($options['name'].'.index'); |
|
36 | + ->name($options[ 'name' ].'.index'); |
|
37 | 37 | } |
38 | 38 | |
39 | - if (in_array('show', $options['only']) && !in_array('show', $options['except'])) { |
|
39 | + if (in_array('show', $options[ 'only' ]) && !in_array('show', $options[ 'except' ])) { |
|
40 | 40 | Route::get($uri.'/{uuid}', $controller.'@show') |
41 | - ->name($options['name'].'.show'); |
|
41 | + ->name($options[ 'name' ].'.show'); |
|
42 | 42 | } |
43 | 43 | |
44 | - if (in_array('store', $options['only']) && !in_array('store', $options['except'])) { |
|
44 | + if (in_array('store', $options[ 'only' ]) && !in_array('store', $options[ 'except' ])) { |
|
45 | 45 | Route::post($uri, $controller.'@store') |
46 | - ->name($options['name'].'.store'); |
|
46 | + ->name($options[ 'name' ].'.store'); |
|
47 | 47 | } |
48 | 48 | |
49 | - if (in_array('update', $options['only']) && !in_array('update', $options['except'])) { |
|
49 | + if (in_array('update', $options[ 'only' ]) && !in_array('update', $options[ 'except' ])) { |
|
50 | 50 | Route::put($uri.'/{uuid}', $controller.'@update') |
51 | - ->name($options['name'].'.update'); |
|
51 | + ->name($options[ 'name' ].'.update'); |
|
52 | 52 | } |
53 | 53 | |
54 | - if (in_array('destroy', $options['only']) && !in_array('destroy', $options['except'])) { |
|
54 | + if (in_array('destroy', $options[ 'only' ]) && !in_array('destroy', $options[ 'except' ])) { |
|
55 | 55 | Route::delete($uri.'/{uuid}', $controller.'@destroy') |
56 | - ->name($options['name'].'.destroy'); |
|
56 | + ->name($options[ 'name' ].'.destroy'); |
|
57 | 57 | } |
58 | 58 | |
59 | - if (in_array('destroyed', $options['only']) && !in_array('destroyed', $options['except'])) { |
|
59 | + if (in_array('destroyed', $options[ 'only' ]) && !in_array('destroyed', $options[ 'except' ])) { |
|
60 | 60 | Route::get($uri.'/destroyed', $controller.'@destroyed') |
61 | - ->name($options['name'].'.destroyed'); |
|
61 | + ->name($options[ 'name' ].'.destroyed'); |
|
62 | 62 | } |
63 | 63 | |
64 | - if (in_array('restoreDestroyed', $options['only']) && !in_array('restoreDestroyed', $options['except'])) { |
|
64 | + if (in_array('restoreDestroyed', $options[ 'only' ]) && !in_array('restoreDestroyed', $options[ 'except' ])) { |
|
65 | 65 | Route::post($uri.'/{uuid}', $controller.'@restoreDestroyed') |
66 | - ->name($options['name'].'.restoreDestroyed'); |
|
66 | + ->name($options[ 'name' ].'.restoreDestroyed'); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return void |
23 | 23 | */ |
24 | - public function boot() |
|
24 | + public function boot () |
|
25 | 25 | { |
26 | 26 | // |
27 | 27 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function map() |
|
36 | + public function map () |
|
37 | 37 | { |
38 | 38 | $this->mapApiRoutes(); |
39 | 39 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - protected function mapWebRoutes() |
|
52 | + protected function mapWebRoutes () |
|
53 | 53 | { |
54 | 54 | Route::middleware('web') |
55 | 55 | ->namespace($this->namespace) |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - protected function mapApiRoutes() |
|
66 | + protected function mapApiRoutes () |
|
67 | 67 | { |
68 | 68 | Route::prefix('api') |
69 | 69 | ->middleware('api') |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @return void |
36 | 36 | */ |
37 | - public function __construct() |
|
37 | + public function __construct () |
|
38 | 38 | { |
39 | 39 | $this->middleware('guest'); |
40 | 40 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return \Illuminate\Contracts\Validation\Validator |
48 | 48 | */ |
49 | - protected function validator(array $data) |
|
49 | + protected function validator (array $data) |
|
50 | 50 | { |
51 | 51 | return Validator::make($data, [ |
52 | 52 | 'name' => 'required|string|max:255', |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return \LaravelSeed\User |
64 | 64 | */ |
65 | - protected function create(array $data) |
|
65 | + protected function create (array $data) |
|
66 | 66 | { |
67 | 67 | return User::create([ |
68 | - 'name' => $data['name'], |
|
69 | - 'email' => $data['email'], |
|
70 | - 'password' => bcrypt($data['password']), |
|
68 | + 'name' => $data[ 'name' ], |
|
69 | + 'email' => $data[ 'email' ], |
|
70 | + 'password' => bcrypt($data[ 'password' ]), |
|
71 | 71 | ]); |
72 | 72 | } |
73 | 73 | } |