1 | <?php |
||
13 | final class TestApi implements CrudsApiInterface, EntityCacheAwareInterface, StaticApiFactoryInterface |
||
14 | { |
||
15 | /** @var RpcClientInterface */ |
||
16 | private $client; |
||
17 | /** @var ApiMetadata */ |
||
18 | private $metadata; |
||
19 | /** @var EntityDataCacheInterface */ |
||
20 | private $cache; |
||
21 | |||
22 | /** |
||
23 | * TestApi constructor. |
||
24 | * |
||
25 | * @param RpcClientInterface $client |
||
26 | * @param ApiMetadata $metadata |
||
27 | */ |
||
28 | public function __construct(RpcClientInterface $client, ApiMetadata $metadata) |
||
29 | { |
||
30 | $this->client = $client; |
||
31 | $this->metadata = $metadata; |
||
32 | $this->cache = new VoidEntityCache($metadata); |
||
33 | } |
||
34 | |||
35 | /** {@inheritdoc} */ |
||
36 | public static function createApi(RpcClientInterface $client, ApiMetadata $metadata) |
||
40 | |||
41 | /** {@inheritdoc} */ |
||
42 | public function count(array $criteria) |
||
48 | |||
49 | /** {@inheritdoc} */ |
||
50 | public function create(array $data) |
||
58 | |||
59 | /** {@inheritdoc} */ |
||
60 | public function find(array $identifier) |
||
74 | |||
75 | /** {@inheritdoc} */ |
||
76 | public function patch(array $identifier, array $patch, array $data) |
||
82 | |||
83 | /** {@inheritdoc} */ |
||
84 | public function search(array $criteria = [], array $orderBy = null, $limit = null, $offset = null) |
||
98 | |||
99 | /** {@inheritdoc} */ |
||
100 | public function remove(array $identifier) |
||
106 | |||
107 | /** @return RpcClientInterface */ |
||
108 | public function getClient() |
||
112 | |||
113 | /** @return ApiMetadata */ |
||
114 | public function getMetadata() |
||
118 | |||
119 | /** {@inheritdoc} */ |
||
120 | public function setEntityCache(EntityDataCacheInterface $cache) |
||
124 | |||
125 | /** |
||
126 | * @param string $method |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | private function getMethod($method) |
||
134 | } |
||
135 |