@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | error_reporting(E_ALL); |
3 | 3 | $autoloader = __DIR__ . '/vendor/autoload.php'; |
4 | -if (! file_exists($autoloader)) { |
|
4 | +if (!file_exists($autoloader)) { |
|
5 | 5 | echo "Composer autoloader not found: $autoloader" . PHP_EOL; |
6 | 6 | echo "Please issue 'composer install' and try again." . PHP_EOL; |
7 | 7 | exit(1); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function prepRelationship(&$info, Manager $manager) |
103 | 103 | { |
104 | - if (! $info['relationship']) { |
|
104 | + if (!$info['relationship']) { |
|
105 | 105 | throw new Exception("No 'relationship' specified for relation '{$info['name']}' on type '{$info['type']}'."); |
106 | 106 | } |
107 | 107 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function prepNative(&$info, Manager $manager) |
121 | 121 | { |
122 | - if (! $info['native_field']) { |
|
122 | + if (!$info['native_field']) { |
|
123 | 123 | throw new Exception("No 'native_field' specified for relation '{$info['name']}' on type '{$info['type']}'."); |
124 | 124 | } |
125 | 125 | } |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected function prepForeign(&$info, Manager $manager) |
139 | 139 | { |
140 | - if (! $info['foreign_type']) { |
|
140 | + if (!$info['foreign_type']) { |
|
141 | 141 | throw new Exception("No 'foreign_type' specified for relation '{$info['name']}' on type '{$info['type']}'."); |
142 | 142 | } |
143 | 143 | |
144 | - if (! $info['foreign_field']) { |
|
144 | + if (!$info['foreign_field']) { |
|
145 | 145 | throw new Exception("No 'foreign_field' specified for relation '{$info['name']}' on type '{$info['type']}'."); |
146 | 146 | } |
147 | 147 | |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - if (! $info['through_type']) { |
|
169 | + if (!$info['through_type']) { |
|
170 | 170 | throw new Exception("No 'through_type' specified for relation '{$info['name']}' on type '{$info['type']}'."); |
171 | 171 | } |
172 | 172 | |
173 | - if (! $info['through_native_field']) { |
|
173 | + if (!$info['through_native_field']) { |
|
174 | 174 | throw new Exception("No 'through_native_field' specified for relation '{$info['name']}' on type '{$info['type']}'."); |
175 | 175 | } |
176 | 176 | |
177 | - if (! $info['through_foreign_field']) { |
|
177 | + if (!$info['through_foreign_field']) { |
|
178 | 178 | throw new Exception("No 'through_foreign_field' specified for relation '{$info['name']}' on type '{$info['type']}'."); |
179 | 179 | } |
180 | 180 |
@@ -67,19 +67,19 @@ |
||
67 | 67 | |
68 | 68 | $info = array_merge($base, $info); |
69 | 69 | |
70 | - if (! $info['identity_field']) { |
|
70 | + if (!$info['identity_field']) { |
|
71 | 71 | throw new Exception('No identity field specified.'); |
72 | 72 | } |
73 | 73 | |
74 | - if (! $info['entity_builder']) { |
|
74 | + if (!$info['entity_builder']) { |
|
75 | 75 | $info['entity_builder'] = new EntityBuilder; |
76 | 76 | } |
77 | 77 | |
78 | - if (! $info['collection_builder']) { |
|
78 | + if (!$info['collection_builder']) { |
|
79 | 79 | $info['collection_builder'] = new CollectionBuilder; |
80 | 80 | } |
81 | 81 | |
82 | - if (! $info['lazy_builder']) { |
|
82 | + if (!$info['lazy_builder']) { |
|
83 | 83 | $info['lazy_builder'] = new LazyBuilder; |
84 | 84 | } |
85 | 85 |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $return_values = []; |
325 | 325 | |
326 | 326 | // what should the return field be? |
327 | - if (! $return_field) { |
|
327 | + if (!$return_field) { |
|
328 | 328 | $return_field = $identity_field; |
329 | 329 | } |
330 | 330 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $index_fields |
399 | 399 | ); |
400 | 400 | $entity = $this->offsetGet($offset); |
401 | - $entities[] =& $entity; |
|
401 | + $entities[] = & $entity; |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | // return a collection of the loaded entities |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | public function getEntity($identity_value) |
504 | 504 | { |
505 | 505 | // if the entity is not in the identity index, exit early |
506 | - if (! isset($this->index_identity[$identity_value])) { |
|
506 | + if (!isset($this->index_identity[$identity_value])) { |
|
507 | 507 | return null; |
508 | 508 | } |
509 | 509 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | */ |
566 | 566 | protected function getEntityByIndex($field, $value) |
567 | 567 | { |
568 | - if (! isset($this->index_fields[$field][$value])) { |
|
568 | + if (!isset($this->index_fields[$field][$value])) { |
|
569 | 569 | return null; |
570 | 570 | } |
571 | 571 | $offset = $this->index_fields[$field][$value][0]; |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | $offset = $this->index_identity[$identity_value]; |
592 | 592 | // assigning by reference keeps the connections |
593 | 593 | // when the element is converted to a entity |
594 | - $list[] =& $this->data[$offset]; |
|
594 | + $list[] = & $this->data[$offset]; |
|
595 | 595 | } |
596 | 596 | return $this->collection_builder->newInstance($list); |
597 | 597 | } |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | if (in_array($entity->$field, $values)) { |
643 | 643 | // assigning by reference keeps the connections |
644 | 644 | // when the original is converted to a entity |
645 | - $list[] =& $this->data[$identity_value]; |
|
645 | + $list[] = & $this->data[$identity_value]; |
|
646 | 646 | } |
647 | 647 | } |
648 | 648 | return $this->collection_builder->newInstance($list); |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | // assigning by reference keeps the connections |
679 | 679 | // when the original is converted to a entity. |
680 | 680 | foreach ($this->index_fields[$field][$value] as $offset) { |
681 | - $list[] =& $this->data[$offset]; |
|
681 | + $list[] = & $this->data[$offset]; |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | } |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | public function removeEntity($identity_value) |
769 | 769 | { |
770 | 770 | // if the entity is not in the identity index, exit early |
771 | - if (! isset($this->index_identity[$identity_value])) { |
|
771 | + if (!isset($this->index_identity[$identity_value])) { |
|
772 | 772 | return false; |
773 | 773 | } |
774 | 774 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | } |
927 | 927 | |
928 | 928 | // if one or the other is not numeric, compare strictly |
929 | - if (! $numeric && $old !== $new) { |
|
929 | + if (!$numeric && $old !== $new) { |
|
930 | 930 | // strictly different, retain the new value |
931 | 931 | $changed[$field] = $new; |
932 | 932 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function setRelation($type, $name, $info) |
189 | 189 | { |
190 | - if (! isset($this->types[$type])) { |
|
190 | + if (!isset($this->types[$type])) { |
|
191 | 191 | throw new Exception("Type '$type' is not in the manager."); |
192 | 192 | } |
193 | 193 | |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function __get($name) |
219 | 219 | { |
220 | - if (! isset($this->types[$name])) { |
|
220 | + if (!isset($this->types[$name])) { |
|
221 | 221 | throw new Exception("Type '$name' not in the manager."); |
222 | 222 | } |
223 | 223 | |
224 | - if (! $this->types[$name] instanceof GenericType) { |
|
224 | + if (!$this->types[$name] instanceof GenericType) { |
|
225 | 225 | $this->buildType($name); |
226 | 226 | } |
227 | 227 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | public function toArray(): array |
10 | 10 | { |
11 | 11 | return array_map( |
12 | - function ($entity) |
|
12 | + function($entity) |
|
13 | 13 | { |
14 | 14 | if ($entity instanceof GenericLazy) { |
15 | 15 | $entity = $entity->get($this); |