Creates or updates a single resource object

@param string Resource location, e.g. "product/property/type"
@return string Generated output
764389
public function putAction( $resource )
	{
		$response = $this->createAdmin( $resource )->put( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
169760
public function resource($name, $resource = null)
    {
        if ($resource) {
            $this->addResource($name, $resource);
        } else {
            return $this->getResource($name);
        }
    }
253980
public function updateFileResource(File $resource, $binaryData)
    {
        $url = self::makeUrl(null, $resource->uri);

        $body = $binaryData;
        $response = $this->service->sendBinary($url, array(201, 200), $body, MimeMapper::mapType($resource->type), 'attachment; filename=' . $resource->label, $resource->description, 'PUT');
        return File::createFromJSON(json_decode($response, true), get_class($resource));

    }
150512
function createResources() {
    if( 0 >= count( $this->resources ))
      return;
    $output = null;
    foreach( $this->resources as $resource ) {
      $attributes = $this->_createParams( $resource['params'], array( 'ALTREP', 'LANGUAGE' ));
      if( is_array( $resource['value'] )) {
        foreach( $resource['value'] as $rix => $resourcePart )
          $resource['value'][$rix] = $this->_strrep( $resourcePart );
        $content  = implode( ',', $resource['value'] );
      }
      else
        $content  = $this->_strrep( $resource['value'] );
      $output    .= $this->_createElement( 'RESOURCES', $attributes, $content );
    }
    return $output;
  }
402717
protected function createModel(Resource $resource)
    {
        $model = new $resource->model_class;
        $model->fill($resource->data);

        $result = $model->save();
        if ($result === true) {
            return $model;
        }

        $code = (empty($resource->data) || $result === null)
            ? static::ERROR_INVALID_PAYLOAD
            : static::ERROR_INTERNAL_SERVER;

        $message = "Resource '$resource->name' could not be created: ";

        if (is_string($result)) {
            $message .= "Database failure ($result)";
        } elseif ($result === false) {
            $message .= 'post-save failure';
        } else {
            $message .= 'pre-save failure';
        }

        $this->sendError($code, $message);
    }
365623
@PUT
    public Response conditionalUpdate(final String resource)
            throws IOException {
        return execute(getResourceRequest(RequestTypeEnum.PUT, RestOperationTypeEnum.UPDATE).resource(resource));
    }
220864
private function cloneResource($resource) {
		// Get width from image.
		$w = imagesx($resource);
		// Get height from image.
		$h = imagesy($resource);
		// Get the transparent color from a 256 palette image.
		$trans = imagecolortransparent($resource);

		if (imageistruecolor($resource)) {
			// this is a true color image...
			$clone = imagecreatetruecolor($w, $h);
			imagealphablending($clone, false);
			imagesavealpha($clone, true);
		} else {
			// this is a 256 color palette image...
			$clone = imagecreate($w, $h);

			// If the image has transparency...
			if ($trans >= 0) {
				$rgb = imagecolorsforindex($resource, $trans);
				imagesavealpha($clone, true);
				$trans_index = imagecolorallocatealpha($clone, $rgb['red'], $rgb['green'], $rgb['blue'], $rgb['alpha']);
				imagefill($clone, 0, 0, $trans_index);
			}
		}

		// Create the Clone!!
		imagecopy($clone, $resource, 0, 0, 0, 0, $w, $h);

		return [
			'resource' => $clone,
			'width' => $w,
			'height' => $h,
		];
	}
1214074
public function getId($resource): ?string
    {
        assert(get_class($resource) === static::MODEL);
        assert($this->classImplements(static::MODEL, ModelInterface::class) === true);

        /** @var ModelInterface $modelClass */
        $modelClass = static::MODEL;

        $pkName = $modelClass::getPrimaryKeyName();

        return $resource->{$pkName};
    }
958908
public function getAction( $resource )
	{
		$response = $this->createAdmin( $resource )->get( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
196129
public static function make($key, $resource, $version = 'v2')
    {
        $client = new Client($key, $version);

        $namespace = 'Rule\\ApiWrapper\\Api\\' . strtoupper($version) . '\\' . ucfirst($resource) . '\\';
        $classname = $namespace . ucfirst($resource);

        if (!class_exists($classname)) {
            throw new InvalidResourceException("Invalid resource name providen or api version not supported");
        }

        return new $classname($client);
    }
631959
protected function createAdmin( $resource )
	{
		$context = $this->getContextBackend( 'admin/jsonadm/templates' );
		return \Aimeos\Admin\JsonAdm::create( $context, Base::getAimeos(), $resource );
	}
276806
function makeResource()
    {
        $resource = $this->resource;
        if ($this->id) $resource .= '/' . $this->id;
        return $resource;
    }
1323376
protected function createResourceOutput(?array $resources) : ?string
    {
        if (empty($resources)) {
            return null;
        }

        $extra = [];

        foreach ($resources as $attr => $value) {
            $extra[] = e($attr) . '="' . e($value) . '"';
        }

        return implode(' ', $extra);
    }
122504
private function generateResourceName($resource)
    {
        if (false === $this->pluralize) {
            return $resource;
        }

        return $this->inflector->pluralize($resource);
    }
153831
protected function createParsedResource($resource): ResourceInterface
    {
        \assert(
            $this->schemaContainer->hasSchema($resource),
            'No Schema found for resource `' . \get_class($resource) . '`.'
        );

        return $this->factory->createParsedResource(
            $this->position,
            $this->schemaContainer,
            $resource
        );
    }
1015336
public function update(ResourceInterface $resource)
    {
        $event = $this->createResourceEvent($resource);
        $this->dispatcher->dispatch($this->config->getEventName('pre_update'), $event);

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

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

        return $event;
    }
841287
public static function createFromResource(Resource $resource, array $options = [])
    {
        $entity = new self();

        $entity->applyResource($resource);

        return $entity;
    }