Read value

@return RobotsTxtParser
542449
protected function readValue()
    {
        if ($this->newLine()) {
            $this->addValueToDirective();
        } elseif ($this->sharp()) {
            $this->current_word = mb_substr($this->current_word, 0, -1);
            $this->addValueToDirective();
        } else {
            $this->increment();
        }
        return $this;
    }
1293394
public function readLine()
    {
        if (null !== $this->unitTestData) {
            return $this->unitTestData;
        } else {
            $outputter = new PlainOutputter();
            $reader = new Reader();
            return $reader
                ->setOutputter($outputter)
                ->readLine("Type 'yes' to continue: ");
        }
    }
560778
protected function getText()
    {
        if ($this->value === null) {
            $text = $this->text;
        } elseif (is_array($this->value)) {
            $text = vsprintf($this->text, $this->value);
        } else {
            $text = sprintf($this->text, $this->value);
        }

        return $text;
    }
486028
private function _extractValue()
    {
        $value = Resources::EMPTY_STRING;

        if ($this->_pos < strlen($this->_value)) {
            $ch = $this->_value[$this->_pos];

            if ($ch == '"' || $ch == '\'') {
                // Value is contained between double quotes or skipped single quotes.
                ++$this->_pos;
                $value = $this->_extractString($ch);
            } else {
                $firstPos = $this->_pos;
                $isFound = false;

                while ($this->_pos < strlen($this->_value) && !$isFound) {
                    $ch = $this->_value[$this->_pos];

                    if ($ch == ';') {
                        $isFound = true;
                    } else {
                        ++$this->_pos;
                    }
                }

                $value = rtrim(
                    substr($this->_value, $firstPos, $this->_pos - $firstPos)
                );
            }
        }

        return $value;
    }
652099
public function read()
    {
        if (!$this->valid()) {
            return null;
        }

        // keep a local copy of the resource; the next() call could change the cached one
        $resource = $this->resource;

        $item = $this->current();
        $this->next();

        // serialize the item
        $event = new ResourceSerializeEvent($resource, $item);
        $this->eventDispatcher->dispatch(FeedEvents::RESOURCE_PRE_SERIALIZE, $event);
        $item = $this->serialize($item);
        $this->eventDispatcher->dispatch(FeedEvents::RESOURCE_POST_SERIALIZE, $event);

        return $item;
    }
327580
private function parseValue()
    {
        $this->getNextToken();

        if ($this->tokenIs(T_ARRAY) || $this->tokenIs('[')) {
            // Sub array with key.
            $this->debug('Sub array with key.');
            $subparser = new ArrayParser($this->parser, ($this->level + 1));
            $subparser->parse();
        } else {
            // String item with key.
            $this->debug('String item with key.');
            $subparser = new StringValue($this->parser, ($this->level + 1));
            $subparser->parse();

            $this->parser->setValue($this->parser->getStack(), $subparser->getValue());
        }
    }
74720
public static function prepare_attr_value ($text) {
		if (is_array($text)) {
			/** @noinspection ForeachSourceInspection */
			foreach ($text as &$t) {
				$t = static::prepare_attr_value($t);
			}
			return $text;
		}
		return strtr(
			$text,
			[
				'&'  => '&amp;',
				'"'  => '&quot;',
				'\'' => '&apos;',
				'<'  => '&lt;',
				'>'  => '&gt;'
			]
		);
	}
366135
public function getJsonValue()
    {
        // Structured text values should always be returned as a single
        // array-item. Multi-value text should be returned as multiple items in
        // the top-array.
        if (in_array($this->name, $this->structuredValues)) {
            return [$this->getParts()];
        }

        return $this->getParts();
    }
88125
public function parse()
	{
		$strBuffer = parent::parse();

		if (TL_MODE == 'BE')
		{
			$strBuffer = '<div class="tl_ce ' . $this->strTemplate . '">' . $strBuffer . '</div>';
		}
		
		return $strBuffer;
	}
1055184
private function getValue()
    {
        $glimpse = $this->lexer->glimpse();

        // check if it's an assigned value: @example(assigned="value")
        if (DocLexer::T_EQUALS === $glimpse['type']) {
            return $this->getAssignedValue();
        }

        return $this->getPlainValue();
    }
756936
public function parse($value)
    {
        if (is_array($value)) {
            return $this->parseSet($value);
        } else {
            return $this->parseValue($value);
        }
    }
1211493
public function parse() {
    $value = $this->getRawValue();
    $matches = [];
    if (is_array($value)) {
      return $value;
    }

    if (preg_match(self::NESTED_CONFIGURATION_REGEX, $value, $matches) === 1) {
      return $this->parseNestedValue($value, $matches);
    } else {
      return $this->parser->parseIntelligent($value);
    }
  }
363715
public function readString()
    {
        if (!is_resource($this->fp)) {
            return $this->raiseError('not connected');
        }

        $string = '';
        while (($char = @fread($this->fp, 1)) !== "\x00") {
            $string .= $char;
        }

        return $string;
    }
821550
protected function readdmesg()
    {
        if (count($this->_dmesg) === 0) {
            if (CommonFunctions::rfts('/var/log/messages', $buf)) {
                    $blocks = preg_replace("/\s(kernel: MINIX \d+\.\d+\.\d+\.)/", '<BLOCK>$1', $buf);
                    $parts = preg_split("/<BLOCK>/", $blocks, -1, PREG_SPLIT_NO_EMPTY);
                    $this->_dmesg = preg_split("/\n/", $parts[count($parts) - 1], -1, PREG_SPLIT_NO_EMPTY);
            }
        }

        return $this->_dmesg;
    }
286827
public static function parse($value)
    {
        if (\is_string($value)) {
            $operator = null;
            if (\strpos($value, AbstractMatcher::OPERATOR_AND)) {
                $operator = AbstractMatcher::OPERATOR_AND;
                $value = \explode(AbstractMatcher::OPERATOR_AND, $value);
            } elseif (\strpos($value, AbstractMatcher::OPERATOR_OR)) {
                $operator = AbstractMatcher::OPERATOR_OR;
                $value = \explode(AbstractMatcher::OPERATOR_OR, $value);
            } elseif (0 === \strpos($value, AbstractMatcher::OPERATOR_NOT)) {
                $value = [AbstractMatcher::OPERATOR_NOT => \substr($value, 1)];
            }
            if (null !== $operator) {
                return [
                    $operator => \array_map(
                        function ($val) {
                            return 0 === \strpos($val, AbstractMatcher::OPERATOR_NOT)
                                ? [AbstractMatcher::OPERATOR_NOT => \substr($val, 1)]
                                : $val;
                        },
                        $value
                    )
                ];
            }
        }

        return $value;
    }
459967
protected function readLine()
    {
        $buffer = '';

        while ($buffer === '') {
            $buffer = fgets($this->getFileHandler());

            if ($buffer === false) {
                $this->currentLine = null;

                return;
            }

            $buffer = trim($buffer);
        }

        if ($buffer === ']') {
            $this->currentLine = null;

            return;
        }

        $data = json_decode(rtrim($buffer, ','), true);
        $this->currentLine = $this->getOptionsResolver()->resolve($data);
    }
859456
def parse_value(cell):
    """"""
    value = cell.value

    # stripea espacios en strings
    if isinstance(value, string_types):
        value = value.strip()

    # convierte a texto ISO 8601 las fechas
    if isinstance(value, (datetime)):
        value = value.isoformat()

    return value