| Conditions | 3 |
| Paths | 3 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function getSchema(ThemeInterface $theme) |
||
| 26 | { |
||
| 27 | $schemaPath = sprintf('%s/Settings.php', $theme->getPath()); |
||
| 28 | |||
| 29 | if (!file_exists($schemaPath)) { |
||
| 30 | throw new \InvalidArgumentException(sprintf( |
||
| 31 | 'Could not find settings schema of theme "%s" (%s) in file "%s"', |
||
| 32 | $theme->getTitle(), |
||
| 33 | $theme->getName(), |
||
| 34 | $schemaPath |
||
| 35 | )); |
||
| 36 | } |
||
| 37 | |||
| 38 | $schema = require $schemaPath; |
||
| 39 | |||
| 40 | if (!$schema instanceof SchemaInterface) { |
||
| 41 | throw new \InvalidArgumentException(sprintf( |
||
| 42 | 'File "%s" must return an instance of "%s"', |
||
| 43 | $schemaPath, |
||
| 44 | SchemaInterface::class |
||
| 45 | )); |
||
| 46 | } |
||
| 47 | |||
| 48 | return $schema; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |