| @@ 55-64 (lines=10) @@ | ||
| 52 | return $this->getProperty($type); |
|
| 53 | } |
|
| 54 | ||
| 55 | public function getOrCreate(string $type): Type |
|
| 56 | { |
|
| 57 | if ($this->has($type)) { |
|
| 58 | return $this->get($type); |
|
| 59 | } elseif (is_subclass_of($type, Type::class)) { |
|
| 60 | return $this->properties[$type] = new $type(); |
|
| 61 | } |
|
| 62 | ||
| 63 | throw new InvalidArgumentException(sprintf('The given type "%s" is not an instance of "%s".', $type, Type::class)); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function hide(string $type) |
|
| 67 | { |
|
| @@ 52-61 (lines=10) @@ | ||
| 49 | return $this->getProperty($type); |
|
| 50 | } |
|
| 51 | ||
| 52 | public function getOrCreate(string $type): Type |
|
| 53 | { |
|
| 54 | if ($this->has($type)) { |
|
| 55 | return $this->get($type); |
|
| 56 | } elseif (is_subclass_of($type, Type::class)) { |
|
| 57 | return $this->properties[$type] = new $type(); |
|
| 58 | } |
|
| 59 | ||
| 60 | throw new InvalidArgumentException(sprintf('The given type "%s" is not an instance of "%s".', $type, Type::class)); |
|
| 61 | } |
|
| 62 | ||
| 63 | public function hide(string $type) |
|
| 64 | { |
|