Example #1
0
 public function testConstructWithEmptyData()
 {
     $collection = new Collection();
     $this->assertEmpty($collection->getData());
     $this->assertEquals(function () {
     }, $collection->getTransformer());
 }
Example #2
0
 /**
  * Paginates the collection response.
  *
  * @param $paginationEnabled
  *
  * @throws \InvalidArgumentException
  */
 protected function paginate($paginationEnabled)
 {
     if ($paginationEnabled) {
         if (!$this->content instanceof Paginator) {
             throw new \InvalidArgumentException();
         }
         $this->paginator->setupPaginator($this->content);
         $this->collection->setPaginator($this->paginator);
     }
 }