Completed
Push — master ( f0a5ce...f805e2 )
by Andreas
06:12
created
api/midgard/collector.php 1 patch
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -25,6 +25,10 @@  discard block
 block discarded – undo
25 25
 
26 26
     private $value_properties = [];
27 27
 
28
+    /**
29
+     * @param string $class
30
+     * @param string $field
31
+     */
28 32
     public function __construct($class, $field = null, $value = null)
29 33
     {
30 34
         parent::__construct($class);
@@ -68,6 +72,9 @@  discard block
 block discarded – undo
68 72
         return true;
69 73
     }
70 74
 
75
+    /**
76
+     * @param string $property
77
+     */
71 78
     protected function build_property_select($property)
72 79
     {
73 80
         $parsed = $this->parse_constraint_name($property);
Please login to merge, or discard this patch.
src/driver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
 
157 157
         foreach ($type->get_properties() as $name => $property) {
158 158
             // doctrine can handle id links only
159
-            if (   $property->link
159
+            if ($property->link
160 160
                 && $target_class = $this->manager->resolve_targetclass($property)) {
161 161
                 $link_mapping = [
162 162
                     'fieldName' => $property->name,
Please login to merge, or discard this patch.
src/storage/subscriber.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         if (!($entity instanceof repligard)) {
100 100
             $repligard_entry = $em->getRepository('midgard:midgard_repligard')->findOneBy(['guid' => $entity->guid]);
101 101
 
102
-            if (   $entity instanceof metadata
102
+            if ($entity instanceof metadata
103 103
                 && $entity->{metadata::DELETED_FIELD}) {
104 104
                 $repligard_entry->object_action = self::ACTION_DELETE;
105 105
             } else {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
         foreach ($columns as $name => &$config) {
142 142
             if ($platform->getName() === 'sqlite') {
143
-                if (   !empty($config['primary'])
143
+                if (!empty($config['primary'])
144 144
                     && !empty($config['autoincrement'])) {
145 145
                     /*
146 146
                      * This is essentially a workaround for http://www.doctrine-project.org/jira/browse/DBAL-642
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                     $modified = true;
150 150
                     $config['columnDefinition'] = 'INTEGER PRIMARY KEY AUTOINCREMENT';
151 151
                 }
152
-                if (   !empty($config['comment'])
152
+                if (!empty($config['comment'])
153 153
                     && $config['comment'] == 'BINARY') {
154 154
                     $modified = true;
155 155
                     $config['columnDefinition'] = $config['type']->getSQLDeclaration($config, $platform) . ' COLLATE BINARY' . $platform->getDefaultValueDeclarationSQL($config);
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $args)
258 258
     {
259 259
         $table = $args->getClassTable();
260
-        if (   !$table->hasOption('engine')
260
+        if (!$table->hasOption('engine')
261 261
             || $table->getOption('engine') !== 'MyISAM') {
262 262
             return;
263 263
         }
Please login to merge, or discard this patch.
src/mgdschema/translator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         if (!array_key_exists($typeattribute, self::$typemap)) {
39 39
             throw new \Exception('unknown type ' . $typeattribute);
40 40
         }
41
-        $search = ['unsigned ', 'guid',   'datetime', 'text', 'longtext'];
41
+        $search = ['unsigned ', 'guid', 'datetime', 'text', 'longtext'];
42 42
         $replace = ['', 'string', 'midgard_datetime', 'string', 'string'];
43 43
 
44 44
         return str_replace($search, $replace, $typeattribute);
Please login to merge, or discard this patch.
src/api/config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function read_file_at_path($path)
34 34
     {
35
-        if (   !file_exists($path)
35
+        if (!file_exists($path)
36 36
             || !is_readable($path)) {
37 37
             return false;
38 38
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $subdirs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'];
146 146
         foreach ($subdirs as $dir) {
147 147
             foreach ($subdirs as $subdir) {
148
-                if (   !is_dir($this->blobdir . '/' . $dir . '/' . $subdir)
148
+                if (!is_dir($this->blobdir . '/' . $dir . '/' . $subdir)
149 149
                     && !mkdir($this->blobdir . '/' . $dir . '/' . $subdir, 0777, true)) {
150 150
                     return false;
151 151
                 }
Please login to merge, or discard this patch.
src/api/dbobject.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $this->initialize();
65 65
         $properties = array_merge($this->cm->getFieldNames(), $this->cm->getAssociationNames(), array_keys($this->cm->midgard['field_aliases']));
66
-        $properties = array_filter($properties, function ($input) {
66
+        $properties = array_filter($properties, function($input) {
67 67
             return (strpos($input, 'metadata_') === false);
68 68
         });
69 69
         $ret = [];
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $this->initialize();
80 80
 
81
-        if (   !$this->cm->hasField($field)
81
+        if (!$this->cm->hasField($field)
82 82
             && array_key_exists($field, $this->cm->midgard['field_aliases'])) {
83 83
             $field = $this->cm->midgard['field_aliases'][$field];
84 84
         }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             if (empty($value)) {
89 89
                 $value = null;
90 90
             } else {
91
-                if (   !is_object($this->$field)
91
+                if (!is_object($this->$field)
92 92
                     || $this->$field->id != $value) {
93 93
                     $this->changed_associations[$field] = true;
94 94
                 }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         } elseif ($this->cm->hasField($field)) {
99 99
             $mapping = $this->cm->getFieldMapping($field);
100 100
 
101
-            if (   $mapping['type'] === 'string'
101
+            if ($mapping['type'] === 'string'
102 102
                 || $mapping['type'] == 'text') {
103 103
                 $value = (string) $value;
104 104
             } elseif ($mapping['type'] === 'integer') {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             } elseif ($mapping['type'] === 'float') {
109 109
                 $value = (float) $value;
110 110
             } elseif ($mapping['type'] === 'midgard_datetime') {
111
-                if (   is_string($value)
111
+                if (is_string($value)
112 112
                     && $value !== '0000-00-00 00:00:00') {
113 113
                     $value = new midgard_datetime($value);
114 114
                 } elseif (!($value instanceof midgard_datetime)) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $this->initialize();
126 126
 
127
-        if (   !$this->cm->hasField($field)
127
+        if (!$this->cm->hasField($field)
128 128
             && array_key_exists($field, $this->cm->midgard['field_aliases'])) {
129 129
             $field = $this->cm->midgard['field_aliases'][$field];
130 130
         }
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
             }
138 138
             return 0;
139 139
         }
140
-        if (   $this->$field === null
140
+        if ($this->$field === null
141 141
             && $this->cm->isIdentifier($field)) {
142 142
             return 0;
143 143
         }
144
-        if (   $this->$field instanceof midgard_datetime
144
+        if ($this->$field instanceof midgard_datetime
145 145
             && $this->$field->format('U') == -62169984000) {
146 146
             //This is mainly needed for working with converted Legacy databases. Midgard2 somehow handles this internally
147 147
             //@todo Find a nicer solution and research how QB handles this
Please login to merge, or discard this patch.
src/api/user.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(['guid' => $this->person]);
115 115
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/query.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
             $value = (array) $value;
105 105
             $value = array_merge($value, $this->get_child_ids($mapping['targetEntity'], $parentfield, $value));
106
-        } elseif (   $operator === 'IN'
106
+        } elseif ($operator === 'IN'
107 107
                  || $operator === 'NOT IN') {
108 108
             $value = array_values($value);
109 109
         } elseif (!in_array($operator, ['=', '>', '<', '<>', '<=', '>=', 'LIKE', 'NOT LIKE'])) {
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
             $parts = explode('.', $name);
258 258
             $column = array_pop($parts);
259 259
             foreach ($parts as $part) {
260
-                if (   $part === 'parameter'
260
+                if ($part === 'parameter'
261 261
                     || $part === 'attachment') {
262 262
                     $targetclass = 'midgard_' . $part;
263 263
                     $current_table = $this->add_collection_join($current_table, $targetclass);
264 264
                 } else {
265 265
                     $mrp = new \midgard_reflection_property($targetclass);
266 266
 
267
-                    if (   !$mrp->is_link($part)
267
+                    if (!$mrp->is_link($part)
268 268
                         && !$mrp->is_special_link($part)) {
269 269
                         throw exception::ok();
270 270
                     }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             $column = $cm->midgard['field_aliases'][$column];
282 282
         }
283 283
 
284
-        if (   !$cm->hasField($column)
284
+        if (!$cm->hasField($column)
285 285
             && !$cm->hasAssociation($column)) {
286 286
             throw exception::ok();
287 287
         }
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
         $parsed = $this->parse_constraint_name($name);
299 299
         $expression = $operator . ' ?' . $this->parameters;
300 300
 
301
-        if (   $operator === 'IN'
301
+        if ($operator === 'IN'
302 302
             || $operator === 'NOT IN') {
303 303
             $expression = $operator . '( ?' . $this->parameters . ')';
304 304
         }
305 305
 
306
-        if (   $value === 0
306
+        if ($value === 0
307 307
             || $value === null
308 308
             || is_array($value)) {
309 309
             $cm = connection::get_em()->getClassMetadata($parsed['targetclass']);
Please login to merge, or discard this patch.