Регистратор модулей
@param $tag
@param $config
@throws InvalidInterfaceException
@throws ModuleNotFoundException
488592
public function register($tag, $config)
    {
        $className = $config['class'];
        unset($config['class']);
        if (class_exists($className)) {
            $this->tags[$tag] = $className;
            if (isset($config['mount'])) {
                $this->mount($tag, $config['mount']);
            }
            $this->known[$className] = [
                'tagName' => $tag,
                'config'  => $config,
                'location' => dirname((new \ReflectionClass($className))->getFileName())
            ];
        } else {
            throw new ModuleNotFoundException($tag . ': ' . $className);
        }
    }
852117
public function add($tag)
    {
        if (!$tag instanceof TagInterface) {
            throw new \InvalidArgumentException('This tag is not allowed');
        }
        if ($this->isUniqueTag($tag->getName())) {
            $this->removeByName($tag->getName());
        }

        return parent::add($tag);
    }
1286890
protected function outputBrTag(Tag $tag)
	{
		$this->outputText($tag->getPos(), 0, false);
		$this->output .= '<br/>';
	}
1182091
protected function buildRuntimeTagRendererException(TagInterface $tag)
    {
        $msg = sprintf('No template tag renderer has been found for the "%s_%s" tag', $tag->getCategory(), $tag->getType());

        if ($tag instanceof RequireTagInterface) {
            $msg .= sprintf(' with the asset "%s"', $tag->getPath());
        }

        return new RuntimeTagRendererException($msg);
    }
3995
public function setTag($tag)
    {
        if (in_array($tag, $this->getParent()->allowed_tags)) {
            throw new \Exception($tag.' can not be changed as it is not allowed under '.$this->getParent()->getTag().'.');
        }

        $this->tag = $tag;

        return $this;
    }
1084323
protected function validate($config): void
    {
        // Check that $config is an array
        if (! Validator::arrayType()->validate($config)) {
            throw new InvalidConfigException('The config must be an array.');
        }

        // Check boolean parameters
        if (! Validator::key('interface', Validator::boolType())->validate($config)) {
            throw new InvalidConfigException('"interface" parameter must be set as a boolean.');
        }
        if (! Validator::key('private', Validator::boolType())->validate($config)) {
            throw new InvalidConfigException('"private" parameter must be set as a boolean.');
        }
        if (! Validator::key('auto', Validator::boolType())->validate($config)) {
            throw new InvalidConfigException('"auto" parameter must be set as a boolean.');
        }

        $this->validatePhpdoc($config);
    }
650173
protected function pushContext(Tag $tag)
	{
		$tagName   = $tag->getName();
		$tagFlags  = $tag->getFlags();
		$tagConfig = $this->tagsConfig[$tagName];

		++$this->cntTotal[$tagName];

		// If this is a self-closing tag, the context remains the same
		if ($tag->isSelfClosingTag())
		{
			return;
		}

		// Recompute the allowed tags
		$allowed = [];
		if ($tagFlags & self::RULE_IS_TRANSPARENT)
		{
			foreach ($this->context['allowed'] as $k => $v)
			{
				$allowed[] = $tagConfig['allowed'][$k] & $v;
			}
		}
		else
		{
			foreach ($this->context['allowed'] as $k => $v)
			{
				$allowed[] = $tagConfig['allowed'][$k] & (($v & 0xFF00) | ($v >> 8));
			}
		}

		// Use this tag's flags as a base for this context and add inherited rules
		$flags = $tagFlags | ($this->context['flags'] & self::RULES_INHERITANCE);

		// RULE_DISABLE_AUTO_BR turns off RULE_ENABLE_AUTO_BR
		if ($flags & self::RULE_DISABLE_AUTO_BR)
		{
			$flags &= ~self::RULE_ENABLE_AUTO_BR;
		}

		++$this->cntOpen[$tagName];
		$this->openTags[] = $tag;
		$this->context = [
			'allowed'       => $allowed,
			'flags'         => $flags,
			'inParagraph'   => false,
			'parentContext' => $this->context
		];
	}
43123
public function addTag($tag)
    {
        $this->tags[] = (string)$tag;
        $this->ref = null;
        return $this;
    }
160137
public function addTag($tag)
    {
        $tags = $this->getTags();
        array_push($tags, $tag);
        $this->setTags($tags);
    }
1156160
public function initModels( $config = [] ) {

		// Detect Category - Used only by dynamic calls
		if( $this->categoryParam ) {

			$this->category = $this->model;
			$this->model	= null;
		}

		// Detect Tag - Used only by dynamic calls
		if( $this->tagParam ) {

			$this->tag		= $this->model;
			$this->model	= null;
		}

		// Detect Author - Used only by dynamic calls
		if( $this->authorParam ) {

			$this->author	= $this->model;
			$this->model	= null;
		}

		// Find models for search page
		if( $this->pagination ) {

			if( empty( $this->dataProvider ) ) {

				// Check Category
				if( empty( $this->category ) && isset( $this->categorySlug ) && isset( $this->categoryType ) ) {

					$categoryService	= Yii::$app->factory->get( 'categoryService' );
					$this->category		= $categoryService->getBySlugType( $this->categorySlug, $this->categoryType );
				}

				// Check Tag
				if( empty( $this->tag ) && isset( $this->tagSlug ) && isset( $this->tagType ) ) {

					$tagService		= Yii::$app->factory->get( 'tagService' );
					$this->tag		= $tagService->getBySlugType( $this->tagSlug, $this->tagType );
				}

				// Category
				if( isset( $this->category ) ) {

					$this->initCategoryModels();
				}
				// Tag
				else if( isset( $this->tag ) ) {

					$this->initTagModels();
				}
				// Author
				else if( isset( $this->author ) ) {

					$this->initAuthorModels();
				}
				// Page
				else {

					$this->initPageModels();
				}
			}

			$this->modelPage = $this->dataProvider->getModels();
		}
		// Find models for popular, recent and related widgets
		else {

			switch( $this->widget ) {

				// Featured
				case 'featured': {

					$this->initFeatured();

					break;
				}
				// Recent
				case 'recent': {

					$this->initRecent();

					break;
				}
				// Popular
				case 'popular': {

					$this->initPopular();

					break;
				}
				// Author
				case 'author': {

					$this->initAuthor( $this->author );

					break;
				}
				// Related
				case 'related': {

					$this->initAuthor( $this->model->creator );

					break;
				}
				// Similar
				case 'similar': {

					$this->initSimilar();

					break;
				}
			}
		}
	}
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);
	}
1072275
public function initModules(Config $config)
    {
        $this->baseInitModule($config);

        $namespaces = array();
        //prepares modules configurations and modules task namespace
        foreach ($this->application->getModules() as $moduleName => $module) {
            $namespaces[$moduleName . '\Tasks'] = dirname($module['path'])
                                                        . DIRECTORY_SEPARATOR . 'tasks';
        }

        //registers module's tasks directories
        $loader = new PhalconLoader();
        $loader->registerNamespaces($namespaces, true);
        $loader->register();
    }
1054531
public function attachTag(Tag $tag)
    {
        if (!$this->hasTag($tag)) {
            $this->_tags[] = $tag;
        }

        return $this;
    }
1287349
public function setConfiguration(Configuration $config)
    {
        if ($config === null) {
            throw new Exception\InvalidArgumentException('$config cannot be null');
        }


        if ($this->config !== null) {
            $this->config->unregisterConfigChangeListener($this->getConfigChangeListener());
        }

        $this->config = $config;
        $this->setOptions($config->getZendLdapConfiguration());
        $this->config->registerConfigChangeListener($this->getConfigChangeListener());
    }
583703
public static function createTag($tag, $attributes, $content = null)
    {
        $tag = strtolower($tag);

        // Build list of arguments
        $preparedAttributes = '';
        foreach ($attributes as $attributeKey => $attributeValue) {
            // Only set non-empty strings (ensures strlen(0) > 0)
            if (strlen($attributeValue) > 0) {
                $preparedAttributes .= sprintf(
                    ' %s="%s"',
                    $attributeKey,
                    Convert::raw2att($attributeValue)
                );
            }
        }

        // Check void element type
        if (in_array($tag, static::config()->get('void_elements'))) {
            if ($content) {
                throw new InvalidArgumentException("Void element \"{$tag}\" cannot have content");
            }
            return "<{$tag}{$preparedAttributes} />";
        }

        // Closed tag type
        return "<{$tag}{$preparedAttributes}>{$content}</{$tag}>";
    }
1373247
public function removeTag(Tag $tag)
    {
        if ($this->tags->contains($tag)) {
            $this->tags->removeElement($tag);
            return true;
        }
        return false;
    }
1290528
protected function isValidTag(string $tag, Message $message = null): void
    {
        $allowedTag = $this->getAllowedTag();
        if (!\in_array($tag, $allowedTag, true)) {
            throw new InvalidKeyException(sprintf(
                'tag must be either "%s".',
                implode(', ', $allowedTag)
            ));
        }

        if ($tag === SendInterface::TAG_ISSUE_RESOLUTION && $message !== null && !$message instanceof GenericTemplate) {
            throw new InvalidClassException(sprintf(
                'message must be an instance of %s if tag is set to %s.',
                GenericTemplate::class,
                SendInterface::TAG_ISSUE_RESOLUTION
            ));
        }
    }