public function build($functionName)
    {
        if (!function_exists($functionName)) {
            return;
        }
        $function            = new \ReflectionFunction($functionName);
        $signatureParameters = [];
        $bodyParameters      = [];
        foreach ($function->getParameters() as $reflectionParameter) {
            if ($this->isVariadic($reflectionParameter)) {
                break;
            }
            $parameter = $reflectionParameter->isPassedByReference()
                ? "&$$reflectionParameter->name"
                : "$$reflectionParameter->name";
            
            $signatureParameter = $reflectionParameter->isOptional()
                ? sprintf("%s = '%s'", $parameter, MockFunctionGenerator::DEFAULT_ARGUMENT)
                : $parameter;

            $signatureParameters[] = $signatureParameter;
            $bodyParameters[]      = $parameter;
        }
        $this->signatureParameters = implode(", ", $signatureParameters);
        $this->bodyParameters      = implode(", ", $bodyParameters);
    }
public function build($functionName)
    {
        if (!function_exists($functionName)) {
            return;
        }
        $function            = new \ReflectionFunction($functionName);
        $signatureParameters = [];
        $bodyParameters      = [];
        foreach ($function->getParameters() as $reflectionParameter) {
            if ($this->isVariadic($reflectionParameter)) {
                break;
            }
            $parameter = $reflectionParameter->isPassedByReference()
                ? "&$$reflectionParameter->name"
                : "$$reflectionParameter->name";
            
            $signatureParameter = $reflectionParameter->isOptional()
                ? sprintf("%s = '%s'", $parameter, MockFunctionGenerator::DEFAULT_ARGUMENT)
                : $parameter;

            $signatureParameters[] = $signatureParameter;
            $bodyParameters[]      = $parameter;
        }
        $this->signatureParameters = implode(", ", $signatureParameters);
        $this->bodyParameters      = implode(", ", $bodyParameters);
    }
public function build ( $ functionName ) { if ( ! function_exists ( $ functionName ) ) { return ; } $ function = new \ ReflectionFunction ( $ functionName ) ; $ signatureParameters = [ ] ; $ bodyParameters = [ ] ; foreach ( $ function -> getParameters ( ) as $ reflectionParameter ) { if ( $ this -> isVariadic ( $ reflectionParameter ) ) { break ; } $ parameter = $ reflectionParameter -> isPassedByReference ( ) ? "&$$reflectionParameter->name" : "$$reflectionParameter->name" ; $ signatureParameter = $ reflectionParameter -> isOptional ( ) ? sprintf ( "%s = '%s'" , $ parameter , MockFunctionGenerator :: DEFAULT_ARGUMENT ) : $ parameter ; $ signatureParameters [ ] = $ signatureParameter ; $ bodyParameters [ ] = $ parameter ; } $ this -> signatureParameters = implode ( ", " , $ signatureParameters ) ; $ this -> bodyParameters = implode ( ", " , $ bodyParameters ) ; }
Builds the parameters for an existing function.

@param string $functionName The function name.
Builds the parameters for an existing function .