1 | <?php |
||
12 | abstract class Api implements \Swader\Diffbot\Interfaces\Api |
||
13 | { |
||
14 | /** @var int Timeout value in ms - defaults to 30s if empty */ |
||
15 | private $timeout = 30000; |
||
16 | |||
17 | /** @var string The URL onto which to unleash the API in question */ |
||
18 | private $url; |
||
19 | |||
20 | /** @var string API URL to which to send the request */ |
||
21 | protected $apiUrl; |
||
22 | |||
23 | /** @var array Settings on which optional fields to fetch */ |
||
24 | protected $fieldSettings = []; |
||
25 | |||
26 | /** @var array Other API specific options */ |
||
27 | protected $otherOptions = []; |
||
28 | |||
29 | /** @var Diffbot The parent class which spawned this one */ |
||
30 | protected $diffbot; |
||
31 | |||
32 | use DiffbotAware; |
||
33 | |||
34 | 122 | public function __construct($url) |
|
56 | |||
57 | /** |
||
58 | * Setting the timeout will define how long Diffbot will keep trying |
||
59 | * to fetch the API results. A timeout can happen for various reasons, from |
||
60 | * Diffbot's failure, to the site being crawled being exceptionally slow, |
||
61 | * and more. |
||
62 | * |
||
63 | * @param int|null $timeout Defaults to 30000 even if not set |
||
64 | * |
||
65 | * @return $this |
||
66 | */ |
||
67 | 12 | public function setTimeout($timeout = null) |
|
85 | |||
86 | 7 | public function call() |
|
95 | |||
96 | 79 | public function buildUrl() |
|
128 | } |
||
129 |