| @@ 22-43 (lines=22) @@ | ||
| 19 | /** |
|
| 20 | * {@inheritdoc} |
|
| 21 | */ |
|
| 22 | public static function tag( |
|
| 23 | $name, |
|
| 24 | array $attributes = [], |
|
| 25 | $content = false, |
|
| 26 | AttributesFactoryInterface $attributesFactory = null, |
|
| 27 | AttributeFactoryInterface $attributeFactory = null |
|
| 28 | ) { |
|
| 29 | /** @var AttributeFactoryInterface $attributeFactory */ |
|
| 30 | $attributeFactory = null === $attributeFactory? |
|
| 31 | (new \ReflectionClass(AttributeFactory::class))->newInstance(): |
|
| 32 | $attributeFactory; |
|
| 33 | ||
| 34 | /** @var AttributesFactoryInterface $attributesFactory */ |
|
| 35 | $attributesFactory = null === $attributesFactory ? |
|
| 36 | (new \ReflectionClass(AttributesFactory::class))->newInstance(): |
|
| 37 | $attributesFactory; |
|
| 38 | ||
| 39 | /** @var AttributesInterface $attributes */ |
|
| 40 | $attributes = ($attributesFactory)::build($attributes, $attributeFactory); |
|
| 41 | ||
| 42 | return new Tag($attributes, $name, $content); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * {@inheritdoc} |
|
| @@ 19-42 (lines=24) @@ | ||
| 16 | /** |
|
| 17 | * {@inheritdoc} |
|
| 18 | */ |
|
| 19 | public static function build( |
|
| 20 | $name, |
|
| 21 | array $attributes = [], |
|
| 22 | $content = false, |
|
| 23 | AttributesFactoryInterface $attributesFactory = null, |
|
| 24 | AttributeFactoryInterface $attributeFactory = null |
|
| 25 | ) { |
|
| 26 | /** @var AttributeFactoryInterface $attributeFactory */ |
|
| 27 | $attributeFactory = null === $attributeFactory ? |
|
| 28 | (new \ReflectionClass(AttributeFactory::class))->newInstance(): |
|
| 29 | $attributeFactory; |
|
| 30 | ||
| 31 | if (null === $attributesFactory) { |
|
| 32 | $attributesFactory = new \ReflectionClass(AttributesFactory::class); |
|
| 33 | ||
| 34 | /** @var AttributesFactoryInterface $attributesFactory */ |
|
| 35 | $attributesFactory = $attributesFactory->newInstance(); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** @var AttributesInterface $attributes */ |
|
| 39 | $attributes = ($attributesFactory)::build($attributes, $attributeFactory); |
|
| 40 | ||
| 41 | return new Tag($attributes, $name, $content); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||