protected function signatureToArray($method, $signature, $cleanup = true)
    {
        // get begin and end of arguments
        $begin = strpos($signature,  '(') + 1;
        $end   = strrpos($signature, ')');

        // extract the list of aringuments
        $signature = substr($signature, $begin, $end - $begin);

        // convert to array
        $arguments = explode(',', $signature);

        // empty result
        $result = [];

        $i = 1;

        // iterate arguments and check for typehint
        foreach ($arguments as $argument) {
            $argument = trim($argument);

            if ($cleanup === true) {
                // take it only if typehint exist and if this is not "array"
                if (stristr($argument, ' ') !== false && strtolower(substr($argument, 0, 5)) != 'array') {
                    $argument = explode(' ', $argument);
                    //array_push($result, $argument);
                    $result[$i] = $argument;
                }
            } else {
                //array_push($result, $argument);
                $result[$i] = $argument;
            }

            ++$i;
        }

        // Return arguments
        return [$method => $result];
    }
protected function signatureToArray($method, $signature, $cleanup = true)
    {
        // get begin and end of arguments
        $begin = strpos($signature,  '(') + 1;
        $end   = strrpos($signature, ')');

        // extract the list of aringuments
        $signature = substr($signature, $begin, $end - $begin);

        // convert to array
        $arguments = explode(',', $signature);

        // empty result
        $result = [];

        $i = 1;

        // iterate arguments and check for typehint
        foreach ($arguments as $argument) {
            $argument = trim($argument);

            if ($cleanup === true) {
                // take it only if typehint exist and if this is not "array"
                if (stristr($argument, ' ') !== false && strtolower(substr($argument, 0, 5)) != 'array') {
                    $argument = explode(' ', $argument);
                    //array_push($result, $argument);
                    $result[$i] = $argument;
                }
            } else {
                //array_push($result, $argument);
                $result[$i] = $argument;
            }

            ++$i;
        }

        // Return arguments
        return [$method => $result];
    }
protected function signatureToArray ( $ method , $ signature , $ cleanup = true ) { // get begin and end of arguments $ begin = strpos ( $ signature , '(' ) + 1 ; $ end = strrpos ( $ signature , ')' ) ; // extract the list of aringuments $ signature = substr ( $ signature , $ begin , $ end - $ begin ) ; // convert to array $ arguments = explode ( ',' , $ signature ) ; // empty result $ result = [ ] ; $ i = 1 ; // iterate arguments and check for typehint foreach ( $ arguments as $ argument ) { $ argument = trim ( $ argument ) ; if ( $ cleanup === true ) { // take it only if typehint exist and if this is not "array" if ( stristr ( $ argument , ' ' ) !== false && strtolower ( substr ( $ argument , 0 , 5 ) ) != 'array' ) { $ argument = explode ( ' ' , $ argument ) ; //array_push($result, $argument); $ result [ $ i ] = $ argument ; } } else { //array_push($result, $argument); $ result [ $ i ] = $ argument ; } ++ $ i ; } // Return arguments return [ $ method => $ result ] ; }
Parses a given signature of a method for arguments and returns result as array.

This method is intend to parse a given signature of a method for arguments and returns result as array.

@param string $method    The name of the method to parse signature of
@param string $signature The signature to parse
@param bool   $cleanup   TRUE to direct cleanup the result and store only arguments with typehint

@author Benjamin Carl <opensource@clickalicious.de>

@return array Containing the parsed arguments and method name
Parses a given signature of a method for arguments and returns result as array .