1 | <?php |
||
17 | class InMemoryQueueManager implements QueueManagerInterface |
||
18 | { |
||
19 | /** @var int The maximum size of the process queue for this spider. 0 means infinite */ |
||
20 | public $maxQueueSize = 0; |
||
21 | |||
22 | /** @var int the amount of times a Resource was enqueued */ |
||
23 | private $currentQueueSize = 0; |
||
24 | |||
25 | /** @var UriInterface[] the list of URIs to process */ |
||
26 | private $traversalQueue = array(); |
||
27 | |||
28 | /** @var int The traversal algorithm to use. Choose from the class constants |
||
29 | */ |
||
30 | private $traversalAlgorithm = self::ALGORITHM_DEPTH_FIRST; |
||
31 | |||
32 | /** @var EventDispatcherInterface */ |
||
33 | private $dispatcher; |
||
34 | |||
35 | /** |
||
36 | * @param int $traversalAlgorithm Choose from the class constants |
||
37 | * TODO: This should be extracted to a Strategy pattern |
||
38 | */ |
||
39 | public function setTraversalAlgorithm($traversalAlgorithm) |
||
43 | |||
44 | /** |
||
45 | * @return int |
||
46 | */ |
||
47 | public function getTraversalAlgorithm() |
||
51 | |||
52 | /** |
||
53 | * @param EventDispatcherInterface $eventDispatcher |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function setDispatcher(EventDispatcherInterface $eventDispatcher) |
||
62 | |||
63 | /** |
||
64 | * @return EventDispatcherInterface |
||
65 | */ |
||
66 | public function getDispatcher() |
||
73 | |||
74 | /** |
||
75 | * @param UriInterface |
||
76 | */ |
||
77 | public function addUri(UriInterface $uri) |
||
91 | |||
92 | public function next() |
||
102 | } |
||
103 |