public function define(string $resource, $versionOrClosure, $closureOrDescription = null, string $description = null)
    {
        $version = $this->version;
        $closure = $closureOrDescription;

        if ($versionOrClosure instanceof \Closure) {
            $version = $this->version;
            $closure = $versionOrClosure;
            $description = $closureOrDescription;
        }

        if (is_numeric($versionOrClosure)) {
            $version = intval($versionOrClosure);
        }

        $this->definitions->push(new ResourceDefinition($version, $resource, $description));

        $resourceDefinition = $this->definition($resource, $version);
        call_user_func_array($closure, [$resourceDefinition]);

        return $this;
    }
public function define(string $resource, $versionOrClosure, $closureOrDescription = null, string $description = null)
    {
        $version = $this->version;
        $closure = $closureOrDescription;

        if ($versionOrClosure instanceof \Closure) {
            $version = $this->version;
            $closure = $versionOrClosure;
            $description = $closureOrDescription;
        }

        if (is_numeric($versionOrClosure)) {
            $version = intval($versionOrClosure);
        }

        $this->definitions->push(new ResourceDefinition($version, $resource, $description));

        $resourceDefinition = $this->definition($resource, $version);
        call_user_func_array($closure, [$resourceDefinition]);

        return $this;
    }
public function define ( string $ resource , $ versionOrClosure , $ closureOrDescription = null , string $ description = null ) { $ version = $ this -> version ; $ closure = $ closureOrDescription ; if ( $ versionOrClosure instanceof \ Closure ) { $ version = $ this -> version ; $ closure = $ versionOrClosure ; $ description = $ closureOrDescription ; } if ( is_numeric ( $ versionOrClosure ) ) { $ version = intval ( $ versionOrClosure ) ; } $ this -> definitions -> push ( new ResourceDefinition ( $ version , $ resource , $ description ) ) ; $ resourceDefinition = $ this -> definition ( $ resource , $ version ) ; call_user_func_array ( $ closure , [ $ resourceDefinition ] ) ; return $ this ; }
defines a new resource

@param string $resource
@param int|callable|\Closure $versionOrClosure
@param null|callable|\Closure $closureOrDescription
@param string $description
@return ResourceManager|static
defines a new resource