@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | */ |
56 | 56 | private function extractTypes() { |
57 | 57 | $baseClass = new \ReflectionClass(NOSQLBase::class); |
58 | - if(null !== $baseClass) { |
|
58 | + if (null !== $baseClass) { |
|
59 | 59 | $types = []; |
60 | - foreach($baseClass->getConstants() as $constant) { |
|
60 | + foreach ($baseClass->getConstants() as $constant) { |
|
61 | 61 | $types[] = $constant; |
62 | 62 | } |
63 | 63 | $this->setTypes($types); |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | public function getDomains() { |
80 | 80 | $domains = []; |
81 | 81 | $storedDomains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, TRUE); |
82 | - if(!empty($storedDomains)) { |
|
83 | - foreach($storedDomains as $domain => $data) { |
|
82 | + if (!empty($storedDomains)) { |
|
83 | + foreach ($storedDomains as $domain => $data) { |
|
84 | 84 | $domainLabel = str_replace(['@', '/'], '', $domain); |
85 | - if('ROOT' !== $domainLabel) { |
|
85 | + if ('ROOT' !== $domainLabel) { |
|
86 | 86 | $domains[] = $domainLabel; |
87 | 87 | } |
88 | 88 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | public function getCollections($module) { |
98 | 98 | $collections = []; |
99 | 99 | $schemaFilename = CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'schema.json'; |
100 | - if(file_exists($schemaFilename)) { |
|
100 | + if (file_exists($schemaFilename)) { |
|
101 | 101 | $collections = $this->cache->getDataFromFile($schemaFilename, Cache::JSON, TRUE); |
102 | 102 | } |
103 | 103 | return $collections; |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | '@NOSQL/generator/api.base.php.twig' => CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'base', |
121 | 121 | '@NOSQL/generator/dto.php.twig' => CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Dto' . DIRECTORY_SEPARATOR . 'Models', |
122 | 122 | ]; |
123 | - foreach($collections as $raw) { |
|
123 | + foreach ($collections as $raw) { |
|
124 | 124 | $collection = new CollectionDto(false); |
125 | 125 | $collection->fromArray($raw); |
126 | - foreach($files as $template => $path) { |
|
126 | + foreach ($files as $template => $path) { |
|
127 | 127 | GeneratorHelper::createDir($path); |
128 | 128 | $templateDump = $tpl->dump($template, [ |
129 | 129 | 'domain' => $module, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | 'properties' => $collection->properties, |
132 | 132 | ]); |
133 | 133 | $force = false; |
134 | - if(false !== strpos($template, 'dto') || false !== strpos($template, 'base')) { |
|
134 | + if (false !== strpos($template, 'dto') || false !== strpos($template, 'base')) { |
|
135 | 135 | $force = true; |
136 | 136 | } |
137 | 137 | $this->writeTemplateToFile($templateDump, $path . DIRECTORY_SEPARATOR . $collection->name . '.php', $force); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $db = ParserService::getInstance()->createConnection($module); |
171 | 171 | $collections = $this->getCollections($module); |
172 | 172 | $success = true; |
173 | - foreach($collections as $raw) { |
|
173 | + foreach ($collections as $raw) { |
|
174 | 174 | $jsonSchema = $this->parseCollection($raw); |
175 | 175 | try { |
176 | 176 | /** @var BSONDocument $result */ |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | ]); |
182 | 182 | $response = $result->getArrayCopy(); |
183 | 183 | $success = array_key_exists('ok', $response) && $response['ok'] > 0; |
184 | - } catch(\Exception $exception) { |
|
185 | - if($exception->getCode() !== 48) { |
|
184 | + } catch (\Exception $exception) { |
|
185 | + if ($exception->getCode() !== 48) { |
|
186 | 186 | $success = false; |
187 | 187 | } |
188 | 188 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | $property = new StringPropertyDto(false); |
214 | 214 | break; |
215 | 215 | } |
216 | - if(array_key_exists('type', $rawProperty)) { |
|
216 | + if (array_key_exists('type', $rawProperty)) { |
|
217 | 217 | $property->bsonType = $rawProperty['type']; |
218 | 218 | } |
219 | - if(array_key_exists('description', $rawProperty)) { |
|
219 | + if (array_key_exists('description', $rawProperty)) { |
|
220 | 220 | $property->description = $rawProperty['description']; |
221 | 221 | } |
222 | 222 | if (array_key_exists('required', $rawProperty) && $rawProperty['required']) { |