解析一行
@param $line
@return array
430344
static function parse_line($line)
    {
        $line = trim($line);
        $result = array();
        $datas = explode(self::$col_sep, $line);
        if (empty(self::$data_sep))
        {
            return $datas;
        }
        foreach ($datas as $data)
        {
            $d = self::parse_data($data);
            if (empty($d[0]))
            {
                continue;
            }
            $result[trim($d[0])] = trim($d[1]);
        }
        return $result;
    }
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;
    }
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;
    }
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);
    }
641323
protected function formatLine($line)
    {
        if (is_array($line)) {
            return implode(' ', array_map('trim', $line));
        }

        return trim(implode(' ', array_map('trim', explode(PHP_EOL, $line))));
    }
922549
public function getRulers($line = 10)
    {
        if ($line == 0) {
            return [];
        }
        $data = [0];
        $percent = ($this->panel->duration / 100);
        $row = $this->panel->duration / $line;
        $precision = $row > 100 ? -2 : -1;
        for ($i = 1; $i < $line; $i++) {
            $ms = round($i * $row, $precision);
            $data[$ms] = $ms / $percent;
        }
        return $data;
    }
373780
public static function run($run = true) {
        $console = Pool::value(get_called_class(),function () {
            $config = Config::$o->console;
            // 实例化 console
            $console = new self($config['name'], $config['version'], $config['user']);
            if(isset($config['commands']) && is_array($config['commands'])) {
                $console->defaultCommands = array_merge(
                    $console->defaultCommands,
                    $config['commands']
                );
            }
            return $console;
        });
        if ($run) {
            // 运行
            return $console->execute();
        }
        return $console;
    }
1286418
public function parse($lines)
    {
        $data = [];
        foreach ($lines as $line) {
            if ($line === '' || $line[0] === '#') {
                continue;
            }

            if ($pos = strpos($line, ' # ')) {
                $line = substr($line, 0, $pos);
            }
            $line = trim($line);
            if (strpos($line, 'export ') === 0) {
                $parts = explode('=', ltrim(substr($line, 7)), 2);
            } else {
                $parts = explode('=', $line, 2);
            }

            if (count($parts) !== 2) {
                throw new InvalidValueException(['invalid line: :line, has no = character', 'line' => $line]);
            }
            $name = $parts[0];
            $value = $parts[1];

            if ($value === '') {
                null;
            } elseif ($value === 'true') {
                $value = true;
            } elseif ($value === 'false') {
                $value = false;
            } elseif ($value === 'null') {
                $value = null;
            } else {
                $fc = $value[0];
                if (($fc === '"' || $fc === "'") && $value[strlen($value) - 1] === $fc) {
                    $value = substr($value, 1, -1);
                    $value = strtr($value, ["\\$fc" => $fc]);
                }
                $value = strtr($value, ['\n' => PHP_EOL]);

                if (strpos($value, '${') !== false) {
                    preg_match_all('#\$\{([\w\.]+)\}#', $value, $matches, PREG_PATTERN_ORDER);
                    foreach ((array)$matches[1] as $match) {
                        $ref_name = $match;
                        if (!isset($data[$ref_name])) {
                            throw new InvalidValueException('`:ref` ref variable is not exists: :value', ['ref' => $ref_name, 'value' => $value]);
                        }
                        $value = strtr($value, ['${' . $ref_name . '}' => $data[$ref_name]]);
                    }
                } elseif (strpos($value, '$') !== false) {
                    preg_match_all('#\$([A-Z_\d]+)#', $value, $matches, PREG_PATTERN_ORDER);
                    foreach ((array)$matches[1] as $match) {
                        $ref_name = $match;
                        if (!isset($data[$ref_name])) {
                            throw new InvalidValueException(['`:ref` ref variable is not exists: :value', 'ref' => $ref_name, 'value' => $value]);
                        }
                        $value = strtr($value, ['$' . $ref_name => $data[$ref_name]]);
                    }
                }
            }

            $data[$name] = $value;
        }

        return $data;
    }
528447
protected function splitLine($line)
    {
        $result = [];
        foreach($this->fields as $field) {
            $result[] = mb_substr($line, $field['from'], $field['to'] - $field['from']);
        }
        return $result;
    }
210708
private function parse_ftp_rawlist($line) {
		$output = array();

		$split = preg_split('[ ]', $line, 9, PREG_SPLIT_NO_EMPTY);
		if ($split[0] != 'total') {
			$output['isdir'] = ($split[0] {0} === 'd');
			$output['perms'] = $split[0];
			$output['number'] = $split[1];
			$output['owner'] = $split[2];
			$output['group'] = $split[3];
			$output['size'] = $split[4];
			$output['month'] = $split[5];
			$output['day'] = $split[6];
			$output['time/year'] = $split[7];
			$output['name'] = $split[8];
		}
		return !empty($output) ? $output : false;
	}
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;
    }
923971
public function handleEvent(string $line)
    {
        $line = trim($line, "\0");
        if ($line === self::BATCH_END) {
            $this->handleBatch();

            return;
        }

        list($eventsString, $path) = explode(':', $line, 2);
        $events = explode(' ', $eventsString);
        $path = rtrim($path, '/');
        foreach ($events as $event) {
            $this->batchEvents[$path][$event] = true;
        }
    }
1047385
public function parseLine($line) {

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

        $model = new Card();
        $model->setTicketNumber($this->decodeString($data[++$i]));
        $model->setUserNumber(IntegerHelper::parseString($data[++$i]));
        $model->setArticleNumber(IntegerHelper::parseString($data[++$i]));
        $model->setValidFrom($this->decodeDate($data[++$i]));
        $model->setExpires($this->decodeDate($data[++$i]));
        $model->setBlocked(BooleanHelper::parseString($data[++$i]));
        $model->setBlockedDate($this->decodeDate($data[++$i]));
        $model->setProductionState(IntegerHelper::parseString($data[++$i]));
        $model->setReasonProduction(IntegerHelper::parseString($data[++$i]));
        $model->setProductionCounter(IntegerHelper::parseString($data[++$i]));
        $model->setNeutral(BooleanHelper::parseString($data[++$i]));
        $model->setRetainTicketEntry(BooleanHelper::parseString($data[++$i]));
        $model->setEntryBarrierClosed(BooleanHelper::parseString($data[++$i]));
        $model->setExitBarrierClosed(BooleanHelper::parseString($data[++$i]));
        $model->setRetainTicketExit(BooleanHelper::parseString($data[++$i]));
        $model->setDisplayText(BooleanHelper::parseString($data[++$i]));
        $model->setDisplayText1($this->decodeString($data[++$i]));
        $model->setDisplayText2($this->decodeString($data[++$i]));
        $model->setPersonnalNo(IntegerHelper::parseString($data[++$i]));
        $model->setResidualValue(IntegerHelper::parseString($data[++$i]));
        $model->setSerialNumberKeyCardSwatch($this->decodeString($data[++$i]));
        $model->setCurrencyResidualValue($this->decodeString($data[++$i]));
        $model->setTicketType(IntegerHelper::parseString($data[++$i]));
        $model->setTicketSubType($this->decodeString($data[++$i]));
        $model->setSerialNo($this->decodeString($data[++$i]));
        $model->setSuspendPeriodFrom($this->decodeDate($data[++$i]));
        $model->setSuspendPeriodUntil($this->decodeDate($data[++$i]));
        $model->setUseValidCarParks(BooleanHelper::parseString($data[++$i]));
        $model->setProductionFacilityNumber(IntegerHelper::parseString($data[++$i]));

        return $model;
    }
791214
protected function parseExpressionLine( Line$line ):self
	{
		$content=  $line->slice(1);
		$ent_flag= var_export($this->htsl->getConfig('ENT_flags',$this->docType),true);
		$charset=   var_export($this->htsl->getConfig('charset'),true);

		return $this->openNode(new StringNode($this,$line))->appendLine("<?=htmlentities($content,$ent_flag,$charset,false)?>");
	}
908519
private function findPath(string $line)
    {
        $matches = [];
        if (preg_match('/^diff --git SRC\/(.*) DST\/(.*)$/', $line, $matches)) {
            $this->originalPath = $matches[1];
            $this->destinationPath = $matches[2];
        }
    }
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);
        }
    }
1211979
protected function getLine():Line
	{
		do{
			$line= $this->buffer->getLine();
		}while( $line->isEmpty() && $line->hasMore() );

		return $line;
	}