@param SubscriberInterface $subscriber

@return array
325833
public function register($subscribers)
    {
        is_array($subscribers) || $subscribers = [$subscribers];

        foreach ($subscribers as $subscriber) {
            $this->registerSubscriber($subscriber);
        }
    }
359720
public function visit($value, ?VisitorInterface $subVisitor = null)
    {
        if ($subVisitor === null) {
            throw new RuntimeException('Implementation requires sub-visitor');
        }

        return [
            'id' => $value->getId(),
            'definition_identifier' => $value->getDefinition()->getIdentifier(),
            'is_translatable' => $value->isTranslatable(),
            'is_always_available' => $value->isAlwaysAvailable(),
            'main_locale' => $value->getMainLocale(),
            'available_locales' => $value->getAvailableLocales(),
            'view_type' => $value->getViewType(),
            'item_view_type' => $value->getItemViewType(),
            'name' => $value->getName(),
            'placeholders' => iterator_to_array($this->visitPlaceholders($value, $subVisitor)),
            'parameters' => $this->visitParameters($value, $subVisitor),
            'configuration' => iterator_to_array($this->visitConfiguration($value, $subVisitor)),
            'collections' => iterator_to_array($this->visitCollections($value, $subVisitor)),
        ];
    }
191529
public function registerSubscriptions(EventDispatcher $dispatcher)
    {
        if ($this->registered) {
            throw new \RuntimeException('Cannot register debug toolbar subscriptions when already registered.');
        }

        foreach ($this->toolbar->getExtensions() as $extension) {
            if ( ! $extension instanceof EventSubscriberInterface) {
                continue;
            }

            $dispatcher->addSubscriber($extension);
        }

        $this->registered = true;
    }
450864
public function parseResponse(ResponseInterface $response)
    {
        $body = $response->getBody()->getContents();
        return [
            'code' => $response->getStatusCode(),
            'headers' => $response->getHeaders(),
            'body' => ($this->isValidJson($body)) ? json_decode($body,
                true) : $body,
        ];
    }
1308644
public static function prepareHeaders(ResponseInterface $response): array
    {
        $preparedHeaders = [];
        $statusHeader = rtrim(self::generateStatusLine($response), "\r\n");

        $preparedHeaders[] = $statusHeader;
        $headers = $response->getHeaders();
        if ($headers instanceof Headers) {
            $preparedHeaders = array_merge($preparedHeaders, $headers->getPreparedValues());
        } else {
            foreach (array_keys($headers) as $name) {
                $preparedHeaders[] = $response->getHeaderLine($name);
            }
        }

        return $preparedHeaders;
    }
543822
public function getSubscriberFields($subscriber, $offset = 0, $limit = 100)
	{
		$fields = [];
		foreach ($this->client->get("subscribers/{$subscriber}/fields?offset={$offset}&limit={$limit}") as $subscriber) {
			$fields[] = new Resources\SubscriberField($this, $subscriber);
		}
		return $fields;
	}
590746
public function subscriptions(Subscriber $subscriber): Collection
    {
        // A subscription can be fired w/out a request so we must make
        // sure the schema has been generated.
        $this->graphQL->prepSchema();

        return (new Collection($subscriber->query->definitions))
            ->filter(function (Node $node): bool {
                return $node instanceof OperationDefinitionNode;
            })
            ->filter(function (OperationDefinitionNode $node): bool {
                return $node->operation === 'subscription';
            })
            ->flatMap(function (OperationDefinitionNode $node) {
                return (new Collection($node->selectionSet->selections))
                    ->map(function (FieldNode $field): string {
                        return $field->name->value;
                    })
                    ->toArray();
            })
            ->map(function ($subscriptionField): GraphQLSubscription {
                return Arr::get(
                    $this->subscriptions,
                    $subscriptionField,
                    new NotFoundSubscription
                );
            });
    }
443897
public function removeSubscriber(EventSubscriberInterface $subscriber)
	{
		foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
			if (\is_array($params) && \is_array($params[0])) {
				foreach ($params as $listener) {
					$this->detach($eventName, [$subscriber, $listener[0]]);
				}
			} else {
				$this->detach($eventName, [$subscriber, \is_string($params) ? $params : $params[0]]);
			}
		}

		return $this;
	}
1266866
public function visit($value, ?VisitorInterface $subVisitor = null)
    {
        if ($subVisitor === null) {
            throw new RuntimeException('Implementation requires sub-visitor');
        }

        return [
            'identifier' => $value->getIdentifier(),
            'blocks' => iterator_to_array($this->visitBlocks($value, $subVisitor)),
        ];
    }
612021
public function isSubscribed(AnEventSubscriberInterface $subscriber)
    {
        $handle = $subscriber->getHandle();
        return isset($this->_subscribers[$handle]);
    }
957855
public function removeSubscriber(EventSubscriberInterface $subscriber)
    {
        if ($subscriber instanceof HttpClientEventSubscriber) {
            $subscriber->attachHttpClient($this);
        }

        $this->eventDispatcher->removeSubscriber($subscriber);
    }
501654
public function subscribed($subscriber)
    {
        if ($subscriber->id && $this->subscriberIds->offsetExists($subscriber->id)) {
            return true;
        }

        return false;
    }
35356
public function updateSubscriber(Subscriber $subscriber)
		{
			$form_data = array(
				'list_id'        => $subscriber->getListId(),
				'identity_field' => 'email',
				'data'           => 'email,first,last,address_1,address_2,city,state,zip,country,phone,fax,company^'
					. $subscriber->getEmail() . ','
					. $subscriber->getFirstName() . ','
					. $subscriber->getLastName() . ','
					. $subscriber->getAddress1() . ','
					. $subscriber->getAddress2() . ','
					. $subscriber->getCity() . ','
					. $subscriber->getState() . ','
					. $subscriber->getZip() . ','
					. $subscriber->getCountry() . ','
					. $subscriber->getPhone() . ','
					. $subscriber->getFax() . ','
					. $subscriber->getCompany()
			);
			$xml = $this->call('update', $form_data);

			return trim($xml[1]);
		}
99148
public function getSubscribers($event)
    {
        $result = array();
        if(isset($this->__listeners[$event])) {
            $result = $this->__listeners[$event];
        }

        return $result;
    }
1283015
public function setSubscribers(array $subscribers): NodeInterface
    {
        $this->_subscribers = [];

        foreach ($subscribers as $subscriber) {
            $this->addSubscriber($subscriber);
        }

        return $this;
    }
734382
public function addSubscriber(SubscriberInterface $instance) {

		// make sure that an already registered object is removed before re-registering
		
		$this->removeSubscriber($instance);

		// register object hash

		$this->registeredHashes[] = spl_object_hash($instance);

		// parameters contain at least a method name; additionally a priority can be added
		
		foreach($instance::getEventsToSubscribe() as $eventName => $parameters) {

			$parameters	= (array) $parameters;
			$methodName	= array_shift($parameters); 

			if(count($parameters)) {
				$priority = (int) $parameters[0];
			}
			else {
				$priority = 0;
			}

			if(!isset($this->registry[$eventName]) || !isset($this->registry[$eventName][$priority])) {
				$this->registry[$eventName][$priority] = [];
			}

			$this->registry[$eventName][$priority][] = [$instance, $methodName];

			// force re-sort upon next dispatch

			unset ($this->sortedRegistry[$eventName]);

		}
		
	}
1068433
public function getAllSubscriptions()
    {
        $limit = RequestInterface::MAX_LIST_LIMIT;
        $offset = 0;
        $subscriptions = [[]];

        while (true) {
            $subscriptionBatch = $this->getSubscriptionsResponse($offset);
            $subscriptions[] = $subscriptionBatch;
            $offset += $limit;
            if (\count($subscriptionBatch) < $limit) {
                break;
            }
        }

        return \array_merge(...$subscriptions);
    }