| @@ 69-77 (lines=9) @@ | ||
| 66 | { |
|
| 67 | $strict = $strict === null ? true : (bool) $strict; |
|
| 68 | ||
| 69 | if ($strict && $this->hasConverterName($name)) { |
|
| 70 | throw new ConverterException( |
|
| 71 | sprintf( |
|
| 72 | "A converter named '%s' already exists. (Known converters are {%s}).", |
|
| 73 | $name, |
|
| 74 | join(', ', $this->getConverterNames()) |
|
| 75 | ) |
|
| 76 | ); |
|
| 77 | } |
|
| 78 | ||
| 79 | $this->converters[$name] = $converter; |
|
| 80 | ||
| @@ 136-144 (lines=9) @@ | ||
| 133 | */ |
|
| 134 | public function addTypeToConverter($name, $type) |
|
| 135 | { |
|
| 136 | if (!$this->hasConverterName($name)) { |
|
| 137 | throw new ConverterException( |
|
| 138 | sprintf( |
|
| 139 | "No such converter name '%s'. Registered converters are {%s}.", |
|
| 140 | $name, |
|
| 141 | join(', ', $this->getConverterNames()) |
|
| 142 | ) |
|
| 143 | ); |
|
| 144 | } |
|
| 145 | ||
| 146 | $this->types[$type] = $name; |
|
| 147 | ||