public function optional($type)
    {
        foreach ($this->arguments as $index => $argument) {
            if (gettype($argument) === $type || is_a($argument, $type, true)) {
                array_splice($this->arguments, $index, 1);

                return $argument;
            }
        }
    }
public function optional($type)
    {
        foreach ($this->arguments as $index => $argument) {
            if (gettype($argument) === $type || is_a($argument, $type, true)) {
                array_splice($this->arguments, $index, 1);

                return $argument;
            }
        }
    }
public function optional ( $ type ) { foreach ( $ this -> arguments as $ index => $ argument ) { if ( gettype ( $ argument ) === $ type || is_a ( $ argument , $ type , true ) ) { array_splice ( $ this -> arguments , $ index , 1 ) ; return $ argument ; } } }
Ask for an optional argument by type then pop and return
the first found from the list.

@param $type

@return mixed
Ask for an optional argument by type then pop and return the first found from the list .