@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param array $components |
21 | 21 | */ |
22 | - public function __construct( array $components = array() ) |
|
22 | + public function __construct(array $components = array()) |
|
23 | 23 | { |
24 | 24 | $this->add_components($components); |
25 | 25 | } |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | * @param string $name |
31 | 31 | * @return AbstractComponent |
32 | 32 | */ |
33 | - public function get_by_name( $name ) |
|
33 | + public function get_by_name($name) |
|
34 | 34 | { |
35 | 35 | $filtered = $this->filter(function($c) use ($name) { |
36 | 36 | return $c instanceof ValueComponentInterface && $c->name === $name; |
37 | 37 | }); |
38 | - if(count($filtered) < 1) |
|
38 | + if (count($filtered) < 1) |
|
39 | 39 | { |
40 | 40 | throw new \RuntimeException("No component with the name <b>$name</b> could be found."); |
41 | 41 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param string $type |
49 | 49 | * @return AbstractComponent[] |
50 | 50 | */ |
51 | - public function get_by_type( $type ) |
|
51 | + public function get_by_type($type) |
|
52 | 52 | { |
53 | 53 | return $this->filter(function($c) use ($type) { |
54 | 54 | return $c->component_type === $type; |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | * @param AbstractComponent[] $components |
108 | 108 | * @return void |
109 | 109 | */ |
110 | - public function add_components( array $components ) |
|
110 | + public function add_components(array $components) |
|
111 | 111 | { |
112 | - foreach( $components as $component ) |
|
112 | + foreach ($components as $component) |
|
113 | 113 | { |
114 | 114 | $this->add_component($component); |
115 | 115 | } |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | * @param AbstractComponent[] $args |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - public function add_component( array $args ) |
|
124 | + public function add_component(array $args) |
|
125 | 125 | { |
126 | - if(!array_key_exists('type', $args)) |
|
126 | + if (!array_key_exists('type', $args)) |
|
127 | 127 | { |
128 | 128 | throw new \RuntimeException("Component configuration arrays must have a <b>type</b> argument"); |
129 | 129 | } |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | * @param AbstractComponent $comp |
141 | 141 | * @return void |
142 | 142 | */ |
143 | - private function verify_name_uniqueness( AbstractComponent $comp ) |
|
143 | + private function verify_name_uniqueness(AbstractComponent $comp) |
|
144 | 144 | { |
145 | - if(!($comp instanceof ValueComponentInterface)) |
|
145 | + if (!($comp instanceof ValueComponentInterface)) |
|
146 | 146 | { |
147 | 147 | return; |
148 | 148 | } |
149 | 149 | |
150 | 150 | foreach ($this->components as $c) |
151 | 151 | { |
152 | - if($c->name === $comp->name) |
|
152 | + if ($c->name === $comp->name) |
|
153 | 153 | { |
154 | 154 | throw new \RuntimeException("Duplicate component name detected for the name <b>{$c->name}</b>."); |
155 | 155 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param function $callable |
163 | 163 | * @return array |
164 | 164 | */ |
165 | - private function filter( $callable ) |
|
165 | + private function filter($callable) |
|
166 | 166 | { |
167 | 167 | // array_values is needed in order to reindex the array after filtering it |
168 | 168 | return array_values(array_filter($this->components, $callable)); |