| @@ 28-37 (lines=10) @@ | ||
| 25 | * |
|
| 26 | * @throws \ReflectionException |
|
| 27 | */ |
|
| 28 | public function __construct(AttributeFactoryInterface $attributeFactory = null) |
|
| 29 | { |
|
| 30 | if ($attributeFactory === null) { |
|
| 31 | $reflection = new \ReflectionClass(AttributeFactory::class); |
|
| 32 | /** @var \drupol\htmltag\Attribute\AttributeFactoryInterface $attributeFactory */ |
|
| 33 | $attributeFactory = $reflection->newInstance(); |
|
| 34 | } |
|
| 35 | ||
| 36 | $this->attributeFactory = $attributeFactory; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * Get an instance of an attributes object. |
|
| @@ 42-54 (lines=13) @@ | ||
| 39 | /** |
|
| 40 | * {@inheritdoc} |
|
| 41 | */ |
|
| 42 | public function attributes(array $attributes = array(), AttributeFactoryInterface $attributeFactory = null) |
|
| 43 | { |
|
| 44 | if ($attributeFactory === null) { |
|
| 45 | $reflection = new \ReflectionClass(AttributeFactory::class); |
|
| 46 | /** @var \drupol\htmltag\Attribute\AttributeFactoryInterface $attributeFactory */ |
|
| 47 | $attributeFactory = $reflection->newInstance(); |
|
| 48 | } |
|
| 49 | ||
| 50 | return new Attributes( |
|
| 51 | $attributeFactory, |
|
| 52 | $attributes |
|
| 53 | ); |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * {@inheritdoc} |
|