@@ -71,7 +71,7 @@ |
||
71 | 71 | /** |
72 | 72 | * Get column value from instance. |
73 | 73 | * |
74 | - * @param Collection|Model|Closure $instance |
|
74 | + * @param Model $instance |
|
75 | 75 | * @param string $name |
76 | 76 | * |
77 | 77 | * @return mixed |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function setOrderable($orderable = true) |
75 | 75 | { |
76 | - if ($orderable !== false && ! $orderable instanceof OrderByClauseInterface) { |
|
77 | - if (! is_string($orderable) && ! $orderable instanceof Closure) { |
|
76 | + if ($orderable !== false && !$orderable instanceof OrderByClauseInterface) { |
|
77 | + if (!is_string($orderable) && !$orderable instanceof Closure) { |
|
78 | 78 | $orderable = $this->getName(); |
79 | 79 | } |
80 | 80 | |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | |
119 | 119 | if ($instance instanceof Collection) { |
120 | 120 | $instance = $instance->pluck($part); |
121 | - } elseif (! is_null($instance)) { |
|
121 | + } elseif (!is_null($instance)) { |
|
122 | 122 | $instance = $instance->getAttribute($part); |
123 | 123 | } |
124 | 124 | |
125 | - if (! empty($parts) && ! is_null($instance)) { |
|
125 | + if (!empty($parts) && !is_null($instance)) { |
|
126 | 126 | return $this->getValueFromObject($instance, implode('.', $parts)); |
127 | 127 | } |
128 | 128 |
@@ -308,7 +308,7 @@ |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | - * @return \Illuminate\Foundation\Application|mixed |
|
311 | + * @return RepositoryInterface |
|
312 | 312 | * @throws \Exception |
313 | 313 | */ |
314 | 314 | protected function makeRepository() |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @var array |
52 | 52 | */ |
53 | - protected $with = []; |
|
53 | + protected $with = [ ]; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @var string |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->repository = $this->makeRepository(); |
168 | 168 | $this->repository->with($this->with); |
169 | 169 | |
170 | - $this->extensions->each(function (DisplayExtensionInterface $extension) { |
|
170 | + $this->extensions->each(function(DisplayExtensionInterface $extension) { |
|
171 | 171 | if ($extension instanceof Initializable) { |
172 | 172 | $extension->initialize(); |
173 | 173 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | $this->title, |
202 | 202 | ]; |
203 | 203 | |
204 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
204 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
205 | 205 | if (method_exists($extension, $method = 'getTitle')) { |
206 | - $titles[] = call_user_func([$extension, $method]); |
|
206 | + $titles[ ] = call_user_func([ $extension, $method ]); |
|
207 | 207 | } |
208 | 208 | }); |
209 | 209 | |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | { |
266 | 266 | $view = app('sleeping_owl.template')->view($this->getView(), $this->toArray()); |
267 | 267 | |
268 | - $blocks = []; |
|
268 | + $blocks = [ ]; |
|
269 | 269 | |
270 | - $placableExtensions = $this->getExtensions()->filter(function ($extension) { |
|
270 | + $placableExtensions = $this->getExtensions()->filter(function($extension) { |
|
271 | 271 | return $extension instanceof Placable; |
272 | 272 | }); |
273 | 273 | |
274 | 274 | foreach ($placableExtensions as $extension) { |
275 | - $blocks[$extension->getPlacement()][] = (string) app('sleeping_owl.template')->view( |
|
275 | + $blocks[ $extension->getPlacement() ][ ] = (string) app('sleeping_owl.template')->view( |
|
276 | 276 | $extension->getView(), |
277 | 277 | $extension->toArray() |
278 | 278 | ); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | foreach ($blocks as $block => $data) { |
282 | 282 | foreach ($data as $html) { |
283 | - if (! empty($html)) { |
|
283 | + if (!empty($html)) { |
|
284 | 284 | $view->getFactory()->startSection($block); |
285 | 285 | echo $html; |
286 | 286 | $view->getFactory()->yieldSection(); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $extension = $this->extensions->get($method); |
316 | 316 | |
317 | 317 | if (method_exists($extension, 'set')) { |
318 | - return call_user_func_array([$extension, 'set'], $arguments); |
|
318 | + return call_user_func_array([ $extension, 'set' ], $arguments); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | */ |
337 | 337 | protected function makeRepository() |
338 | 338 | { |
339 | - $repository = app($this->repositoryClass, [$this->modelClass]); |
|
339 | + $repository = app($this->repositoryClass, [ $this->modelClass ]); |
|
340 | 340 | |
341 | - if (! ($repository instanceof RepositoryInterface)) { |
|
341 | + if (!($repository instanceof RepositoryInterface)) { |
|
342 | 342 | throw new \Exception('Repository class must be instanced of [RepositoryInterface]'); |
343 | 343 | } |
344 | 344 |
@@ -145,7 +145,7 @@ |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | - * @param string|\Illuminate\View\View $view |
|
148 | + * @param string $view |
|
149 | 149 | * |
150 | 150 | * @return $this |
151 | 151 | */ |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | $this->controlActive = false; |
89 | 89 | |
90 | 90 | if ($this->isInitialize()) { |
91 | - $this->columns = $this->columns->filter(function ($column) { |
|
91 | + $this->columns = $this->columns->filter(function($column) { |
|
92 | 92 | $class = get_class($this->getControlColumn()); |
93 | 93 | |
94 | - return ! ($column instanceof $class); |
|
94 | + return !($column instanceof $class); |
|
95 | 95 | }); |
96 | 96 | } |
97 | 97 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function set($columns) |
115 | 115 | { |
116 | - if (! is_array($columns)) { |
|
116 | + if (!is_array($columns)) { |
|
117 | 117 | $columns = func_get_args(); |
118 | 118 | } |
119 | 119 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | public function initialize() |
181 | 181 | { |
182 | - $this->all()->each(function (ColumnInterface $column) { |
|
182 | + $this->all()->each(function(ColumnInterface $column) { |
|
183 | 183 | $column->initialize(); |
184 | 184 | }); |
185 | 185 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | public function render() |
199 | 199 | { |
200 | 200 | $params = $this->toArray(); |
201 | - $params['collection'] = $this->getDisplay()->getCollection(); |
|
202 | - $params['pagination'] = null; |
|
201 | + $params[ 'collection' ] = $this->getDisplay()->getCollection(); |
|
202 | + $params[ 'pagination' ] = null; |
|
203 | 203 | |
204 | - if ($params['collection'] instanceof \Illuminate\Contracts\Pagination\Paginator) { |
|
204 | + if ($params[ 'collection' ] instanceof \Illuminate\Contracts\Pagination\Paginator) { |
|
205 | 205 | if (class_exists('Illuminate\Pagination\BootstrapThreePresenter')) { |
206 | - $params['pagination'] = (new \Illuminate\Pagination\BootstrapThreePresenter($params['collection']))->render(); |
|
206 | + $params[ 'pagination' ] = (new \Illuminate\Pagination\BootstrapThreePresenter($params[ 'collection' ]))->render(); |
|
207 | 207 | } else { |
208 | - $params['pagination'] = $params['collection']->render(); |
|
208 | + $params[ 'pagination' ] = $params[ 'collection' ]->render(); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * @return Closure |
|
86 | + * @return \Closure |
|
87 | 87 | */ |
88 | 88 | public function getAccessLogic() |
89 | 89 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getModelConfiguration() |
33 | 33 | { |
34 | - if (! $this->hasModel()) { |
|
34 | + if (!$this->hasModel()) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function hasModel() |
45 | 45 | { |
46 | - return ! is_null($this->model) and class_exists($this->model); |
|
46 | + return !is_null($this->model) and class_exists($this->model); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function getAccessLogic() |
89 | 89 | { |
90 | - if (! is_callable($this->accessLogic)) { |
|
90 | + if (!is_callable($this->accessLogic)) { |
|
91 | 91 | if ($this->hasModel()) { |
92 | - return function () { |
|
92 | + return function() { |
|
93 | 93 | return $this->getModelConfiguration()->isDisplayable(); |
94 | 94 | }; |
95 | 95 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $data = $this->toArray(); |
109 | 109 | |
110 | - if (! is_null($view)) { |
|
110 | + if (!is_null($view)) { |
|
111 | 111 | return view($view, $data)->render(); |
112 | 112 | } |
113 | 113 |
@@ -214,7 +214,7 @@ |
||
214 | 214 | /** |
215 | 215 | * @param $object |
216 | 216 | * |
217 | - * @return mixed |
|
217 | + * @return Model |
|
218 | 218 | */ |
219 | 219 | protected function getElementContainer($object) |
220 | 220 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public function initializeElements() |
20 | 20 | { |
21 | - $this->getElements()->each(function ($element) { |
|
21 | + $this->getElements()->each(function($element) { |
|
22 | 22 | if ($element instanceof Initializable) { |
23 | 23 | $element->initialize(); |
24 | 24 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | foreach ($this->getElements() as $element) { |
38 | 38 | if ($element instanceof ElementsInterface) { |
39 | - if (! is_null($found = $element->getElement($path))) { |
|
39 | + if (!is_null($found = $element->getElement($path))) { |
|
40 | 40 | return $found; |
41 | 41 | } |
42 | 42 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function setModelForElements(Model $model) |
132 | 132 | { |
133 | - $this->getElements()->each(function ($element) use ($model) { |
|
133 | + $this->getElements()->each(function($element) use ($model) { |
|
134 | 134 | $element = $this->getElementContainer($element); |
135 | 135 | if ($element instanceof FormElementInterface) { |
136 | 136 | $element->setModel($model); |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @return array |
147 | 147 | */ |
148 | - protected function getValidationRulesFromElements(array $rules = []) |
|
148 | + protected function getValidationRulesFromElements(array $rules = [ ]) |
|
149 | 149 | { |
150 | - $this->getElements()->each(function ($element) use (&$rules) { |
|
150 | + $this->getElements()->each(function($element) use (&$rules) { |
|
151 | 151 | $element = $this->getElementContainer($element); |
152 | 152 | if ($element instanceof FormElementInterface) { |
153 | 153 | $rules += $element->getValidationRules(); |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return array |
164 | 164 | */ |
165 | - protected function getValidationMessagesForElements(array $messages = []) |
|
165 | + protected function getValidationMessagesForElements(array $messages = [ ]) |
|
166 | 166 | { |
167 | - $this->getElements()->each(function ($element) use (&$messages) { |
|
167 | + $this->getElements()->each(function($element) use (&$messages) { |
|
168 | 168 | $element = $this->getElementContainer($element); |
169 | 169 | if ($element instanceof NamedFormElement) { |
170 | 170 | $messages += $element->getValidationMessages(); |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function getValidationLabelsForElements(array $labels = []) |
|
182 | + protected function getValidationLabelsForElements(array $labels = [ ]) |
|
183 | 183 | { |
184 | - $this->getElements()->each(function ($element) use (&$labels) { |
|
184 | + $this->getElements()->each(function($element) use (&$labels) { |
|
185 | 185 | $element = $this->getElementContainer($element); |
186 | 186 | if ($element instanceof NamedFormElement) { |
187 | 187 | $labels += $element->getValidationLabels(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | protected function saveElements() |
195 | 195 | { |
196 | - $this->getElements()->each(function ($element) { |
|
196 | + $this->getElements()->each(function($element) { |
|
197 | 197 | $element = $this->getElementContainer($element); |
198 | 198 | if ($element instanceof FormElementInterface) { |
199 | 199 | $element->save(); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | protected function afterSaveElements() |
205 | 205 | { |
206 | - $this->getElements()->each(function ($element) { |
|
206 | + $this->getElements()->each(function($element) { |
|
207 | 207 | $element = $this->getElementContainer($element); |
208 | 208 | if ($element instanceof FormElementInterface) { |
209 | 209 | $element->afterSave(); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param WysiwygFilterInterface|null $filter |
46 | 46 | * @param array $config |
47 | 47 | */ |
48 | - public function __construct($id, $name = null, WysiwygFilterInterface $filter = null, array $config = []) |
|
48 | + public function __construct($id, $name = null, WysiwygFilterInterface $filter = null, array $config = [ ]) |
|
49 | 49 | { |
50 | 50 | $this->id = $id; |
51 | 51 | $this->name = is_null($name) ? studly_case($id) : $name; |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | |
141 | 141 | public function __call($method, $arguments) |
142 | 142 | { |
143 | - if (in_array($method, ['js', 'css'])) { |
|
144 | - call_user_func_array([$this->getPackage(), $method], $arguments); |
|
143 | + if (in_array($method, [ 'js', 'css' ])) { |
|
144 | + call_user_func_array([ $this->getPackage(), $method ], $arguments); |
|
145 | 145 | |
146 | 146 | return $this; |
147 | 147 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | $relationName = implode('.', $parts); |
39 | 39 | } |
40 | 40 | |
41 | - if (! is_null($relationName)) { |
|
42 | - $query->whereHas($relationName, function ($q) use ($name, $value) { |
|
41 | + if (!is_null($relationName)) { |
|
42 | + $query->whereHas($relationName, function($q) use ($name, $value) { |
|
43 | 43 | $this->buildQuery($q, $name, $value); |
44 | 44 | }); |
45 | 45 | } else { |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct(Closure $callback = null) |
26 | 26 | { |
27 | - if (! is_null($callback)) { |
|
27 | + if (!is_null($callback)) { |
|
28 | 28 | $this->setCallback($callback); |
29 | 29 | } |
30 | 30 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $this->initializeElements(); |
45 | 45 | |
46 | - $activeTabs = $this->getTabs()->filter(function (TabInterface $tab) { |
|
46 | + $activeTabs = $this->getTabs()->filter(function(TabInterface $tab) { |
|
47 | 47 | return $tab->isActive(); |
48 | 48 | })->count(); |
49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function setModelClass($class) |
59 | 59 | { |
60 | - $this->getTabs()->each(function (TabInterface $tab) use ($class) { |
|
60 | + $this->getTabs()->each(function(TabInterface $tab) use ($class) { |
|
61 | 61 | if ($tab instanceof DisplayInterface) { |
62 | 62 | $tab->setModelClass($class); |
63 | 63 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function setAction($action) |
139 | 139 | { |
140 | - $this->getTabs()->each(function (TabInterface $tab) use ($action) { |
|
140 | + $this->getTabs()->each(function(TabInterface $tab) use ($action) { |
|
141 | 141 | if ($tab instanceof FormInterface) { |
142 | 142 | $tab->setAction($action); |
143 | 143 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function setId($id) |
151 | 151 | { |
152 | - $this->getTabs()->each(function (TabInterface $tab) use ($id) { |
|
152 | + $this->getTabs()->each(function(TabInterface $tab) use ($id) { |
|
153 | 153 | if ($tab instanceof FormInterface) { |
154 | 154 | $tab->setId($id); |
155 | 155 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | foreach ($this->getTabs() as $tab) { |
167 | 167 | if ($tab instanceof FormInterface) { |
168 | 168 | $result = $tab->validateForm($model); |
169 | - if (! is_null($result)) { |
|
169 | + if (!is_null($result)) { |
|
170 | 170 | return $result; |
171 | 171 | } |
172 | 172 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function saveForm(ModelConfigurationInterface $model) |
180 | 180 | { |
181 | - $this->getTabs()->each(function (TabInterface $tab) use ($model) { |
|
181 | + $this->getTabs()->each(function(TabInterface $tab) use ($model) { |
|
182 | 182 | if ($tab instanceof FormInterface) { |
183 | 183 | $tab->saveForm($model); |
184 | 184 | } |