@@ -35,8 +35,8 @@ |
||
35 | 35 | */ |
36 | 36 | public function register() |
37 | 37 | { |
38 | - $this->app->singleton(Smokescreen::class, function () { |
|
39 | - return new Smokescreen(new \Rexlabs\Smokescreen\Smokescreen(), config('smokescreen', [])); |
|
38 | + $this->app->singleton(Smokescreen::class, function() { |
|
39 | + return new Smokescreen(new \Rexlabs\Smokescreen\Smokescreen(), config('smokescreen', [ ])); |
|
40 | 40 | }); |
41 | 41 | $this->app->alias(Smokescreen::class, 'smokescreen'); |
42 | 42 |
@@ -89,9 +89,9 @@ |
||
89 | 89 | $modelClass = null; |
90 | 90 | |
91 | 91 | // If not name-spaced, get a list of classes to search in common model namespaces. |
92 | - $search = str_contains('\\', $name) ? [$name] : array_map(function ($directory) use ($name) { |
|
92 | + $search = str_contains('\\', $name) ? [ $name ] : array_map(function($directory) use ($name) { |
|
93 | 93 | return $directory . '\\' . $name; |
94 | - }, ['App\\Models', 'App\\Model', 'App']); |
|
94 | + }, [ 'App\\Models', 'App\\Model', 'App' ]); |
|
95 | 95 | |
96 | 96 | // Check for a valid class. |
97 | 97 | foreach ($search as $class) { |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getIncludes(): array |
68 | 68 | { |
69 | - $list = []; |
|
69 | + $list = [ ]; |
|
70 | 70 | $methods = (new ReflectionClass($this->getModelClass()))->getMethods(ReflectionMethod::IS_PUBLIC); |
71 | - $declaredMethods = array_filter($methods, function (ReflectionMethod $method) { |
|
71 | + $declaredMethods = array_filter($methods, function(ReflectionMethod $method) { |
|
72 | 72 | return $method->getDeclaringClass() |
73 | 73 | ->getName() === $this->getModelClass(); |
74 | 74 | }); |
75 | 75 | |
76 | 76 | foreach ($declaredMethods as $method) { |
77 | 77 | if ($type = $this->getResourceTypeByMethodReturnType($method)) { |
78 | - $list[$method->getName()] = "relation|{$type}"; |
|
78 | + $list[ $method->getName() ] = "relation|{$type}"; |
|
79 | 79 | } elseif ($type = $this->getResourceTypeByMethodDefinition($method)) { |
80 | - $list[$method->getName()] = "relation|{$type}"; |
|
80 | + $list[ $method->getName() ] = "relation|{$type}"; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getDeclaredProperties() : array |
97 | 97 | { |
98 | - $list = []; |
|
98 | + $list = [ ]; |
|
99 | 99 | $class = $this->getModelClass(); |
100 | 100 | $table = (new $class)->getTable(); |
101 | 101 | $columns = Schema::getColumnListing($table); |
102 | 102 | |
103 | 103 | foreach ($columns as $column) { |
104 | 104 | $type = Schema::getColumnType($table, $column); |
105 | - $list[$column] = $this->typesMap[$type] ?? null; |
|
105 | + $list[ $column ] = $this->typesMap[ $type ] ?? null; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return $list; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getDefaultProperties(): array |
117 | 117 | { |
118 | - return []; |
|
118 | + return [ ]; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected function getResourceTypeByMethodReturnType(ReflectionMethod $method) |
138 | 138 | { |
139 | - $returnType = (string)$method->getReturnType(); |
|
139 | + $returnType = (string) $method->getReturnType(); |
|
140 | 140 | $namespace = 'Illuminate\Database\Eloquent\Relations'; |
141 | 141 | |
142 | 142 | if (!starts_with($returnType, $namespace)) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $relation = lcfirst(class_basename($returnType)); |
147 | 147 | |
148 | - return $this->relationsMap[$relation] ?? null; |
|
148 | + return $this->relationsMap[ $relation ] ?? null; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |