2017-01-10 21:13:44 -05:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
/**
|
|
|
|
* Anime List Client
|
|
|
|
*
|
|
|
|
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
|
|
|
|
*
|
|
|
|
* PHP version 7
|
|
|
|
*
|
|
|
|
* @package AnimeListClient
|
|
|
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
2017-01-11 10:30:53 -05:00
|
|
|
* @copyright 2015 - 2017 Timothy J. Warren
|
2017-01-10 21:13:44 -05:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
|
|
* @version 4.0
|
|
|
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
2017-01-11 10:34:24 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Aviat\AnimeClient\API;
|
2017-01-10 21:13:44 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class encapsulating Json API data structure for a request or response
|
|
|
|
*/
|
|
|
|
class JsonAPI {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The full data array
|
|
|
|
*
|
|
|
|
* Basic structure is generally like so:
|
|
|
|
* @example [
|
|
|
|
* 'id' => '12016665',
|
|
|
|
* 'type' => 'libraryEntries',
|
|
|
|
* 'links' => [
|
|
|
|
* 'self' => 'https://kitsu.io/api/edge/library-entries/13016665'
|
|
|
|
* ],
|
|
|
|
* 'attributes' => [
|
|
|
|
*
|
|
|
|
* ]
|
|
|
|
* ]
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $data = [];
|
|
|
|
|
2017-01-11 19:37:14 -05:00
|
|
|
/**
|
|
|
|
* Data array parsed out from a request
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $parsedData = [];
|
|
|
|
|
2017-01-10 21:13:44 -05:00
|
|
|
/**
|
|
|
|
* Related objects included with the request
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $included = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pagination links
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $links = [];
|
|
|
|
|
2017-01-11 19:37:14 -05:00
|
|
|
/**
|
|
|
|
* JsonAPI constructor
|
|
|
|
*
|
|
|
|
* @param array $initital
|
|
|
|
*/
|
|
|
|
public function __construct(array $initial = [])
|
|
|
|
{
|
|
|
|
$this->data = $initial;
|
|
|
|
}
|
|
|
|
|
2017-01-10 21:13:44 -05:00
|
|
|
/**
|
|
|
|
* Parse a JsonAPI response into its components
|
|
|
|
*
|
|
|
|
* @param array $data
|
|
|
|
*/
|
|
|
|
public function parse(array $data)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2017-01-11 19:37:14 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return data array after input is parsed
|
|
|
|
* to inline includes inside of relationship objects
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getParsedData(): array
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2017-01-10 21:13:44 -05:00
|
|
|
}
|