1 | <?php |
||
14 | class CrawlerSession |
||
15 | { |
||
16 | use TraverseTrait; |
||
17 | |||
18 | /** |
||
19 | * CrawlerInterface |
||
20 | */ |
||
21 | private $crawler; |
||
22 | |||
23 | /** |
||
24 | * @param CrawlerInterface $crawler |
||
25 | */ |
||
26 | public function __construct(CrawlerInterface $crawler) |
||
30 | |||
31 | /** |
||
32 | * @param Query\AbstractQuery $query |
||
33 | * @return array |
||
34 | */ |
||
35 | 1 | public function queryIds(Query\AbstractQuery $query) |
|
39 | |||
40 | /** |
||
41 | * @return CrawlerInterface |
||
42 | */ |
||
43 | 1 | public function getCrawler() |
|
47 | |||
48 | /** |
||
49 | * @param string $uri |
||
50 | * @return self |
||
51 | */ |
||
52 | public function open($uri) |
||
60 | |||
61 | /** |
||
62 | * @return UriInterface |
||
63 | */ |
||
64 | public function getUri() |
||
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getHtml() |
||
76 | |||
77 | /** |
||
78 | * Save the HTML of the session into a file |
||
79 | * Optionally resolve all the links with a base uri |
||
80 | * |
||
81 | * @param string $filename |
||
82 | * @throws InvalidArgumentException if directory doesnt exist or is not writable |
||
83 | * @param UriInterface|string $base |
||
84 | */ |
||
85 | 1 | public function saveHtml($filename, $base = null) |
|
99 | |||
100 | /** |
||
101 | * @param string $directory |
||
102 | * @return boolean |
||
103 | */ |
||
104 | public function isWritableDirectory($directory) |
||
108 | |||
109 | /** |
||
110 | * @param string $directory |
||
111 | * @throws InvalidArgumentException if directory doesnt exist or is not writable |
||
112 | */ |
||
113 | 1 | public function ensureWritableDirectory($directory) |
|
122 | } |
||
123 |