Add rewriter reference by priority.

@param array  $rewriterReferences
@param string $taggedServiceId
@param array  $tag

@return array
488610
private function addRewriterReferenceByPriority(array $rewriterReferences, $taggedServiceId, array $tag)
    {
        $priority = (
            array_key_exists(self::TAG_ATTRIBUTE_PRIORITY, $tag)
            ? (int) $tag[self::TAG_ATTRIBUTE_PRIORITY]
            : self::DEFAULT_PRIORITY
        );

        if (!array_key_exists($priority, $rewriterReferences)) {
            $rewriterReferences[$priority] = [];
        }

        $rewriterReferences[$priority][] = $this->referenceFactory->createReference($taggedServiceId);

        return $rewriterReferences;
    }
1293443
public void updateTags(Reference reference, Collection<String> tags) {
		getResourceFactory()
				.getApiResource("/tag/" + reference.toURLFragment())
				.entity(tags, MediaType.APPLICATION_JSON_TYPE).put();
	}
801975
public function setReadPreference($readPreference, array $tags = null)
    {
        if ($tags !== null) {
            $this->mongoCursor->setReadPreference($readPreference, $tags);
        } else {
            $this->mongoCursor->setReadPreference($readPreference);
        }

        $this->readPreference = $readPreference;
        $this->readPreferenceTags = $tags;

        return $this;
    }
689195
private function injectRewritersIntoRegistry(ContainerBuilder $container, array $references)
    {
        $registryDefinition = $container
            ->getDefinition(ServiceNames::BUNDLE_CONFIGURATION_SERVICE_DEFINITION_REWRITER_REGISTRY);

        $arguments = $registryDefinition->getArguments();

        $arguments[0] = $references;

        $registryDefinition->setArguments($arguments);
    }
756274
public function setTags($tags)
    {
        $this->tags = [];
        $this->ref = null;

        if (is_array($tags)) {
            foreach ($tags as $tag) {
                $this->addTag($tag);
            }
        } else {
            $this->addTag($tags);
        }

        return $this;
    }
262219
public function setReadPreference(?string $readPreference, array $tags) : void
    {
        $this->readPreference     = $readPreference;
        $this->readPreferenceTags = $tags;
    }
1035400
protected function addFosterTag(Tag $tag, Tag $fosterTag)
	{
		list($childPos, $childPrio) = $this->getMagicStartCoords($tag->getPos() + $tag->getLen());

		// Add a 0-width copy of the parent tag after this tag and make it depend on this tag
		$childTag = $this->addCopyTag($fosterTag, $childPos, 0, $childPrio);
		$tag->cascadeInvalidationTo($childTag);
	}
466840
private function configureConsumer(Definition $definition, array $tag, array $references)
    {
        if (isset($tag['method'])) {

            if (isset($tag['bulk']) && $tag['bulk']) {
                $definition->addMethodCall($tag['method'], array($references));
            } else {
                foreach ($references as $name => $service) {
                    $definition->addMethodCall($tag['method'], array($service, $name));
                }
            }

        } else {

            if (isset($tag['bulk']) && !$tag['bulk']) {
                foreach ($references as $service) {
                    $definition->addArgument($service);
                }
            } else {
                $definition->addArgument($references);
            }
        }
    }
531047
public function tagWithTagIds($tag_ids = [])
    {
        if (count($tag_ids) <= 0) {
            return;
        }

		$model = static::$taggingUtility->tagModelString();
		$tag_names = $model::byTagIds($tag_ids)->lists('name')->all();

		$this->retag($tag_names);
    }
1222631
public static function patchTags($ids, $tag)
    {
        assert(is_array($ids) || $ids === 'all');
        $fields = [
            'action' => 'reassign_tag',
            'data' => [
                'subscribers' => $ids,
                'tag' => $tag
            ]
        ];
        Yii::$app->mailtankClient->sendRequest(
            self::ENDPOINT,
            json_encode($fields),
            'patch'
        );

        return true;
    }
389945
public function setReadPreference($readPreference, array $tags = null)
    {
        if (isset($tags)) {
            return $this->mongoCollection->setReadPreference($readPreference, $tags);
        }

        return $this->mongoCollection->setReadPreference($readPreference);
    }
612311
public void createTags(Reference reference, String... tags) {
		createTags(reference, Arrays.asList(tags));
	}
508443
private function getServiceList($tag = null)
    {
        if ($tag) {
            return $this->getServiceListByTag($tag);
        }

        $services = [];
        $serviceDefinitions = $this->container->getDefinitions();

        foreach ($serviceDefinitions as $serviceId => $serviceDefinition) {
            $services[] = [$serviceId, $serviceDefinition->getClass()];
        }
        usort($services, [$this, 'compareService']);
        return $services;
    }
701400
public function registerService($serviceName, ConfigObject $config, $overwrite = false)
    {
        /**
         * Check if service instance already exists
         */
        if ($this->registeredServices->keyExists($serviceName) && !$overwrite) {
            throw new ServiceManagerException(ServiceManagerException::SERVICE_NAME_ALREADY_EXISTS, [$serviceName]);
        }
        $this->registeredServices[$serviceName] = $config;

        if ($this->instantiatedServices->keyExists($serviceName) && $overwrite) {
            $this->instantiatedServices->removeKey($serviceName);
        }

        /**
         * Tagify service
         */
        foreach ($config->get('Tags', []) as $tag) {
            $tagServices = $this->taggedServices->key($tag, [], true);
            $tagServices[] = $serviceName;
            $this->taggedServices->key($tag, $tagServices);
        }

        return $this;
    }
481230
protected function addResolvers(ContainerBuilder $container, string $service, string $tag)
    {
        if (!$container->has($service)) {
            return;
        }

        $definition = $container->getDefinition($service);
        $taggedServices = $container->findTaggedServiceIds($tag);

        foreach ($taggedServices as $id => $tags) {
            foreach ($tags as $attributes) {
                $definition->addMethodCall('addResolver', [
                    new Reference($id)
                ]);
            }
        }
    }
651123
private function redirect($redirect, int $tagID, int $postTypeID)
    {
        $adminPrefix = Config::get('project')['adminPrefix'];
        if($redirect == 'save') {
            $redirectUrl = "/".$adminPrefix."/".App::getLocale()."/post-type/tagupdate/".$tagID;
            $view = 'tagupdate';
            $redirectID = $tagID;
        }else if($redirect == 'close') {
            $redirectUrl = "/".$adminPrefix."/".App::getLocale()."/post-type/taglist/".$postTypeID;
            $view = 'taglist';
            $redirectID = $postTypeID;
        }else{
            $redirectUrl = "/".$adminPrefix."/".App::getLocale()."/post-type/tagcreate/".$postTypeID;
            $view = 'tagcreate';
            $redirectID = $postTypeID;
        }

        return[
            "url" => $redirectUrl,
            "view" => $view,
            "id" => $redirectID
        ];
    }
1310268
public final void rewriteXml(
        Writer out,
        Node xmlDoc,
        String aloneTags[]
    ) {
        rewriteXml(
            out,
            xmlDoc,
            aloneTags,
            false
        );
    }