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