PostObject
        
        extends Collection
    
    
            
            in package
            
        
    
    
    
Encapsulates the logic for getting the data for an S3 object POST upload form
Table of Contents
Properties
- $bucket : string
 - $client : S3Client
 - $data : array<string|int, mixed>
 - $formAttributes : array<string|int, mixed>
 - $formInputs : array<string|int, mixed>
 - $jsonPolicy : string
 
Methods
- __construct() : mixed
 - Constructs the PostObject
 - add() : Collection
 - Add a value to a key. If a key of the same name has already been added, the key value will be converted into an array and the new value will be pushed to the end of the array.
 - clear() : Collection
 - Removes all key value pairs
 - count() : mixed
 - filter() : Collection
 - Iterates over each key value pair in the collection passing them to the Closure. If the Closure function returns true, the current value from input is returned into the result Collection. The Closure must accept three parameters: (string) $key, (string) $value and return Boolean TRUE or FALSE for each value.
 - fromConfig() : self
 - Create a new collection from an array, validate the keys, and add default values where missing
 - get() : mixed|null
 - Get a specific key value.
 - getAll() : array<string|int, mixed>
 - Get all or a subset of matching key value pairs
 - getBucket() : string
 - Gets the bucket name
 - getClient() : S3Client
 - Gets the S3 client
 - getFormAttributes() : array<string|int, mixed>
 - Gets the form attributes as an array
 - getFormInputs() : array<string|int, mixed>
 - Gets the form inputs as an array
 - getIterator() : mixed
 - getJsonPolicy() : string
 - Gets the raw JSON policy
 - getKeys() : array<string|int, mixed>
 - Get all keys in the collection
 - getPath() : mixed|null
 - Gets a value from the collection using an array path (e.g. foo/baz/bar would retrieve bar from two nested arrays) Allows for wildcard searches which recursively combine matches up to the level at which the wildcard occurs. This can be useful for accepting any key of a sub-array and combining matching keys from each diverging path.
 - hasKey() : bool
 - Returns whether or not the specified key is present.
 - hasValue() : mixed
 - Checks if any keys contains a certain value
 - inject() : string
 - Inject configuration settings into an input string
 - keySearch() : bool|string
 - Case insensitive search the keys in the collection
 - map() : Collection
 - Returns a Collection containing all the elements of the collection after applying the callback function to each one. The Closure should accept three parameters: (string) $key, (string) $value, (array) $context and return a modified value
 - merge() : Collection
 - Add and merge in a Collection or array of key value pair data.
 - offsetExists() : mixed
 - offsetGet() : mixed
 - offsetSet() : mixed
 - offsetUnset() : mixed
 - overwriteWith() : self
 - Over write key value pairs in this collection with all of the data from an array or collection.
 - prepareData() : PostObject
 - Analyzes the provided data and turns it into useful data that can be consumed and used to build an upload form
 - remove() : Collection
 - Remove a specific key value pair
 - replace() : Collection
 - Replace the data of the object with the value of an array
 - set() : Collection
 - Set a key value pair
 - setBucket() : PostObject
 - Sets the bucket and makes sure it is a valid bucket name
 - setClient() : PostObject
 - Sets the S3 client
 - setPath() : self
 - Set a value into a nested array key. Keys will be created as needed to set the value.
 - toArray() : array<string|int, mixed>
 - Get the array representation of an object
 - applyPolicy() : mixed
 - Handles the encoding, singing, and injecting of the policy
 
Properties
$bucket
    protected
        string
    $bucket
    
    
        The bucket name where the object will be posted
$client
    protected
        S3Client
    $client
    
    
        The S3 client being used to sign the policy
$data
    protected
        array<string|int, mixed>
    $data
    
    
        Data associated with the object.
$formAttributes
    protected
        array<string|int, mixed>
    $formAttributes
    
    
        The
$formInputs
    protected
        array<string|int, mixed>
    $formInputs
    
    
        The form's elements as an array
$jsonPolicy
    protected
        string
    $jsonPolicy
    
    
        The raw json policy
Methods
__construct()
Constructs the PostObject
    public
                    __construct(S3Client $client, mixed $bucket[, array<string|int, mixed> $options = array() ]) : mixed
    The options array accepts the following keys:
- acl: The access control setting to apply to the uploaded file. Accepts any of the CannedAcl constants
 - Cache-Control: The Cache-Control HTTP header value to apply to the uploaded file
 - Content-Disposition: The Content-Disposition HTTP header value to apply to the uploaded file
 - Content-Encoding: The Content-Encoding HTTP header value to apply to the uploaded file
 - Content-Type:                 The Content-Type HTTP header value to apply to the uploaded file. The default
value is 
application/octet-stream - Expires: The Expires HTTP header value to apply to the uploaded file
 - key:                          The location where the file should be uploaded to. The default value is
^${filename}which will use the name of the uploaded file - policy: A raw policy in JSON format. By default, the PostObject creates one for you
 - policy_callback: A callback used to modify the policy before encoding and signing it. The method signature for the callback should accept an array of the policy data as the 1st argument, (optionally) the PostObject as the 2nd argument, and return the policy data with the desired modifications.
 - success_action_redirect: The URI for Amazon S3 to redirect to upon successful upload
 - success_action_status: The status code for Amazon S3 to return upon successful upload
 - ttd: The expiration time for the generated upload form data
 - x-amz-meta-*: Any custom meta tag that should be set to the object
 - x-amz-server-side-encryption: The server-side encryption mechanism to use
 - x-amz-storage-class: The storage setting to apply to the object
 - x-amz-server-side-encryption-customer-algorithm: The SSE-C algorithm
 - x-amz-server-side-encryption-customer-key: The SSE-C customer secret key
 - x-amz-server-side-encryption-customer-key-MD5: The MD5 hash of the SSE-C customer secret key
 
For the Cache-Control, Content-Disposition, Content-Encoding, Content-Type, Expires, and key options, to use a "starts-with" comparison instead of an equals comparison, prefix the value with a ^ (carat) character
Parameters
- $client : S3Client
 - $bucket : mixed
 - $options : array<string|int, mixed> = array()
 
add()
Add a value to a key. If a key of the same name has already been added, the key value will be converted into an array and the new value will be pushed to the end of the array.
    public
                    add(string $key, mixed $value) : Collection
    Parameters
- $key : string
 - 
                    
Key to add
 - $value : mixed
 - 
                    
Value to add to the key
 
Return values
Collection —Returns a reference to the object.
clear()
Removes all key value pairs
    public
                    clear() : Collection
    Return values
Collectioncount()
    public
                    count() : mixed
    Attributes
- #[ReturnTypeWillChange]
 
filter()
Iterates over each key value pair in the collection passing them to the Closure. If the Closure function returns true, the current value from input is returned into the result Collection. The Closure must accept three parameters: (string) $key, (string) $value and return Boolean TRUE or FALSE for each value.
    public
                    filter(Closure $closure[, bool $static = true ]) : Collection
    Parameters
- $closure : Closure
 - 
                    
Closure evaluation function
 - $static : bool = true
 - 
                    
Set to TRUE to use the same class as the return rather than returning a Collection
 
Return values
CollectionfromConfig()
Create a new collection from an array, validate the keys, and add default values where missing
    public
            static        fromConfig([array<string|int, mixed> $config = array() ][, array<string|int, mixed> $defaults = array() ][, array<string|int, mixed> $required = array() ]) : self
    Parameters
- $config : array<string|int, mixed> = array()
 - 
                    
Configuration values to apply.
 - $defaults : array<string|int, mixed> = array()
 - 
                    
Default parameters
 - $required : array<string|int, mixed> = array()
 - 
                    
Required parameter names
 
Tags
Return values
selfget()
Get a specific key value.
    public
                    get(string $key) : mixed|null
    Parameters
- $key : string
 - 
                    
Key to retrieve.
 
Return values
mixed|null —Value of the key or NULL
getAll()
Get all or a subset of matching key value pairs
    public
                    getAll([array<string|int, mixed> $keys = null ]) : array<string|int, mixed>
    Parameters
- $keys : array<string|int, mixed> = null
 - 
                    
Pass an array of keys to retrieve only a subset of key value pairs
 
Return values
array<string|int, mixed> —Returns an array of all matching key value pairs
getBucket()
Gets the bucket name
    public
                    getBucket() : string
    Return values
stringgetClient()
Gets the S3 client
    public
                    getClient() : S3Client
    Return values
S3ClientgetFormAttributes()
Gets the form attributes as an array
    public
                    getFormAttributes() : array<string|int, mixed>
    Return values
array<string|int, mixed>getFormInputs()
Gets the form inputs as an array
    public
                    getFormInputs() : array<string|int, mixed>
    Return values
array<string|int, mixed>getIterator()
    public
                    getIterator() : mixed
    Attributes
- #[ReturnTypeWillChange]
 
getJsonPolicy()
Gets the raw JSON policy
    public
                    getJsonPolicy() : string
    Return values
stringgetKeys()
Get all keys in the collection
    public
                    getKeys() : array<string|int, mixed>
    Return values
array<string|int, mixed>getPath()
Gets a value from the collection using an array path (e.g. foo/baz/bar would retrieve bar from two nested arrays) Allows for wildcard searches which recursively combine matches up to the level at which the wildcard occurs. This can be useful for accepting any key of a sub-array and combining matching keys from each diverging path.
    public
                    getPath(string $path[, string $separator = '/' ][, mixed $data = null ]) : mixed|null
    Parameters
- $path : string
 - 
                    
Path to traverse and retrieve a value from
 - $separator : string = '/'
 - 
                    
Character used to add depth to the search
 - $data : mixed = null
 - 
                    
Optional data to descend into (used when wildcards are encountered)
 
Return values
mixed|nullhasKey()
Returns whether or not the specified key is present.
    public
                    hasKey(string $key) : bool
    Parameters
- $key : string
 - 
                    
The key for which to check the existence.
 
Return values
boolhasValue()
Checks if any keys contains a certain value
    public
                    hasValue(string $value) : mixed
    Parameters
- $value : string
 - 
                    
Value to search for
 
Return values
mixed —Returns the key if the value was found FALSE if the value was not found.
inject()
Inject configuration settings into an input string
    public
                    inject(string $input) : string
    Parameters
- $input : string
 - 
                    
Input to inject
 
Return values
stringkeySearch()
Case insensitive search the keys in the collection
    public
                    keySearch(string $key) : bool|string
    Parameters
- $key : string
 - 
                    
Key to search for
 
Return values
bool|string —Returns false if not found, otherwise returns the key
map()
Returns a Collection containing all the elements of the collection after applying the callback function to each one. The Closure should accept three parameters: (string) $key, (string) $value, (array) $context and return a modified value
    public
                    map(Closure $closure[, array<string|int, mixed> $context = array() ][, bool $static = true ]) : Collection
    Parameters
- $closure : Closure
 - 
                    
Closure to apply
 - $context : array<string|int, mixed> = array()
 - 
                    
Context to pass to the closure
 - $static : bool = true
 - 
                    
Set to TRUE to use the same class as the return rather than returning a Collection
 
Return values
Collectionmerge()
Add and merge in a Collection or array of key value pair data.
    public
                    merge(Collection|array<string|int, mixed> $data) : Collection
    Parameters
- $data : Collection|array<string|int, mixed>
 - 
                    
Associative array of key value pair data
 
Return values
Collection —Returns a reference to the object.
offsetExists()
    public
                    offsetExists(mixed $offset) : mixed
    Parameters
- $offset : mixed
 
Attributes
- #[ReturnTypeWillChange]
 
offsetGet()
    public
                    offsetGet(mixed $offset) : mixed
    Parameters
- $offset : mixed
 
Attributes
- #[ReturnTypeWillChange]
 
offsetSet()
    public
                    offsetSet(mixed $offset, mixed $value) : mixed
    Parameters
- $offset : mixed
 - $value : mixed
 
Attributes
- #[ReturnTypeWillChange]
 
offsetUnset()
    public
                    offsetUnset(mixed $offset) : mixed
    Parameters
- $offset : mixed
 
Attributes
- #[ReturnTypeWillChange]
 
overwriteWith()
Over write key value pairs in this collection with all of the data from an array or collection.
    public
                    overwriteWith(array<string|int, mixed>|Traversable $data) : self
    Parameters
- $data : array<string|int, mixed>|Traversable
 - 
                    
Values to override over this config
 
Return values
selfprepareData()
Analyzes the provided data and turns it into useful data that can be consumed and used to build an upload form
    public
                    prepareData() : PostObject
    Return values
PostObjectremove()
Remove a specific key value pair
    public
                    remove(string $key) : Collection
    Parameters
- $key : string
 - 
                    
A key to remove
 
Return values
Collectionreplace()
Replace the data of the object with the value of an array
    public
                    replace(array<string|int, mixed> $data) : Collection
    Parameters
- $data : array<string|int, mixed>
 - 
                    
Associative array of data
 
Return values
Collection —Returns a reference to the object
set()
Set a key value pair
    public
                    set(string $key, mixed $value) : Collection
    Parameters
- $key : string
 - 
                    
Key to set
 - $value : mixed
 - 
                    
Value to set
 
Return values
Collection —Returns a reference to the object
setBucket()
Sets the bucket and makes sure it is a valid bucket name
    public
                    setBucket(string $bucket) : PostObject
    Parameters
- $bucket : string
 
Return values
PostObjectsetClient()
Sets the S3 client
    public
                    setClient(S3Client $client) : PostObject
    Parameters
- $client : S3Client
 
Return values
PostObjectsetPath()
Set a value into a nested array key. Keys will be created as needed to set the value.
    public
                    setPath(string $path, mixed $value) : self
    Parameters
- $path : string
 - 
                    
Path to set
 - $value : mixed
 - 
                    
Value to set at the key
 
Tags
Return values
selftoArray()
Get the array representation of an object
    public
                    toArray() : array<string|int, mixed>
    Return values
array<string|int, mixed>applyPolicy()
Handles the encoding, singing, and injecting of the policy
    protected
                    applyPolicy() : mixed