@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Thinktomorrow\Chief\Media; |
6 | 6 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | $this->fetch(); |
14 | 14 | |
15 | - if (! isset($this->values[$key])) { |
|
15 | + if (!isset($this->values[$key])) { |
|
16 | 16 | return $default; |
17 | 17 | } |
18 | 18 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | public function register() |
15 | 15 | { |
16 | - $this->app->singleton(SettingsManager::class, function ($app) { |
|
16 | + $this->app->singleton(SettingsManager::class, function($app) { |
|
17 | 17 | return new SettingsManager(); |
18 | 18 | }); |
19 | 19 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | private function defaultField() |
46 | 46 | { |
47 | 47 | return InputField::make($this->key) |
48 | - ->label(ucfirst(str_replace(['-','_','.'], ' ', $this->key))); |
|
48 | + ->label(ucfirst(str_replace(['-', '_', '.'], ' ', $this->key))); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public static function refreshFieldsFromConfig() |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | public static function toSelectValues(Collection $collection): Collection |
10 | 10 | { |
11 | - return $collection->map(function (ProvidesFlatReference $item) { |
|
11 | + return $collection->map(function(ProvidesFlatReference $item) { |
|
12 | 12 | return [ |
13 | 13 | 'id' => $item->flatReference()->get(), |
14 | 14 | 'label' => $item->flatReferenceLabel(), |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | { |
22 | 22 | $grouped = []; |
23 | 23 | |
24 | - static::toSelectValues($collection)->each(function ($item) use (&$grouped) { |
|
24 | + static::toSelectValues($collection)->each(function($item) use (&$grouped) { |
|
25 | 25 | if (isset($grouped[$item['group']])) { |
26 | 26 | $grouped[$item['group']]['values'][] = $item; |
27 | - } else { |
|
27 | + }else { |
|
28 | 28 | $grouped[$item['group']] = ['group' => $item['group'], 'values' => [$item]]; |
29 | 29 | } |
30 | 30 | }); |
@@ -21,16 +21,16 @@ |
||
21 | 21 | $referenceStrings = []; |
22 | 22 | } |
23 | 23 | |
24 | - return (new Collection($referenceStrings))->reject(function ($referenceString) { |
|
24 | + return (new Collection($referenceStrings))->reject(function($referenceString) { |
|
25 | 25 | return is_null($referenceString); |
26 | - })->map(function ($referenceString) { |
|
26 | + })->map(function($referenceString) { |
|
27 | 27 | return FlatReferenceFactory::fromString($referenceString)->instance(); |
28 | 28 | }); |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function toFlatReferences(): Collection |
32 | 32 | { |
33 | - return (new Collection($this->all()))->map(function (ProvidesFlatReference $item) { |
|
33 | + return (new Collection($this->all()))->map(function(ProvidesFlatReference $item) { |
|
34 | 34 | return $item->flatReference()->get(); |
35 | 35 | }); |
36 | 36 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | public static function fromString(string $reference): FlatReference |
8 | 8 | { |
9 | 9 | if (false == strpos($reference, '@')) { |
10 | - throw new \InvalidArgumentException('Invalid reference composition. A flat reference should honour schema <class>@<id>. [' . $reference . '] was passed instead.'); |
|
10 | + throw new \InvalidArgumentException('Invalid reference composition. A flat reference should honour schema <class>@<id>. ['.$reference.'] was passed instead.'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | list($className, $id) = explode('@', $reference); |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | $instance = app($className); |
16 | 16 | $instance->{$instance->getKeyName()} = $id; |
17 | 17 | |
18 | - if (! method_exists($instance, 'flatReference')) { |
|
19 | - throw new \InvalidArgumentException('Instance created from model reference [' . $reference . '] was expected to have a method of flatReference() but is has not.'); |
|
18 | + if (!method_exists($instance, 'flatReference')) { |
|
19 | + throw new \InvalidArgumentException('Instance created from model reference ['.$reference.'] was expected to have a method of flatReference() but is has not.'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | return $instance->flatReference(); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function apply($value = null): Closure |
21 | 21 | { |
22 | - return function ($query) use ($value) { |
|
22 | + return function($query) use ($value) { |
|
23 | 23 | if ($value == 'all') { |
24 | 24 | return $query; |
25 | 25 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | // Constraints |
36 | 36 | if (!isset($values['action'])) { |
37 | - throw new \InvalidArgumentException('Set reference array is missing required values for the "action" keys. Given: ' . print_r($values, true)); |
|
37 | + throw new \InvalidArgumentException('Set reference array is missing required values for the "action" keys. Given: '.print_r($values, true)); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return new static( |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | { |
50 | 50 | $sets = config('thinktomorrow.chief.sets', []); |
51 | 51 | |
52 | - return collect($sets)->map(function ($set, $key) { |
|
52 | + return collect($sets)->map(function($set, $key) { |
|
53 | 53 | return SetReference::fromArray($key, $set); |
54 | 54 | }); |
55 | 55 | } |
56 | 56 | |
57 | 57 | public static function find($key): ?SetReference |
58 | 58 | { |
59 | - return static::all()->filter(function ($ref) use ($key) { |
|
59 | + return static::all()->filter(function($ref) use ($key) { |
|
60 | 60 | return $ref->key() == $key; |
61 | 61 | })->first(); |
62 | 62 | } |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | |
74 | 74 | $this->validateAction($class, $method); |
75 | 75 | |
76 | - $result = call_user_func_array([app($class),$method], $this->parameters); |
|
76 | + $result = call_user_func_array([app($class), $method], $this->parameters); |
|
77 | 77 | |
78 | - if (! $result instanceof Set && $result instanceof Collection) { |
|
78 | + if (!$result instanceof Set && $result instanceof Collection) { |
|
79 | 79 | return new Set($result->all(), $this->key); |
80 | 80 | } |
81 | 81 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | private static function validateAction($class, $method) |
109 | 109 | { |
110 | - if (! class_exists($class)) { |
|
110 | + if (!class_exists($class)) { |
|
111 | 111 | throw new \InvalidArgumentException('The class ['.$class.'] isn\'t a valid class reference or does not exist in the chief-settings.sets config entry.'); |
112 | 112 | } |
113 | 113 |