1 | <?php |
||
20 | class InMemoryQueueManager implements QueueManager |
||
21 | { |
||
22 | /** @var int The maximum depth for the crawl */ |
||
23 | public $maxDepth = 3; |
||
24 | |||
25 | /** @var int The maximum size of the process queue for this spider. 0 means infinite */ |
||
26 | public $maxQueueSize = 0; |
||
27 | |||
28 | /** @var int the amount of times a Resource was enqueued */ |
||
29 | private $currentQueueSize = 0; |
||
30 | |||
31 | /** @var UriInterface[] the list of URIs to process */ |
||
32 | private $traversalQueue = array(); |
||
33 | |||
34 | /** @var int The traversal algorithm to use. Choose from the class constants |
||
35 | */ |
||
36 | private $traversalAlgorithm = self::ALGORITHM_DEPTH_FIRST; |
||
37 | |||
38 | /** @var EventDispatcherInterface */ |
||
39 | private $dispatcher; |
||
40 | |||
41 | /** |
||
42 | * @param int $traversalAlgorithm Choose from the class constants |
||
43 | * TODO: This should be extracted to a Strategy pattern |
||
44 | */ |
||
45 | public function setTraversalAlgorithm($traversalAlgorithm) |
||
49 | |||
50 | /** |
||
51 | * @return int |
||
52 | */ |
||
53 | public function getTraversalAlgorithm() |
||
57 | |||
58 | /** |
||
59 | * @param EventDispatcherInterface $eventDispatcher |
||
60 | * @return $this |
||
61 | */ |
||
62 | public function setDispatcher(EventDispatcherInterface $eventDispatcher) |
||
68 | |||
69 | /** |
||
70 | * @return EventDispatcherInterface |
||
71 | */ |
||
72 | public function getDispatcher() |
||
79 | |||
80 | /** |
||
81 | * @param UriInterface |
||
82 | */ |
||
83 | public function addUri(UriInterface $uri) |
||
97 | |||
98 | public function next() |
||
108 | } |
||
109 |