| @@ 33-44 (lines=12) @@ | ||
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| 33 | public function setObjectFactory($classOrObjectFactory) |
|
| 34 | { |
|
| 35 | if (is_object($classOrObjectFactory) && $classOrObjectFactory instanceof ObjectFactoryInterface) { |
|
| 36 | $objectFactory = $classOrObjectFactory; |
|
| 37 | } elseif (is_string($classOrObjectFactory)) { |
|
| 38 | $objectFactory = new DefaultObjectFactory($classOrObjectFactory); |
|
| 39 | } else { |
|
| 40 | throw new \InvalidArgumentException('classOrObjectFactory must not be empty'); |
|
| 41 | } |
|
| 42 | ||
| 43 | $this->objectFactory = $objectFactory; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| @@ 22-34 (lines=13) @@ | ||
| 19 | */ |
|
| 20 | private $metadataParser; |
|
| 21 | ||
| 22 | public function __construct($classOrObjectFactory, JmsMetadataParser $metadataParser) |
|
| 23 | { |
|
| 24 | if (is_object($classOrObjectFactory) && $classOrObjectFactory instanceof ObjectFactoryInterface) { |
|
| 25 | $objectFactory = $classOrObjectFactory; |
|
| 26 | } elseif (is_string($classOrObjectFactory)) { |
|
| 27 | $objectFactory = new DefaultObjectFactory($classOrObjectFactory); |
|
| 28 | } else { |
|
| 29 | throw new \InvalidArgumentException('classOrObjectFactory must be of type string or ObjectFactoryInterface'); |
|
| 30 | } |
|
| 31 | ||
| 32 | $this->objectFactory = $objectFactory; |
|
| 33 | $this->metadataParser = $metadataParser; |
|
| 34 | } |
|
| 35 | ||
| 36 | public function getFields() |
|
| 37 | { |
|