mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 07:52:29 +03:00
Implemented minimize response processor and updated the ProcessorsInterface.
This commit is contained in:
parent
bfc96409bc
commit
4189bcb459
6 changed files with 27 additions and 7 deletions
|
@ -15,7 +15,7 @@ namespace EA\Engine\Api\V1\Processors;
|
|||
|
||||
class Filter implements ProcessorsInterface {
|
||||
{
|
||||
public static function process(array $response) {
|
||||
public static function process(array &$response) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,27 @@
|
|||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
class Minimize implements ProcessorsInterface {
|
||||
public static function process(array $response) {
|
||||
|
||||
public static function process(array &$response) {
|
||||
if (!isset($_GET['fields'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$fields = explode(',', $_GET['fields']);
|
||||
|
||||
$temporaryResponse = [];
|
||||
|
||||
foreach ($response as &$entry) {
|
||||
$temporaryEntry = [];
|
||||
|
||||
foreach ($fields as $field) {
|
||||
if (isset($entry[$field])) {
|
||||
$temporaryEntry[$field] = $entry[$field];
|
||||
}
|
||||
}
|
||||
|
||||
$temporaryResponse[] = $temporaryEntry;
|
||||
}
|
||||
|
||||
$response = $temporaryResponse;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
class Paginate implements ProcessorsInterface {
|
||||
public static function process(array $response) {
|
||||
public static function process(array &$response) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@
|
|||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
interface ProcessorsInterface {
|
||||
public static function process(array $response);
|
||||
public static function process(array &$response);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
class Search implements ProcessorsInterface {
|
||||
public static function process(array $response) {
|
||||
public static function process(array &$response) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace EA\Engine\Api\V1\Processors;
|
||||
|
||||
class Sort implements ProcessorsInterface {
|
||||
public static function process(array $response) {
|
||||
public static function process(array &$response) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue