| @@ 95-101 (lines=7) @@ | ||
| 92 | * @return self |
|
| 93 | * @throws InvalidArgumentException If the type already exists. |
|
| 94 | */ |
|
| 95 | public function addType($name, $fqcn) |
|
| 96 | { |
|
| 97 | if (true === $this->hasType($name)) { |
|
| 98 | throw new InvalidArgumentException(sprintf('The type "%s" already exists.', $name)); |
|
| 99 | } |
|
| 100 | return $this->setType($name, $fqcn); |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * Overrides a type object with new class. |
|
| @@ 111-117 (lines=7) @@ | ||
| 108 | * @return self |
|
| 109 | * @throws InvalidArgumentException If the type was not found. |
|
| 110 | */ |
|
| 111 | public function overrideType($name, $fqcn) |
|
| 112 | { |
|
| 113 | if (false === $this->hasType($name)) { |
|
| 114 | throw new InvalidArgumentException(sprintf('The type "%s" was not found.', $name)); |
|
| 115 | } |
|
| 116 | return $this->setType($name, $fqcn); |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Sets a type. |
|