Create tag by name.

@param string      $tag
@param string|null $locale
@param string|null $group

@return static
976906
public static function createByName(string $tag, string $group = null, string $locale = null): self
    {
        $locale = $locale ?? app()->getLocale();

        return static::create([
            'name' => [$locale => $tag],
            'group' => $group,
        ]);
    }
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;
    }
4483
public function tag($tag, $attr = null, $content = null, $close = false)
    {
        $tag = strtolower($tag);

        if (! empty($attr) && is_array($attr)) {
            $attr = $this->Attr->attr($attr);
        }

        if ($close) {
            return sprintf('<%s%s>%s</%1$s>', $tag, $attr, $content);
        } else {
            return sprintf('<%s%s>', $tag, $attr);
        }
    }
872408
@SuppressWarnings("unchecked")
    public T addTag(String tag) {
        if (this.tags_ == null) {
            tags_ = new ArrayList<>();
        }
        this.tags_.add(tag);
        return (T) this;
    }
307982
public function createTag($tag, $message = null)
    {
        $command = 'tag';

        if ($message) {
            $command .= " -a -m '$message'";
        }

        $command .= " $tag";

        $this->getClient()->run($this, $command);
    }
560723
public function locale(string $locale) : self
    {
        if ($this->validate and ! $locale) {
            throw new Exception("Open Graph: Invalid locale (none set)");
        }

        $this->forget('locale');

        $this->tags[] = $this->createTag('locale', $locale);

        return $this;
    }
232888
private function getTags(NodeInterface $node, $locale)
    {
        return $node->getPropertyValueWithDefault(
            sprintf(self::TAGS_PROPERTY, $locale),
            []
        );
    }
369438
protected static function createTag($tagName, TagStack $tagStack, Tag $tag)
	{
		$startPos = $tag->getPos();
		$endTag   = $tag->getEndTag();
		if ($endTag)
		{
			$startLen = $tag->getLen();
			$endPos   = $endTag->getPos();
			$endLen   = $endTag->getLen();
		}
		else
		{
			$startLen = 0;
			$endPos   = $tag->getPos() + $tag->getLen();
			$endLen   = 0;
		}

		return $tagStack->addTagPair($tagName, $startPos, $startLen, $endPos, $endLen, $tag->getSortPriority());
	}
422169
public function load($locale, $group, $namespace = null)
	{
		if (is_null($namespace) || $namespace == '*')
		{
			return $this->loadData($locale, $group);
		}

		return $this->loadNamespaced($locale, $group, $namespace);
	}
1157605
public function addTranslation($locale, $group, $key)
    {
        if(!\Config::get('app.debug') || \Config::get('translation-db.minimal')) return;

        // Extract the real key from the translation.
        if (preg_match("/^{$group}\.(.*?)$/sm", $key, $match)) {
            $name = $match[1];
        } else {
            throw new TranslationException('Could not extract key from translation.');
        }

        $item = \DB::table('translations')
            ->where('locale', $locale)
            ->where('group', $group)
            ->where('name', $name)->first();

        $data = compact('locale', 'group', 'name');
        $data = array_merge($data, [
            'viewed_at' => date_create(),
            'updated_at' => date_create(),
        ]);

        if($item === null) {
            $data = array_merge($data, [
                'created_at' => date_create(),
            ]);
            \DB::table('translations')->insert($data);
        } else {
            if($this->_app['config']->get('translation-db.update_viewed_at')) {
                \DB::table('translations')->where('id', $item->id)->update($data);
            }
        }
    }
131348
static final String createTag(final String name) {
		if (name.length() <= MAX_TAG_LEN) {
			return name;
		}

		final char[] tag = name.toCharArray();
		final int arrayLen = tag.length;
		int len = 0;
		int mark = 0;

		for (int i = 0; i < arrayLen; i++, len++) {
			if (tag[i] == '.') {
				len = mark;

				if (tag[len] != '.') {
					len++;
				}

				mark = len;

				if (i + 1 < arrayLen && tag[i + 1] != '.') {
					mark++;
				}
			}

			tag[len] = tag[i];
		}

		if (len > MAX_TAG_LEN) {
			int i = 0;

			mark--;

			for (int j = 0; j < len; j++) {
				if (tag[j] == '.' && ((j != mark) || (i >= MAX_TAG_LEN - 1))) {
					continue;
				}

				tag[i++] = tag[j];
			}

			len = i;

			if (len > MAX_TAG_LEN) {
				len = MAX_TAG_LEN;
			}
		}

		return new String(tag, 0, len);
	}
624493
public function get($locale, $group, $namespace)
    {
        $key = $this->getKey($locale, $group, $namespace);
        return $this->store->tags([$this->cacheTag, $key])->get($key);
    }
1300447
public function getFrom($group, $locale, $default = null)
    {
        if ( ! $this->hasCollection($group))
            return $default;

        $locales = $this->getCollection($group);

        return $locales->get($locale, $default);
    }
1216422
private function buildTagsWhere($tags, $operator, $languageCode)
    {
        $structure = $this->structureManager->getStructure('excerpt');

        $sql2Where = [];
        if ($structure->hasProperty('tags')) {
            $property = new TranslatedProperty(
                $structure->getProperty('tags'),
                $languageCode,
                $this->languageNamespace,
                'excerpt'
            );

            foreach ($tags as $tag) {
                $sql2Where[] = 'page.[' . $property->getName() . '] = ' . $tag;
            }

            if (count($sql2Where) > 0) {
                return '(' . implode(' ' . strtoupper($operator) . ' ', $sql2Where) . ')';
            }
        }

        return '';
    }
861473
public function addTag($tag, $message = null)
    {
        if ($message === null) {
            $message = $tag;
        }
        return $this->run("tag -a $tag -m $message");
    }
22531
public function load($locale, $group, $namespace = null)
    {
        if ($locale != $this->defaultLocale) {
            return array_replace_recursive(
                $this->loadSource($this->defaultLocale, $group, $namespace),
                $this->loadSource($locale, $group, $namespace)
            );
        }
        return $this->loadSource($locale, $group, $namespace);
    }
1151458
public static function tag($name, $content = NULL, Array $attributes = NULL) {
    $tag = new HTMLTag($name, $content, $attributes);
    return $tag;
  }