# Class AbstractResource

Abstract base class which implements shared functionality of ObjectStore resources. Provides support, for example, for metadata-handling and other features that are common to the ObjectStore components.

  OpenCloud\Common\Base
  OpenCloud\ObjectStore\Resource\AbstractResource

#### Direct known subclasses

OpenCloud\ObjectStore\Resource\AbstractContainer, OpenCloud\ObjectStore\Resource\Account, OpenCloud\ObjectStore\Resource\DataObject

#### Indirect known subclasses

OpenCloud\ObjectStore\Resource\CDNContainer, OpenCloud\ObjectStore\Resource\Container
Abstract
Namespace: OpenCloud\ObjectStore\Resource
Located at OpenCloud/ObjectStore/Resource/AbstractResource.php

Methods summary
`public` | # `__construct( `OpenCloud\Common\Service\ServiceInterface` $service )`
`public` | # `getService( )`
`public` | # `getCdnService( )`
`public` | # `getClient( )`
`public static static` | # `fromResponse( Guzzle\Http\Message\Response $response, `OpenCloud\Common\Service\ServiceInterface` $service )` Factory method that allows for easy instantiation from a Response object. Factory method that allows for easy instantiation from a Response object. #### Parameters $response `Guzzle\Http\Message\Response` $response $service ``OpenCloud\Common\Service\ServiceInterface`` $service #### Returns `static`
`public static array` | # `trimHeaders( mixed $headers )` Trim headers of their resource-specific prefixes. Trim headers of their resource-specific prefixes. #### Parameters $headers `mixed` $headers #### Returns `array`
`protected static` | # `headerIsValidMetadata( mixed $header )`
`protected static mixed` | # `stripPrefix( mixed $header )` Strip an individual header name of its resource-specific prefix. Strip an individual header name of its resource-specific prefix. #### Parameters $header `mixed` $header #### Returns `mixed`
`public static array` | # `stockHeaders( array $headers )` Prepend/stock the header names with a resource-specific prefix. Prepend/stock the header names with a resource-specific prefix. #### Parameters $headers `array` $headers #### Returns `array`
`public mixed` | # `setMetadata( mixed $data, boolean $constructFromResponse = false )` Set the metadata (local-only) for this object. Set the metadata (local-only) for this object. #### Parameters $data `mixed` $data $constructFromResponse `boolean` $constructFromResponse #### Returns `mixed` $this
`public `OpenCloud\Common\Metadata`` | # `getMetadata( )` #### Returns ``OpenCloud\Common\Metadata``
`public mixed` | # `saveMetadata( array $metadata, boolean $stockPrefix = true )` Push local metadata to the API, thereby executing a permanent save. Push local metadata to the API, thereby executing a permanent save. #### Parameters $metadata `array` $metadata The array of values you want to set as metadata $stockPrefix `boolean` $stockPrefix Whether to prepend each array key with the metadata-specific prefix. For objects, this would be X-Object-Meta-Foo => Bar #### Returns `mixed`
`public `OpenCloud\Common\Metadata`` | # `retrieveMetadata( )` Retrieve metadata from the API. This method will then set and return this value. Retrieve metadata from the API. This method will then set and return this value. #### Returns ``OpenCloud\Common\Metadata``
`public mixed` | # `unsetMetadataItem( mixed $key )` To delete or unset a particular metadata item. To delete or unset a particular metadata item. #### Parameters $key `mixed` $key #### Returns `mixed`
`public array` | # `appendToMetadata( array $values )` Append a particular array of values to the existing metadata. Analogous to a merge. Append a particular array of values to the existing metadata. Analogous to a merge. #### Parameters $values `array` $values #### Returns `array`

Methods inherited from OpenCloud\Common\Base
`__call(), checkJsonError(), generateUuid(), getInstance(), getJsonHeader(), getLogger(), getProperty(), makeResourceIteratorOptions(), populate(), propertyExists(), setLogger(), setProperty(), stripNamespace(), toCamel(), toUnderscores()`

Constants summary
`string` | `GLOBAL_METADATA_PREFIX` | `'X'` | #

Properties summary
`protected `OpenCloud\Common\Metadata`` | $metadata | `` | #
`protected string` | $metadataClass | `'OpenCloud\\Common\\Metadata'` | # The FQCN of the metadata object used for the container. The FQCN of the metadata object used for the container.
`protected `OpenCloud\Common\Service\ServiceInterface`` | $service | `` | # The service object. The service object.

Properties inherited from OpenCloud\Common\Base
`$aliases`