@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function handle(Fields $fields, array $payload) |
| 21 | 21 | { |
| 22 | - foreach($fields as $field) { |
|
| 22 | + foreach ($fields as $field) { |
|
| 23 | 23 | if ($field->hasValidation()) { |
| 24 | 24 | $this->createValidator($field, $payload)->validate(); |
| 25 | 25 | } |
@@ -41,16 +41,16 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | private function ruleMatrix(array $keys, array $values): array |
| 43 | 43 | { |
| 44 | - if(is_string(key($values))) { |
|
| 44 | + if (is_string(key($values))) { |
|
| 45 | 45 | return $values; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - return array_fill_keys($keys , $values); |
|
| 48 | + return array_fill_keys($keys, $values); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | private function matrix(array $keys, array $values): array |
| 52 | 52 | { |
| 53 | - if(empty($values)) return []; |
|
| 53 | + if (empty($values)) return []; |
|
| 54 | 54 | |
| 55 | 55 | return array_fill_keys($keys, reset($values)); |
| 56 | 56 | } |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | |
| 51 | 51 | private function matrix(array $keys, array $values): array |
| 52 | 52 | { |
| 53 | - if(empty($values)) return []; |
|
| 53 | + if(empty($values)) { |
|
| 54 | + return []; |
|
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | return array_fill_keys($keys, reset($values)); |
| 56 | 58 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (isset($customRules[$rule])) { |
| 52 | - $rules[$k] = $customRules[$rule] . ($params ? ':' . $params : ''); |
|
| 52 | + $rules[$k] = $customRules[$rule].($params ? ':'.$params : ''); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | private static function normalizeToArray($values): array |
| 63 | 63 | { |
| 64 | - if(is_string($values)){ |
|
| 64 | + if (is_string($values)) { |
|
| 65 | 65 | $values = explode('|', $values); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -14,10 +14,10 @@ |
||
| 14 | 14 | { |
| 15 | 15 | $payload = $this->emptyPayload(); |
| 16 | 16 | |
| 17 | - if(!$value || !is_array($value)) return $payload; |
|
| 17 | + if (!$value || !is_array($value)) return $payload; |
|
| 18 | 18 | |
| 19 | - foreach([MediaRequest::NEW, MediaRequest::REPLACE, MediaRequest::DETACH] as $action) { |
|
| 20 | - if(isset($value[$action])){ |
|
| 19 | + foreach ([MediaRequest::NEW, MediaRequest::REPLACE, MediaRequest::DETACH] as $action) { |
|
| 20 | + if (isset($value[$action])) { |
|
| 21 | 21 | $payload[$action] = $value[$action]; |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -14,7 +14,9 @@ |
||
| 14 | 14 | { |
| 15 | 15 | $payload = $this->emptyPayload(); |
| 16 | 16 | |
| 17 | - if(!$value || !is_array($value)) return $payload; |
|
| 17 | + if(!$value || !is_array($value)) { |
|
| 18 | + return $payload; |
|
| 19 | + } |
|
| 18 | 20 | |
| 19 | 21 | foreach([MediaRequest::NEW, MediaRequest::REPLACE, MediaRequest::DETACH] as $action) { |
| 20 | 22 | if(isset($value[$action])){ |
@@ -10,19 +10,19 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | $value = $this->normalizePayload($value); |
| 12 | 12 | |
| 13 | - foreach([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | - foreach($value[$type] as $file) { |
|
| 15 | - if($file && false !== $this->validateMimetypes($attribute, $file, $params)) { |
|
| 13 | + foreach ([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | + foreach ($value[$type] as $file) { |
|
| 15 | + if ($file && false !== $this->validateMimetypes($attribute, $file, $params)) { |
|
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $validator->setCustomMessages([ |
| 22 | - 'filefield_mimetypes' => 'De :attribute is niet het juiste bestandstype. Volgende types zijn geldig: ' . implode(', ', $params), |
|
| 22 | + 'filefield_mimetypes' => 'De :attribute is niet het juiste bestandstype. Volgende types zijn geldig: '.implode(', ', $params), |
|
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | - if(!isset($validator->customAttributes[$attribute])) { |
|
| 25 | + if (!isset($validator->customAttributes[$attribute])) { |
|
| 26 | 26 | $validator->addCustomAttributes([ |
| 27 | 27 | $attribute => 'afbeelding', |
| 28 | 28 | ]); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function validateMimetypes($attribute, $value, $parameters) |
| 36 | 36 | { |
| 37 | - if($this->refersToExistingAsset($value)) { |
|
| 37 | + if ($this->refersToExistingAsset($value)) { |
|
| 38 | 38 | return $this->validateAssetMimetypes($this->existingAsset($value), $parameters); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -10,19 +10,19 @@ |
||
| 10 | 10 | { |
| 11 | 11 | $value = $this->normalizePayload($value); |
| 12 | 12 | |
| 13 | - foreach([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | - foreach($value[$type] as $file) { |
|
| 15 | - if($file && false !== $this->validateMax($attribute, $file, $params)) { |
|
| 13 | + foreach ([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | + foreach ($value[$type] as $file) { |
|
| 15 | + if ($file && false !== $this->validateMax($attribute, $file, $params)) { |
|
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $validator->setCustomMessages([ |
| 22 | - 'imagefield_max' => 'De :attribute is te groot en dient kleiner te zijn dan ' . implode(',',$params) .'Kb.', |
|
| 22 | + 'imagefield_max' => 'De :attribute is te groot en dient kleiner te zijn dan '.implode(',', $params).'Kb.', |
|
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | - if(!isset($validator->customAttributes[$attribute])) { |
|
| 25 | + if (!isset($validator->customAttributes[$attribute])) { |
|
| 26 | 26 | $validator->addCustomAttributes([ |
| 27 | 27 | $attribute => 'afbeelding', |
| 28 | 28 | ]); |
@@ -10,19 +10,19 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | $value = $this->normalizePayload($value); |
| 12 | 12 | |
| 13 | - foreach([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | - foreach($value[$type] as $file) { |
|
| 15 | - if($file && false !== $this->validateDimensions($attribute, $file, $params)) { |
|
| 13 | + foreach ([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | + foreach ($value[$type] as $file) { |
|
| 15 | + if ($file && false !== $this->validateDimensions($attribute, $file, $params)) { |
|
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $validator->setCustomMessages([ |
| 22 | - 'filefield_dimensions' => 'De :attribute heeft niet de juiste afmetingen: ' . implode(', ', $params), |
|
| 22 | + 'filefield_dimensions' => 'De :attribute heeft niet de juiste afmetingen: '.implode(', ', $params), |
|
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | - if(!isset($validator->customAttributes[$attribute])) { |
|
| 25 | + if (!isset($validator->customAttributes[$attribute])) { |
|
| 26 | 26 | $validator->addCustomAttributes([ |
| 27 | 27 | $attribute => 'afbeelding', |
| 28 | 28 | ]); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function validateDimensions($attribute, $value, $parameters) |
| 36 | 36 | { |
| 37 | - if($this->refersToExistingAsset($value)) { |
|
| 37 | + if ($this->refersToExistingAsset($value)) { |
|
| 38 | 38 | return $this->validateAssetDimensions($this->existingAsset($value), $parameters); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $validator->setCustomMessages([ |
| 22 | - 'imagefield_dimensions' => 'De :attribute heeft niet de juiste afmetingen: ' . implode(',', $this->humanReadableParams($params)), |
|
| 22 | + 'imagefield_dimensions' => 'De :attribute heeft niet de juiste afmetingen: '.implode(',', $this->humanReadableParams($params)), |
|
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | 25 | if (!isset($validator->customAttributes[$attribute])) { |
@@ -10,19 +10,19 @@ |
||
| 10 | 10 | { |
| 11 | 11 | $value = $this->normalizePayload($value); |
| 12 | 12 | |
| 13 | - foreach([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | - foreach($value[$type] as $file) { |
|
| 15 | - if($file && false !== $this->validateMin($attribute, $file, $params)) { |
|
| 13 | + foreach ([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | + foreach ($value[$type] as $file) { |
|
| 15 | + if ($file && false !== $this->validateMin($attribute, $file, $params)) { |
|
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $validator->setCustomMessages([ |
| 22 | - 'imagefield_min' => 'De :attribute is te klein en dient groter te zijn dan ' . implode(',',$params) .'Kb.', |
|
| 22 | + 'imagefield_min' => 'De :attribute is te klein en dient groter te zijn dan '.implode(',', $params).'Kb.', |
|
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | - if(!isset($validator->customAttributes[$attribute])) { |
|
| 25 | + if (!isset($validator->customAttributes[$attribute])) { |
|
| 26 | 26 | $validator->addCustomAttributes([ |
| 27 | 27 | $attribute => 'afbeelding', |
| 28 | 28 | ]); |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | $value = $this->normalizePayload($value); |
| 12 | 12 | |
| 13 | - foreach([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | - if(is_array($value[$type]) && !empty($value[$type])) { |
|
| 13 | + foreach ([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
|
| 14 | + if (is_array($value[$type]) && !empty($value[$type])) { |
|
| 15 | 15 | return true; |
| 16 | 16 | } |
| 17 | 17 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'imagefield_required' => 'De :attribute is verplicht.', |
| 21 | 21 | ]); |
| 22 | 22 | |
| 23 | - if(!isset($validator->customAttributes[$attribute])) { |
|
| 23 | + if (!isset($validator->customAttributes[$attribute])) { |
|
| 24 | 24 | $validator->addCustomAttributes([ |
| 25 | 25 | $attribute => 'afbeelding', |
| 26 | 26 | ]); |