1 | <?php |
||
10 | class Entity implements EntityFactory |
||
11 | { |
||
12 | protected $apiEntities = [ |
||
13 | 'product' => '\Swader\Diffbot\Entity\Product', |
||
14 | 'article' => '\Swader\Diffbot\Entity\Article', |
||
15 | 'image' => '\Swader\Diffbot\Entity\Image', |
||
16 | 'discussion' => '\Swader\Diffbot\Entity\Discussion', |
||
17 | '*' => '\Swader\Diffbot\Entity\Wildcard', |
||
18 | ]; |
||
19 | |||
20 | /** |
||
21 | * Creates an appropriate Entity from a given Response |
||
22 | * If no valid Entity can be found for typo of API, the Wildcard entity is selected |
||
23 | * |
||
24 | * @todo: remove error avoidance when issue 12 is fixed: https://github.com/Swader/diffbot-php-client/issues/12 |
||
25 | * @param Response $response |
||
26 | * @return EntityIterator |
||
27 | * @throws DiffbotException |
||
28 | */ |
||
29 | 164 | public function createAppropriateIterator(Response $response) |
|
49 | |||
50 | /** |
||
51 | * Makes sure the Diffbot response has all the fields it needs to work properly |
||
52 | * |
||
53 | * @todo: remove error avoidance when issue 12 is fixed: https://github.com/Swader/diffbot-php-client/issues/12 |
||
54 | * @param Response $response |
||
55 | * @throws DiffbotException |
||
56 | */ |
||
57 | protected function checkResponseFormat(Response $response) |
||
79 | } |