@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | { |
38 | 38 | $requestInput = request()->all(); |
39 | 39 | |
40 | - return array_reduce($this->all(), function ($carry, Filter $filter) use ($requestInput) { |
|
41 | - return $carry . $filter->render($requestInput); |
|
40 | + return array_reduce($this->all(), function($carry, Filter $filter) use ($requestInput) { |
|
41 | + return $carry.$filter->render($requestInput); |
|
42 | 42 | }, ''); |
43 | 43 | } |
44 | 44 | |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | |
55 | 55 | public function keys(): array |
56 | 56 | { |
57 | - return array_map(function (Filter $filter) { |
|
57 | + return array_map(function(Filter $filter) { |
|
58 | 58 | return $filter->key(); |
59 | 59 | }, $this->filters); |
60 | 60 | } |
61 | 61 | |
62 | 62 | private function validateFilters(array $filters) |
63 | 63 | { |
64 | - array_map(function (Filter $filter) { |
|
64 | + array_map(function(Filter $filter) { |
|
65 | 65 | }, $filters); |
66 | 66 | } |
67 | 67 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | |
87 | 87 | public function offsetSet($offset, $value) |
88 | 88 | { |
89 | - if (! $value instanceof Filter) { |
|
90 | - throw new \InvalidArgumentException('Passed value must be of type ' . Filter::class); |
|
89 | + if (!$value instanceof Filter) { |
|
90 | + throw new \InvalidArgumentException('Passed value must be of type '.Filter::class); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $this->filters[$offset] = $value; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | private function sanitizeFilters(array $filters) |
107 | 107 | { |
108 | - return array_map(function ($filter) { |
|
108 | + return array_map(function($filter) { |
|
109 | 109 | if (is_string($filter) && class_exists($filter)) { |
110 | 110 | return $filter::init(); |
111 | 111 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function apply($value = null): Closure |
17 | 17 | { |
18 | - return $this->query && $this->query instanceof Closure ? $this->query : function ($query) { |
|
18 | + return $this->query && $this->query instanceof Closure ? $this->query : function($query) { |
|
19 | 19 | return $query; |
20 | 20 | }; |
21 | 21 | } |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | |
7 | 7 | class FilterType |
8 | 8 | { |
9 | - const INPUT = 'input'; // oneliner text (input) |
|
10 | - const SELECT = 'select'; // Select options |
|
9 | + const INPUT = 'input'; // oneliner text (input) |
|
10 | + const SELECT = 'select'; // Select options |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @var string |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | static::INPUT, |
21 | 21 | static::SELECT, |
22 | 22 | ])) { |
23 | - throw new \Exception('Invalid type identifier given [' . $type . '].'); |
|
23 | + throw new \Exception('Invalid type identifier given ['.$type.'].'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $this->type = $type; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public static function fromString(string $type) |
30 | 30 | { |
31 | - $class = 'Thinktomorrow\Chief\Filters\Types\\' . ucfirst($type . 'Filter'); |
|
31 | + $class = 'Thinktomorrow\Chief\Filters\Types\\'.ucfirst($type.'Filter'); |
|
32 | 32 | |
33 | 33 | return new $class(new static($type)); |
34 | 34 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | foreach ($manager->fields() as $field) { |
19 | 19 | |
20 | 20 | // Custom save methods |
21 | - $saveMethodName = 'save'. ucfirst(camel_case($field->key())) . 'Field'; |
|
21 | + $saveMethodName = 'save'.ucfirst(camel_case($field->key())).'Field'; |
|
22 | 22 | if (method_exists($manager, $saveMethodName)) { |
23 | 23 | $this->saveMethods[$field->key] = ['field' => $field, 'method' => $saveMethodName]; |
24 | 24 | continue; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | // Media fields are treated separately |
28 | 28 | if ($field->ofType(FieldType::MEDIA, FieldType::DOCUMENT)) { |
29 | - if (! isset($this->saveMethods['_files'])) { |
|
29 | + if (!isset($this->saveMethods['_files'])) { |
|
30 | 30 | $this->saveMethods['_files'] = ['field' => new Fields([$field]), 'method' => 'uploadMedia']; |
31 | 31 | continue; |
32 | 32 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | // Custom set methods - default is the generic setField() method. |
39 | - $methodName = 'set'. ucfirst(camel_case($field->key())) . 'Field'; |
|
39 | + $methodName = 'set'.ucfirst(camel_case($field->key())).'Field'; |
|
40 | 40 | (method_exists($manager, $methodName)) |
41 | 41 | ? $manager->$methodName($field, $request) |
42 | 42 | : $manager->setField($field, $request); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function isAssistedBy(string $assistant): bool |
19 | 19 | { |
20 | - return !! $this->getAssistantClass($assistant); |
|
20 | + return !!$this->getAssistantClass($assistant); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function assistant(string $assistant): Assistant |
31 | 31 | { |
32 | - if (! $this->isAssistedBy($assistant)) { |
|
33 | - throw new MissingAssistant('No assistant [' . $assistant . '] present on manager ' . get_class($this)); |
|
32 | + if (!$this->isAssistedBy($assistant)) { |
|
33 | + throw new MissingAssistant('No assistant ['.$assistant.'] present on manager '.get_class($this)); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $instance = app($this->getAssistantClass($assistant)); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function findAll(): Collection |
73 | 73 | { |
74 | - return $this->model->published()->get()->map(function ($model) { |
|
74 | + return $this->model->published()->get()->map(function($model) { |
|
75 | 75 | return $this->managers->findByModel($model); |
76 | 76 | }); |
77 | 77 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function guard($verb): Assistant |
95 | 95 | { |
96 | - if (! $this->can($verb)) { |
|
96 | + if (!$this->can($verb)) { |
|
97 | 97 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
98 | 98 | } |
99 | 99 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | |
103 | 103 | public function previewUrl(): string |
104 | 104 | { |
105 | - if (! $this->model instanceof ProvidesUrl) { |
|
106 | - throw new \Exception('Managed model ' . get_class($this->model) . ' should implement ' . ProvidesUrl::class); |
|
105 | + if (!$this->model instanceof ProvidesUrl) { |
|
106 | + throw new \Exception('Managed model '.get_class($this->model).' should implement '.ProvidesUrl::class); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | return $this->model->previewUrl(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function findAll(): Collection |
71 | 71 | { |
72 | - return $this->model->archived()->get()->map(function ($model) { |
|
72 | + return $this->model->archived()->get()->map(function($model) { |
|
73 | 73 | return $this->managers->findByModel($model); |
74 | 74 | }); |
75 | 75 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | public function guard($verb): Assistant |
101 | 101 | { |
102 | - if (! $this->can($verb)) { |
|
102 | + if (!$this->can($verb)) { |
|
103 | 103 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
104 | 104 | } |
105 | 105 |
@@ -39,11 +39,11 @@ |
||
39 | 39 | |
40 | 40 | public static function notAllowedVerb($verb, Manager $manager) |
41 | 41 | { |
42 | - throw new static('Not allowed to '.$verb.' a model. '.ucfirst($verb).' route is not allowed by the ' . $manager->details()->key.' manager.'); |
|
42 | + throw new static('Not allowed to '.$verb.' a model. '.ucfirst($verb).' route is not allowed by the '.$manager->details()->key.' manager.'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function notAllowedPermission($permission, Manager $manager) |
46 | 46 | { |
47 | - throw new static('Not allowed permission for '.$permission.' on a model as managed by the ' . $manager->details()->key.' manager.'); |
|
47 | + throw new static('Not allowed permission for '.$permission.' on a model as managed by the '.$manager->details()->key.' manager.'); |
|
48 | 48 | } |
49 | 49 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | |
65 | 65 | public function __toString() |
66 | 66 | { |
67 | - return (string) $this->get('key'); |
|
67 | + return (string)$this->get('key'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |