| 1 | <?php |
||
| 14 | class FacileCrossbarHTTPPublisherExtension extends Extension |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * {@inheritDoc} |
||
| 18 | */ |
||
| 19 | 1 | public function load(array $config, ContainerBuilder $container) |
|
| 20 | { |
||
| 21 | 1 | $configuration = new Configuration(); |
|
| 22 | 1 | $config = $this->processConfiguration($configuration, $config); |
|
| 23 | |||
| 24 | 1 | $this->loadConnections($container, $config); |
|
| 25 | 1 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Registers publisher services in container |
||
| 29 | * @param ContainerBuilder $container |
||
| 30 | * @param array $config |
||
| 31 | */ |
||
| 32 | 1 | private function loadConnections(ContainerBuilder $container, array $config) |
|
| 33 | { |
||
| 34 | 1 | $factoryName = $this->addFactoryToContainer($container); |
|
| 35 | 1 | $genericDefinition = new Definition('Facile\CrossbarHTTPPublisherBundle\Publisher\Publisher'); |
|
| 36 | 1 | if (method_exists($genericDefinition, 'setFactory')) { |
|
| 37 | 1 | $genericDefinition->setFactory([new Reference($factoryName), 'createPublisher']); |
|
| 38 | } else { |
||
| 39 | $genericDefinition->setFactoryService($factoryName); |
||
|
1 ignored issue
–
show
|
|||
| 40 | $genericDefinition->setFactoryMethod('createPublisher'); |
||
|
1 ignored issue
–
show
|
|||
| 41 | } |
||
| 42 | |||
| 43 | 1 | foreach ($config['connections'] as $key => $connection) { |
|
| 44 | 1 | $protocol = $connection['protocol']; |
|
| 45 | 1 | $host = $connection['host']; |
|
| 46 | 1 | $port = $connection['port']; |
|
| 47 | 1 | $path = $connection['path']; |
|
| 48 | 1 | $auth_key = $connection['auth_key']; |
|
| 49 | 1 | $auth_secret = $connection['auth_secret']; |
|
| 50 | 1 | $hostname = $connection['hostname']; |
|
| 51 | 1 | $ignoreSsl = $connection['ssl_ignore']; |
|
| 52 | |||
| 53 | 1 | if ($path[0] !== '/') { |
|
| 54 | $path = '/' . $path; |
||
| 55 | } |
||
| 56 | |||
| 57 | 1 | $definition = clone $genericDefinition; |
|
| 58 | 1 | $definition->setArguments([$protocol, $host, $port, $path, $auth_key, $auth_secret, $hostname, $ignoreSsl]); |
|
| 59 | 1 | $container->setDefinition(sprintf('facile.crossbar.publisher.%s', $key), $definition); |
|
| 60 | } |
||
| 61 | 1 | } |
|
| 62 | |||
| 63 | /** |
||
| 64 | * @param ContainerBuilder $container |
||
| 65 | * @return string The factory service name inside the container |
||
| 66 | */ |
||
| 67 | 1 | private function addFactoryToContainer(ContainerBuilder $container) |
|
| 76 | } |
||
| 77 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.