22
33namespace Facebook \WebDriver ;
44
5- use InvalidArgumentException ;
5+ use Facebook \ WebDriver \ Exception \ Internal \ LogicException ;
66
77/**
88 * Set values of an cookie.
@@ -36,10 +36,10 @@ public function __construct($name, $value)
3636 public static function createFromArray (array $ cookieArray )
3737 {
3838 if (!isset ($ cookieArray ['name ' ])) {
39- throw new InvalidArgumentException ('Cookie name should be set ' );
39+ throw LogicException:: forError ('Cookie name should be set ' );
4040 }
4141 if (!isset ($ cookieArray ['value ' ])) {
42- throw new InvalidArgumentException ('Cookie value should be set ' );
42+ throw LogicException:: forError ('Cookie value should be set ' );
4343 }
4444 $ cookie = new self ($ cookieArray ['name ' ], $ cookieArray ['value ' ]);
4545
@@ -107,7 +107,7 @@ public function getPath()
107107 public function setDomain ($ domain )
108108 {
109109 if (mb_strpos ($ domain , ': ' ) !== false ) {
110- throw new InvalidArgumentException (sprintf ('Cookie domain "%s" should not contain a port ' , $ domain ));
110+ throw LogicException:: forError (sprintf ('Cookie domain "%s" should not contain a port ' , $ domain ));
111111 }
112112
113113 $ this ->offsetSet ('domain ' , $ domain );
@@ -258,11 +258,11 @@ public function offsetUnset($offset)
258258 protected function validateCookieName ($ name )
259259 {
260260 if ($ name === null || $ name === '' ) {
261- throw new InvalidArgumentException ('Cookie name should be non-empty ' );
261+ throw LogicException:: forError ('Cookie name should be non-empty ' );
262262 }
263263
264264 if (mb_strpos ($ name , '; ' ) !== false ) {
265- throw new InvalidArgumentException ('Cookie name should not contain a ";" ' );
265+ throw LogicException:: forError ('Cookie name should not contain a ";" ' );
266266 }
267267 }
268268
@@ -272,7 +272,7 @@ protected function validateCookieName($name)
272272 protected function validateCookieValue ($ value )
273273 {
274274 if ($ value === null ) {
275- throw new InvalidArgumentException ('Cookie value is required when setting a cookie ' );
275+ throw LogicException:: forError ('Cookie value is required when setting a cookie ' );
276276 }
277277 }
278278}
0 commit comments