diff --git a/lib/WebDriver/ClassLoader.php b/lib/WebDriver/ClassLoader.php index 55ae4c79..12e04b84 100644 --- a/lib/WebDriver/ClassLoader.php +++ b/lib/WebDriver/ClassLoader.php @@ -55,7 +55,7 @@ public static function autoload($class) { try { self::loadClass($class); - } catch (Exception $e) { + } catch (\Exception $e) { } } } diff --git a/lib/WebDriver/Container.php b/lib/WebDriver/Container.php index 00c690ec..08f47928 100644 --- a/lib/WebDriver/Container.php +++ b/lib/WebDriver/Container.php @@ -71,7 +71,7 @@ public function element($using = null, $value = null) sprintf( "Element not found with %s, %s\n\n%s", $locatorJson['using'], - $locatorJson['value'], + $locatorJson['value'], $e->getMessage() ), $e @@ -81,7 +81,8 @@ public function element($using = null, $value = null) $element = $this->webDriverElement($result['value']); if ($element === null) { - throw WebDriverException::factory(WebDriverException::NO_SUCH_ELEMENT, + throw WebDriverException::factory( + WebDriverException::NO_SUCH_ELEMENT, sprintf( "Element not found with %s, %s\n", $locatorJson['using'], @@ -119,9 +120,12 @@ public function elements($using = null, $value = null) return array(); } - return array_filter(array_map( - array($this, 'webDriverElement'), $result['value'] - )); + return array_filter( + array_map( + array($this, 'webDriverElement'), + $result['value'] + ) + ); } /** @@ -147,12 +151,14 @@ private function parseArgs($method, $argv) case 1: $arg = $argv[0]; + if (is_array($arg)) { $using = $arg['using']; $value = $arg['value']; break; } + // fall through default: throw WebDriverException::factory( WebDriverException::JSON_PARAMETERS_EXPECTED, diff --git a/lib/WebDriver/Exception/CurlExec.php b/lib/WebDriver/Exception/CurlExec.php index e42c3665..0ace7631 100644 --- a/lib/WebDriver/Exception/CurlExec.php +++ b/lib/WebDriver/Exception/CurlExec.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class CurlExec extends BaseException { +final class CurlExec extends BaseException +{ } diff --git a/lib/WebDriver/Exception/ElementIsNotSelectable.php b/lib/WebDriver/Exception/ElementIsNotSelectable.php index 70cde9d4..73ca6bf6 100644 --- a/lib/WebDriver/Exception/ElementIsNotSelectable.php +++ b/lib/WebDriver/Exception/ElementIsNotSelectable.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class ElementIsNotSelectable extends BaseException { +final class ElementIsNotSelectable extends BaseException +{ } diff --git a/lib/WebDriver/Exception/ElementNotVisible.php b/lib/WebDriver/Exception/ElementNotVisible.php index 89ddf7e9..a414f54a 100644 --- a/lib/WebDriver/Exception/ElementNotVisible.php +++ b/lib/WebDriver/Exception/ElementNotVisible.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class ElementNotVisible extends BaseException { +final class ElementNotVisible extends BaseException +{ } diff --git a/lib/WebDriver/Exception/IMEEngineActivationFailed.php b/lib/WebDriver/Exception/IMEEngineActivationFailed.php index 2b0b986e..44579fd6 100644 --- a/lib/WebDriver/Exception/IMEEngineActivationFailed.php +++ b/lib/WebDriver/Exception/IMEEngineActivationFailed.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class IMEEngineActivationFailed extends BaseException { +final class IMEEngineActivationFailed extends BaseException +{ } diff --git a/lib/WebDriver/Exception/IMENotAvailable.php b/lib/WebDriver/Exception/IMENotAvailable.php index 5739900b..23c40f2b 100644 --- a/lib/WebDriver/Exception/IMENotAvailable.php +++ b/lib/WebDriver/Exception/IMENotAvailable.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class IMENotAvailable extends BaseException { +final class IMENotAvailable extends BaseException +{ } diff --git a/lib/WebDriver/Exception/InvalidCookieDomain.php b/lib/WebDriver/Exception/InvalidCookieDomain.php index 6703df47..977a9fed 100644 --- a/lib/WebDriver/Exception/InvalidCookieDomain.php +++ b/lib/WebDriver/Exception/InvalidCookieDomain.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class InvalidCookieDomain extends BaseException { +final class InvalidCookieDomain extends BaseException +{ } diff --git a/lib/WebDriver/Exception/InvalidElementCoordinates.php b/lib/WebDriver/Exception/InvalidElementCoordinates.php index d1ccb211..4b68b5a8 100644 --- a/lib/WebDriver/Exception/InvalidElementCoordinates.php +++ b/lib/WebDriver/Exception/InvalidElementCoordinates.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class InvalidElementCoordinates extends BaseException { +final class InvalidElementCoordinates extends BaseException +{ } diff --git a/lib/WebDriver/Exception/InvalidElementState.php b/lib/WebDriver/Exception/InvalidElementState.php index 65f87b92..bfa90a3b 100644 --- a/lib/WebDriver/Exception/InvalidElementState.php +++ b/lib/WebDriver/Exception/InvalidElementState.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class InvalidElementState extends BaseException { +final class InvalidElementState extends BaseException +{ } diff --git a/lib/WebDriver/Exception/InvalidRequest.php b/lib/WebDriver/Exception/InvalidRequest.php index a663e232..3af1d2aa 100644 --- a/lib/WebDriver/Exception/InvalidRequest.php +++ b/lib/WebDriver/Exception/InvalidRequest.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class InvalidRequest extends BaseException { +final class InvalidRequest extends BaseException +{ } diff --git a/lib/WebDriver/Exception/InvalidSelector.php b/lib/WebDriver/Exception/InvalidSelector.php index 90a1f91a..bb21c239 100644 --- a/lib/WebDriver/Exception/InvalidSelector.php +++ b/lib/WebDriver/Exception/InvalidSelector.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class InvalidSelector extends BaseException { +final class InvalidSelector extends BaseException +{ } diff --git a/lib/WebDriver/Exception/JavaScriptError.php b/lib/WebDriver/Exception/JavaScriptError.php index cb151ea5..5ac9c9db 100644 --- a/lib/WebDriver/Exception/JavaScriptError.php +++ b/lib/WebDriver/Exception/JavaScriptError.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class JavaScriptError extends BaseException { +final class JavaScriptError extends BaseException +{ } diff --git a/lib/WebDriver/Exception/JsonParameterExpected.php b/lib/WebDriver/Exception/JsonParameterExpected.php index e62b281a..8ee6836d 100644 --- a/lib/WebDriver/Exception/JsonParameterExpected.php +++ b/lib/WebDriver/Exception/JsonParameterExpected.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class JsonParameterExpected extends BaseException { +final class JsonParameterExpected extends BaseException +{ } diff --git a/lib/WebDriver/Exception/MoveTargetOutOfBounds.php b/lib/WebDriver/Exception/MoveTargetOutOfBounds.php index 734a277a..ade1de61 100644 --- a/lib/WebDriver/Exception/MoveTargetOutOfBounds.php +++ b/lib/WebDriver/Exception/MoveTargetOutOfBounds.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class MoveTargetOutOfBounds extends BaseException { +final class MoveTargetOutOfBounds extends BaseException +{ } diff --git a/lib/WebDriver/Exception/NoAlertOpenError.php b/lib/WebDriver/Exception/NoAlertOpenError.php index 0536eabd..eb25ee92 100644 --- a/lib/WebDriver/Exception/NoAlertOpenError.php +++ b/lib/WebDriver/Exception/NoAlertOpenError.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class NoAlertOpenError extends BaseException { +final class NoAlertOpenError extends BaseException +{ } diff --git a/lib/WebDriver/Exception/NoParametersExpected.php b/lib/WebDriver/Exception/NoParametersExpected.php index f15ef0ab..68ff2688 100644 --- a/lib/WebDriver/Exception/NoParametersExpected.php +++ b/lib/WebDriver/Exception/NoParametersExpected.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class NoParametersExpected extends BaseException { +final class NoParametersExpected extends BaseException +{ } diff --git a/lib/WebDriver/Exception/NoSuchDriver.php b/lib/WebDriver/Exception/NoSuchDriver.php index d799cbbf..beead676 100644 --- a/lib/WebDriver/Exception/NoSuchDriver.php +++ b/lib/WebDriver/Exception/NoSuchDriver.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class NoSuchDriver extends BaseException { +final class NoSuchDriver extends BaseException +{ } diff --git a/lib/WebDriver/Exception/NoSuchElement.php b/lib/WebDriver/Exception/NoSuchElement.php index 35b6985a..a4ec05ce 100644 --- a/lib/WebDriver/Exception/NoSuchElement.php +++ b/lib/WebDriver/Exception/NoSuchElement.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class NoSuchElement extends BaseException { +final class NoSuchElement extends BaseException +{ } diff --git a/lib/WebDriver/Exception/NoSuchFrame.php b/lib/WebDriver/Exception/NoSuchFrame.php index 92461a3a..3d89edd7 100644 --- a/lib/WebDriver/Exception/NoSuchFrame.php +++ b/lib/WebDriver/Exception/NoSuchFrame.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class NoSuchFrame extends BaseException { +final class NoSuchFrame extends BaseException +{ } diff --git a/lib/WebDriver/Exception/NoSuchWindow.php b/lib/WebDriver/Exception/NoSuchWindow.php index 58205b37..de84af40 100644 --- a/lib/WebDriver/Exception/NoSuchWindow.php +++ b/lib/WebDriver/Exception/NoSuchWindow.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class NoSuchWindow extends BaseException { +final class NoSuchWindow extends BaseException +{ } diff --git a/lib/WebDriver/Exception/ObsoleteCommand.php b/lib/WebDriver/Exception/ObsoleteCommand.php index 0bb0f0a5..7f943f4d 100644 --- a/lib/WebDriver/Exception/ObsoleteCommand.php +++ b/lib/WebDriver/Exception/ObsoleteCommand.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class ObsoleteCommand extends BaseException { +final class ObsoleteCommand extends BaseException +{ } diff --git a/lib/WebDriver/Exception/ScriptTimeout.php b/lib/WebDriver/Exception/ScriptTimeout.php index 49a82225..3195c254 100644 --- a/lib/WebDriver/Exception/ScriptTimeout.php +++ b/lib/WebDriver/Exception/ScriptTimeout.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class ScriptTimeout extends BaseException { +final class ScriptTimeout extends BaseException +{ } diff --git a/lib/WebDriver/Exception/SessionNotCreated.php b/lib/WebDriver/Exception/SessionNotCreated.php index c149fbd0..5ee1b7ad 100644 --- a/lib/WebDriver/Exception/SessionNotCreated.php +++ b/lib/WebDriver/Exception/SessionNotCreated.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class SessionNotCreated extends BaseException { +final class SessionNotCreated extends BaseException +{ } diff --git a/lib/WebDriver/Exception/StaleElementReference.php b/lib/WebDriver/Exception/StaleElementReference.php index 1c6842be..92fc283e 100644 --- a/lib/WebDriver/Exception/StaleElementReference.php +++ b/lib/WebDriver/Exception/StaleElementReference.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class StaleElementReference extends BaseException { +final class StaleElementReference extends BaseException +{ } diff --git a/lib/WebDriver/Exception/Timeout.php b/lib/WebDriver/Exception/Timeout.php index 317d1b0d..d30343ae 100644 --- a/lib/WebDriver/Exception/Timeout.php +++ b/lib/WebDriver/Exception/Timeout.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class Timeout extends BaseException { +final class Timeout extends BaseException +{ } diff --git a/lib/WebDriver/Exception/UnableToSetCookie.php b/lib/WebDriver/Exception/UnableToSetCookie.php index 221b49ae..f50ef5c3 100644 --- a/lib/WebDriver/Exception/UnableToSetCookie.php +++ b/lib/WebDriver/Exception/UnableToSetCookie.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class UnableToSetCookie extends BaseException { +final class UnableToSetCookie extends BaseException +{ } diff --git a/lib/WebDriver/Exception/UnexpectedAlertOpen.php b/lib/WebDriver/Exception/UnexpectedAlertOpen.php index 666a3c69..c40b5e2b 100644 --- a/lib/WebDriver/Exception/UnexpectedAlertOpen.php +++ b/lib/WebDriver/Exception/UnexpectedAlertOpen.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class UnexpectedAlertOpen extends BaseException { +final class UnexpectedAlertOpen extends BaseException +{ } diff --git a/lib/WebDriver/Exception/UnexpectedParameters.php b/lib/WebDriver/Exception/UnexpectedParameters.php index 3f218309..a0c3f4e4 100644 --- a/lib/WebDriver/Exception/UnexpectedParameters.php +++ b/lib/WebDriver/Exception/UnexpectedParameters.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class UnexpectedParameters extends BaseException { +final class UnexpectedParameters extends BaseException +{ } diff --git a/lib/WebDriver/Exception/UnknownCommand.php b/lib/WebDriver/Exception/UnknownCommand.php index 830d5e05..b78cd084 100644 --- a/lib/WebDriver/Exception/UnknownCommand.php +++ b/lib/WebDriver/Exception/UnknownCommand.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class UnknownCommand extends BaseException { +final class UnknownCommand extends BaseException +{ } diff --git a/lib/WebDriver/Exception/UnknownError.php b/lib/WebDriver/Exception/UnknownError.php index 9b4d3932..b656e5b0 100644 --- a/lib/WebDriver/Exception/UnknownError.php +++ b/lib/WebDriver/Exception/UnknownError.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class UnknownError extends BaseException { +final class UnknownError extends BaseException +{ } diff --git a/lib/WebDriver/Exception/UnknownLocatorStrategy.php b/lib/WebDriver/Exception/UnknownLocatorStrategy.php index f0ae9c83..6ebd0f2c 100644 --- a/lib/WebDriver/Exception/UnknownLocatorStrategy.php +++ b/lib/WebDriver/Exception/UnknownLocatorStrategy.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class UnknownLocatorStrategy extends BaseException { +final class UnknownLocatorStrategy extends BaseException +{ } diff --git a/lib/WebDriver/Exception/XPathLookupError.php b/lib/WebDriver/Exception/XPathLookupError.php index 28dcb330..10dde025 100644 --- a/lib/WebDriver/Exception/XPathLookupError.php +++ b/lib/WebDriver/Exception/XPathLookupError.php @@ -29,5 +29,6 @@ * * @package WebDriver */ -final class XPathLookupError extends BaseException { +final class XPathLookupError extends BaseException +{ } diff --git a/lib/WebDriver/SauceLabs/SauceRest.php b/lib/WebDriver/SauceLabs/SauceRest.php index 270079e1..73d5c616 100644 --- a/lib/WebDriver/SauceLabs/SauceRest.php +++ b/lib/WebDriver/SauceLabs/SauceRest.php @@ -74,7 +74,7 @@ protected function execute($requestMethod, $url, $parameters = null) CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, - CURLOPT_HTTPHEADER => Array ('Expect:'), + CURLOPT_HTTPHEADER => array('Expect:'), ); $url = 'https://saucelabs.com/rest/v1/' . $url; diff --git a/lib/WebDriver/ServiceFactory.php b/lib/WebDriver/ServiceFactory.php index 825fe87d..9a199c3b 100755 --- a/lib/WebDriver/ServiceFactory.php +++ b/lib/WebDriver/ServiceFactory.php @@ -64,7 +64,7 @@ private function __construct() * * @return \WebDriver\ServiceFactory */ - static public function getInstance() + public static function getInstance() { if (!self::$instance) { self::$instance = new self; diff --git a/lib/WebDriver/Session.php b/lib/WebDriver/Session.php index b50e6914..9d7ebb70 100644 --- a/lib/WebDriver/Session.php +++ b/lib/WebDriver/Session.php @@ -138,7 +138,7 @@ public function open($url) */ public function capabilities() { - if ( ! isset($this->capabilities)) { + if (! isset($this->capabilities)) { $result = $this->curl('GET', ''); $this->capabilities = $result['value']; diff --git a/lib/WebDriver/WebDriver.php b/lib/WebDriver/WebDriver.php index d0b5c344..7c5206be 100644 --- a/lib/WebDriver/WebDriver.php +++ b/lib/WebDriver/WebDriver.php @@ -65,7 +65,7 @@ public function session($requiredCapabilities = Browser::FIREFOX, $desiredCapabi ); // optional - if ( ! empty($requiredCapabilities)) { + if (! empty($requiredCapabilities)) { $parameters['requiredCapabilities'] = $requiredCapabilities; }