Parse a long option (--option) string.

@param string $optionString

@return $this
775418
protected function parseOption($optionString)
    {
        $optionParts = explode('=', $optionString);

        if (count($optionParts) > 1) {
            list($key, $value) = $optionParts;
        } else {
            $key   = $optionString;
            $value = true;
        }

        $this->options[$key] = $value;
        return $this;
    }
130851
public function setHelpOptionLong($str) {
        if (!Option::validateLong($str)) {
            throw new ConfigException('long help option has invalid format');
        }
        $this->helpLong = $str;
        return $this;
    }
1339199
public function parseString($string)
    {
        $string = (string) $string;
        $string = preg_replace_callback("/\\$\{(.*?)\}/",
            function ($k) {
                return $this->get($k[1]);
            }, $string);

        return $string;
    }
34035
public static function fromString($string)
    {
        list($lat, $long) = explode(',', $string);
        return new self($lat, $long);
    }
527430
protected function parseRuleString($ruleString)
    {
        if (is_string($ruleString)) {
            // Check for valid rule format
            // (with vendor prefix check to match e.g. "@-moz-document")
            if (preg_match(
                '/^[ \r\n\t\f]*@(' . self::getVendorPrefixRegExp("/") . ')?document[ \r\n\t\f]+(.*)$/i',
                $ruleString,
                $matches
            )) {
                $vendorPrefix = $matches[1];
                $ruleString = trim($matches[2], " \r\n\t\f");
                $charset = $this->getCharset();

                $inFunction = false;
                $isEscaped = false;

                $conditions = [];
                $currentCondition = "";
                $currentValue  = "";
                for ($i = 0, $j = mb_strlen($ruleString, $charset); $i < $j; $i++) {
                    $char = mb_substr($ruleString, $i, 1, $charset);
                    if ($char === "\\") {
                        if ($isEscaped === false) {
                            $isEscaped = true;
                        } else {
                            $isEscaped = false;
                        }
                    } else {
                        if ($char === "(") {
                            if ($isEscaped === false) {
                                $inFunction = true;
                                continue;
                            } else {
                                $currentValue .= $char;
                            }
                        } else if ($char === ")") {
                            if ($isEscaped === false) {
                                $conditions[$currentCondition] = trim($currentValue, " \r\n\t\f");
                                $currentCondition = "";
                                $currentValue = "";
                                $inFunction = false;
                                continue;
                            } else {
                                $currentValue .= $char;
                            }
                        } else if ($char === "," || $char === " ") {
                            if ($currentCondition === "" && $currentValue === "") {
                                continue;
                            } elseif ($currentValue !== "") {
                                $currentValue .= $char;
                            } else {
                                // something wrong here...
                            }
                        } else {
                            if ($inFunction === false) {
                                $currentCondition .= $char;
                            } else {
                                $currentValue .= $char;
                            }
                        }
                    }

                    // Reset escaped flag
                    if ($isEscaped === true && $char !== "\\") {
                        $isEscaped = false;
                    }
                }

                foreach ($conditions as $key => $value) {
                    $conditions[$key] = Placeholder::replaceStringPlaceholders($value, true);
                }

                if (isset($conditions["url"])) {
                    $this->setUrl($conditions["url"]);
                }
                if (isset($conditions["url-prefix"])) {
                    $this->setUrlPrefix($conditions["url-prefix"]);
                }
                if (isset($conditions["domain"])) {
                    $this->setDomain($conditions["domain"]);
                }
                if (isset($conditions["regexp"])) {
                    $this->setRegexp($conditions["regexp"]);
                }
                if ($vendorPrefix !== "") {
                    $this->setVendorPrefix($vendorPrefix);
                }
            } else {
                throw new \InvalidArgumentException("Invalid format for @document rule.");
            }
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($ruleString) . "' for argument 'ruleString' given. String expected."
            );
        }
    }
287356
public function long($long) {
        $this->validated = false;
        if (!self::validateLong($long)) {
            throw new OptionConfigException('invalid long option format: ' . $long);
        }
        $this->config[self::LONG] = $long;
        return $this;
    }
1037876
public static function startsWithAlphanumeric($stringOrStrings, $optionOrOptions)
    {
        return self::startsWithInternal($stringOrStrings, $optionOrOptions, false, true, false);
    }
1299361
public function parse($input = null, $options = 0)
    {
        $this->root = null;

        if (!is_null($input)) {
            $this->setInput($input);
        }

        if (0 !== $options) {
            $this->options = $options;
        }

        $this->parseDocument();

        return $this->root;
    }
235082
private function parseLongOption($token) {
        $name = substr($token, 2);

        if (false !== $pos = strpos($name, '=')) {
            $this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1));
        }
        else {
            $this->addLongOption($name, null);
        }
    }
1180912
private function setOptionalStrings()
    {
        /*
         *  Make another string t' check fer
         */
        if($this->optional)
        {
            $this->strings[1] = $this->strings[0].Url::SLASH_WORD;
            //reverse the fecker, if the longer one matches first, good!
            $this->strings = array_reverse($this->strings);
        }
    }
762971
protected function _parseOptions($fieldName, $options)
    {
        $options = parent::_parseOptions($fieldName, $options);
        $options += ['id' => $this->_domId($fieldName)];
        if (is_string($options['label'])) {
            $options['label'] = ['text' => $options['label']];
        }

        return $options;
    }
93180
private function parseOption($rawOption) {
		$regex = "#^(?P<option>-[a-zA-Z]{1}|--[a-zA-Z-]{2,})(?:=(?P<value>['|\"]?.+?['|\"]?))?$#";
		if (preg_match($regex, trim($rawOption), $matches)) {
			if (isset($matches['option'])) {
				$option = ltrim($matches['option'], '-');
				if (isset($matches['value'])) {
					$value = $matches['value'];
				}

				if (strlen($option) == 1) {
					//Short Option
					$validOptions = $this->validShortOptions;
				} elseif (strlen($option) >= 2) {
					//Long Option
					$validOptions = $this->validLongOptions;
				}
				if (!isset($validOptions[$option])) {
					die("The option `{$option}` does not exist.\n");
				}
				if ($validOptions[$option]['value'] === self::VALUE_REQUIRED && !isset($value)) {
					die("The option `{$option}` requires a value, but none was given.\n");
				}
				if (isset($validOptions[$option]['allowed']) || (isset($validOptions[$option]['comma_delimited']) && $validOptions[$option]['comma_delimited'] == true)) {
					$value = explode(',', $value);
					$value = array_map('trim', $value);
				}
				if (isset($validOptions[$option]['allowed'])) {
					foreach ($value as $_value) {
						if (!in_array($_value, $validOptions[$option]['allowed'])) {
							die("The value `{$_value}` for `{$option}` is not valid.\n");
						}
					}
				}
				$this->options[$option] = (isset($value) ? $value : true);
			}
		}
	}
1224662
public function read_longstr()
    {
        $this->bitcount = $this->bits = 0;
        $slen = $this->read_php_int();

        if ($slen < 0) {
            throw new AMQPOutOfBoundsException('Strings longer than supported on this platform');
        }

        return $this->rawread($slen);
    }
1238001
public function write($string, $options = null) {
        if ($options === null) {
            $options = OutputVerbosity::NORMAL;
        }

        if ($this->is($options)) {
            $this->buffer->write($string);

            if ( ! $this->isBufferingEnabled()) {
                $this->flushBuffer();
            }
        }

        return $this;
    }
1250777
public Option getOptionWithLongForm( String longForm ) throws InvalidOptionException
    {
        for (Option option : options)
        {
            if (longForm.equals( option.getLongForm() )) return option;
        }

        throw new InvalidOptionException( longForm );
    }
273363
public static function fromString($string, Translations $translations, array $options = [])
    {
        $options += static::$options;

        $functions = new JsFunctionsScanner($string);
        $functions->saveGettextFunctions($translations, $options);
    }
1224946
public static function endsWith($stringOrStrings, $optionOrOptions)
    {
        return self::startsWithInternal($stringOrStrings, $optionOrOptions, true, false, false);
    }