| 1 | <?php |
||
| 2 | namespace Yoanm\SymfonyJsonRpcHttpServerDoc\DependencyInjection; |
||
| 3 | |||
| 4 | use Symfony\Component\Config\Definition\Processor; |
||
| 5 | use Symfony\Component\Config\FileLocator; |
||
| 6 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
||
| 7 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
|
1 ignored issue
–
show
|
|||
| 8 | use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; |
||
| 9 | use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
||
| 10 | use Symfony\Component\DependencyInjection\Reference; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Class JsonRpcHttpServerDocExtension |
||
| 14 | */ |
||
| 15 | class JsonRpcHttpServerDocExtension implements ExtensionInterface, CompilerPassInterface |
||
| 16 | { |
||
| 17 | /** Tags */ |
||
| 18 | /** Use this tag to inject your custom documentation creator */ |
||
| 19 | const DOC_PROVIDER_TAG = 'json_rpc_server_doc.doc_provider'; |
||
| 20 | |||
| 21 | // Extension identifier (used in configuration for instance) |
||
| 22 | const EXTENSION_IDENTIFIER = 'json_rpc_http_server_doc'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * {@inheritdoc} |
||
| 26 | */ |
||
| 27 | 6 | public function load(array $configs, ContainerBuilder $container) |
|
| 28 | { |
||
| 29 | 6 | $this->compileAndProcessConfigurations($configs, $container); |
|
| 30 | |||
| 31 | 6 | $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 32 | |||
| 33 | 6 | $loader->load('services.sdk.infra.yaml'); |
|
| 34 | 6 | $loader->load('services.private.yaml'); |
|
| 35 | 6 | $loader->load('services.public.yaml'); |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * {@inheritdoc} |
||
| 40 | */ |
||
| 41 | 6 | public function process(ContainerBuilder $container) |
|
| 42 | { |
||
| 43 | 6 | $this->appendDocumentationProvider($container); |
|
| 44 | } |
||
| 45 | |||
| 46 | |||
| 47 | /** |
||
| 48 | * {@inheritdoc} |
||
| 49 | */ |
||
| 50 | 7 | public function getNamespace() |
|
| 51 | { |
||
| 52 | 7 | return 'http://example.org/schema/dic/'.$this->getAlias(); |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * {@inheritdoc} |
||
| 57 | */ |
||
| 58 | 1 | public function getXsdValidationBasePath() |
|
| 59 | { |
||
| 60 | 1 | return ''; |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * {@inheritdoc} |
||
| 65 | */ |
||
| 66 | 7 | public function getAlias() |
|
| 67 | { |
||
| 68 | 7 | return self::EXTENSION_IDENTIFIER; |
|
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @param ContainerBuilder $container |
||
| 73 | */ |
||
| 74 | 6 | private function appendDocumentationProvider(ContainerBuilder $container) |
|
| 75 | { |
||
| 76 | 6 | $docProviderDefinition = $container->getDefinition('json_rpc_http_server_doc.finder.normalized_doc'); |
|
| 77 | 6 | $docCreatorServiceList = $container->findTaggedServiceIds(self::DOC_PROVIDER_TAG); |
|
| 78 | 6 | foreach (array_keys($docCreatorServiceList) as $serviceId) { |
|
| 79 | 6 | $docProviderDefinition->addMethodCall('addProvider', [new Reference($serviceId)]); |
|
| 80 | } |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @param array $configs |
||
| 85 | * @param ContainerBuilder $container |
||
| 86 | */ |
||
| 87 | 6 | private function compileAndProcessConfigurations(array $configs, ContainerBuilder $container) |
|
| 88 | { |
||
| 89 | 6 | $configuration = new Configuration(); |
|
| 90 | 6 | $config = (new Processor())->processConfiguration($configuration, $configs); |
|
| 91 | |||
| 92 | 6 | $httpEndpointPath = $config['endpoint']; |
|
| 93 | |||
| 94 | 6 | $container->setParameter(self::EXTENSION_IDENTIFIER.'.http_endpoint_path', $httpEndpointPath); |
|
| 95 | } |
||
| 96 | } |
||
| 97 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths