Completed
Pull Request — master (#2)
by
unknown
05:35
created
src/NOSQL/autoload.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,25 +5,25 @@  discard block
 block discarded – undo
5 5
  * @version 1.0
6 6
  * Autogenerated autoloader [2019-01-03 15:23:58]
7 7
  */
8
-if(!defined("BASE_DIR"))
9
-define("BASE_DIR", dirname( dirname(__DIR__) ) );
8
+if (!defined("BASE_DIR"))
9
+define("BASE_DIR", dirname(dirname(__DIR__)));
10 10
 
11 11
 require_once __DIR__ . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php';
12 12
 
13
-if(!function_exists("NOSQL_Autoloader")) {
13
+if (!function_exists("NOSQL_Autoloader")) {
14 14
     // autoloader
15
-    function NOSQL_Autoloader( $class ) {
15
+    function NOSQL_Autoloader($class) {
16 16
         // it only autoload class into the Rain scope
17 17
         if (false !== preg_match('/^\\\?NOSQL/', $class)) {
18 18
             // Change order src
19 19
             $class = preg_replace('/^\\\?NOSQL/', 'NOSQL', $class);
20 20
             // transform the namespace in path
21
-            $path = str_replace("\\", DIRECTORY_SEPARATOR, $class );
21
+            $path = str_replace("\\", DIRECTORY_SEPARATOR, $class);
22 22
             // filepath
23 23
             $abs_path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $path . ".php";
24 24
 
25 25
             // require the file
26
-            if(file_exists($abs_path)) {
26
+            if (file_exists($abs_path)) {
27 27
                 require_once $abs_path;
28 28
             }
29 29
         }
@@ -31,5 +31,5 @@  discard block
 block discarded – undo
31 31
     }
32 32
 
33 33
     // register the autoloader
34
-    spl_autoload_register( "NOSQL_Autoloader" );
34
+    spl_autoload_register("NOSQL_Autoloader");
35 35
 }
Please login to merge, or discard this patch.
src/NOSQL/Api/NOSQL.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $code = 200;
58 58
         try {
59 59
             $this->srv->setCollections($module, $this->getRequest()->getRawData());
60
-        } catch(\Exception $exception) {
60
+        } catch (\Exception $exception) {
61 61
             $success = false;
62 62
             $code = 400;
63 63
             Logger::log($exception->getMessage(), LOG_WARNING);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $code = 200;
76 76
         try {
77 77
             $success = $this->srv->syncCollections($module);
78
-        } catch(\Exception $exception) {
78
+        } catch (\Exception $exception) {
79 79
             $success = false;
80 80
             $code = 400;
81 81
             Logger::log($exception->getMessage(), LOG_WARNING);
Please login to merge, or discard this patch.
src/NOSQL/Services/ParserService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $dns .= '@' . Config::getParam('nosql.host', 'localhost', $lowerDomain);
28 28
 
29 29
         $database = Config::getParam('nosql.database', 'nosql', $lowerDomain);
30
-        if(null !== Config::getParam('nosql.replicaset')) {
30
+        if (null !== Config::getParam('nosql.replicaset')) {
31 31
             $dns .= '/' . $database . '?ssl=true&replicaSet=' . Config::getParam('nosql.replicaset', null, $lowerDomain);
32 32
             $dns .= '&authSource=admin&serverSelectionTryOnce=false&serverSelectionTimeoutMS=15000&retryWrites=true';
33 33
         } else {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function checkAndSave($domain, $collection, NOSQLModelDto $dto) {
50 50
         $errors = $dto->validate();
51
-        if(empty($errors)) {
51
+        if (empty($errors)) {
52 52
 
53 53
         } else {
54 54
             throw new ApiException(t('Dto not valid'), 400);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public function hydrateModelFromRequest(array $data, $className) {
65 65
         $model = null;
66 66
         $reflectionClass = new \ReflectionClass($className);
67
-        if($reflectionClass->isSubclassOf(NOSQLBase::class)) {
67
+        if ($reflectionClass->isSubclassOf(NOSQLBase::class)) {
68 68
             /** @var NOSQLActiveRecord $modelName */
69 69
             $modelName = $className::MODEL_CLASS;
70 70
             $model = $modelName::fromArray($data);
Please login to merge, or discard this patch.
src/NOSQL/Services/Helpers/NOSQLApiHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public static function parseForm(CollectionDto $collectionDto) {
34 34
         $form = new Form(false);
35 35
         $form->addField(self::generateId());
36
-        foreach($collectionDto->properties as $property) {
36
+        foreach ($collectionDto->properties as $property) {
37 37
             $values = null;
38 38
             $data = [];
39 39
             $url = null;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 case NOSQLBase::NOSQL_TYPE_ENUM:
59 59
                     $type = Field::COMBO_TYPE;
60 60
                     $enumValues = explode('|', $property->enum);
61
-                    foreach($enumValues as $value) {
61
+                    foreach ($enumValues as $value) {
62 62
                         $data[] = [
63 63
                             $property->name => $value,
64 64
                             'Label' => t($value),
Please login to merge, or discard this patch.
src/NOSQL/Models/base/NOSQLStatusTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @param string $property
80 80
      */
81 81
     public function addChanges($property) {
82
-        if(!in_array($property, $this->changes)) {
82
+        if (!in_array($property, $this->changes)) {
83 83
             $this->changes[] = $property;
84 84
         }
85 85
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @throws \NOSQL\Exceptions\NOSQLValidationException
112 112
      */
113 113
     public static function invokeHook(NOSQLActiveRecord $model, NOSQLModelDto $dto, $hook, Database $con = null) {
114
-        if(method_exists($model, $hook)) {
114
+        if (method_exists($model, $hook)) {
115 115
             $con = self::initConnection($model, $con);
116 116
             $model->feed($dto->toArray());
117 117
             $model->$hook($con);
Please login to merge, or discard this patch.
src/NOSQL/Api/base/NOSQLBase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
     public function getApi()
57 57
     {
58 58
         $class = explode('\\', get_called_class());
59
-        return $class[count($class)-1];
59
+        return $class[count($class) - 1];
60 60
     }
61 61
 
62 62
     /**
Please login to merge, or discard this patch.
src/NOSQL/Dto/Model/NOSQLModelDto.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function setPk(string $id)
53 53
     {
54
-        if(!empty($this->_id)) {
54
+        if (!empty($this->_id)) {
55 55
             throw new NOSQLValidationException(t('Primary key already defined'), NOSQLValidationException::NOSQL_VALIDATION_ID_ALREADY_DEFINED);
56 56
         }
57 57
         $this->_id = $id;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public function getLastUpdate($format = null)
65 65
     {
66 66
         $value = $this->_last_update;
67
-        if(null !== $format) {
67
+        if (null !== $format) {
68 68
 
69 69
         }
70 70
         return $value;
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
     public function validate($throwException = false) {
105 105
         $errors = [];
106 106
         $reflection = new \ReflectionClass(get_called_class());
107
-        foreach($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
107
+        foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
108 108
             $required = InjectorHelper::checkIsRequired($property->getDocComment());
109 109
             $value = $property->getValue($this);
110
-            if($required && empty($value)) {
111
-                if($throwException) {
110
+            if ($required && empty($value)) {
111
+                if ($throwException) {
112 112
                     throw new NOSQLValidationException(t('Empty value for property ') . $property->getName(), NOSQLValidationException::NOSQL_VALIDATION_REQUIRED);
113 113
                 } else {
114 114
                     $errors[] = $property->getName();
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
     public function toArray()
124 124
     {
125 125
         $array = parent::toArray();
126
-        if(null !== $this->getPk()) {
126
+        if (null !== $this->getPk()) {
127 127
             $array['_id'] = $this->getPk();
128 128
         }
129
-        if(null !== $this->getName()) {
129
+        if (null !== $this->getName()) {
130 130
             $array[Api::API_LIST_NAME_FIELD] = $this->getName();
131 131
         }
132 132
         $array['_last_update'] = $this->getLastUpdate(\DateTime::ATOM);
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
                 if (!is_numeric($value)) {
151 151
                     $errors[] = $property->getName();
152 152
                 } else {
153
-                    if(NOSQLBase::NOSQL_TYPE_INTEGER === strtolower($type)) {
154
-                        $property->setValue($this, (integer)$value);
153
+                    if (NOSQLBase::NOSQL_TYPE_INTEGER === strtolower($type)) {
154
+                        $property->setValue($this, (integer) $value);
155 155
                     } else {
156
-                        $property->setValue($this, (float)$value);
156
+                        $property->setValue($this, (float) $value);
157 157
                     }
158 158
                 }
159 159
                 break;
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
                 if (!in_array($value, [true, false, 0, 1])) {
176 176
                     $errors[] = $property->getName();
177 177
                 }
178
-                $property->setValue($this, (bool)$value);
178
+                $property->setValue($this, (bool) $value);
179 179
                 break;
180 180
             case NOSQLBase::NOSQL_TYPE_DATE:
181 181
             case NOSQLBase::NOSQL_TYPE_TIMESTAMP:
182 182
                 $dateTime = new \DateTime($value, new \DateTimeZone('UTC'));
183
-                if(!$dateTime) {
183
+                if (!$dateTime) {
184 184
                     $errors[] = $property->getName();
185 185
                 } else {
186 186
                     $dateTime->setTimezone(new \DateTimeZone(date_default_timezone_get()));
187
-                    $property->setValue($this, new UTCDateTime($dateTime->getTimestamp()*1000));
187
+                    $property->setValue($this, new UTCDateTime($dateTime->getTimestamp() * 1000));
188 188
                 }
189 189
                 break;
190 190
         }
Please login to merge, or discard this patch.
src/NOSQL/Models/NOSQLActiveRecord.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function getDtoCopy($cleanPk = false) {
46 46
         $copy = clone $this->dto;
47
-        if($cleanPk) {
47
+        if ($cleanPk) {
48 48
             $this->dto->resetPk();
49 49
         }
50 50
         return $copy;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function save(Database $con = null) {
62 62
         $saved = false;
63
-        if(null === $con) {
63
+        if (null === $con) {
64 64
             $con = ParserService::getInstance()->createConnection($this->getDomain());
65 65
         }
66 66
         $collection = $con->selectCollection($this->getSchema()->name);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             $isInsert = $isUpdate = false;
69 69
             $this->prepareData();
70 70
             $this->dto->setLastUpdate();
71
-            if($this->isNew()) {
71
+            if ($this->isNew()) {
72 72
                 $this->preInsert($con);
73 73
                 $isInsert = true;
74 74
             } elseif ($this->isModified()) {
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
                 $isUpdate = true;
77 77
             }
78 78
             $result = $collection->insertOne($this->toArray());
79
-            if($result->getInsertedCount() > 0) {
79
+            if ($result->getInsertedCount() > 0) {
80 80
                 $id = $result->getInsertedId();
81 81
                 $this->dto->setPk($id->jsonSerialize()['$oid']);
82
-                if($isInsert) {
82
+                if ($isInsert) {
83 83
                     $this->postInsert($con);
84
-                } elseif($isUpdate) {
84
+                } elseif ($isUpdate) {
85 85
                     $this->postUpdate($con);
86 86
                 }
87 87
                 $saved = true;
88 88
                 $this->countAction();
89 89
             }
90
-        } catch(\Exception $exception) {
91
-            if($exception instanceof NOSQLValidationException) {
90
+        } catch (\Exception $exception) {
91
+            if ($exception instanceof NOSQLValidationException) {
92 92
                 throw $exception;
93 93
             } else {
94 94
                 Logger::log($exception->getMessage(), LOG_CRIT, $this->toArray());
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function update(Database $con = null) {
105 105
         $updated = false;
106
-        if(null === $con) {
106
+        if (null === $con) {
107 107
             $con = ParserService::getInstance()->createConnection($this->getDomain());
108 108
         }
109 109
         $collection = $con->selectCollection($this->getSchema()->name);
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
             $this->postUpdate($con);
118 118
             $updated = true;
119 119
             $this->countAction();
120
-        } catch(\Exception $exception) {
121
-            if($exception instanceof NOSQLValidationException) {
120
+        } catch (\Exception $exception) {
121
+            if ($exception instanceof NOSQLValidationException) {
122 122
                 throw $exception;
123 123
             } else {
124 124
                 Logger::log($exception->getMessage(), LOG_CRIT, $this->toArray());
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function bulkInsert(array $data, Database $con = null) {
136 136
         $inserts = 0;
137
-        if(null === $con) {
137
+        if (null === $con) {
138 138
             $con = ParserService::getInstance()->createConnection($this->getDomain());
139 139
         }
140 140
         $collection = $con->selectCollection($this->getSchema()->name);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             $ids = $result->getInsertedIds();
145 145
             $inserts = $this->parseInsertedDtos($con, $ids, $dtos);
146 146
             $this->setActionCount($inserts);
147
-        } catch(\Exception $exception) {
147
+        } catch (\Exception $exception) {
148 148
             Logger::log($exception->getMessage(), LOG_CRIT, $this->toArray());
149 149
         }
150 150
         return $inserts;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @return int
159 159
      */
160 160
     public function bulkUpsert(array $data, $id, Database $con = null) {
161
-        if(null === $con) {
161
+        if (null === $con) {
162 162
             $con = ParserService::getInstance()->createConnection($this->getDomain());
163 163
         }
164 164
         $collection = $con->selectCollection($this->getSchema()->name);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         try {
169 169
             // Check index collation
170 170
             $indexes = $collection->listIndexes();
171
-            foreach($indexes as $index) {
171
+            foreach ($indexes as $index) {
172 172
                 $indexInfo = $index->__debugInfo();
173 173
                 $keys = array_keys($index["key"]);
174 174
                 if ((count($keys) === 1) && ($keys[0] === $id) && (array_key_exists("collation", $indexInfo))) {
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                 }
179 179
             }
180 180
 
181
-            foreach($data as $item) {
181
+            foreach ($data as $item) {
182 182
                 $filter[$id] = ['$eq' => $item[$id]];
183 183
                 $update = [];
184 184
                 $update['$set'] = $item;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function delete(Database $con = null) {
206 206
         $deleted = false;
207
-        if(null === $con) {
207
+        if (null === $con) {
208 208
             $con = ParserService::getInstance()->createConnection($this->getDomain());
209 209
         }
210 210
         $collection = $con->selectCollection($this->getSchema()->name);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             $deleted = true;
216 216
             $this->dto = null;
217 217
             $this->countAction();
218
-        } catch(\Exception $exception) {
218
+        } catch (\Exception $exception) {
219 219
             Logger::log($exception->getMessage(), LOG_CRIT, $this->toArray());
220 220
         }
221 221
         return $deleted;
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public function bulkDelete(array $filters, Database $con = null) {
231 231
         $deletedCount = 0;
232
-        if(null === $con) {
232
+        if (null === $con) {
233 233
             $con = ParserService::getInstance()->createConnection($this->getDomain());
234 234
         }
235 235
         $collection = $con->selectCollection($this->getSchema()->name);
236 236
         try {
237 237
             $result = $collection->deleteMany($filters);
238 238
             $deletedCount = $result->getDeletedCount();
239
-        } catch(\Exception $exception) {
239
+        } catch (\Exception $exception) {
240 240
             Logger::log($exception->getMessage(), LOG_CRIT, $this->toArray());
241 241
         }
242 242
         return $deletedCount;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $dtos = [];
254 254
         /** @var NOSQLModelDto $dto */
255 255
         foreach ($data as &$insertData) {
256
-            if(is_object($insertData) && $insertData instanceof NOSQLModelDto) {
256
+            if (is_object($insertData) && $insertData instanceof NOSQLModelDto) {
257 257
                 $dto = clone $insertData;
258 258
             } else {
259 259
                 $dto = $this->getDtoCopy(true);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         foreach ($ids as $index => $insertedId) {
284 284
             $id = $insertedId->jsonSerialize();
285 285
             $dto = $dtos[$index];
286
-            if($dto instanceof  NOSQLModelDto) {
286
+            if ($dto instanceof  NOSQLModelDto) {
287 287
                 $dto->setPk($id['$oid']);
288 288
             } else {
289 289
 
Please login to merge, or discard this patch.
src/NOSQL/Services/NOSQLService.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
      */
58 58
     private function extractTypes() {
59 59
         $baseClass = new \ReflectionClass(NOSQLBase::class);
60
-        if(null !== $baseClass) {
60
+        if (null !== $baseClass) {
61 61
             $types = [];
62
-            foreach($baseClass->getConstants() as $constant) {
62
+            foreach ($baseClass->getConstants() as $constant) {
63 63
                 $types[] = $constant;
64 64
             }
65 65
             $this->setTypes($types);
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
     public function getDomains() {
82 82
         $domains = [];
83 83
         $storedDomains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, TRUE);
84
-        if(!empty($storedDomains)) {
85
-            foreach($storedDomains as $domain => $data) {
84
+        if (!empty($storedDomains)) {
85
+            foreach ($storedDomains as $domain => $data) {
86 86
                 $domainLabel = str_replace(['@', '/'], '', $domain);
87
-                if('ROOT' !== $domainLabel) {
87
+                if ('ROOT' !== $domainLabel) {
88 88
                     $domains[] = $domainLabel;
89 89
                 }
90 90
             }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $collections = [];
101 101
         $path = GeneratorHelper::getDomainPaths($module);
102 102
         $schemaFilename = $path['base'] . 'Config' . DIRECTORY_SEPARATOR . 'schema.json';
103
-        if(file_exists($schemaFilename)) {
103
+        if (file_exists($schemaFilename)) {
104 104
             $collections = $this->cache->getDataFromFile($schemaFilename, Cache::JSON, TRUE);
105 105
         }
106 106
         return $collections;
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
             '@NOSQL/generator/api.base.php.twig' => CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'Base',
124 124
             '@NOSQL/generator/dto.php.twig' => CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Dto' . DIRECTORY_SEPARATOR . 'Models',
125 125
         ];
126
-        foreach($collections as $raw) {
126
+        foreach ($collections as $raw) {
127 127
             $collection = new CollectionDto(false);
128 128
             $collection->fromArray($raw);
129
-            foreach($files as $template => $path) {
129
+            foreach ($files as $template => $path) {
130 130
                 GeneratorHelper::createDir($path);
131 131
                 $templateDump = $tpl->dump($template, [
132 132
                     'domain' => $module,
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                     'properties' => $collection->properties,
135 135
                 ]);
136 136
                 $force = false;
137
-                if(false !== strpos($template, 'dto') || false !== strpos(strtolower($template), 'base')) {
137
+                if (false !== strpos($template, 'dto') || false !== strpos(strtolower($template), 'base')) {
138 138
                     $force = true;
139 139
                 }
140 140
                 $this->writeTemplateToFile($templateDump, $path . DIRECTORY_SEPARATOR . $collection->name . '.php', $force);
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
         try {
173 173
             $collection = $db->selectCollection($collectionDto['name']);
174 174
             $textIndexes = [];
175
-            foreach($collectionDto['properties'] as $property) {
176
-                if(in_array($property['type'], [NOSQLBase::NOSQL_TYPE_STRING, NOSQLBase::NOSQL_TYPE_OBJECT])) {
175
+            foreach ($collectionDto['properties'] as $property) {
176
+                if (in_array($property['type'], [NOSQLBase::NOSQL_TYPE_STRING, NOSQLBase::NOSQL_TYPE_OBJECT])) {
177 177
                     $textIndexes[$property['name']] = 'text';
178 178
                 }
179 179
             }
180
-            if(count($textIndexes)) {
180
+            if (count($textIndexes)) {
181 181
                 $collection->createIndex($textIndexes, ['name' => 'idx_text_' . $collectionDto['name']]);
182 182
             }
183 183
         } catch (\Exception $exception) {
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         $db = ParserService::getInstance()->createConnection($module);
195 195
         $collections = $this->getCollections($module);
196 196
         $success = true;
197
-        foreach($collections as $raw) {
197
+        foreach ($collections as $raw) {
198 198
             $jsonSchema = $this->parseCollection($raw);
199 199
             try {
200 200
                 /** @var BSONDocument $result */
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                 ]);
206 206
                 $response = $result->getArrayCopy();
207 207
                 $success = array_key_exists('ok', $response) && $response['ok'] > 0;
208
-            } catch(\Exception $exception) {
209
-                if($exception->getCode() !== 48) {
208
+            } catch (\Exception $exception) {
209
+                if ($exception->getCode() !== 48) {
210 210
                     $success = false;
211 211
                 }
212 212
             }
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
                     $property = new StringPropertyDto(false);
239 239
                     break;
240 240
             }
241
-            if(array_key_exists('type', $rawProperty)) {
241
+            if (array_key_exists('type', $rawProperty)) {
242 242
                 $property->bsonType = $rawProperty['type'];
243 243
             }
244
-            if(array_key_exists('description', $rawProperty)) {
244
+            if (array_key_exists('description', $rawProperty)) {
245 245
                 $property->description = $rawProperty['description'];
246 246
             }
247 247
             if (array_key_exists('required', $rawProperty) && $rawProperty['required']) {
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     public function getValidations() {
260 260
         $fieldTypes = new \ReflectionClass(Field::class);
261 261
         $validations = [];
262
-        foreach($fieldTypes->getConstants() as $validation) {
262
+        foreach ($fieldTypes->getConstants() as $validation) {
263 263
             $validations[] = $validation;
264 264
         }
265 265
         return $validations;
Please login to merge, or discard this patch.