public static function factory($prefix, $name = null)
    {
        $calledClass = get_called_class();

        /** @var \PhalconRest\Api\ApiResource $resource */
        $resource = new $calledClass($prefix);

        if (!$resource->getItemKey()) {
            $resource->itemKey('items');
        }

        if (!$resource->getCollectionKey()) {
            $resource->collectionKey('items');
        }

        if (!$resource->getTransformer()) {
            $resource->transformer(ModelTransformer::class);
        }

        if (!$resource->getHandler()) {
            $resource->setHandler(CrudResourceController::class);
        }

        if (!$resource->getName() && $name) {
            $resource->name($name);
        }

        if ($name) {
            $resource->name($name);
        }

        return $resource;
    }
public static function factory($prefix, $name = null)
    {
        $calledClass = get_called_class();

        /** @var \PhalconRest\Api\ApiResource $resource */
        $resource = new $calledClass($prefix);

        if (!$resource->getItemKey()) {
            $resource->itemKey('items');
        }

        if (!$resource->getCollectionKey()) {
            $resource->collectionKey('items');
        }

        if (!$resource->getTransformer()) {
            $resource->transformer(ModelTransformer::class);
        }

        if (!$resource->getHandler()) {
            $resource->setHandler(CrudResourceController::class);
        }

        if (!$resource->getName() && $name) {
            $resource->name($name);
        }

        if ($name) {
            $resource->name($name);
        }

        return $resource;
    }
public static function factory ( $ prefix , $ name = null ) { $ calledClass = get_called_class ( ) ; /** @var \PhalconRest\Api\ApiResource $resource */ $ resource = new $ calledClass ( $ prefix ) ; if ( ! $ resource -> getItemKey ( ) ) { $ resource -> itemKey ( 'items' ) ; } if ( ! $ resource -> getCollectionKey ( ) ) { $ resource -> collectionKey ( 'items' ) ; } if ( ! $ resource -> getTransformer ( ) ) { $ resource -> transformer ( ModelTransformer :: class ) ; } if ( ! $ resource -> getHandler ( ) ) { $ resource -> setHandler ( CrudResourceController :: class ) ; } if ( ! $ resource -> getName ( ) && $ name ) { $ resource -> name ( $ name ) ; } if ( $ name ) { $ resource -> name ( $ name ) ; } return $ resource ; }
Returns resource with default values

@param string $prefix Prefix for the resource (e.g. /user)
@param string $name Name for the resource (e.g. users) (optional)

@return static
Returns resource with default values