easyappointments/engine/Api/V1/Parsers/Settings.php

62 lines
1.6 KiB
PHP
Raw Normal View History

<?php
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org
* @since v1.2.0
* ---------------------------------------------------------------------------- */
namespace EA\Engine\Api\V1\Parsers;
/**
* Settings Parser
*
* This class will handle the encoding and decoding from the API requests.
*
* @deprecated
*/
class Settings implements ParsersInterface {
/**
* Encode Response Array
*
* @param array &$response The response to be encoded.
*/
public function encode(array &$response)
{
$encoded_response = [
'name' => $response['name'],
'value' => $response['value']
];
$response = $encoded_response;
}
/**
* Decode Request
*
* @param array &$request The request to be decoded.
* @param array $base Optional (null), if provided it will be used as a base array.
*/
public function decode(array &$request, array $base = NULL)
{
$decoded_request = $base ?: [];
if (array_key_exists('name', $request))
{
$decoded_request['name'] = $request['name'];
}
if (array_key_exists('value', $request))
{
$decoded_request['value'] = $request['value'];
}
$request = $decoded_request;
}
}