Factory method for easy instantiation.

@param string[] $additionalTags
19751
public static function createInstance(array $additionalTags = []): self
    {
        $fqsenResolver = new FqsenResolver();
        $tagFactory = new StandardTagFactory($fqsenResolver);
        $descriptionFactory = new DescriptionFactory($tagFactory);

        $tagFactory->addService($descriptionFactory);
        $tagFactory->addService(new TypeResolver($fqsenResolver));

        $docBlockFactory = new self($descriptionFactory, $tagFactory);
        foreach ($additionalTags as $tagName => $tagHandler) {
            $docBlockFactory->registerTagHandler($tagName, $tagHandler);
        }

        return $docBlockFactory;
    }
235582
public function addExtra($extra)
    {
        $functions = $extra->getFunctions();
        if ($functions && is_array($functions)) {
            foreach ($functions as $function) {
                $this->twig->addFunction($function);
            }
        }
        $filters = $extra->getFilters();
        if ($filters && is_array($filters)) {
            foreach ($filters as $filter) {
                $this->twig->addFilter($filter);
            }
        }
        $globals = $extra->getGlobals();
        if ($globals && is_array($globals)) {
            foreach ($globals as $key => $value) {
                $this->twig->addGlobal($key, $value);
            }
        }
    }
1099194
public function fromServices($providerName, array $additionalConfigKeys = [])
    {
        $this->providerName = $providerName;
        $this->getConfigFromServicesArray($providerName);

        $this->additionalConfigKeys = $additionalConfigKeys = array_unique($additionalConfigKeys + ['guzzle']);

        return new Config(
            $this->getFromServices('client_id'),
            $this->getFromServices('client_secret'),
            $this->getFromServices('redirect'),
            $this->getConfigItems($additionalConfigKeys, function ($key) {
                return $this->getFromServices(strtolower($key));
            })
        );
    }
83677
protected function internalCreateTag($single = true, $name, $column1 = null, $column2 = null, $_ = null)
    {
        // Create constructor arguments
        $arguments = func_get_args();
        $single    = array_shift($arguments);

        array_unshift($arguments, $this->maxColumnLengths);

        // Remove null values
        foreach ($arguments as $index => $argument) {
            if ($argument === null) {
                unset($arguments[$index]);
            }
        }

        $arguments = array_values($arguments);
        $tag       = $this->tagPrototype->newInstanceArgs($arguments);

        // Create new tag
        if ($single === true) {
            $this->tags->offsetSet($arguments[1], $tag);
        } else {
            $this->tags->append($tag);
        }

        return $this;
    }
135513
public function addTag($tagAttributes = array())
	{
		if (is_string($tagAttributes)) {
			$tagAttributes = array('tag' => $tagAttributes);
		}
		$tagAttributes['tag'] = $this->formatTag($tagAttributes['tag']);
		if (!array_key_exists('size', $tagAttributes)) {
			$tagAttributes = array_merge($tagAttributes, array('size' => 1));
		}
		if (!array_key_exists('tag', $tagAttributes)) {
			return false;
		}
		$tag = $tagAttributes['tag'];
		if (empty($this->_tagsArray[$tag])) {
			$this->_tagsArray[$tag] = array();
		}
		if (!empty($this->_tagsArray[$tag]['size']) && !empty($tagAttributes['size'])) {
			$tagAttributes['size'] = ($this->_tagsArray[$tag]['size'] + $tagAttributes['size']);
		} elseif (!empty($this->_tagsArray[$tag]['size'])) {
			$tagAttributes['size'] = $this->_tagsArray[$tag]['size'];
		}
		$this->_tagsArray[$tag] = $tagAttributes;
		//$this->addAttributes($tagAttributes);
		return $this->_tagsArray[$tag];
	}
721730
public static function invalidateTags(array $tags)
    {
        $cache = self::getCacheService()->user();
        if ($cache instanceof TagAwareAdapterInterface) {
            $cache->invalidateTags($tags);
        }
    }
1317302
public function tags($names)
    {
        if (! method_exists($this->store, 'tags')) {
            throw new \BadMethodCallException('Class '.get_class($this->store).' does not have a method \'tags\'');
        }

        return new TaggedCache($this->store, new TagSet($this->store, is_array($names) ? $names : func_get_args()));
    }
1332862
public function specifyAdditionalParameters(array $data, array $additionalParams): array
    {
        foreach ($additionalParams as $param) {
            $method = 'get' . ucfirst($param);
            if (method_exists($this, $method)) {
                $value = $this->{$method}();
                if ($value) {
                    $data[$param] = $value;
                }
            }
        }
        return $data;
    }
770985
public function tag($tags)
    {
        $tags = array_slice((array)$tags, 0, 3);
        foreach ($tags as $tag) {
            $this->messageBuilder->addTag($tag);
        }

        return $this;
    }
31702
public function tags(Tags $tags = null)
    {
        if (is_null($tags)) {
            return $this->tags;
        }

        $this->tags = $tags;

        return $this;
    }
50653
public static function addAdditionalNodeIDPerObject( $contentObjectID, $additionalNodeID )
    {
        if ( !isset( self::$additionalNodeIDsPerObject[$contentObjectID] ) )
        {
            self::$additionalNodeIDsPerObject[$contentObjectID] = array();
        }

        self::$additionalNodeIDsPerObject[$contentObjectID][] = $additionalNodeID;
    }
152265
public function replace($tags)
    {
        foreach ($tags as $tag) {
            if (!$tag instanceof Tag) {
                throw InvalidTagException::build([], ['invalidTag' => $tag]);
            }
        }

        parent::replace($tags);
    }
1100492
public function getListByIds($ids, array $additionalFields = array())
    {
        return $this->getInternalList(
            'region/get',
            'Region',
            array(
                'id' => self::getArray($ids),
                'fields' => self::getArray($additionalFields)
            )
        );
    }
811349
public function initFields ($extra = array())
    {
        $this->tenant = $extra['tenant'];
        
        $this->fields['tag_key'] = new Pluf_Form_Field_Varchar(
                array(
                        'required' => false,
                        'label' => __('key')
                ));
        $this->fields['tag_value'] = new Pluf_Form_Field_Varchar(
                array(
                        'required' => false,
                        'label' => __('value')
                ));
        $this->fields['tag_title'] = new Pluf_Form_Field_Varchar(
                array(
                        'required' => false,
                        'label' => __('title')
                ));
        
        $this->fields['tag_description'] = new Pluf_Form_Field_Varchar(
                array(
                        'required' => false,
                        'label' => __('description')
                ));
    }
1048896
public static function makeTagsArray($tags)
    {
        if (is_array($tags)) {
            $tags = array_unique(array_filter($tags));
        } else if (is_string($tags)) {
            $tags = preg_split('#[' . preg_quote(',', '#' ) . ']#', $tags, null, PREG_SPLIT_NO_EMPTY);
        } else {
            $tags = $tags->toArray();
        }

        $tagSet = [];
        foreach ($tags as $tag)
            $tagSet[] = Tag::taggify($tag);

        return $tagSet;
    }
614134
public function add_related_tags($tagnames) {
        $context = context_system::instance();
        $tagobjects = static::create_if_missing($this->tagcollid, $tagnames);

        $currenttags = static::get_item_tags('core', 'tag', $this->id);

        foreach ($tagobjects as $name => $tag) {
            foreach ($currenttags as $currenttag) {
                if ($currenttag->name === $name) {
                    continue 2;
                }
            }
            $this->add_instance('core', 'tag', $tag->id, $context, 0);
            $tag->add_instance('core', 'tag', $this->id, $context, 0);
            $currenttags[] = $tag;
        }
    }
1332949
public function findOrCreate(array $tags)
    {
        $foundTags = $this->findWhereIn(['tag', $tags]);

        $returnTags = [];

        if ($foundTags) {
            foreach ($foundTags as $tag) {
                $pos = array_search($tag->tag, $tags);

                // Add returned tags to array
                if ($pos !== false) {
                    $returnTags[] = $tag;
                    unset($tags[$pos]);
                }
            }
        }

        // Add remainings tags as new
        foreach ($tags as $tag) {
            $returnTags[] = $this->create([
                'tag' => $tag,
                'slug' => Str::slug($tag),
            ]);
        }

        return $returnTags;
    }