Skip to content
This repository has been archived by the owner on Mar 14, 2021. It is now read-only.

The sort function #46

Open
alacret opened this issue Feb 3, 2013 · 0 comments
Open

The sort function #46

alacret opened this issue Feb 3, 2013 · 0 comments

Comments

@alacret
Copy link

alacret commented Feb 3, 2013

/**
 * Setting the sort to a specified value.
 * Allows to sort results, only if the cattegory selected is not 'ALL'
 *
 * @param string $parameter
 *
 * @return AmazonECS
 * 
 * @autor alacret
 * 
 */
public function sort($parameter) {
    if(!isset($this -> requestConfig['category']) or $this -> requestConfig['category'] == null ){
        throw new InvalidArgumentException('A category must be set before adding the sort parameter');
    }
    if($this -> requestConfig['category'] == "All" ){
        throw new InvalidArgumentException('The sort is not supported for the "All" category');
    }
    if($parameter == null or $parameter == "" ){
        throw new InvalidArgumentException(sprintf('%s : invalid value for sort parameter',$parameter));
    }

    $this -> responseConfig['optionalParameters'] = array_merge($this -> responseConfig['optionalParameters'], array("Sort" => $parameter));

    return $this;
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant