@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $parsed = $this->parse_constraint_name($property); |
71 | 71 | |
72 | 72 | // for properties like up.name |
73 | - if ( strpos($property, ".") !== false |
|
73 | + if (strpos($property, ".") !== false |
|
74 | 74 | && !(strpos($property, "metadata") === 0)) |
75 | 75 | { |
76 | 76 | return $parsed['name'] . " as " . str_replace(".", "_", $property); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function get($key) |
156 | 156 | { |
157 | - if ( !$this->_has_results() |
|
157 | + if (!$this->_has_results() |
|
158 | 158 | || !isset($this->_results[$key])) |
159 | 159 | { |
160 | 160 | return false; |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | throw exception::object_purged(); |
39 | 39 | } |
40 | - if ( !$include_deleted |
|
40 | + if (!$include_deleted |
|
41 | 41 | && $result["object_action"] == subscriber::ACTION_DELETE) |
42 | 42 | { |
43 | 43 | throw exception::object_deleted(); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | use midgard\portable\mgdschema\translator; |
10 | 10 | use midgard\portable\api\error\exception; |
11 | 11 | |
12 | -if ( extension_loaded('midgard') |
|
12 | +if (extension_loaded('midgard') |
|
13 | 13 | || extension_loaded('midgard2')) |
14 | 14 | { |
15 | 15 | //TODO: Print some error? |
@@ -80,7 +80,7 @@ |
||
80 | 80 | $fqcn = $this->namespace . '\\' . $fqcn; |
81 | 81 | } |
82 | 82 | |
83 | - if ( array_key_exists($fqcn, $this->types) |
|
83 | + if (array_key_exists($fqcn, $this->types) |
|
84 | 84 | || $property->link['target'] === $property->get_parent()->name) |
85 | 85 | { |
86 | 86 | $target_class = $property->link['target']; |
@@ -76,7 +76,7 @@ |
||
76 | 76 | if ($property->parentfield) |
77 | 77 | { |
78 | 78 | $this->parentfield = $property->name; |
79 | - if ( empty($this->parent) |
|
79 | + if (empty($this->parent) |
|
80 | 80 | && $property->link) |
81 | 81 | { |
82 | 82 | $this->parent = $property->link['target']; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $mgd_config = midgard_connection::get_instance()->config; |
62 | 62 | $mgdobjects_file = $mgd_config->vardir . '/midgard_objects.php'; |
63 | - if ( file_exists($mgdobjects_file) |
|
63 | + if (file_exists($mgdobjects_file) |
|
64 | 64 | && !unlink($mgdobjects_file)) |
65 | 65 | { |
66 | 66 | throw new \RuntimeException('Could not unlink ' . $mgdobjects_file); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $cms = $em->getMetadataFactory()->getAllMetadata(); |
81 | 81 | |
82 | 82 | // create storage |
83 | - if ( !midgard_storage::create_base_storage() |
|
83 | + if (!midgard_storage::create_base_storage() |
|
84 | 84 | && midgard_connection::get_instance()->get_error_string() != 'MGD_ERR_OK') |
85 | 85 | { |
86 | 86 | throw new \Exception("Failed to create base database structures" . midgard_connection::get_instance()->get_error_string()); |
@@ -201,19 +201,19 @@ |
||
201 | 201 | break; |
202 | 202 | } |
203 | 203 | |
204 | - if ( $dbobject->id > 0 |
|
204 | + if ($dbobject->id > 0 |
|
205 | 205 | && $dbobject->metadata->revised >= $object->metadata->revised) { |
206 | 206 | midgard_connection::get_instance()->set_error(exception::OBJECT_IMPORTED); |
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | |
210 | - if ( $dbobject->metadata->deleted |
|
210 | + if ($dbobject->metadata->deleted |
|
211 | 211 | && !$object->metadata->deleted) { |
212 | 212 | if (!midgard_object_class::undelete($dbobject->guid)) { |
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | $dbobject->metadata_deleted = false; |
216 | - } elseif ( !$dbobject->metadata->deleted |
|
216 | + } elseif (!$dbobject->metadata->deleted |
|
217 | 217 | && $object->metadata->deleted) { |
218 | 218 | return $dbobject->delete(); |
219 | 219 | } |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | $types = $this->manager->get_types(); |
66 | - uasort($types, function ($a, $b) { |
|
67 | - if ( !empty($a->extends) |
|
66 | + uasort($types, function($a, $b) { |
|
67 | + if (!empty($a->extends) |
|
68 | 68 | && !empty($b->extends)) { |
69 | 69 | return strnatcmp($a->extends, $b->extends); |
70 | 70 | } elseif (!empty($a->extends)) { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $prefix = $this->get_class_prefix($namespace); |
106 | 106 | |
107 | 107 | foreach ($this->manager->get_types() as $type) { |
108 | - if ( $prefix !== '' |
|
108 | + if ($prefix !== '' |
|
109 | 109 | && !class_exists($type->name)) { |
110 | 110 | $this->add_line('class_alias( "' . $prefix . $type->name . '", "' . $type->name . '");'); |
111 | 111 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | foreach ($this->manager->get_inherited_mapping() as $child => $parent) { |
115 | 115 | $this->add_line('class_alias( "' . $prefix . $parent . '", "' . $prefix . $child . '");'); |
116 | - if ( $prefix !== '' |
|
116 | + if ($prefix !== '' |
|
117 | 117 | && !class_exists($child)) { |
118 | 118 | $this->add_line('class_alias( "' . $prefix . $parent . '", "' . $child . '");'); |
119 | 119 | } |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | $objects[$name] = 'new midgard_datetime("0001-01-01 00:00:00")'; |
178 | 178 | break; |
179 | 179 | } |
180 | - if ( $default !== null |
|
180 | + if ($default !== null |
|
181 | 181 | // we need to skip working links because in this case, Doctrine expects objects as values |
182 | - && ( !$property->link |
|
182 | + && (!$property->link |
|
183 | 183 | || $this->manager->resolve_targetclass($property) === false)) { |
184 | 184 | $line .= ' = ' . $default; |
185 | 185 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | $this->add_line('class ' . $type->name . ' extends ' . $type->extends); |
225 | 225 | $mixins = $type->get_mixins(); |
226 | - $interfaces = array_filter(array_map(function ($name) { |
|
226 | + $interfaces = array_filter(array_map(function($name) { |
|
227 | 227 | if (interface_exists('\\midgard\\portable\\storage\\' . $name . '\\entity')) { |
228 | 228 | return '\\midgard\\portable\\storage\\' . $name . '\\entity'; |
229 | 229 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | private function load_by_properties(array $properties) |
63 | 63 | { |
64 | - if ( !array_key_exists('authtype', $properties) |
|
64 | + if (!array_key_exists('authtype', $properties) |
|
65 | 65 | || !array_key_exists('login', $properties)) { |
66 | 66 | throw exception::invalid_property_value(); |
67 | 67 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | public function &get_person() |
111 | 111 | { |
112 | - if ( $this->person_object === null |
|
112 | + if ($this->person_object === null |
|
113 | 113 | && $this->person !== null) { |
114 | 114 | $this->person_object = connection::get_em()->getRepository('midgard:midgard_person')->findOneBy(array('guid' => $this->person)); |
115 | 115 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function create() |
120 | 120 | { |
121 | - if ( empty($this->authtype) |
|
121 | + if (empty($this->authtype) |
|
122 | 122 | || !empty($this->id)) { |
123 | 123 | exception::invalid_property_value(); |
124 | 124 | return false; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | protected function is_unique() |
184 | 184 | { |
185 | - if ( empty($this->login) |
|
185 | + if (empty($this->login) |
|
186 | 186 | || empty($this->authtype)) { |
187 | 187 | return true; |
188 | 188 | } |