Skip to content

Commit

Permalink
added CollectionHelper->query()
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyWendt committed Aug 20, 2015
1 parent dd770bd commit 839f6c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/CollectionHelper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace LaraPackage\Api;

use LaraPackage\Api\Contracts\Entity\Transformer\Transformer;

class CollectionHelper implements \LaraPackage\Api\Contracts\CollectionHelper
{
/**
Expand Down Expand Up @@ -74,4 +76,14 @@ public function pageSize()
return $this->version->collectionPageSize($this->requestParser->version());
}


/**
* @inheritdoc
*/
public function query(Transformer $transformer)
{
$queryArray = $this->requestParser->query();

return $transformer->reverseTransform($queryArray);
}
}
9 changes: 9 additions & 0 deletions src/Contracts/CollectionHelper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace LaraPackage\Api\Contracts;

use LaraPackage\Api\Contracts\Entity\Transformer\Transformer;

interface CollectionHelper
{
/**
Expand Down Expand Up @@ -34,4 +36,11 @@ public static function isCollection(array $array);
* @return int
*/
public function pageSize();

/**
* @param Transformer $transformer
*
* @return array
*/
public function query(Transformer $transformer);
}

0 comments on commit 839f6c4

Please sign in to comment.