Пример #1
0
 public function testCanSetAndGetSort()
 {
     $this->assertSame(array(), $this->query->sort());
     $this->assertSame($this->query, $this->query->sort(array('size', 'width')));
     $this->assertSame(array('size', 'width'), $this->query->sort());
 }
Пример #2
0
 /**
  * Get images owned by a user
  *
  * @param ImagesQuery $query An optional images query object
  * @return Model
  */
 public function getImages(ImagesQuery $query = null)
 {
     if (!$query) {
         $query = new ImagesQuery();
     }
     $params = array('user' => $this->getUser(), 'page' => $query->page(), 'limit' => $query->limit());
     if ($query->metadata()) {
         $params['metadata'] = true;
     }
     if ($from = $query->from()) {
         $params['from'] = $from;
     }
     if ($to = $query->to()) {
         $params['to'] = $to;
     }
     if ($fields = $query->fields()) {
         $params['fields'] = $fields;
     }
     if ($sort = $query->sort()) {
         $params['sort'] = $sort;
     }
     if ($ids = $query->ids()) {
         $params['ids'] = $ids;
     }
     if ($checksums = $query->checksums()) {
         $params['checksums'] = $checksums;
     }
     if ($originalChecksums = $query->originalChecksums()) {
         $params['originalChecksums'] = $originalChecksums;
     }
     $response = $this->getCommand('GetImages', $params)->execute();
     $response['images'] = array_map(array('ImboClient\\Helper\\PublicKeyFallback', 'fallback'), $response['images']);
     return $response;
 }