input/formats/parsers/Argv.php
protected function parseLongOption(string $token, values\Options $options, array& $input) : void
    {
        // Remove the two starting hyphens.
        $name  = substr($token, 2);
        $value = null;

        // If the token contains a value for the option, we need to split the token accordingly.
        if (false !== $pos = strpos($name, '=')) {
            $value = substr($name, $pos + 1);
            $name  = substr($name, 0, $pos);
        }

        // If the option didn't have a value assigned using the 'equals' sign, the value may be contained in
        // the next token, *if* the Option accepts values to begin with.
        // Note: It's possible that no Definition for the given Option even exists, but we're deferring
        // Exception throwing to parameters\Options::set() to avoid some duplicate code.
        /* @var input\Option $definition */
        if (!isset($value) && $definition = $options->definitions()->get($name) and $definition->hasValue()) {
            // $input[0][0] is the first character of the first token in the $input array.
            // Ensure the token does not begin with a hyphen, which would indicate it's another Option,
            // and not a value for the Option we are processing.
            if (isset($input[0]) && '-' !== $input[0][0]) {
                $value = array_shift($input);
            }
        }

        $options->set($name, $value);
    }
protected function parseLongOption(string $token, values\Options $options, array& $input) : void
    {
        // Remove the two starting hyphens.
        $name  = substr($token, 2);
        $value = null;

        // If the token contains a value for the option, we need to split the token accordingly.
        if (false !== $pos = strpos($name, '=')) {
            $value = substr($name, $pos + 1);
            $name  = substr($name, 0, $pos);
        }

        // If the option didn't have a value assigned using the 'equals' sign, the value may be contained in
        // the next token, *if* the Option accepts values to begin with.
        // Note: It's possible that no Definition for the given Option even exists, but we're deferring
        // Exception throwing to parameters\Options::set() to avoid some duplicate code.
        /* @var input\Option $definition */
        if (!isset($value) && $definition = $options->definitions()->get($name) and $definition->hasValue()) {
            // $input[0][0] is the first character of the first token in the $input array.
            // Ensure the token does not begin with a hyphen, which would indicate it's another Option,
            // and not a value for the Option we are processing.
            if (isset($input[0]) && '-' !== $input[0][0]) {
                $value = array_shift($input);
            }
        }

        $options->set($name, $value);
    }
protected function parseLongOption ( string $ token , values \ Options $ options , array & $ input ) : void { // Remove the two starting hyphens. $ name = substr ( $ token , 2 ) ; $ value = null ; // If the token contains a value for the option, we need to split the token accordingly. if ( false !== $ pos = strpos ( $ name , '=' ) ) { $ value = substr ( $ name , $ pos + 1 ) ; $ name = substr ( $ name , 0 , $ pos ) ; } // If the option didn't have a value assigned using the 'equals' sign, the value may be contained in // the next token, *if* the Option accepts values to begin with. // Note: It's possible that no Definition for the given Option even exists, but we're deferring // Exception throwing to parameters\Options::set() to avoid some duplicate code. /* @var input\Option $definition */ if ( ! isset ( $ value ) && $ definition = $ options -> definitions ( ) -> get ( $ name ) and $ definition -> hasValue ( ) ) { // $input[0][0] is the first character of the first token in the $input array. // Ensure the token does not begin with a hyphen, which would indicate it's another Option, // and not a value for the Option we are processing. if ( isset ( $ input [ 0 ] ) && '-' !== $ input [ 0 ] [ 0 ] ) { $ value = array_shift ( $ input ) ; } } $ options -> set ( $ name , $ value ) ; }
Parses the given token as a long option and adds it to the Options set.

@param   string          $token      The token to parse.
@param   values\Options  $options    The collection of Options being filled.
@param   array&          $input      A reference to the argv input array.
Parses the given token as a long option and adds it to the Options set .