1 | <?php |
||
13 | class OaiPmhHarvest extends Job |
||
14 | { |
||
15 | use DispatchesJobs; |
||
16 | |||
17 | public $name; |
||
18 | public $url; |
||
19 | public $schema; |
||
20 | public $set; |
||
21 | public $start; |
||
22 | public $until; |
||
23 | public $resume; |
||
24 | public $maxRetries; |
||
25 | public $sleepTimeOnError; |
||
26 | |||
27 | /** |
||
28 | * Start time for the full harvest. |
||
29 | * |
||
30 | * @var float |
||
31 | */ |
||
32 | protected $startTime; |
||
33 | |||
34 | /** |
||
35 | * Start time for the current batch. |
||
36 | * |
||
37 | * @var float |
||
38 | */ |
||
39 | protected $batchTime; |
||
40 | |||
41 | /** |
||
42 | * Harvest position. |
||
43 | * |
||
44 | * @var int |
||
45 | */ |
||
46 | protected $batchPos = 0; |
||
47 | |||
48 | /** |
||
49 | * @var Collection |
||
50 | */ |
||
51 | public $collection; |
||
52 | |||
53 | /** |
||
54 | * Number of records retrieved between each emitted OaiPmhHarvestStatus event. |
||
55 | * A too small number will cause CPU overhead. |
||
56 | * |
||
57 | * @var int |
||
58 | */ |
||
59 | protected $statusUpdateEvery = 50; |
||
60 | |||
61 | /** |
||
62 | * Create a new job instance. |
||
63 | * |
||
64 | * @param string $name Harvest name from config |
||
65 | * @param array $config Harvest config array (url, set, schema) |
||
66 | * @param string $start Start date (optional) |
||
67 | * @param string $until End date (optional) |
||
68 | * @param string $resume Resumption token for continuing an aborted harvest (optional) |
||
69 | */ |
||
70 | public function __construct($name, $config, $start = null, $until = null, $resume = null) |
||
82 | |||
83 | public function fromNetwork() |
||
104 | |||
105 | /** |
||
106 | * Execute the job. |
||
107 | */ |
||
108 | public function handle() |
||
126 | |||
127 | /** |
||
128 | * Output a status message. |
||
129 | * |
||
130 | * @param int $fetched |
||
131 | * @param int $current |
||
132 | */ |
||
133 | public function status($fetched, $current) |
||
153 | } |
||
154 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.