Called when we need to setup a registration
If there is a registration that works - then we set the handler
Otherwise, we set it to null

@param SubscriptionGroup $subscriptionGroup
515124
private function setupStateHandlerRegistration(SubscriptionGroup $subscriptionGroup)
    {
        /** @var StateHandlerRegistration $stateHandlerRegistration */
        foreach ($this->stateHandlerRegistrations as $stateHandlerRegistration) {
            if ($stateHandlerRegistration->handlesStateFor($subscriptionGroup)) {
                $this->stateHandlerMap->attach($subscriptionGroup, $stateHandlerRegistration);
                return;
            }
        }
        $this->stateHandlerMap->attach($subscriptionGroup, null);
    }
141813
public function it_should_have_listener_after_adding_subscriber(MockSubscriber $sub)
    {
        $events = [
            'test1' => [
                [
                    [
                        $sub,
                        'method1'
                    ],
                    [
                        $sub,
                        'method2'
                    ]
                ]
            ]
        ];
        $this->getListeners()
             ->shouldHaveCount(0);
        $sub->getSubscribedEvents()
            ->willReturn($events);
        $this->addSubscriber($sub);
        $this->getListeners()
             ->shouldHaveCount(1);
        $this->getListeners()
             ->shouldHaveKey('test1');
    }
444306
private function addGroup($group)
	{
		if($group != null)
		{
			if($this->_groups == null)
				$this->_groups = array();
			$this->_groups[] = $group;
		}
	}
430237
protected function registerSubscribeWorkerService(){

        $this->app->bind('designpond\newsletter\Newsletter\Worker\SubscriptionWorkerInterface', function()
        {
            return new \designpond\newsletter\Newsletter\Worker\SubscriptionWorker(
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterInterface'),
                \App::make('designpond\newsletter\Newsletter\Repo\NewsletterUserInterface'),
                \App::make('designpond\newsletter\Newsletter\Worker\MailjetServiceInterface')
            );
        });
    }
986953
public function hasRegistrationForm($group)
    {
        try {
            $this->connector->get('registrarManager', 'getApplicationForm', array(
                'group' => $group->getId(),
            ));
            return true;
        } catch (\Exception $exception) {
            return false;
        }
    }
625373
public function attachSubscriber(Subscriber $subscriber)
	{
		$listeners = $subscriber->getRegisteredEvents();
		foreach($listeners as $id => $listener) {
			EventManager::listenTo($id, array($subscriber, $listener));
		}
	}
1195107
protected function processUnsubscribe(Session $session, UnsubscribeMessage $msg)
    {
        $subscription = false;
        // should probably be more efficient about this - maybe later
        /** @var SubscriptionGroup $subscriptionGroup */
        foreach ($this->subscriptionGroups as $subscriptionGroup) {
            $result = $subscriptionGroup->processUnsubscribe($session, $msg);

            if ($result !== false) {
                $subscription = $result;
            }
        }

        if ($subscription === false) {
            $errorMsg = ErrorMessage::createErrorMessageFromMessage($msg);
            $session->sendMessage($errorMsg->setErrorURI('wamp.error.no_such_subscription'));

            return;
        }
    }
455796
protected function lazyLoad(string $eventType): void
    {
        if (isset($this->serviceIds[$eventType])) {
            foreach ($this->serviceIds[$eventType] as $args) {
                list($serviceId, $method, $priority) = $args;
                $service = $this->container->get($serviceId);
                $key = sprintf('%s.%s', $serviceId, $method);
                if (!isset($this->services[$eventType][$key])) {
                    $this->addHandler($eventType, [$service, $method], $priority);
                } elseif ($service !== $this->services[$eventType][$key]) {
                    parent::removeHandler($eventType, [$this->services[$eventType][$key], $method]);
                    $this->addHandler($eventType, [$service, $method], $priority);
                }
                $this->services[$eventType][$key] = $service;
            }
        }
    }
904507
function setEndPointGroup($endPointGroup) {
        if (strlen($this->getEndPoint()) > 0)
        {
            throw new RuntimeException(
                "End point has been already set. You can set either end point or end point group."
            );
        }

        $this->endPointGroup = (int) $endPointGroup;
    }
112412
public void initRegistryEntry(String groupName, String entryName) throws RepositoryException,
      RepositoryConfigurationException
   {

      String relPath = EXO_REGISTRY + "/" + groupName + "/" + entryName;
      for (RepositoryEntry repConfiguration : repConfigurations())
      {
         String repName = repConfiguration.getName();
         SessionProvider sysProvider = SessionProvider.createSystemProvider();
         Node root = session(sysProvider, repositoryService.getRepository(repName)).getRootNode();
         if (!root.hasNode(relPath))
         {
            root.addNode(relPath, EXO_REGISTRYENTRY_NT);
            root.save();
         }
         else
         {
            LOG.info("The RegistryEntry " + relPath + "is already initialized on repository " + repName);
         }
         sysProvider.close();
      }
   }
563390
protected function registerSubscribeService(){

        $this->app->bind('designpond\newsletter\Newsletter\Repo\NewsletterSubscriptionInterface', function()
        {
            return new \designpond\newsletter\Newsletter\Repo\NewsletterSubscriptionEloquent(
                new \designpond\newsletter\Newsletter\Entities\Newsletter_subscriptions
            );
        });
    }
54036
public function responseGroup($responseGroup = null)
  {
    if (null === $responseGroup)
    {
      return $this->responseConfig['responseGroup'];
    }

    $this->responseConfig['responseGroup'] = $responseGroup;

    return $this;
  }
763052
public function create($data, $subscriptionId = null)
    {
        if (isset($subscriptionId)) {
            return $this->client()->put($data, 'subscriptions/{subscriptionId}', ['subscriptionId' => $subscriptionId]);
        }

        return $this->client()->post($data, 'subscriptions');
    }
715333
private function addGroup(MenuGroup $group)
    {
        if (!$this->hasGroup($group->getName())) {
            $this->groups[$group->getName()] = $group;
        }
    }
325833
public function register($subscribers)
    {
        is_array($subscribers) || $subscribers = [$subscribers];

        foreach ($subscribers as $subscriber) {
            $this->registerSubscriber($subscriber);
        }
    }
755149
public function it_should_have_listener_after_adding_service_subscriber(MockServiceSubscriber $sub)
    {
        $events = [
            'test1' => [
                [
                    [
                        'containerID1',
                        'method1'
                    ],
                    [
                        'containerID1',
                        'method2'
                    ]
                ]
            ],
            'test2' => [
                [
                    [
                        'containerID1',
                        'method1'
                    ],
                    [
                        'containerID1',
                        'method2'
                    ]
                ]
            ]
        ];
        $this->getServiceListeners()
             ->shouldHaveCount(0);
        $sub->getServiceSubscribedEvents()
            ->willReturn($events);
        $this->addServiceSubscriber($sub);
        $this->getServiceListeners()
             ->shouldHaveCount(2);
        $this->getServiceListeners()
             ->shouldHaveKey('test1');
        $this->getServiceListeners()
             ->shouldHaveKey('test2');
    }
180924
public function triggerSubscriptionCustomActivated(SubscriptionInterface $subscription, $note)
    {
        $this->trigger(self::ON_SUBSCRIPTION_CUSTOM_ACTIVATED, $subscription, $note);
    }