src/Plugin/Double.php
protected static function _generateMethodStubs($methods, $defaults = true)
    {
        $result = [];
        $methods = $methods !== null ? (array) $methods : [];

        if ($defaults) {
            $methods = array_merge($methods, array_keys(static::_getMagicMethods()));
        }
        $methods = array_unique($methods);

        $magicMethods = static::_getMagicMethods();

        foreach ($methods as $name) {
            if (isset($magicMethods[$name])) {
                $result[$name] = $magicMethods[$name];
            } else {
                $static = $return = '';
                if ($name[0] === '&') {
                    $return = '$r = null; return $r;';
                }
                if (preg_match('/^&?::.*/', $name)) {
                    $static = 'static ';
                    $name = substr($name, 2);
                }
                $result[$name] = "public {$static}function {$name}() {{$return}}";
            }
        }

        return $result;
    }
protected static function _generateMethodStubs($methods, $defaults = true)
    {
        $result = [];
        $methods = $methods !== null ? (array) $methods : [];

        if ($defaults) {
            $methods = array_merge($methods, array_keys(static::_getMagicMethods()));
        }
        $methods = array_unique($methods);

        $magicMethods = static::_getMagicMethods();

        foreach ($methods as $name) {
            if (isset($magicMethods[$name])) {
                $result[$name] = $magicMethods[$name];
            } else {
                $static = $return = '';
                if ($name[0] === '&') {
                    $return = '$r = null; return $r;';
                }
                if (preg_match('/^&?::.*/', $name)) {
                    $static = 'static ';
                    $name = substr($name, 2);
                }
                $result[$name] = "public {$static}function {$name}() {{$return}}";
            }
        }

        return $result;
    }
protected static function _generateMethodStubs ( $ methods , $ defaults = true ) { $ result = [ ] ; $ methods = $ methods !== null ? ( array ) $ methods : [ ] ; if ( $ defaults ) { $ methods = array_merge ( $ methods , array_keys ( static :: _getMagicMethods ( ) ) ) ; } $ methods = array_unique ( $ methods ) ; $ magicMethods = static :: _getMagicMethods ( ) ; foreach ( $ methods as $ name ) { if ( isset ( $ magicMethods [ $ name ] ) ) { $ result [ $ name ] = $ magicMethods [ $ name ] ; } else { $ static = $ return = '' ; if ( $ name [ 0 ] === '&' ) { $ return = '$r = null; return $r;' ; } if ( preg_match ( '/^&?::.*/' , $ name ) ) { $ static = 'static ' ; $ name = substr ( $ name , 2 ) ; } $ result [ $ name ] = "public {$static}function {$name}() {{$return}}" ; } } return $ result ; }
Creates method stubs.

@param  array   $methods  An array of method definitions.
@param  boolean $defaults If `true`, Magic Methods will be appended.
@return array             The generated method definitions.
Creates method stubs .