@@ 12-44 (lines=33) @@ | ||
9 | use Spiechu\SymfonyCommonsBundle\Service\SchemaValidator\SchemaValidatorFactoryInterface; |
|
10 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
11 | ||
12 | class JsonCheckSchemaSubscriber extends AbstractCheckSchemaSubscriber implements EventSubscriberInterface |
|
13 | { |
|
14 | /** |
|
15 | * @var JsonSchemaValidatorFactory |
|
16 | */ |
|
17 | protected $jsonSchemaValidatorFactory; |
|
18 | ||
19 | /** |
|
20 | * @param JsonSchemaValidatorFactory $jsonSchemaValidatorFactory |
|
21 | */ |
|
22 | public function __construct(JsonSchemaValidatorFactory $jsonSchemaValidatorFactory) |
|
23 | { |
|
24 | $this->jsonSchemaValidatorFactory = $jsonSchemaValidatorFactory; |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * {@inheritdoc} |
|
29 | */ |
|
30 | public static function getSubscribedEvents(): array |
|
31 | { |
|
32 | return [ |
|
33 | Events::getCheckSchemaEventNameFor('json') => 'validateSchema', |
|
34 | ]; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * {@inheritdoc} |
|
39 | */ |
|
40 | protected function getSchemaValidatorFactory(): SchemaValidatorFactoryInterface |
|
41 | { |
|
42 | return $this->jsonSchemaValidatorFactory; |
|
43 | } |
|
44 | } |
|
45 |
@@ 12-44 (lines=33) @@ | ||
9 | use Spiechu\SymfonyCommonsBundle\Service\SchemaValidator\XmlSchemaValidatorFactory; |
|
10 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
11 | ||
12 | class XmlCheckSchemaSubscriber extends AbstractCheckSchemaSubscriber implements EventSubscriberInterface |
|
13 | { |
|
14 | /** |
|
15 | * @var XmlSchemaValidatorFactory |
|
16 | */ |
|
17 | protected $xmlSchemaValidatorFactory; |
|
18 | ||
19 | /** |
|
20 | * @param XmlSchemaValidatorFactory $xmlSchemaValidatorFactory |
|
21 | */ |
|
22 | public function __construct(XmlSchemaValidatorFactory $xmlSchemaValidatorFactory) |
|
23 | { |
|
24 | $this->xmlSchemaValidatorFactory = $xmlSchemaValidatorFactory; |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * {@inheritdoc} |
|
29 | */ |
|
30 | public static function getSubscribedEvents(): array |
|
31 | { |
|
32 | return [ |
|
33 | Events::getCheckSchemaEventNameFor('xml') => 'validateSchema', |
|
34 | ]; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * {@inheritdoc} |
|
39 | */ |
|
40 | protected function getSchemaValidatorFactory(): SchemaValidatorFactoryInterface |
|
41 | { |
|
42 | return $this->xmlSchemaValidatorFactory; |
|
43 | } |
|
44 | } |
|
45 |