Generates a brand new token.
@param $tag string
@return string
320407
public function generateNewToken(string $tag) : string
    {
        $token = str_random(7);
        $this->setTokenInMemory($tag, $token);
        $this->persistToken($tag, $token);

        return $token;
    }
141600
public function tags($tag)
    {
        return $this->model->where('is_published', 1)
            ->where('published_at', '<=', Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s'))
            ->where('tags', 'LIKE', '%'.$tag.'%')->orderBy('created_at', 'desc')
            ->paginate(config('cms.pagination', 24));
    }
709305
public function getTags ($tag)
	{
		
		$tags	= array ();
		
		foreach ($this->lines as $line)
		{
			if (strpos ($line, '@' . $tag) === 0)
			{
				$tags[]	= trim (substr ($line, strlen ('@' . $tag)));
			}
		}
		
		return $tags;
		
	}
1054531
public function attachTag(Tag $tag)
    {
        if (!$this->hasTag($tag)) {
            $this->_tags[] = $tag;
        }

        return $this;
    }
986201
public function generate()
    {
        $indentation = $this->getIndentation();

        $code = array();
        foreach ($this->tags as $tag) {
            $code[] = $indentation . ' * ' . trim($tag->generate());
        }

        return implode($this->getLineFeed(), $code);
    }
963161
public function withTag($tag) {
        if (is_null($this->tags)) {
            $this->tags = [];
        }

        array_push($this->tags, $tag);
        return $this;
    }
354668
public function withTag($tag): Identifier
    {
        $obj = clone $this;
        $obj->_tag = new BigInt($tag);
        return $obj;
    }
1267338
protected function getOrCreateTag($label)
    {
        if (isset($this->tagFirstLevelCache[$label])) {
            return $this->tagFirstLevelCache[$label];
        }

        $tag = $this->tagRepository->findOneByLabel($label);

        if ($tag === null) {
            $tag = new Tag($label);
            $this->tagRepository->add($tag);
        }

        $this->tagFirstLevelCache[$label] = $tag;

        return $tag;
    }
1299172
public function generateTag($tag, $attributes, $closeTag = true)
    {
        $openPattern = replace_variables($this->openTagPattern, compact('tag'));
        $external = '';

        if (in_array($tag, $this->voidTags) && !empty($this->voidTagPattern) && $this->voidTagPattern != $this->openTagPattern) {
            $openPattern = replace_variables($this->voidTagPattern, compact('tag'));
        }

        if (array_key_exists($this->externalKey, $attributes)) {
            $external = $attributes[$this->externalKey];
            unset($attributes[$this->externalKey]);
        }

        $html = replace_variables($openPattern, ['attr' => associative_implode('=', ' ', $attributes)]);

        if (!in_array($tag, $this->voidTags)) {
            $html .= $external;

            if ($closeTag) {
                $html .= $this->closeTag($tag);
            }
        }

        return $html;
    }
1072849
public function getTokenParser($tag)
    {
        if (isset($this->parsers[$tag])) {
            return $this->parsers[$tag];
        }
        $broker = end($this->brokers);
        while (false !== $broker) {
            $parser = $broker->getTokenParser($tag);
            if (null !== $parser) {
                return $parser;
            }
            $broker = prev($this->brokers);
        }
    }
1210258
public static function create_from_tag($tag) {
        $event = self::create(array(
            'objectid' => $tag->id,
            'relateduserid' => $tag->userid,
            'context' => \context_system::instance(),
            'other' => array(
                'name' => $tag->name,
                'rawname' => $tag->rawname
            )
        ));
        return $event;
    }
25122
public function attribute($tag): string
    {
        if (preg_match('/\n2 (?:' . $tag . ') ?(.*(?:(?:\n3 CONT ?.*)*)*)/', $this->gedcom, $match)) {
            return preg_replace("/\n3 CONT ?/", "\n", $match[1]);
        }

        return '';
    }
358121
private function setTokenInMemory(string $tag, string $token): string
    {
        return $this->tagTokens[$tag] = $token;
    }
829151
private function buildItem(Tag $tag): Item
    {
        $tagName = $this->translationHelper->getTranslatedByMethod(
            $tag,
            'getKeyword'
        );

        return new Item($tag, (string) $tagName);
    }
383891
public function withTag(string $tag): self
    {
        if ($this->has($tag)) {
            return $this;
        }
        self::validateTag($tag);
        $newTags = $this->tags;
        $newTags[] = $tag;
        return new static($newTags);
    }
482419
public function appendTag(Tag $tag)
    {
        if (null === $tag->getDocBlock()) {
            $tag->setDocBlock($this);
        }

        if ($tag->getDocBlock() === $this) {
            $this->tags[] = $tag;
        } else {
            throw new \LogicException(
                'This tag belongs to a different DocBlock object.'
            );
        }

        return $tag;
    }
403839
public function get($tag)
    {
        // load if necessary
        if (!$this->loaded) {
            $this->load();
        }

        // get tag
        if (!isset($this->phrases[$tag]) || $this->phrases[$tag] == '') {
            return 'LOCALIZE [' . $this->local . ']: ' . $tag;
        } else {
            return $this->phrases[$tag];
        }
    }