@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function keys(): array |
| 36 | 36 | { |
| 37 | - return array_map(function (Field $field) { |
|
| 37 | + return array_map(function(Field $field) { |
|
| 38 | 38 | return $field->key(); |
| 39 | 39 | }, $this->fields); |
| 40 | 40 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | private function validateFields(array $fields) |
| 70 | 70 | { |
| 71 | - array_map(function (Field $field) { |
|
| 71 | + array_map(function(Field $field) { |
|
| 72 | 72 | }, $fields); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | public function offsetSet($offset, $value) |
| 114 | 114 | { |
| 115 | - if (! $value instanceof Field) { |
|
| 116 | - throw new \InvalidArgumentException('Passed value must be of type ' . Field::class); |
|
| 115 | + if (!$value instanceof Field) { |
|
| 116 | + throw new \InvalidArgumentException('Passed value must be of type '.Field::class); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $this->fields[$offset] = $value; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | // prepend the name with the expected trans.<locale>. string |
| 28 | 28 | $localizedAttr = (false !== strpos($attr, '*')) |
| 29 | 29 | ? str_replace('*', $locale, $attr) |
| 30 | - : 'trans.' . $locale . '.' . $attr; |
|
| 30 | + : 'trans.'.$locale.'.'.$attr; |
|
| 31 | 31 | |
| 32 | 32 | $localizedRules[$localizedAttr] = $rule; |
| 33 | 33 | } |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function influenceByPayload(array $data) |
| 49 | 49 | { |
| 50 | - if (! isset($data['trans'])) { |
|
| 50 | + if (!isset($data['trans'])) { |
|
| 51 | 51 | return $this; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // Remove locales that are considered empty in the request payload |
| 55 | 55 | foreach ($data['trans'] as $locale => $values) { |
| 56 | - if ($locale == $this->defaultLocale || ! is_array_empty($values)) { |
|
| 56 | + if ($locale == $this->defaultLocale || !is_array_empty($values)) { |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Thinktomorrow\Chief\Fields\Types; |
| 5 | 5 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Thinktomorrow\Chief\Fields\Types; |
| 6 | 6 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $value = parent::__get($key); |
| 51 | 51 | |
| 52 | 52 | // Default empty array for these following values |
| 53 | - if (!$value && in_array($key, ['sections','availableModules','availablePages', 'availableSets'])) { |
|
| 53 | + if (!$value && in_array($key, ['sections', 'availableModules', 'availablePages', 'availableSets'])) { |
|
| 54 | 54 | return []; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | namespace Thinktomorrow\Chief\Fields\Types; |
| 4 | 4 | |
| 5 | 5 | class HtmlField extends Field |
@@ -6,15 +6,15 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | class FieldType |
| 8 | 8 | { |
| 9 | - const INPUT = 'input'; // oneliner text (input) |
|
| 10 | - const TEXT = 'text'; // Plain text (textarea) |
|
| 11 | - const DATE = 'date'; // Timestamp input |
|
| 12 | - const HTML = 'html'; // Html text (wysiwyg) |
|
| 13 | - const SELECT = 'select'; // Select options |
|
| 14 | - const MEDIA = 'media'; // media file (slim uploader) |
|
| 15 | - const DOCUMENT = 'document'; // documents |
|
| 16 | - const RADIO = 'radio'; // media file (slim uploader) |
|
| 17 | - const PAGEBUILDER = 'pagebuilder'; // the most special field there is... |
|
| 9 | + const INPUT = 'input'; // oneliner text (input) |
|
| 10 | + const TEXT = 'text'; // Plain text (textarea) |
|
| 11 | + const DATE = 'date'; // Timestamp input |
|
| 12 | + const HTML = 'html'; // Html text (wysiwyg) |
|
| 13 | + const SELECT = 'select'; // Select options |
|
| 14 | + const MEDIA = 'media'; // media file (slim uploader) |
|
| 15 | + const DOCUMENT = 'document'; // documents |
|
| 16 | + const RADIO = 'radio'; // media file (slim uploader) |
|
| 17 | + const PAGEBUILDER = 'pagebuilder'; // the most special field there is... |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var string |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | static::RADIO, |
| 35 | 35 | static::PAGEBUILDER, |
| 36 | 36 | ])) { |
| 37 | - throw new \Exception('Invalid type identifier given [' . $type . '].'); |
|
| 37 | + throw new \Exception('Invalid type identifier given ['.$type.'].'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $this->type = $type; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public static function fromString(string $type) |
| 44 | 44 | { |
| 45 | - $class = 'Thinktomorrow\Chief\Fields\Types\\' . ucfirst($type . 'Field'); |
|
| 45 | + $class = 'Thinktomorrow\Chief\Fields\Types\\'.ucfirst($type.'Field'); |
|
| 46 | 46 | |
| 47 | 47 | return new $class(new static($type)); |
| 48 | 48 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | namespace Thinktomorrow\Chief\Fields\Types; |
| 4 | 4 | |
| 5 | 5 | class DateField extends Field |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Thinktomorrow\Chief\Fields\Types; |
| 6 | 6 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function getValidation(array $data = []) |
| 37 | 37 | { |
| 38 | - if (! $this->hasValidation()) { |
|
| 38 | + if (!$this->hasValidation()) { |
|
| 39 | 39 | return null; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (!in_array($name, ['label', 'key', 'description', 'column', 'name', 'prepend', 'append'])) { |
| 119 | - throw new \InvalidArgumentException('Cannot set value by ['. $name .'].'); |
|
| 119 | + throw new \InvalidArgumentException('Cannot set value by ['.$name.'].'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $this->values[$name] = $arguments[0]; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | private function validateTabs(array $tabs) |
| 49 | 49 | { |
| 50 | - array_map(function (FieldsTab $tab) { |
|
| 50 | + array_map(function(FieldsTab $tab) { |
|
| 51 | 51 | }, $tabs); |
| 52 | 52 | } |
| 53 | 53 | |