示例#1
0
文件: ImageTest.php 项目: n10ty/api
 public function setUp()
 {
     $this->collection = new Images();
     foreach ($this->images as $image) {
         $factory = new ImageFactory();
         $object = $factory->create($image);
         $this->collection->addImage($object);
     }
 }
示例#2
0
 public function setUp()
 {
     $client = new Client(new ApiToken('abcdef'));
     $this->collection = new Images();
     foreach ($this->images as $image) {
         $factory = new ImageFactory($client->getHttpClient());
         $object = $factory->create($image);
         $this->collection->addImage($object);
     }
 }
示例#3
0
 /**
  * Create full collection
  *
  * @param  array  $data
  * @return Images
  */
 public function createImageCollection(array $data = array())
 {
     $collection = new Images();
     foreach ($data as $format => $formatCollection) {
         if (!is_array($formatCollection)) {
             continue;
         }
         foreach ($formatCollection as $item) {
             if (array_key_exists($format, Image::$formats)) {
                 $item = $this->create($item, $format);
                 $collection->addImage($item);
             }
         }
     }
     return $collection;
 }