Beispiel #1
0
 /** @test **/
 public function it_parses_ranges()
 {
     $this->assertEquals(['12345:1:2:3:4:5', '67890:1:2:3:4:5'], GetObject::ids([12345, 67890], '1-5'));
 }
Beispiel #2
0
 /**
  * @param $resource
  * @param $type
  * @param $content_ids
  * @param string $object_ids
  * @param int $location
  * @return Collection
  * @throws Exceptions\CapabilityUnavailable
  */
 public function GetObject($resource, $type, $content_ids, $object_ids = '*', $location = 0)
 {
     $request_id = GetObject::ids($content_ids, $object_ids);
     $response = $this->request('GetObject', ['query' => ['Resource' => $resource, 'Type' => $type, 'ID' => implode(',', $request_id), 'Location' => $location]]);
     if (preg_match('/multipart/', $response->getHeader('Content-Type'))) {
         $parser = $this->grab('parser.object.multiple');
         $collection = $parser->parse($response);
     } else {
         $collection = new Collection();
         $parser = $this->grab('parser.object.single');
         $object = $parser->parse($response);
         $collection->push($object);
     }
     return $collection;
 }