\Qcloud\CosUploadBodyListener

Prepares the body parameter of a command such that the parameter is more flexible (e.g. accepts file handles) with the value it accepts but converts it to the correct format for the command. Also looks for a "Filename" parameter.

Summary

Methods
Properties
Constants
__construct()
getSubscribedEvents()
onCommandBeforePrepare()
No public properties found
No constants found
No protected methods found
$commands
$bodyParameter
$sourceParameter
N/A
No private methods found
No private properties found
N/A

Properties

$commands

$commands : array

Type

array — The names of the commands of which to modify the body parameter

$bodyParameter

$bodyParameter : string

Type

string — The key for the upload body parameter

$sourceParameter

$sourceParameter : string

Type

string — The key for the source file parameter

Methods

__construct()

__construct(array  $commands, string  $bodyParameter = 'Body', string  $sourceParameter = 'SourceFile') 

Parameters

array $commands

The commands to modify

string $bodyParameter

The key for the body parameter

string $sourceParameter

The key for the source file parameter

getSubscribedEvents()

getSubscribedEvents() : array

Returns an array of event names this subscriber wants to listen to.

The array keys are event names and the value can be:

  • The method name to call (priority defaults to 0)
  • An array composed of the method name to call and the priority
  • An array of arrays composed of the method names to call and respective priorities, or 0 if unset

For instance:

  • array('eventName' => 'methodName')
  • array('eventName' => array('methodName', $priority))
  • array('eventName' => array(array('methodName1', $priority), array('methodName2')))

Returns

array —

The event names to listen to

onCommandBeforePrepare()

onCommandBeforePrepare(\Guzzle\Common\Event  $event) 

Converts filenames and file handles into EntityBody objects before the command is validated

Parameters

\Guzzle\Common\Event $event

Event emitted

Throws

\Qcloud\Cos\Exception\InvalidArgumentException