@param array $line

@return bool
342746
protected function splitNonMatchingLine(array $line)
    {
        list($lowAmount, $highAmount) = $this->splitAmountOver2VatRates($line[Meta::LineAmount],
            $line[Meta::LineAmountInc] - $line[Meta::LineAmount],
            $this->minVatRate[Tag::VatRate],
            $this->maxVatRate[Tag::VatRate]);

        // Dividing was possible if both amounts have the same sign.
        if (($highAmount < -0.005 && $lowAmount < -0.005 && $line[Meta::LineAmount] < -0.005)
            || ($highAmount > 0.005 && $lowAmount > 0.005 && $line[Meta::LineAmount] > 0.005)
        ) {
            $splitLine = $line;
            $splitLine[Tag::Product] .= sprintf(' (%f%% %s)', $this->maxVatRate[Tag::VatRate], $this->t('vat'));
            $splitLine[Tag::UnitPrice] = $highAmount;
            unset($splitLine[Meta::UnitPriceInc]);
            $this->completeLine($splitLine, $this->maxVatRate[Tag::VatRate]);

            $splitLine = $line;
            $splitLine[Tag::Product] .= sprintf(' (%f%% %s)', $this->minVatRate[Tag::VatRate], $this->t('vat'));
            $splitLine[Tag::UnitPrice] = $lowAmount;
            unset($splitLine[Meta::UnitPriceInc]);
            $this->completeLine($splitLine, $this->minVatRate[Tag::VatRate]);
            return true;
        }
        return false;
    }
335326
private function isChangePositionLine(string $line): bool
    {
        $matches = [];
        if (preg_match('#^@@ (\-[0-9,]{3,} \+[0-9,]{3,}) @@ ?(.*)$#', $line, $matches)) {
            $this->currentPosition                        = $matches[1];
            $this->currentChanges[$this->currentPosition] = new Change($matches[1], $matches[2]);
            return true;
        }
        return false;
    }
1100203
private function getParamChunksFromLine($line)
    {
        $paramChunks = explode(' ', $line);
        $paramChunks = array_filter($paramChunks, function($val) {
            return $val !== '';
        });
        unset($paramChunks[0]);
        
        return $paramChunks;
    }
620968
public function parse($line)
    {
        $elements = [];

        // 1. remove braces
        $line = \str_replace(['{', '}'], '', $line);

        // 2. extract elements
        $elements = $this->extractElements($line);

        // 3. remove quotes
        $iterator = function($element)
        {
            return \str_replace(['\'', '"'], '', $element);
        };

        return \array_map($iterator, $elements);
    }
133905
public function add($line)
    {
        if ($line == '' ||
            ($pair = $this->generateRulePair($line, [-1 => self::DIRECTIVE_USER_AGENT] + array_keys(self::SUB_DIRECTIVES))) === false) {
            return $this->append = false;
        }
        if ($pair[0] === self::DIRECTIVE_USER_AGENT) {
            return $this->set($pair[1]);
        }
        $this->append = false;
        $result = [];
        foreach ($this->current as $group) {
            $result[] = $this->handler[$group]->{self::SUB_DIRECTIVES[$pair[0]]}->add($pair[1]);
            $this->handler[$group]->count++;
        }
624077
private function getInlineArray(array $lines, array $options)
    {
        $output = $this->wrap(implode(', ', $lines), $options['array.short']);

        if (preg_match('/[\r\n\t]/', $output)) {
            return false;
        } elseif ($options['array.inline'] === true || \strlen($output) <= (int) $options['array.inline']) {
            return $output;
        }

        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;
    }
1201366
public function parseLine($line) {

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

        $model = new StartRecordFormat();
        $model->setVersionRecordStructure(IntegerHelper::parseString($data[++$i]));
        $model->setFacilityNumber(IntegerHelper::parseString($data[++$i]));
        $model->setDateFile($this->decodeDate($data[++$i]));
        $model->setNumberRecords(IntegerHelper::parseString($data[++$i]));
        $model->setCurrency($this->decodeString($data[++$i]));

        return $model;
    }
783826
public function updateOrAdd(LineInterface $line)
    {
        $key = $line->key();

        $index = $this->search(function (LineInterface $line) use ($key) {
            return $line->key() == $key;
        });

        if ($index > -1) {
            $this->put($index, $line);
        } else {
            $this->add($line);
        }
    }
874622
protected function handleMessage($line)
    {
        if (!is_string($line)) {
            return false;
        }

        $parts = array_map('trim', explode(',', $line));
        if (count($parts) != 2) {
            return false;
        }

        $line = implode(" , ", $parts);
        if (!ctype_digit($parts[0]) || !ctype_digit($parts[1])) {
            return $line . " : ERROR : INVALID-PORT";
        }

        $cport = (int) $parts[0];
        $sport = (int) $parts[1];

        if ($sport <= 0 || $sport > 65535 || $cport <= 0 || $cport > 65535) {
            return $line . " : ERROR : INVALID-PORT";
        }

        foreach ($this->bot->getConnections() as $connection) {
            if ($connection == $this) {
                continue;
            }

            $socket = $connection->getSocket();

            $rport = (int) substr(strrchr(stream_socket_get_name($socket, true), ':'), 1);
            if ($rport != $sport) {
                continue;
            }

            $lport = (int) substr(strrchr(stream_socket_get_name($socket, false), ':'), 1);
            if ($lport != $cport) {
                continue;
            }

            try {
                $config     = $connection->getConfig(null);
                $identity   = $config->parseString(
                    '\\Erebot\\Module\\IrcConnector',
                    'identity',
                    ''
                );
                return $line . " : USERID : UNIX : " . $identity;
            } catch (\Erebot\Exception $e) {
                return $line . " : ERROR : HIDDEN-USER ";
            }
        }

        return $line . " : ERROR : NO-USER";
    }
1155192
public static function isEmpty($line, $strict = false)
    {
        if (!is_array($line)) {
            throw new \RuntimeException("got a string that should already have been split into an array");
        }
        $test = array_filter($line, function ($element) use ($strict) {
            return !Reader::isEmpty($element, $strict);
        });
        return empty($test);
    }
99558
public function add($line)
    {
        if (!is_numeric($line) ||
            (
                isset($this->delay) &&
                $this->delay > 0
            )
        ) {
            return false;
        }
        // PHP hack to convert numeric string to float or int
        // http://stackoverflow.com/questions/16606364/php-cast-string-to-either-int-or-float
        $this->delay = $line + 0;
        return true;
    }
783678
public static function extract($line)
    {
        $e = explode(': ', $line, 2);
        $header = strtolower(trim($e[0]));
        $value = isset($e[1]) ? trim($e[1]) : null;
        $safe = false;

        foreach (self::$safeCaseValues as $item) {
            if (strncasecmp($header, $item, mb_orig_strlen($item)) === 0) {
                $safe = true;
                break;
            }
            if (strncasecmp($value, $item, mb_orig_strlen($item)) === 0) {
                $safe = true;
                break;
            }
        }

        if (!$safe) {
            $value = strtolower($value);
        }

        return [$header, $value];
    }
865795
protected function _parseLine( $line )
    {
        $_result = str_getcsv(
            $line,
            $this->_separator,
            $this->_enclosure,
            EscapeStyle::SLASHED == $this->_escapeStyle ? '\\' : EscapeStyle::DOUBLED == $this->_escapeStyle ? '"' : ''
        );

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

        return empty($line) || $char === '#' || $char === ';';
    }
549934
private function parseLine($line)
    {
        if (!$line) {
            return array();
        }

        $line = trim($line);

        if (!$line) {
            return array();
        }

        $array = array();
        $group = $this->nodeContainsGroup($line);

        if ($group) {
            $this->addGroup($line, $group);
            $line = $this->stripGroup ($line, $group);
        }
        if ($this->startsMappedSequence($line)) {
            return $this->returnMappedSequence($line);
        }
        if ($this->startsMappedValue($line)) {
            return $this->returnMappedValue($line);
        }
        if ($this->isArrayElement($line)) {
            return $this->returnArrayElement($line);
        }
        if ($this->isPlainArray($line)) {
            return $this->returnPlainArray($line);
        }

        return $this->returnKeyValuePair($line);
    }
671872
protected function blockInclude($line)
    {
        if ($this->config["include"]
            && preg_match("/^#include[ \t]([\w.]+)$/", $line, $matches)
        ) {
            $file = $this->config["include_base"]."/".$matches[1];

            if (!is_readable($file)) {
                throw new Exception("Could not find include file: '$file'");
            }

            $include = file_get_contents($file);
            $include = str_replace(array("\r\n", "\r"), "\n", $include);
            $include = explode("\n", $include);
            array_splice(
                $this->lines,
                $this->lineNumber - 1,
                1,
                $include
            );

            $this->lineNumber--;
            return true;
        }
    }