protected function generateMethodSignature(\ReflectionMethod $reflectionMethod)
    {

        // initialize the array for the method params
        $params = array();

        // iterate over the reflection method's parameters
        foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
            // initialize the param
            $param = '';

            // add the type hint, if specified
            if ($typeHint = $reflectionParameter->getClass()) {
                $param .= sprintf('\%s ', $typeHint->getName());
            }

            // add the array type hint, if specified
            if ($reflectionParameter->isArray()) {
                $param .= 'array ';
            }

            // add the by reference symbol, if necessary
            if ($reflectionParameter->isPassedByReference()) {
                $param .= '&';
            }

            // prepare the parameter name
            $param .= sprintf('$%s', $reflectionParameter->getName());

            // query whether or not the parameter has a default value
            if ($reflectionParameter->isDefaultValueAvailable()) {
                // if yes, try to load the type
                $type = gettype($defaultValue = $reflectionParameter->getDefaultValue());

                // qoute it, if it's a string
                switch ($type) {
                    case 'string':
                        $param .= sprintf(' = "%s"', $defaultValue);
                        break;
                    case 'array':
                        $param .= ' = array(';
                        foreach ($defaultValue as $value) {
                            $param .= $value . ', ';
                        }
                        $param .= ')';
                        break;
                    case 'boolean':
                        $param .= sprintf(' = %s', $defaultValue ? 'true' : 'false');
                        break;
                    case 'integer':
                        $param .= sprintf(' = %s', $defaultValue);
                        break;
                    case 'double':
                        $param .= sprintf(' = %s', $defaultValue);
                        break;
                    default:
                        $param .= sprintf(' = null');

                }
            }

            // append the parameter to the array
            $params[] = $param;
        }

        // implode the paramters and return them as string
        return implode(', ', $params);
    }
protected function generateMethodSignature(\ReflectionMethod $reflectionMethod)
    {

        // initialize the array for the method params
        $params = array();

        // iterate over the reflection method's parameters
        foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
            // initialize the param
            $param = '';

            // add the type hint, if specified
            if ($typeHint = $reflectionParameter->getClass()) {
                $param .= sprintf('\%s ', $typeHint->getName());
            }

            // add the array type hint, if specified
            if ($reflectionParameter->isArray()) {
                $param .= 'array ';
            }

            // add the by reference symbol, if necessary
            if ($reflectionParameter->isPassedByReference()) {
                $param .= '&';
            }

            // prepare the parameter name
            $param .= sprintf('$%s', $reflectionParameter->getName());

            // query whether or not the parameter has a default value
            if ($reflectionParameter->isDefaultValueAvailable()) {
                // if yes, try to load the type
                $type = gettype($defaultValue = $reflectionParameter->getDefaultValue());

                // qoute it, if it's a string
                switch ($type) {
                    case 'string':
                        $param .= sprintf(' = "%s"', $defaultValue);
                        break;
                    case 'array':
                        $param .= ' = array(';
                        foreach ($defaultValue as $value) {
                            $param .= $value . ', ';
                        }
                        $param .= ')';
                        break;
                    case 'boolean':
                        $param .= sprintf(' = %s', $defaultValue ? 'true' : 'false');
                        break;
                    case 'integer':
                        $param .= sprintf(' = %s', $defaultValue);
                        break;
                    case 'double':
                        $param .= sprintf(' = %s', $defaultValue);
                        break;
                    default:
                        $param .= sprintf(' = null');

                }
            }

            // append the parameter to the array
            $params[] = $param;
        }

        // implode the paramters and return them as string
        return implode(', ', $params);
    }
protected function generateMethodSignature ( \ ReflectionMethod $ reflectionMethod ) { // initialize the array for the method params $ params = array ( ) ; // iterate over the reflection method's parameters foreach ( $ reflectionMethod -> getParameters ( ) as $ reflectionParameter ) { // initialize the param $ param = '' ; // add the type hint, if specified if ( $ typeHint = $ reflectionParameter -> getClass ( ) ) { $ param .= sprintf ( '\%s ' , $ typeHint -> getName ( ) ) ; } // add the array type hint, if specified if ( $ reflectionParameter -> isArray ( ) ) { $ param .= 'array ' ; } // add the by reference symbol, if necessary if ( $ reflectionParameter -> isPassedByReference ( ) ) { $ param .= '&' ; } // prepare the parameter name $ param .= sprintf ( '$%s' , $ reflectionParameter -> getName ( ) ) ; // query whether or not the parameter has a default value if ( $ reflectionParameter -> isDefaultValueAvailable ( ) ) { // if yes, try to load the type $ type = gettype ( $ defaultValue = $ reflectionParameter -> getDefaultValue ( ) ) ; // qoute it, if it's a string switch ( $ type ) { case 'string' : $ param .= sprintf ( ' = "%s"' , $ defaultValue ) ; break ; case 'array' : $ param .= ' = array(' ; foreach ( $ defaultValue as $ value ) { $ param .= $ value . ', ' ; } $ param .= ')' ; break ; case 'boolean' : $ param .= sprintf ( ' = %s' , $ defaultValue ? 'true' : 'false' ) ; break ; case 'integer' : $ param .= sprintf ( ' = %s' , $ defaultValue ) ; break ; case 'double' : $ param .= sprintf ( ' = %s' , $ defaultValue ) ; break ; default : $ param .= sprintf ( ' = null' ) ; } } // append the parameter to the array $ params [ ] = $ param ; } // implode the paramters and return them as string return implode ( ', ' , $ params ) ; }
Generates the method signature based on the passed reflection method.

@param \ReflectionMethod $reflectionMethod The reflection method to generate the proxy for

@return string The method signature as string
Generates the method signature based on the passed reflection method .