@@ -213,7 +213,7 @@ |
||
| 213 | 213 | $midgard = midgard_connection::get_instance(); |
| 214 | 214 | if ($midgard->config->logfilename) { |
| 215 | 215 | $logdir = dirname($midgard->config->logfilename); |
| 216 | - if ( !is_dir($logdir) |
|
| 216 | + if (!is_dir($logdir) |
|
| 217 | 217 | && !mkdir($logdir, 0777, true)) { |
| 218 | 218 | throw exception::user_data('Log directory could not be created'); |
| 219 | 219 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $mgd_config = midgard_connection::get_instance()->config; |
| 57 | 57 | $mgdschema_file = $mgd_config->vardir . '/mgdschema_classes.php'; |
| 58 | - if ( file_exists($mgdschema_file) |
|
| 58 | + if (file_exists($mgdschema_file) |
|
| 59 | 59 | && !unlink($mgdschema_file)) { |
| 60 | 60 | throw new \RuntimeException('Could not unlink ' . $mgdschema_file); |
| 61 | 61 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $cms = $em->getMetadataFactory()->getAllMetadata(); |
| 73 | 73 | |
| 74 | 74 | // create storage |
| 75 | - if ( !midgard_storage::create_base_storage() |
|
| 75 | + if (!midgard_storage::create_base_storage() |
|
| 76 | 76 | && midgard_connection::get_instance()->get_error_string() != 'MGD_ERR_OK') { |
| 77 | 77 | throw new \Exception("Failed to create base database structures" . midgard_connection::get_instance()->get_error_string()); |
| 78 | 78 | } |
@@ -174,7 +174,7 @@ |
||
| 174 | 174 | break; |
| 175 | 175 | } |
| 176 | 176 | if ( $default !== null |
| 177 | - // we need to skip working links because in this case, Doctrine expects objects as values |
|
| 177 | + // we need to skip working links because in this case, Doctrine expects objects as values |
|
| 178 | 178 | && ( !$property->link |
| 179 | 179 | || $this->manager->resolve_targetclass($property) === false)) { |
| 180 | 180 | $line .= ' = ' . $default; |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $types = $this->manager->get_types(); |
| 55 | - uasort($types, function (type $a, type $b) { |
|
| 56 | - if ( !empty($a->extends) |
|
| 55 | + uasort($types, function(type $a, type $b) { |
|
| 56 | + if (!empty($a->extends) |
|
| 57 | 57 | && !empty($b->extends)) { |
| 58 | 58 | return strnatcmp($a->extends, $b->extends); |
| 59 | 59 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $prefix = $this->get_class_prefix($namespace); |
| 97 | 97 | |
| 98 | 98 | foreach ($this->manager->get_types() as $type) { |
| 99 | - if ( $prefix !== '' |
|
| 99 | + if ($prefix !== '' |
|
| 100 | 100 | && !class_exists($type->name)) { |
| 101 | 101 | $this->add_line('class_alias( "' . $prefix . $type->name . '", "' . $type->name . '");'); |
| 102 | 102 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | foreach ($this->manager->get_inherited_mapping() as $child => $parent) { |
| 106 | 106 | $this->add_line('class_alias( "' . $prefix . $parent . '", "' . $prefix . $child . '");'); |
| 107 | - if ( $prefix !== '' |
|
| 107 | + if ($prefix !== '' |
|
| 108 | 108 | && !class_exists($child)) { |
| 109 | 109 | $this->add_line('class_alias( "' . $prefix . $parent . '", "' . $child . '");'); |
| 110 | 110 | } |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | $objects[$name] = 'new midgard_datetime("0001-01-01 00:00:00")'; |
| 166 | 166 | break; |
| 167 | 167 | } |
| 168 | - if ( $default !== null |
|
| 168 | + if ($default !== null |
|
| 169 | 169 | // we need to skip working links because in this case, Doctrine expects objects as values |
| 170 | - && ( !$property->link |
|
| 170 | + && (!$property->link |
|
| 171 | 171 | || $this->manager->resolve_targetclass($property) === false)) { |
| 172 | 172 | $line .= ' = ' . $default; |
| 173 | 173 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $this->write_annotations($type); |
| 236 | 236 | $this->add_line('class ' . $type->name . ' extends ' . $type->extends); |
| 237 | 237 | $mixins = $type->get_mixins(); |
| 238 | - $interfaces = array_filter(array_map(function (string $name) { |
|
| 238 | + $interfaces = array_filter(array_map(function(string $name) { |
|
| 239 | 239 | if (interface_exists('\\midgard\\portable\\storage\\interfaces\\' . $name)) { |
| 240 | 240 | return '\\midgard\\portable\\storage\\interfaces\\' . $name; |
| 241 | 241 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | } else { |
| 66 | 66 | if ($property->parentfield) { |
| 67 | 67 | $this->parentfield = $property->name; |
| 68 | - if ( empty($this->parent) |
|
| 68 | + if (empty($this->parent) |
|
| 69 | 69 | && $property->link) { |
| 70 | 70 | $this->parent = $property->link['target']; |
| 71 | 71 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | |
| 76 | 76 | $fqcn = $this->get_fcqn($property->link['target']); |
| 77 | 77 | |
| 78 | - if ( isset($this->types[$fqcn]) |
|
| 78 | + if (isset($this->types[$fqcn]) |
|
| 79 | 79 | || $property->link['target'] === $property->get_parent()->name) { |
| 80 | 80 | return $property->link['target']; |
| 81 | 81 | } |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | $subdirs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F']; |
| 124 | 124 | foreach ($subdirs as $dir) { |
| 125 | 125 | foreach ($subdirs as $subdir) { |
| 126 | - if ( !is_dir($this->blobdir . '/' . $dir . '/' . $subdir) |
|
| 126 | + if (!is_dir($this->blobdir . '/' . $dir . '/' . $subdir) |
|
| 127 | 127 | && !mkdir($this->blobdir . '/' . $dir . '/' . $subdir, 0777, true)) { |
| 128 | 128 | return false; |
| 129 | 129 | } |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | |
| 153 | 153 | foreach ($properties as $name => $property) { |
| 154 | 154 | // doctrine can handle id links only |
| 155 | - if ( $property->link |
|
| 155 | + if ($property->link |
|
| 156 | 156 | && $target_class = $this->manager->resolve_targetclass($property)) { |
| 157 | 157 | $link_mapping = [ |
| 158 | 158 | 'fieldName' => $property->name, |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | private function load_by_properties(array $properties) |
| 66 | 66 | { |
| 67 | - if ( !array_key_exists('authtype', $properties) |
|
| 67 | + if (!array_key_exists('authtype', $properties) |
|
| 68 | 68 | || !array_key_exists('login', $properties)) { |
| 69 | 69 | throw exception::invalid_property_value(); |
| 70 | 70 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | public function &get_person() : person |
| 109 | 109 | { |
| 110 | - if ( $this->person_object === null |
|
| 110 | + if ($this->person_object === null |
|
| 111 | 111 | && $this->person !== null) { |
| 112 | 112 | $this->person_object = connection::get_em()->getRepository(connection::get_fqcn('midgard_person'))->findOneBy(['guid' => $this->person]); |
| 113 | 113 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function create() : bool |
| 118 | 118 | { |
| 119 | - if ( empty($this->authtype) |
|
| 119 | + if (empty($this->authtype) |
|
| 120 | 120 | || !empty($this->id)) { |
| 121 | 121 | exception::invalid_property_value(); |
| 122 | 122 | return false; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | protected function is_unique() : bool |
| 182 | 182 | { |
| 183 | - if ( empty($this->login) |
|
| 183 | + if (empty($this->login) |
|
| 184 | 184 | || empty($this->authtype)) { |
| 185 | 185 | return true; |
| 186 | 186 | } |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | $cs = $em->getUnitOfWork()->getEntityChangeSet($entity); |
| 108 | 108 | // We only need to update repligard if we're coming from create (revision 0) |
| 109 | 109 | // or if we delete/undelete |
| 110 | - if ( !array_key_exists('metadata_deleted', $cs) |
|
| 111 | - && $entity->metadata_revision > 0) { |
|
| 110 | + if (!array_key_exists('metadata_deleted', $cs) |
|
| 111 | + && $entity->metadata_revision > 0) { |
|
| 112 | 112 | $check_repligard = false; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | foreach ($columns as $name => &$config) { |
| 179 | 179 | if ($platform instanceof SqlitePlatform) { |
| 180 | - if ( !empty($config['comment']) |
|
| 180 | + if (!empty($config['comment']) |
|
| 181 | 181 | && $config['comment'] == 'BINARY') { |
| 182 | 182 | $modified = true; |
| 183 | 183 | $config['columnDefinition'] = $config['type']->getSQLDeclaration($config, $platform) . ' COLLATE BINARY' . $platform->getDefaultValueDeclarationSQL($config); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $config['columnDefinition'] = $config['comment'] . $platform->getDefaultValueDeclarationSQL($config); |
| 195 | 195 | } |
| 196 | 196 | if (!empty($config['columnDefinition']) && $platform->supportsInlineColumnComments()) { |
| 197 | - $config['columnDefinition'] .= " COMMENT " . $platform->quoteStringLiteral($config['comment']); |
|
| 197 | + $config['columnDefinition'] .= " COMMENT " . $platform->quoteStringLiteral($config['comment']); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $args) |
| 279 | 279 | { |
| 280 | 280 | $table = $args->getClassTable(); |
| 281 | - if ( !$table->hasOption('engine') |
|
| 281 | + if (!$table->hasOption('engine') |
|
| 282 | 282 | || $table->getOption('engine') !== 'MyISAM') { |
| 283 | 283 | return; |
| 284 | 284 | } |