@@ 95-100 (lines=6) @@ | ||
92 | )); |
|
93 | } |
|
94 | ||
95 | if (isset($this->providerMapping[$type]) === true) { |
|
96 | throw new InvalidArgumentException(T::t( |
|
97 | 'Type should not be used more than once to register a schema (\'%s\').', |
|
98 | [$type] |
|
99 | )); |
|
100 | } |
|
101 | ||
102 | $this->providerMapping[$type] = $schema; |
|
103 | } |
|
@@ 140-145 (lines=6) @@ | ||
137 | return $this->createdProviders[$type]; |
|
138 | } |
|
139 | ||
140 | if (isset($this->providerMapping[$type]) === false) { |
|
141 | throw new InvalidArgumentException(T::t('Schema is not registered for type \'%s\'.', [$type])); |
|
142 | } |
|
143 | ||
144 | $classNameOrClosure = $this->providerMapping[$type]; |
|
145 | if ($classNameOrClosure instanceof Closure) { |
|
146 | $this->createdProviders[$type] = ($schema = $classNameOrClosure($this->factory, $this)); |
|
147 | } else { |
|
148 | $this->createdProviders[$type] = ($schema = new $classNameOrClosure($this->factory, $this)); |