This repository was archived by the owner on Jan 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class RecursivePagination {
3434 */
3535 public function __construct (Grabber $ grabber , $ xpath = []) {
3636 $ this ->grabber = $ grabber ;
37- if (!is_string ($ xpath ) && !is_array ($ xpath )) {
37+ if (!is_string ($ xpath ) AND !is_array ($ xpath )) {
3838 throw new \Exception ('xPath should be an array or a string ' );
3939 }
4040 $ xpath = (array ) $ xpath ;
@@ -48,12 +48,23 @@ public function __construct(Grabber $grabber, $xpath = []) {
4848
4949
5050 /**
51- * @param $link
51+ * @param array|string $links
5252 * @param bool $state
53+ * @throws \Exception
5354 * @return $this
5455 */
55- public function addToQueue ($ link , $ state = false ) {
56- $ this ->queue [$ link ] = $ state ;
56+ public function addToQueue ($ links = [], $ state = false ) {
57+ if (!is_string ($ links ) AND !is_array ($ links )) {
58+ throw new \Exception ('Links should be an array or a string ' );
59+ }
60+ $ links = (array ) $ links ;
61+ foreach ($ links as $ url ) {
62+ if (!is_string ($ url )) {
63+ throw new \Exception ('url should be a string ' );
64+ }
65+ $ this ->queue [$ url ] = $ state ;
66+ }
67+
5768 return $ this ;
5869 }
5970
You can’t perform that action at this time.
0 commit comments