X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FTestwork%2FEventDispatcher%2FServiceContainer%2FEventDispatcherExtension.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FTestwork%2FEventDispatcher%2FServiceContainer%2FEventDispatcherExtension.php;h=0000000000000000000000000000000000000000;hp=72376dac5fb342fe67a48a1739915fe4964ce001;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/ServiceContainer/EventDispatcherExtension.php b/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/ServiceContainer/EventDispatcherExtension.php deleted file mode 100644 index 72376dac5..000000000 --- a/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/ServiceContainer/EventDispatcherExtension.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Tester\ServiceContainer\TesterExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides event dispatching service. - * - * @author Konstantin Kudryashov - */ -class EventDispatcherExtension implements Extension -{ - /* - * Available services - */ - const DISPATCHER_ID = 'event_dispatcher'; - - /* - * Available extension points - */ - const SUBSCRIBER_TAG = 'event_dispatcher.subscriber'; - - /** - * @var ServiceProcessor - */ - protected $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'events'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadSigintController($container); - $this->loadEventDispatcher($container); - $this->loadEventDispatchingExercise($container); - $this->loadEventDispatchingSuiteTester($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processSubscribers($container); - } - - /** - * Loads sigint controller - * - * @param ContainerBuilder $container - */ - protected function loadSigintController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\EventDispatcher\Cli\SigintController', array( - new Reference(EventDispatcherExtension::DISPATCHER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 9999)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.sigint', $definition); - } - - /** - * Loads event dispatcher. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatcher(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\EventDispatcher\TestworkEventDispatcher'); - $container->setDefinition(self::DISPATCHER_ID, $definition); - } - - /** - * Loads event-dispatching exercise. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingExercise(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise', array( - new Reference(TesterExtension::EXERCISE_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::EXERCISE_WRAPPER_TAG); - $container->setDefinition(TesterExtension::EXERCISE_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Loads event-dispatching suite tester. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingSuiteTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester', array( - new Reference(TesterExtension::SUITE_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::SUITE_TESTER_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::SUITE_TESTER_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Registers all available event subscribers. - * - * @param ContainerBuilder $container - */ - protected function processSubscribers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::SUBSCRIBER_TAG); - $definition = $container->getDefinition(self::DISPATCHER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('addSubscriber', array($reference)); - } - } -}