@param string $data
@param int    $tagLength

@return string
16711
protected function readTag(string $data, int $tagLength): string
    {
        $tag  = substr($data, 0, $tagLength);
        $isOk = $tag !== false && strlen($tag) === $tagLength;

        $isOk === true ?: $this->throwException(new CryptException($this->getReadTagErrorMessage()));

        return $tag;
    }
1020535
private function readFlvTag($fp, $tagOffset)
    {
        $result = null;
        $seeked = @fseek($fp, $tagOffset + 4); // +4 to skip PreviousTagSize
        if ($seeked === 0) {
            $tagHeaderChunk = @fread($fp, 11); // (2 bits reserved + 1 bit filter + 5 bits TagType) + 3 bytes DataSize + 3 bytes Timestamp + 1 byte TimestampExtended + 3 bytes StreamID
            if ($tagHeaderChunk !== false && isset($tagHeaderChunk[10])) {
                $byte = $this->parseUI8($tagHeaderChunk[0]);
                $result = [
                    'filter' => ($byte >> 5) & 0x01,
                    'tagType' => $byte & 0x1F,
                    'dataSize' => $this->parseUI24(substr($tagHeaderChunk, 1, 3)),
                ];
            }
        }

        return $result;
    }
843637
public function getFormat(string $dateLength): string
    {
        // Oops, unknown length of date
        if (false === (new DateLength())->isCorrectType($dateLength)) {
            throw UnknownDateLengthException::createException($dateLength);
        }

        $format = '';

        switch ($dateLength) {
            case DateLength::DATE:
                $format = $this->dateFormat;

                break;
            case DateLength::DATETIME:
                $format = $this->dateTimeFormat;

                break;
            case DateLength::TIME:
                $format = $this->timeFormat;

                break;
        }

        return $format;
    }
526998
public function parseXmlTag($tagLib,$tag,$attr,$content) {
        if(ini_get('magic_quotes_sybase'))
            $attr   =   str_replace('\"','\'',$attr);
        $parse      =   '_'.$tag;
        $content    =   trim($content);
        $tags       =   $tagLib->parseXmlAttr($attr,$tag);
        return $tagLib->$parse($tags,$content);
    }
1293430
public function getShortContent($maxlength = 50, $attr = 'content')
    {
        $content = $this->{$attr};
        if (strlen($content) > $maxlength) {
            return substr($content, 0, $maxlength).'...';
        }

        return $content;
    }
321971
protected function getReportData(?string $tagContent = null): ?array
    {
        return [
            static::MESSAGE_TAG_CONTENT_FORMAT_INVALID,
            $this->stackPos,
            static::CODE_TAG_CONTENT_FORMAT_INVALID,
            [
                $tagContent,
                $this->getValidPattern()
            ]
        ];
    }
1211103
public function returnTag($text, &$data, &$root)
    {
        $explode = preg_split('/[ \t]+/', $text);
        $data['return'] = array_shift($explode);
        parent::tag('@return', join(' ', $explode), $root);
    }
1364233
protected function send(array $data, array $tags = array())
    {
        $tagsData = $this->serializeTags(array_replace($this->tags, $tags));

        try {
            $socket = $this->getSocket();
            $messages = array();
            $prefix = $this->namespace ? $this->namespace . '.' : '';
            foreach ($data as $key => $value) {
                $messages[] = $prefix . $key . ':' . $value . $tagsData;
            }
            $this->message = implode("\n", $messages);
            @fwrite($socket, $this->message);
            fflush($socket);
        } catch (ConnectionException $e) {
            if ($this->throwConnectionExceptions) {
                throw $e;
            } else {
                trigger_error(
                    sprintf('StatsD server connection failed (udp://%s:%d)', $this->host, $this->port),
                    E_USER_WARNING
                );
            }
        }

        return $this;
    }
330407
public function fromRawData($data)
    {
        $secretLength = VarInt::readUnsignedVarInt($data);
        $data = substr($data, $secretLength->getDataLength());

        $secretData = substr($data, 0, $secretLength->getValue());
        $data = substr($data, $secretLength->getValue());

        $verifyLength = VarInt::readUnsignedVarInt($data);
        $data = substr($data, $verifyLength->getDataLength());

        $verifyData = substr($data, 0, $verifyLength->getValue());

        $this->setToken($verifyData)->setSecret($secretData);
    }
648444
public function serializeToDom($data, string $tagName = null): \DOMDocument
    {
        return $this->xmlSerializer->serialize($data, $this->xmlStreamWriter, $tagName)
               ->asDOM();
    }
1011743
protected function getIndentation($tagName, $tagElement) {
        if ($tagElement instanceof PHP_CodeSniffer_CommentParser_SingleElement) {
            if ($tagElement->getContent() !== '') {
                return (strlen($tagName) + substr_count($tagElement->getWhitespaceBeforeContent(), ' '));
            }
        } else if ($tagElement instanceof PHP_CodeSniffer_CommentParser_PairElement) {
            if ($tagElement->getValue() !== '') {
                return (strlen($tagName) + substr_count($tagElement->getWhitespaceBeforeValue(), ' '));
            }
        }

        return 0;

    }
971075
public function write($data)
    {
        $this->contentLength += strlen($data);
        $this->data .= $data;

        return $this;
    }
926695
public function getBasicTagData($tagId)
    {
        $query = $this->handler->createSelectQuery();
        $query
            ->select('*')
            ->from($this->handler->quoteTable('eztags'))
            ->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('id'),
                    $query->bindValue($tagId, null, PDO::PARAM_INT)
                )
            );

        $statement = $query->prepare();
        $statement->execute();

        if ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
            return $row;
        }

        throw new NotFoundException('tag', $tagId);
    }
159798
public static int getLength(final List<TagAndLength> pList) {
		int ret = 0;
		if (pList != null) {
			for (TagAndLength tl : pList) {
				ret += tl.getLength();
			}
		}
		return ret;
	}
1181553
public static function data(Tag $tag, $name, $data) {
    $js = sprintf("data(%s, %s)",
                  JSHelper::convertString($name), JSHelper::convertValue($data)
                  );
    
    $tag->chain(new Code($js));
    
    return $tag;
  }
1245123
protected static Set<Tag> stringToTags(String data) {
        Set<Tag> tags = new HashSet<>();
        String[] split = data.split("\r");
        for (String s : split) {
            if (s.indexOf(Tag.KEY_VALUE_SEPARATOR) > -1) {
                String[] keyValue = s.split(String.valueOf(Tag.KEY_VALUE_SEPARATOR));
                if (keyValue.length == 2) {
                    tags.add(new Tag(keyValue[0], keyValue[1]));
                }
            }
        }
        return tags;
    }
238257
protected static function u_wrap ($data, $tag) {
		$in = $attributes = '';
		static::pre_processing($tag, $data);
		if (!static::data_prepare($data, $tag, $in, $attributes)) {
			return false;
		}
		return "<$tag$attributes>".($in ? " $in" : '')."\n";
	}