swapResource

@param mixed $resource
@access public
@return void
498896
public function swapResource($resource)
    {
        if (!is_resource($resource) or 'gd' !== get_resource_type($resource)) {
            throw new \InvalidArgumentException('No resource given or wrong resource type');
        }

        $this->resource = $resource;
    }
182152
protected function setResource( string $resource, string $endpoint ): self
	{
		$this->resource = $resource;
		$this->resource_endpoint = $endpoint;
		return $this;
	}
1195017
protected function setStream($resource)
    {
        if (!$resource instanceof StreamInterface && ! is_resource($resource))
            throw new \InvalidArgumentException(
                'Stream must instance of StreamInterface or php resource.'
                .' given: "%s"'
                , \Poirot\Std\flatten($resource)
            );


        /** @see self::getStream */
        $this->stream           = null;      # reset stream fot getStream
        $this->_c_givenResource = $resource; # stream will made of this when requested
        return $this;
    }
363968
public function setResourceObj ($name, &$resource)
	{
		
		// Set the resource
		
		$this->resources[$name]	=& $resource;
		
		// If the object variable exists 
		
		if (isset ($this->$name))
		{

			// Assign to object variable

			$this->$name	=& $this->resources[$name];
			
		}
		
	}
1119712
public function delete($resource)
    {
        $event = $this->createResourceEvent($resource);
        $this->dispatcher->dispatch($this->config->getEventName('pre_delete'), $event);

        if (!$event->isPropagationStopped()) {
            $this->removeResource($event);

            $this->dispatcher->dispatch($this->config->getEventName('post_delete'), $event);
        }

        return $event;
    }
924182
public static function handleResource($resource)
    {
        if(!self::$_resourceLoader) {
            require_once 'Zend/Amf/Exception.php';
            throw new Zend_Amf_Exception('Unable to handle resources - resource plugin loader not set');
        }
        try {
            while(is_resource($resource)) {
                $resclass = self::getResourceParser($resource);
                if(!$resclass) {
                    require_once 'Zend/Amf/Exception.php';
                    throw new Zend_Amf_Exception('Can not serialize resource type: '. get_resource_type($resource));
                }
                $parser = new $resclass();
                if(is_callable(array($parser, 'parse'))) {
                    $resource = $parser->parse($resource);
                } else {
                    require_once 'Zend/Amf/Exception.php';
                    throw new Zend_Amf_Exception("Could not call parse() method on class $resclass");
                }
            }
            return $resource;
        } catch(Zend_Amf_Exception $e) {
            throw new Zend_Amf_Exception($e->getMessage(), $e->getCode(), $e);
        } catch(Exception $e) {
            require_once 'Zend/Amf/Exception.php';
            throw new Zend_Amf_Exception('Can not serialize resource type: '. get_resource_type($resource), 0, $e);
        }
    }
338728
function remove($resource)
    {
        $rid = spl_object_hash($resource);
        if (!isset($this->resourcePool[$rid]))
        {
            return false;
        }
        //从resourcePool中删除
        unset($this->resourcePool[$rid]);
        $this->resourceNum--;
        return true;
    }
1009587
protected function setupCreateReference($resource)
    {
        foreach ($resource->settings['actions']['CreateReference']['uris'] as $property => $uri) {
            $this->setupCreate($resource, $uri, $property);
        }
    }
624978
private function close($resource)
    {
        if (is_resource($resource)) {
            fclose($resource);
        }

        if (is_resource($this->process)) {
            proc_close($this->process);
            $this->process = null;
        }

        $this->stdin->close();
    }
923665
public function setResource($resource)
    {
        if(get_resource_type($resource) !== 'stream')
        {
            throw new \RuntimeException(sprintf(
                "Not a valid 'stream' resource; received a '%s' resource", get_resource_type($resource)
            ));
        }

        $this->_resource = $resource;

        return $this;
    }
229779
static public function createFromResource($resource) {
		if (!is_resource($resource))
			throw new Exception('Invalid (resource) parameter! This is not a resource!');
		if (get_resource_type($resource) != 'gd')
			throw new Exception('Invalid (resource) parameter! Resource is not a gd resource!');
		return new self($resource);
	}
341392
public function resourceExists($resource)
    {
        $resources = $this->getAvailableResources();
        foreach ($resources as $res) {
            if ($res->slug == $resource) {
                return true;
            }
        }
        return false;
    }
1208562
public function setResources($resources)
    {
        foreach ($resources as $resource) {
            $resource->setWidget($this);
        }

        $this->resources = $resources;

        return $this;
    }
566083
protected function resolveTransformerForResource($resource)
    {
        $transformer = null;

        if ($this->transformerResolver !== null) {
            $transformer = $this->transformerResolver->resolve($resource);
        }

        return $transformer;
    }
49802
protected function setupUpdateReference($resource)
    {
        foreach ($resource->settings['actions']['UpdateReference']['uris'] as $property => $uri) {
            $this->setupUpdate($resource, $uri, $property);
        }
    }
1132606
public function transform(FilesystemResource $resource)
    {
        $config = json_decode($resource->getBody(), true);
        return $this->validateConfig($config) ? $config : [];
    }
261590
public function delete(Resource $resource)
    {
        $data = $resource->toArray();

        $user = $this->userManager->findUserByUsername($data['username']);
        if (!$user) {
            $errorMessage = $this->translator->trans('error.user_not_found', array('%username%' => $data['username']));
            throw new NotFoundHttpException($errorMessage);
        }

        $this->userManager->deleteUser($user);
    }