@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function __get($field) |
| 80 | 80 | { |
| 81 | - if ( $field === 'metadata' |
|
| 81 | + if ($field === 'metadata' |
|
| 82 | 82 | && $this->metadata === null |
| 83 | 83 | && $this instanceof metadata_interface) { |
| 84 | 84 | $this->metadata = new metadata($this); |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | protected function load_parent(array $candidates) : ?dbobject |
| 99 | 99 | { |
| 100 | 100 | foreach ($candidates as $candidate) { |
| 101 | - if ( is_string($this->$candidate) |
|
| 101 | + if (is_string($this->$candidate) |
|
| 102 | 102 | && mgd_is_guid($this->$candidate)) { |
| 103 | 103 | return \midgard_object_class::get_object_by_guid($this->$candidate); |
| 104 | 104 | } |
| 105 | 105 | if ($this->$candidate !== null) { |
| 106 | 106 | //Proxies become stale if the object itself is detached, so we have to re-fetch |
| 107 | - if ( $this->$candidate instanceof Proxy |
|
| 107 | + if ($this->$candidate instanceof Proxy |
|
| 108 | 108 | && $this->$candidate->__isInitialized()) { |
| 109 | 109 | try { |
| 110 | 110 | $this->$candidate->get_by_id($this->$candidate->id); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | exception::duplicate(); |
| 174 | 174 | return false; |
| 175 | 175 | } |
| 176 | - if ( !$this->is_unique() |
|
| 176 | + if (!$this->is_unique() |
|
| 177 | 177 | || !$this->check_parent()) { |
| 178 | 178 | return false; |
| 179 | 179 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | exception::invalid_property_value(); |
| 225 | 225 | return false; |
| 226 | 226 | } |
| 227 | - if ( $check_dependencies |
|
| 227 | + if ($check_dependencies |
|
| 228 | 228 | && $this->has_dependents()) { |
| 229 | 229 | exception::has_dependants(); |
| 230 | 230 | return false; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | private function check_parent() : bool |
| 308 | 308 | { |
| 309 | - if ( empty($this->cm->midgard['parentfield']) |
|
| 309 | + if (empty($this->cm->midgard['parentfield']) |
|
| 310 | 310 | || empty($this->cm->midgard['parent'])) { |
| 311 | 311 | return true; |
| 312 | 312 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | private function check_fields() : bool |
| 322 | 322 | { |
| 323 | 323 | foreach ($this->cm->fieldMappings as $name => $field) { |
| 324 | - if ( $field['midgard:midgard_type'] == translator::TYPE_GUID |
|
| 324 | + if ($field['midgard:midgard_type'] == translator::TYPE_GUID |
|
| 325 | 325 | && !empty($this->$name) |
| 326 | 326 | && !mgd_is_guid($this->$name)) { |
| 327 | 327 | exception::invalid_property_value("'" . $name . "' property's value is not a guid."); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | private function check_upfield() : bool |
| 335 | 335 | { |
| 336 | 336 | $identifier = $this->cm->getIdentifierValues($this); |
| 337 | - if ( $identifier |
|
| 337 | + if ($identifier |
|
| 338 | 338 | && !empty($this->cm->midgard['upfield']) |
| 339 | 339 | && $this->__get($this->cm->midgard['upfield']) === reset($identifier) |
| 340 | 340 | && $this->cm->getAssociationMapping($this->cm->midgard['upfield'])['targetEntity'] === $this->cm->getName()) { |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $stat = $results > 0; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - if ( !$stat |
|
| 375 | + if (!$stat |
|
| 376 | 376 | && !empty($this->cm->midgard['childtypes'])) { |
| 377 | 377 | foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) { |
| 378 | 378 | $identifier = $this->cm->getIdentifierValues($this); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | exception::not_exists(); |
| 688 | 688 | return false; |
| 689 | 689 | } |
| 690 | - if ( $check_dependencies |
|
| 690 | + if ($check_dependencies |
|
| 691 | 691 | && $this->has_dependents()) { |
| 692 | 692 | exception::has_dependants(); |
| 693 | 693 | return false; |