Parses an individual tag line

@param string $line
@throws \InvalidArgumentException
@return \gossi\docblock\tags\AbstractTag
1279
protected function parseTag($line) {
		$matches = [];
		if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)?/us', $line, $matches)) {
			throw new \InvalidArgumentException('Invalid tag line detected: ' . $line);
		}
		
		$tagName = $matches[1];
		$content = isset($matches[2]) ? $matches[2] : '';
		
		return TagFactory::create($tagName, $content);
	}
482692
private function parseDocBlock( $lines )
	{
#		remark( "Parsing DocBlock" );
		$data		= array();
		$descLines	= array();
		foreach( $lines as $line )
		{
			if( preg_match( $this->regexDocParam, $line, $matches ) )
			{
				$param	= array(
					'type'			=> $matches[2],
					'name'			=> $matches[4],
					'description'	=> isset( $matches[5] ) ? $matches[5] : NULL,
				);
				if( !isset( $data['param'] ) )
					$data['param']	= array();
				$data['param'][$matches[4]]	= $param;
			}
			else if( preg_match( "@\*\s+\@return\s+(\w+)\s*(.+)?$@i", $line, $matches ) )
			{
				$data['return']	= array(
					'type'			=> trim( $matches[1] ),
					'description'	=> isset( $matches[2] ) ? trim( $matches[2] ) : "",
				);
			}
			else if( preg_match( "@\*\s+\@author\s+(.+)\s*(<(.+)>)?$@iU", $line, $matches ) )
			{
				$data['author'][]	= array(
					'name'	=> trim( $matches[1] ),
					'mail'	=> isset( $matches[3] ) ? trim( $matches[3] ) : "",
				);
			}
			else if( preg_match( "@\*\s+\@license\s+(\S+)( .+)?$@i", $line, $matches ) )
			{
				if( isset( $matches[2] ) )
				{
					$url	= trim( $matches[1] );
					$name	= trim( $matches[2] );
					if( preg_match( "@^http://@", $matches[2] ) )
					{
						$url	= trim( $matches[2] );
						$name	= trim( $matches[1] );
					}
				}
				else
				{
					$url	= "";
					$name	= trim( $matches[1] );
					if( preg_match( "@^http://@", $matches[1] ) )
						$url	= trim( $matches[1] );
				}
			
				$data['license'][]	= array(
					'url'	=> $url,
					'name'	=> $name,
				);
			}
			else if( preg_match( "/^\*\s+@(\w+)\s+(.+)$/", $line, $matches ) )
			{
				switch( $matches[1] )
				{
					case 'implements':
					case 'deprecated':
					case 'todo':
					case 'see':
					case 'link':
					case 'copyright':
					case 'license':
					case 'author':
					case 'see':
					case 'uses':
					case 'throws':
					case 'link':
						$data[$matches[1]][]	= $matches[2];			
						break;
					default:
						$data[$matches[1]]	= $matches[2];			
						break;
				}
			}
			else if( !$data && preg_match( "/^\*\s*([^@].+)?$/", $line, $matches ) )
				$descLines[]	= isset( $matches[1] ) ? trim( $matches[1] ) : "";
		}
		$data['description']	= trim( implode( "\n", $descLines ) );
		if( !isset( $data['throws'] ) )
			$data['throws']	= array();
		foreach( $data['throws'] as $throws )
		{
			$list	= array();
			$parts	= explode( ",", $throws );
			foreach( $parts as $part )
				$list[]	= trim( $part );
			$data['throws']	= $list;
		}
		return $data;
	}
334193
public function parseGitAttributesLine($line)
    {
        $parts = preg_split('#\s+#', $line);

        if (count($parts) != 2) {
            return null;
        }

        if ($parts[1] === 'export-ignore') {
            return $this->generatePattern($parts[0]);
        }
    }
1090705
protected function parseBlockLine($line, \SplFileObject $file, $lineBreaks)
    {
        $block = new Block();

        $args = $this->blockRegex($line);
        $name = array_shift($args);

        if ($name === null) {
            $lineNum = $file->key();
            throw new SyntaxException($lineNum, $line, "Could not parse the name of the block");
        }

        $block->setName($name)
              ->setArguments($args)
              ->setLineBreaks($lineBreaks);

        // Now we parse the children
        $newLine = $file->getCurrentLine();

        while (!$this->isBlockEnd($newLine, $name)) {
            $parsedLine = $this->parseLine($newLine, $file);
            if (!is_null($parsedLine)) {
                $block->addChild($parsedLine);
            }
            $newLine = $file->getCurrentLine();
        }

        return $block;
    }
423585
protected function convertToArray(&$line)
    {
        $implodeStr = $this->multipleValueSeparator;
        $arr = array_map(
            function ($value, $key) use (&$implodeStr) {
                if (is_array($value) && is_numeric($key)) {
                    $this->convertToArray($value);
                    $implodeStr = '|';
                    return $value;
                }
                return sprintf("%s=%s", $key, $value);
            },
            $line,
            array_keys($line)
        );

        $line = implode(
            $implodeStr, $arr
        );
    }
69491
public function parseLine($line) {

        $data = explode(";", $line);
        $i    = -1;

        $model = new Customer();
        $model->setCustomerNumber(IntegerHelper::parseString($data[++$i]));
        $model->setTitle($this->decodeString($data[++$i]));
        $model->setSurname($this->decodeString($data[++$i]));
        $model->setFirstname($this->decodeString($data[++$i]));
        $model->setStreet($this->decodeString($data[++$i]));
        $model->setPCode($this->decodeString($data[++$i]));
        $model->setCity($this->decodeString($data[++$i]));
        $model->setCountry($this->decodeString($data[++$i]));
        $model->setTaxCode($this->decodeString($data[++$i]));
        $model->setIdDocumentNo($this->decodeString($data[++$i]));
        $model->setTelephone($this->decodeString($data[++$i]));
        $model->setRentalAgreementNo($this->decodeString($data[++$i]));
        $model->setBeginDate($this->decodeDate($data[++$i]));
        $model->setTerminationDate($this->decodeDate($data[++$i]));
        $model->setDeposit(IntegerHelper::parseString($data[++$i]));
        $model->setMaximumLevel(IntegerHelper::parseString($data[++$i]));
        $model->setRemarks($this->decodeString($data[++$i]));
        $model->setDatetimeLastModification($this->decodeDateTime($data[++$i]));
        $model->setBlocked(BooleanHelper::parseString($data[++$i]));
        $model->setBlockedDate($this->decodeDate($data[++$i]));
        $model->setDeletedRecord(BooleanHelper::parseString($data[++$i]));
        $model->setTicketReturnAllowed(BooleanHelper::parseString($data[++$i]));
        $model->setGroupCounting(BooleanHelper::parseString($data[++$i]));
        $model->setEntryMaxLevelAllowed(BooleanHelper::parseString($data[++$i]));
        $model->setMaxLevelCarPark(BooleanHelper::parseString($data[++$i]));
        $model->setRemarks2($this->decodeString($data[++$i]));
        $model->setRemarks3($this->decodeString($data[++$i]));
        $model->setDivision($this->decodeString($data[++$i]));
        $model->setEmail($this->decodeString($data[++$i]));
        $model->setCountingNeutralCards(BooleanHelper::parseString($data[++$i]));
        $model->setNationality($this->decodeString($data[++$i]));
        $model->setAccountingNumber($this->decodeString($data[++$i]));

        return $model;
    }
889068
protected function getTranslationPhrases( $line )
    {
        $strings = array();
        $patternMatch1 = array();
        $patternMatch2 = array();

        preg_match_all( "/__\\(([\\\"'])(?:(?=(\\\\?))\\2.)*?\\1/u", $line, $patternMatch1); //for php and JS helper function
        preg_match_all( "/\{\{__ ['\"](.*?)['\"]\}\}/u", $line, $patternMatch2 ); //used for parsing templates

        if ( ! empty( $patternMatch1[0] )) {
            $strings = array_reduce(
                $patternMatch1[0],
                function ( $m, $str ) use ( $patternMatch1 ) {
                    $found = preg_match(
                        "/([\"'])(?:(?=(\\\\?))\\2.)*?\\1/u",
                        $str,
                        $matches
                    ); //matches first passed argument only
                    $m[]   = $found ? trim( $matches[0], '"\'' ) : $patternMatch1[1];

                    return $m;
                },
                array()
            );
        }
        if ( ! empty( $patternMatch2[1] )) {
            $strings = array_merge( $strings, $patternMatch2[1] );

            return $strings;
        }

        return $strings;
    }
1058437
protected function parseTag($line)
    {
        $tagAndValue = [];
        if (preg_match('/@[A-Za-z0-9\\\\]+\\\\([A-Za-z0-9]+)(?:\\((.*)\\))?$/', $line, $tagAndValue) === 0) {
            $tagAndValue = preg_split('/\s/', $line, 2);
        } else {
            array_shift($tagAndValue);
        }
        $tag = strtolower(trim($tagAndValue[0], '@'));
        if (count($tagAndValue) > 1) {
            $this->tags[$tag][] = trim($tagAndValue[1], ' "');
        } else {
            $this->tags[$tag] = [];
        }
    }
1226177
private function parseResponseHeaderLine($line) {
        list($key, $value) = explode(':', $line, 2);
        $key = trim(strtolower(str_replace('-', '_', $key)));
        $value = trim($value);
        if (empty($this->headers[$key])) {
            $this->headers[$key] = $value;
        } elseif (is_array($this->headers[$key])) {
            $this->headers[$key][] = $value;
        } else {
            $this->headers[$key] = array($this->headers[$key], $value);
        }
    }
1313503
private function parseCodeLine(string $line): Line
    {
        if (strlen($line) == 0) {
            return new Line(Line::EXISTED, '');
        }

        $firstChar = $line[0];
        $cleanLine = rtrim(substr($line, 1));

        return new Line(Line::$opsMap[$firstChar], $cleanLine);
    }
13321
public function parseLink($line)
    {
        // Links
        if (preg_match('/^\.\. _`(.+)`: (.+)$/mUsi', $line, $match)) {
            $this->environment->setLink($match[1], $match[2]);
            return true;
        }

        if (preg_match('/^\.\. _(.+): (.+)$/mUsi', $line, $match)) {
            $this->environment->setLink($match[1], $match[2]);
            return true;
        }

        // Short anonymous links
        if (preg_match('/^__ (.+)$/mUsi', trim($line), $match)) {
            $url = $match[1];
            $this->environment->setLink('_', $url);
            return true;
        }

        // Anchor link 
        if (preg_match('/^\.\. _(.+):$/mUsi', trim($line), $match)) {
            $anchor = $match[1];
            $this->document->addNode($this->kernel->build('Nodes\AnchorNode', $anchor));
            $this->environment->setLink($anchor, '#'.$anchor);
            return true;
        }

        return false;
    }
1029826
protected function parse_line($line)
    {
        $line = trim($line);
        if (empty($line)) {
            return null;
        }

        $fields = rcube_utils::explode_quoted_string(',', $line);

        // remove quotes if needed
        if (!empty($fields)) {
            foreach ($fields as $idx => $value) {
                if (($len = strlen($value)) > 1 && $value[0] == '"' && $value[$len-1] == '"') {
                    // remove surrounding quotes
                    $value = substr($value, 1, -1);
                    // replace doubled quotes inside the string with single quote
                    $value = str_replace('""', '"', $value);

                    $fields[$idx] = $value;
                }
            }
        }

        return $fields;
    }
350536
protected function parseTagLine($tagLine)
    {
        $tagArr = explode(' ', $tagLine);
        $tag = array_shift($tagArr);

        switch (strtolower($tag)) {
            case 'abstract':
                $this->obj->abstract = true; break;
            case 'access':
                if (isset($tagArr[0])) {
                    $this->obj->isPrivate = (strtolower(trim($tagArr[0])) == 'private') ? true : false;
                }
                break;
            case 'author':
                $this->obj->author = implode(' ', $tagArr);
                break;
            case 'copyright':
                $this->obj->copyright = implode(' ', $tagArr);
                break;
            case 'deprecated':
            case 'deprec':
                $this->obj->deprecated = true;
                break;
            case 'extends': break;
            case 'global':
                if (isset($tagArr[0])) {
                    $this->obj->globals[] = $tagArr[0];
                }
                break;
            case 'param':
                $o = new stdClass();
                $o->type = trim(array_shift($tagArr));
                if ($o->type == 'object') {
                    $o->type = 'stdClass';
                }
                $o->comment = implode(' ', $tagArr);
                $this->obj->params[] = $o;
                break;
            case 'externalparam':
                // external parameter, to declare soap parameter that are not method
                // parameters
                $o = new stdClass();
                if (count($tagArr) < 2) {
                    throw new Exception('Not enough parameters on @externalparam '.$tagLine);
                }
                $o->type = trim(array_shift($tagArr));
                if ($o->type == 'object') {
                    $o->type = 'stdClass';
                }
                $o->name = ltrim(array_shift($tagArr), '$');
                $o->comment = implode(' ', $tagArr);
                $this->obj->externalParams[] = $o;
                break;
            case 'return':
                if (isset($tagArr[0])) {
                    $this->obj->return = trim($tagArr[0]);
                    if ($this->obj->return == 'object') {
                        $this->obj->return = 'stdClass';
                    }
                }
                break;
            case 'link':break;
            case 'see':break;
            case 'since':
                if (isset($tagArr[0])) {
                    $this->obj->since = trim($tagArr[0]);
                }
                break;
            case 'static':
                $this->obj->static = true; break;
            case 'throws':
                $this->obj->throws = implode(' ', $tagArr);
                break;
            case 'todo':
                $this->obj->todo[] = implode(' ', $tagArr);
                break;
            case 'var':
                $this->obj->type = trim(array_shift($tagArr));
                $comment = implode(' ', $tagArr);
                //check if its an optional property
                $this->obj->optional = strpos($comment, '[OPTIONAL]') !== false;
                $this->obj->autoincrement = strpos($comment, '[AUTOINCREMENT]') !== false;
                $this->obj->description = trim(str_replace(array('[OPTIONAL]', '[AUTOINCREMENT]'), '', $comment));
                break;
            case 'version':
                if (isset($tagArr[0])) {
                    $this->obj->version = $tagArr[0];
                }
                break;
            default:
                //do nothing
        }
    }
1004951
protected function parseLine( Line$line ):self
	{
		$this->currentLine= $line;
		$this->setLevel($line->getIndentLevel());

		$this->{'parse'.ucfirst($this->getLineType($line))}($line);

		return $this;
	}
173106
private static function parseContent(string $line): array
    {
        /* Get position of separator */
        $separatePosition = strpos($line, self::$separator);

        /* Get config key */
        $configName = trim(substr($line, 0, $separatePosition));

        /* Get config value */
        $configValue = trim(rtrim(substr($line, $separatePosition + strlen(self::$separator)), "\n"));

        /* Transform config value to number */
        if (is_numeric($configValue)) {
            /* Is int */
            if ((int)$configValue == $configValue) {
                $configValue = (int)$configValue;
            }

            /* Is float */
            else {
                $configValue = (float)$configValue;
            }
        }

        return ['key' => $configName, 'value' => $configValue];
    }
1036389
protected function parseLine(string $line): string
    {
        if (!$this->isHiraganaCodePoints($line)) {
            throw new SyntaxException(_('ピクトセンスで使用可能の文字はひらがな、「ヴ」「ー」のみです。ただし、「ゔ」「ゕ」「ゖ」「𛀁」も使用できません: ') . $line);
        }
        
        if (mb_strlen($line, 'UTF-8') > self::WORD_MAX) {
            throw new SyntaxException(sprintf(_('「%1$s」は%2$d文字を越えています。'), $line, self::WORDS_MAX));
        }

        return str_replace('ヴ', 'ゔ', $line);
    }
1122883
protected function splitLine($line)
    {
        $chunks = explode(';', $line);
        if (count($chunks) !== 6) {
            throw new InvalidValueException('Line "' . $line . '" is malformed');
        }

        return array_map('trim', $chunks);
    }