protected function extractParameter(string $parameter, array $variables): array
    {
        $result = preg_match(
            '/^\s*' . self::REGEX_VARIABLE . '(\s*,\s*(?<next>.+))?\s*$/is',
            $parameter,
            $matches
        );

        if ($result === 0) {
            throw new SyntaxErrorException("Invalid parameter list $parameter");
        }

        return empty($matches['next'])
            ? [$this->getValue($matches, $variables)]
            : array_merge(
                [$this->getValue($matches, $variables)],
                $this->extractParameter($matches['next'], $variables)
            );
    }
protected function extractParameter(string $parameter, array $variables): array
    {
        $result = preg_match(
            '/^\s*' . self::REGEX_VARIABLE . '(\s*,\s*(?<next>.+))?\s*$/is',
            $parameter,
            $matches
        );

        if ($result === 0) {
            throw new SyntaxErrorException("Invalid parameter list $parameter");
        }

        return empty($matches['next'])
            ? [$this->getValue($matches, $variables)]
            : array_merge(
                [$this->getValue($matches, $variables)],
                $this->extractParameter($matches['next'], $variables)
            );
    }
protected function extractParameter ( string $ parameter , array $ variables ) : array { $ result = preg_match ( '/^\s*' . self :: REGEX_VARIABLE . '(\s*,\s*(?<next>.+))?\s*$/is' , $ parameter , $ matches ) ; if ( $ result === 0 ) { throw new SyntaxErrorException ( "Invalid parameter list $parameter" ) ; } return empty ( $ matches [ 'next' ] ) ? [ $ this -> getValue ( $ matches , $ variables ) ] : array_merge ( [ $ this -> getValue ( $ matches , $ variables ) ] , $ this -> extractParameter ( $ matches [ 'next' ] , $ variables ) ) ; }
Extract a parameter from a given string

@param string $parameter The parameter string of a function
@param array  $variables The current scope

@return array
@throws SyntaxErrorException
@throws UndefinedSymbolException
Extract a parameter from a given string