| @@ 18-33 (lines=16) @@ | ||
| 15 | /** |
|
| 16 | * @inheritdoc |
|
| 17 | */ |
|
| 18 | public function getType($type_name) |
|
| 19 | { |
|
| 20 | if (! $this->has($type_name)) { |
|
| 21 | $this->inject($type_name, $this->create($type_name)); // auto-wiring |
|
| 22 | } |
|
| 23 | ||
| 24 | $type = $this->get($type_name); |
|
| 25 | ||
| 26 | if (! $type instanceof Type) { |
|
| 27 | $class_name = get_class($type); |
|
| 28 | ||
| 29 | throw new UnexpectedValueException("{$class_name} does not implement the Type interface"); |
|
| 30 | } |
|
| 31 | ||
| 32 | return $type; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @param string Schema class-name |
|
| @@ 40-55 (lines=16) @@ | ||
| 37 | * |
|
| 38 | * @return Schema |
|
| 39 | */ |
|
| 40 | public function getSchema($schema_type) |
|
| 41 | { |
|
| 42 | if (! $this->has($schema_type)) { |
|
| 43 | $this->inject($schema_type, $this->create($schema_type)); // auto-wiring |
|
| 44 | } |
|
| 45 | ||
| 46 | $schema_type = $this->get($schema_type); |
|
| 47 | ||
| 48 | if (! $schema_type instanceof Schema) { |
|
| 49 | $class_name = get_class($schema_type); |
|
| 50 | ||
| 51 | throw new UnexpectedValueException("{$class_name} does not extend the Schema class"); |
|
| 52 | } |
|
| 53 | ||
| 54 | return $schema_type; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @inheritdoc |
|