public function setOptionsObject($method, $args)
    {
        // All options are stored as a child namespace so the below is possible
        $class = get_class($this->client) . "\\" . ucfirst($method);

        // If there is no array passed to the function just return the object
        if (!is_array($args[0]) || count($args[0]) === 0) {
            return new $class;
        }

        $optionClass = new $class;

        foreach ($args[0] as $key => $val) {
            $setterMethod = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
            if (method_exists($optionClass, 'set' . $setterMethod)) {
                $optionClass->{'set' . $setterMethod}($val);
            }
        }

        $this->_options[$method] = $optionClass;

        return $optionClass;
    }
public function setOptionsObject($method, $args)
    {
        // All options are stored as a child namespace so the below is possible
        $class = get_class($this->client) . "\\" . ucfirst($method);

        // If there is no array passed to the function just return the object
        if (!is_array($args[0]) || count($args[0]) === 0) {
            return new $class;
        }

        $optionClass = new $class;

        foreach ($args[0] as $key => $val) {
            $setterMethod = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
            if (method_exists($optionClass, 'set' . $setterMethod)) {
                $optionClass->{'set' . $setterMethod}($val);
            }
        }

        $this->_options[$method] = $optionClass;

        return $optionClass;
    }
public function setOptionsObject ( $ method , $ args ) { // All options are stored as a child namespace so the below is possible $ class = get_class ( $ this -> client ) . "\\" . ucfirst ( $ method ) ; // If there is no array passed to the function just return the object if ( ! is_array ( $ args [ 0 ] ) || count ( $ args [ 0 ] ) === 0 ) { return new $ class ; } $ optionClass = new $ class ; foreach ( $ args [ 0 ] as $ key => $ val ) { $ setterMethod = str_replace ( ' ' , '' , ucwords ( str_replace ( '_' , ' ' , $ key ) ) ) ; if ( method_exists ( $ optionClass , 'set' . $ setterMethod ) ) { $ optionClass -> { 'set' . $ setterMethod } ( $ val ) ; } } $ this -> _options [ $ method ] = $ optionClass ; return $ optionClass ; }
Sets the given options object and stores it
@param $method
@param $args
@return mixed
Sets the given options object and stores it