Conditions | 4 |
Paths | 6 |
Total Lines | 29 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 4.2916 |
Changes | 0 |
1 | <?php |
||
35 | 3 | public function extractSchemas(array $schemaTables = []) |
|
36 | { |
||
37 | 3 | if (count($schemaTables) === 0) { |
|
38 | $schemaTables = array_map( |
||
39 | function (Config\SchemaConfigInterface $schemaConfig) { |
||
40 | return $schemaConfig->getSchema(); |
||
41 | }, |
||
42 | $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 |