@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | function removeClass($className) |
| 21 | 21 | { |
| 22 | - if ( ! $this->hasClass($className)) { |
|
| 22 | + if (!$this->hasClass($className)) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | $classes = preg_replace('/\b' . $className . '\b/i', '', $this->get('class')); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | return; |
| 15 | 15 | } |
| 16 | - if ( ! is_string($nameOrArray)) { |
|
| 16 | + if (!is_string($nameOrArray)) { |
|
| 17 | 17 | throw new \InvalidArgumentException('Only strings or arrays are accepted as first argument of the set() method of the DataContainer class'); |
| 18 | 18 | } |
| 19 | 19 | if ($value !== null) { |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | return $this; |
| 32 | 32 | } |
| 33 | - if ( ! is_string($classOrClosure)) { |
|
| 33 | + if (!is_string($classOrClosure)) { |
|
| 34 | 34 | throw new \RuntimeException('Input type must be a class or a closure'); |
| 35 | 35 | } |
| 36 | - if ( ! class_exists($classOrClosure)) { |
|
| 36 | + if (!class_exists($classOrClosure)) { |
|
| 37 | 37 | throw new \RuntimeException(sprintf('Class %s does not exist', $classOrClosure)); |
| 38 | 38 | } |
| 39 | - if ( ! is_subclass_of($classOrClosure, '\Sirius\Input\Element')) { |
|
| 39 | + if (!is_subclass_of($classOrClosure, '\Sirius\Input\Element')) { |
|
| 40 | 40 | throw new \RuntimeException( |
| 41 | 41 | sprintf('Class %s must extend the \Sirius\Input\Element class', $classOrClosure) |
| 42 | 42 | ); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $element = new $class($name, $options); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( ! $element instanceof Element) { |
|
| 73 | + if (!$element instanceof Element) { |
|
| 74 | 74 | throw new \RuntimeException('Cannot create a valid element based on the data provided'); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -43,8 +43,8 @@ |
||
| 43 | 43 | ); |
| 44 | 44 | if (is_array($this->getUploadRules())) { |
| 45 | 45 | foreach ($this->getUploadRules() as $rule) { |
| 46 | - if ( ! is_array($rule)) { |
|
| 47 | - $rule = array( $rule ); |
|
| 46 | + if (!is_array($rule)) { |
|
| 47 | + $rule = array($rule); |
|
| 48 | 48 | } |
| 49 | 49 | $name = $rule[0]; |
| 50 | 50 | $options = isset($rule[1]) ? $rule[1] : null; |
@@ -27,10 +27,10 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | function filterValue($value, $valueIdentifier = null) |
| 29 | 29 | { |
| 30 | - if ( ! $value) { |
|
| 30 | + if (!$value) { |
|
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | - if ( ! is_array($value)) { |
|
| 33 | + if (!is_array($value)) { |
|
| 34 | 34 | $value = (array) $value; |
| 35 | 35 | } |
| 36 | 36 | $allowedValues = array_keys($this->getOptions()); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->getName(), |
| 72 | 72 | 'callback', |
| 73 | 73 | array( |
| 74 | - Callback::OPTION_CALLBACK => array( $this, 'filterValue' ) |
|
| 74 | + Callback::OPTION_CALLBACK => array($this, 'filterValue') |
|
| 75 | 75 | ) |
| 76 | 76 | ); |
| 77 | 77 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function filterValue($value, $valueIdentifier = null) |
| 88 | 88 | { |
| 89 | - if ( ! $value) { |
|
| 89 | + if (!$value) { |
|
| 90 | 90 | return null; |
| 91 | 91 | } |
| 92 | 92 | $allowedValues = array_keys($this->getOptions()); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | protected function ensureAttributes() |
| 11 | 11 | { |
| 12 | - if ( ! isset($this[Specs::ATTRIBUTES])) { |
|
| 12 | + if (!isset($this[Specs::ATTRIBUTES])) { |
|
| 13 | 13 | $this[Specs::ATTRIBUTES] = new AttributesContainer(); |
| 14 | 14 | } |
| 15 | 15 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | throw new \RuntimeException(sprintf('Variable $nameorElement must be a string or an instance of the Element class')); |
| 62 | 62 | } |
| 63 | 63 | // add the index for sorting |
| 64 | - if ( ! isset($element['__index'])) { |
|
| 65 | - $element['__index'] = ($this->elementsIndex --); |
|
| 64 | + if (!isset($element['__index'])) { |
|
| 65 | + $element['__index'] = ($this->elementsIndex--); |
|
| 66 | 66 | } |
| 67 | 67 | $this->elements[$name] = $element; |
| 68 | 68 | |
@@ -135,20 +135,20 @@ discard block |
||
| 135 | 135 | protected function childComparator($childA, $childB) |
| 136 | 136 | { |
| 137 | 137 | if ($childA->getPosition() < $childB->getPosition()) { |
| 138 | - return - 1; |
|
| 138 | + return -1; |
|
| 139 | 139 | } |
| 140 | 140 | if ($childA->getPosition() > $childB->getPosition()) { |
| 141 | 141 | return 1; |
| 142 | 142 | } |
| 143 | 143 | if ($childA->get('__index') > $childB->get('__index')) { |
| 144 | - return - 1; |
|
| 144 | + return -1; |
|
| 145 | 145 | } |
| 146 | 146 | if ($childA->get('__index') < $childB->get('__index')) { |
| 147 | 147 | return 1; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // if the priority is the same, childB is first |
| 151 | - return - 1; |
|
| 151 | + return -1; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | function getElements() |
| 160 | 160 | { |
| 161 | 161 | // first sort the children so they are retrieved by priority |
| 162 | - uasort($this->elements, array( $this, 'childComparator' )); |
|
| 162 | + uasort($this->elements, array($this, 'childComparator')); |
|
| 163 | 163 | |
| 164 | 164 | return $this->elements; |
| 165 | 165 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | { |
| 173 | 173 | foreach ($this->elements as $element) { |
| 174 | 174 | $group = $element->getGroup(); |
| 175 | - if ($group && ! isset($this->elements[$group])) { |
|
| 175 | + if ($group && !isset($this->elements[$group])) { |
|
| 176 | 176 | $element->setGroup(null); |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | protected function ensureData() |
| 11 | 11 | { |
| 12 | - if ( ! isset($this[Specs::DATA])) { |
|
| 12 | + if (!isset($this[Specs::DATA])) { |
|
| 13 | 13 | $this[Specs::DATA] = new DataContainer(); |
| 14 | 14 | } |
| 15 | 15 | } |