@param string $line

@return bool
482810
protected function isEmptyLine(string $line): bool
    {
        $char = \mb_substr($line, 0, 1);

        return empty($line) || $char === '#' || $char === ';';
    }
381781
protected function parseLine(&$line)
    {
        switch ($this->state) {
        case self::STATE_BEGIN:
            if (trim($line)) {
                if ($this->isListLine($line)) {
                    $this->state = self::STATE_LIST;
                    $this->buffer = $this->kernel->build('Nodes\ListNode');
                    $this->lineInfo = null;
                    $this->listFlow = true;
                    return false;
                } else if ($this->isBlockLine($line)) {
                    if ($this->isCode) {
                        $this->state = self::STATE_CODE;
                    } else {
                        $this->state = self::STATE_BLOCK;
                    }
                    return false;
                } else if ($this->isDirective($line)) {
                    $this->state = self::STATE_DIRECTIVE;
                    $this->buffer = array();
                    $this->flush();
                    $this->initDirective($line);
                } else if ($this->parseLink($line)) {
                    return true;
                } else if ($parts = $this->parseTableLine($line)) {
                    $this->state = self::STATE_TABLE;
                    $this->buffer = $this->kernel->build('Nodes\TableNode', $parts);
                } else {
                    $this->state = self::STATE_NORMAL;
                    return false;
                }
            }
            break;

        case self::STATE_LIST:
            if (!$this->pushListLine($line)) {
                $this->flush();
                $this->state = self::STATE_BEGIN;
                return false;
            }
            break;

        case self::STATE_TABLE:
            if (!trim($line)) {
                $this->flush();
                $this->state = self::STATE_BEGIN;
            } else {
                $parts = $this->parseTableLine($line);

                if (!$this->buffer->push($parts, $line)) {
                    $this->flush();
                    $this->state = self::STATE_BEGIN;
                    return false;
                }
            }

            break;

        case self::STATE_NORMAL:
            if (trim($line)) {
                $specialLetter = $this->isSpecialLine($line);

                if ($specialLetter) {
                    $this->specialLetter = $specialLetter;
                    $lastLine = array_pop($this->buffer);

                    if ($lastLine) {
                        $this->buffer = array($lastLine);
                        $this->state = self::STATE_TITLE;
                    } else {
                        $this->buffer[] = $line;
                        $this->state = self::STATE_SEPARATOR;
                    }
                    $this->flush();
                    $this->state = self::STATE_BEGIN;
                } else {
                    if ($this->isDirective($line)) {
                        $this->flush();
                        $this->state = self::STATE_BEGIN;
                        return false;
                    }
                    if ($this->isComment($line)) {
                        $this->flush();
                        $this->state = self::STATE_COMMENT;
                    } else {
                        $this->buffer[] = $line;
                    }
                }
            } else {
                $this->flush();
                $this->state = self::STATE_BEGIN;
            }
            break;
        
        case self::STATE_COMMENT:
            $isComment = false;

            if (!$this->isComment($line) && (!trim($line) || $line[0] != ' ')) {
                $this->state = self::STATE_BEGIN;
                return false;
            }
            break;

        case self::STATE_BLOCK:
        case self::STATE_CODE:
            if (!$this->isBlockLine($line)) {
                $this->flush();
                $this->state = self::STATE_BEGIN;
                return false;
            } else {
                $this->buffer[] = $line;
            }
            break;

        case self::STATE_DIRECTIVE:
            if (!$this->directiveAddOption($line)) {
                if ($this->isDirective($line)) {
                    $this->flush();
                    $this->initDirective($line);
                } else {
                    $directive = $this->getCurrentDirective();
                    $this->isCode = $directive ? $directive->wantCode() : false;
                    $this->state = self::STATE_BEGIN;
                    return false;
                }
            }
            break;

        default:
            $this->getEnvironment()->getErrorManager()->error('Parser ended in an unexcepted state');
        }

        return true;
    }
963
private function isHeaderLine(string $line): bool
    {
        $matches = [];
        if (preg_match('#^diff --git [a|b|c|i|w|o]/(.*) [a|b|c|i|w|o]/(.*)#', $line, $matches)) {
            $this->appendCollectedFileAndChanges();
            $this->currentOperation = File::OP_MODIFIED;
            $this->currentFileName  = $matches[2];
            return true;
        }
        return false;
    }
1123452
protected function isSpecialLine($line)
    {
        if (strlen($line) < 3) {
            return false;
        }

        $letter = $line[0];

        $environment = $this->environment;
        if (!in_array($letter, $environment::$letters)) {
            return false;
        }

        for ($i=1; $i<strlen($line); $i++) {
            if ($line[$i] != $letter) {
                return false;
            }
        }

        return $letter;
    }
1100203
private function getParamChunksFromLine($line)
    {
        $paramChunks = explode(' ', $line);
        $paramChunks = array_filter($paramChunks, function($val) {
            return $val !== '';
        });
        unset($paramChunks[0]);
        
        return $paramChunks;
    }
663648
private function parseLine($line)
    {
        if ($line == '') {
            return;
        }

        $slices = NodeObject::getLineSlices($line);
        if ($this->isBlob()) {
            $this->pathChildren[] = $this->blob->getName();
        } else {
            if ($this->isRoot()) {
                // if is root check for first children
                $pattern = '/(\w+)\/(.*)/';
                $replacement = '$1';
            } else {
                // filter by the children of the path
                $actualPath = $this->subject->getFullPath();
                if (!preg_match(sprintf('/^%s\/(\w*)/', preg_quote($actualPath, '/')), $slices['fullPath'])) {
                    return;
                }
                $pattern = sprintf('/^%s\/(\w*)/', preg_quote($actualPath, '/'));
                $replacement = '$1';
            }

            $name = preg_replace($pattern, $replacement, $slices['fullPath']);
            if (strpos($name, '/') !== false) {
                return;
            }

            if (!in_array($name, $this->pathChildren)) {
                $path = rtrim(rtrim($slices['fullPath'], $name), '/');
                $treeObject = new TreeObject(
                    $this->repository,
                    $slices['permissions'],
                    $slices['type'],
                    $slices['sha'],
                    $slices['size'],
                    $name,
                    $path
                );
                $this->children[] = $treeObject;
                $this->pathChildren[] = $name;
            }
        }
    }
1359497
public function add($line)
    {
        $uriParser = new UriParser($line);
        $uri = $uriParser->encode();
        if (!$uriParser->validate() ||
            in_array($uri, $this->sitemaps)
        ) {
            return false;
        }
        $this->sitemaps[] = $uri;
        return true;
    }
1289271
protected function isImmediate( $line )
	{
		$code = "";
		$sq = $dq = false;
		for( $i = 0; $i < strlen( $line ); $i++ )
		{
			$c = $line{$i};
			if( $c == "'" )
				$sq = !$sq;
			else if( $c == '"')
				$dq = !$dq;
			else if( ( $sq ) ||( $dq ) )
			{
				if( $c == "\\" )
					$i++;
			}
			else
				$code .= $c;
		}
		$code = str_replace( $this->okeq, "", $code );
		if( strcspn( $code, ";{=" ) != strlen( $code ) )
			return false;
		$kw = split( "[^A-Za-z0-9_]", $code );
		foreach( $kw as $i )
			if( in_array( $i, $this->skip ) )
				return false;
		return true;
	}
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;
    }
678954
private function parseHeaderLine($line)
    {
        $matches = [];
        if (preg_match('/^([^:]+):(.*)$/', $line, $matches) === 1) {
            $this->addHeader(trim($matches[1]), trim($matches[2]));
        }
    }
451414
private function interpretApacheInfoData(string $line) : bool
    {
        $retval = false;
        $parts = preg_split('/:\s+/', $line, 2);
        if (count($parts) === 2) {
            switch (trim($parts[0])) {
                case 'Server version':
                    $this->apache_info['server-version'] = trim($parts[1]);
                    $retval = true;
                    break;
                case 'Server built':
                    $this->apache_info['server-built'] = trim($parts[1]);
                    $retval = true;
                    break;
                case 'Server\'s Module Magic Number':
                    $this->apache_info['server-magic-number'] = trim($parts[1]);
                    $retval = true;
                    break;
                case 'Architecture':
                    $this->apache_info['server-architecture'] = trim($parts[1]);
                    $retval = true;
                    break;
                case 'Server MPM':
                    $this->apache_info['server-mpm'] = trim($parts[1]);
                    $retval = true;
                    break;
                case 'threaded':
                    $this->apache_info['server-mpm-threaded'] = trim($parts[1]);
                    $retval = true;
                    break;
                case 'forked':
                    $this->apache_info['server-mpm-forked'] = trim($parts[1]);
                    $retval = true;
                    break;
                default:
            }
        }

        return $retval;
    }
871720
protected function validateLine($line)
    {
        $line = trim($line);

        $parts = explode(',', $line);
        $parts = array_filter($parts);

        foreach ($parts as $part) {
            if (!$this->validatePart($part)) {
                return false;
            }
        }

        return true;
    }
772289
protected function parseLine( $line )
	{
		$data	= preg_replace_callback( $this->patterns, array( $this, 'callback' ), $line );
		return unserialize( $data );
	}
215139
protected function parse_line($line) {
        $data = array();
        foreach ($line as $keynum => $value) {
            if (!isset($this->columns[$keynum])) {
                // This should not happen.
                continue;
            }

            $key = $this->columns[$keynum];
            $data[$key] = $value;
        }
        return $data;
    }
245194
protected function isParentItem($line)
	{
		if ($this->_listDepth === 1 || ($marker = $line[0]) !== '*' && $marker !== '#') {
			return false;
		}
		$depthMax = $this->_listDepth - 1;
		if (preg_match('/^(#{1,' . $depthMax . '})[^#]+/', $line, $matches)) {
			return $this->_nestedListTypes[strlen($matches[1])] === 'ol';
		}
		if (preg_match('/^(\*{1,' . $depthMax . '})[^\*]+/', $line, $matches)) {
			return $this->_nestedListTypes[strlen($matches[1])] === 'ul';
		}
		return false;
	}
419639
public function parse($line)
    {
        $this->error = false;
        $this->currentTextLineContainer = $this->textLineContainers[$this->config->defaultTextLineContainer];
        $firsttag = clone ($this->currentTextLineContainer->tag);

        $this->str = preg_split($this->currentTextLineContainer->pattern, $line, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
        $this->end = count($this->str);

        if ($this->end > 1) {
            $pos = -1;
            $this->_parse($firsttag, $pos);

            return $firsttag->getContent();
        } else {
            $firsttag->addContentString($line);

            return $firsttag->getContent();
        }
    }
1021261
public function get($line)
    {
        return isset($this->lines[$line-1]) ? $this->lines[$line-1] : null;
    }