@@ -34,13 +34,13 @@ class RecursivePagination {
3434 */
3535 public function __construct (Grabber $ grabber , $ xpath = []) {
3636 $ this ->grabber = $ grabber ;
37- if (!is_string ($ xpath ) AND !is_array ($ xpath )) {
38- throw new \Exception ('xPath should be an array or a string ' );
37+ if (!is_string ($ xpath ) and !is_array ($ xpath )) {
38+ throw new \InvalidArgumentException ('xPath should be an array or a string ' );
3939 }
4040 $ xpath = (array ) $ xpath ;
4141 foreach ($ xpath as $ path ) {
4242 if (!is_string ($ path )) {
43- throw new \Exception ('Incorrect xPath, should be an array or a string ' );
43+ throw new \InvalidArgumentException ('Incorrect xPath, should be an array or a string ' );
4444 }
4545 $ this ->defaultXpath [] = $ path ;
4646 }
@@ -53,14 +53,14 @@ public function __construct(Grabber $grabber, $xpath = []) {
5353 * @throws \Exception
5454 * @return $this
5555 */
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 ' );
56+ public function addToQueue ($ links , $ state = false ) {
57+ if (!is_string ($ links ) and !is_array ($ links )) {
58+ throw new \InvalidArgumentException ('Links should be an array or a string ' );
5959 }
6060 $ links = (array ) $ links ;
6161 foreach ($ links as $ url ) {
6262 if (!is_string ($ url )) {
63- throw new \Exception ('url should be a string ' );
63+ throw new \InvalidArgumentException ('url should be a string ' );
6464 }
6565 $ this ->queue [$ url ] = $ state ;
6666 }
0 commit comments