| Conditions | 4 |
| Paths | 6 |
| Total Lines | 29 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 4.0023 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 4 | public function extractSchemas(array $schemaTables = []) |
|
| 36 | { |
||
| 37 | 4 | if (count($schemaTables) === 0) { |
|
| 38 | 1 | $schemaTables = array_map( |
|
| 39 | 1 | function (Config\SchemaConfigInterface $schemaConfig) { |
|
| 40 | return $schemaConfig->getSchema(); |
||
| 41 | 1 | }, |
|
| 42 | 1 | $this->config->get(Config::CONFIG_SCHEMAS) |
|
| 43 | ); |
||
| 44 | } |
||
| 45 | |||
| 46 | 3 | $parsedSchemas = []; |
|
| 47 | 3 | foreach ($schemaTables as $schemaTable) { |
|
| 48 | 3 | if (preg_match('/^([a-z0-9_]+):(.+)$/i', $schemaTable, $matches)) { |
|
| 49 | 2 | $schema = $matches[1]; |
|
| 50 | 2 | $tables = explode(',', $matches[2]); |
|
| 51 | } else { |
||
| 52 | 2 | $schema = $schemaTable; |
|
| 53 | 2 | $tables = []; |
|
| 54 | } |
||
| 55 | |||
| 56 | 3 | $parsedSchemas[] = new ParsedSchema( |
|
| 57 | 3 | $this->config->getSchemaConfiguration($schema), |
|
| 58 | 3 | $this->config->getSchemaPath($this->config->getSchemaConfiguration($schema), $this->group), |
|
| 59 | 3 | $tables |
|
| 60 | ); |
||
| 61 | }; |
||
| 62 | |||
| 63 | 3 | return array_filter(array_map([$this->populator, 'populateTables'], $parsedSchemas)); |
|
| 64 | } |
||
| 66 |