@@ -91,6 +91,9 @@ |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | + /** |
|
95 | + * @param string $textDomain |
|
96 | + */ |
|
94 | 97 | protected function translatePart($translate, $result, $textDomain, $locale) |
95 | 98 | { |
96 | 99 | $newResult = parent::translate($result, $textDomain, $locale); |
@@ -94,7 +94,7 @@ |
||
94 | 94 | protected function translatePart($translate, $result, $textDomain, $locale) |
95 | 95 | { |
96 | 96 | $newResult = parent::translate($result, $textDomain, $locale); |
97 | - $translate = str_replace('{{' . $result . '}}', $newResult, $translate); |
|
97 | + $translate = str_replace('{{'.$result.'}}', $newResult, $translate); |
|
98 | 98 | return $translate; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | \ No newline at end of file |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$this->baseUrl = 'http://magento19.loc//'; |
|
4 | 3 | \ No newline at end of file |
4 | +$this->baseUrl = 'http://magento19.loc//'; |
|
5 | 5 | \ No newline at end of file |
@@ -2,4 +2,4 @@ |
||
2 | 2 | |
3 | 3 | namespace Magium\Extractors\Navigation; |
4 | 4 | |
5 | -class UnableToExtractMenuXpathException extends \Exception{} |
|
6 | 5 | \ No newline at end of file |
6 | +class UnableToExtractMenuXpathException extends \Exception {} |
|
7 | 7 | \ No newline at end of file |
@@ -2,4 +2,4 @@ |
||
2 | 2 | |
3 | 3 | namespace Magium\Extractors\Navigation; |
4 | 4 | |
5 | -class MissingNavigationSchemeException extends \Exception{} |
|
6 | 5 | \ No newline at end of file |
6 | +class MissingNavigationSchemeException extends \Exception {} |
|
7 | 7 | \ No newline at end of file |
@@ -53,7 +53,9 @@ |
||
53 | 53 | $max = false; |
54 | 54 | $min = PHP_INT_MAX; |
55 | 55 | foreach ($matchedParts as $part) { |
56 | - if ($part === null) continue; |
|
56 | + if ($part === null) { |
|
57 | + continue; |
|
58 | + } |
|
57 | 59 | if ($part >= $max) { |
58 | 60 | $max = $part; |
59 | 61 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * We re-run the test method each time because Dec 01 01:01:01 could match only the first 01. So we |
44 | 44 | * have to be a bit greedy here. |
45 | 45 | */ |
46 | - $fn = 'test' . ucfirst($term); |
|
46 | + $fn = 'test'.ucfirst($term); |
|
47 | 47 | if ($this->$fn($part) && $matchedParts[$term] === null) { |
48 | 48 | $matchedParts[$term] = $key; |
49 | 49 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | $foundDate = ''; |
69 | 69 | for ($i = (int)$min; $i <= (int)$max; $i++) { |
70 | - $foundDate .= ' ' . $parts[$i]; |
|
70 | + $foundDate .= ' '.$parts[$i]; |
|
71 | 71 | } |
72 | 72 | $parse = date_parse(trim($foundDate)); |
73 | 73 | if (isset($parse['error_count']) && $parse['error_count'] == 0) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return true; |
114 | 114 | } |
115 | 115 | $parse = date_parse($part); |
116 | - if (!empty($parse) && $parse['day'] !== false && $parse['error_count'] == 0 ) { |
|
116 | + if (!empty($parse) && $parse['day'] !== false && $parse['error_count'] == 0) { |
|
117 | 117 | return true; |
118 | 118 | } else if (preg_match('/^\d{1,2}[\/\\-]\d{1,2}[\/\\-]\d{1,2}$/', $part)) { |
119 | 119 | return true; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return true; |
128 | 128 | } |
129 | 129 | $parse = date_parse($part); |
130 | - if (!empty($parse) && $parse['month'] !== false && $parse['error_count'] == 0 ) { |
|
130 | + if (!empty($parse) && $parse['month'] !== false && $parse['error_count'] == 0) { |
|
131 | 131 | return true; |
132 | 132 | } else if (preg_match('/^\d{1,2}[\/\\-]\d{1,2}[\/\\-]\d{1,2}$/', $part)) { |
133 | 133 | return true; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if (!empty($parse) && $parse['year'] !== false && $parse['error_count'] == 0) { |
142 | 142 | return true; |
143 | 143 | // DateTime parses 2015 as 20:15:00, so this is to account for the unique condition. |
144 | - } else if (strlen($part) ==4 ) { |
|
144 | + } else if (strlen($part) == 4) { |
|
145 | 145 | if ($parse['second'] === 0 && $parse['hour'] == substr($part, 0, 2) && $parse['minute'] == substr($part, 2, 2)) { |
146 | 146 | return true; |
147 | 147 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | return false; |
163 | 163 | } |
164 | 164 | $parse = date_parse($part); |
165 | - if (!empty($parse) && $parse['hour'] !== false && $parse['error_count'] == 0 ) { |
|
165 | + if (!empty($parse) && $parse['hour'] !== false && $parse['error_count'] == 0) { |
|
166 | 166 | return true; |
167 | 167 | } |
168 | 168 | return false; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | $parse = date_parse($part); |
182 | - if (!empty($parse) && $parse['minute'] !== false && $parse['error_count'] == 0 ) { |
|
182 | + if (!empty($parse) && $parse['minute'] !== false && $parse['error_count'] == 0) { |
|
183 | 183 | return true; |
184 | 184 | |
185 | 185 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | $parse = date_parse($part); |
200 | - if (!empty($parse) && $parse['second'] !== false && $parse['error_count'] == 0 ) { |
|
200 | + if (!empty($parse) && $parse['second'] !== false && $parse['error_count'] == 0) { |
|
201 | 201 | return true; |
202 | 202 | } |
203 | 203 | return false; |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $this->name = trim(array_pop($rows)); |
32 | 32 | while (count($rows) > 0) { |
33 | 33 | $row = array_shift($rows); |
34 | - if (strpos($row, 'T: ') ===0) { |
|
34 | + if (strpos($row, 'T: ') === 0) { |
|
35 | 35 | $this->phone = trim(substr($row, 3)); |
36 | 36 | continue; |
37 | - } else if (strpos($row, 'F: ') ===0) { |
|
37 | + } else if (strpos($row, 'F: ') === 0) { |
|
38 | 38 | $this->fax = trim(substr($row, 3)); |
39 | 39 | continue; |
40 | 40 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $this->street1 = trim(array_shift($rows)); |
60 | 60 | $this->business = trim(array_shift($rows)); |
61 | 61 | //Easy |
62 | - }else if (count($rows) == 1) { |
|
62 | + } else if (count($rows) == 1) { |
|
63 | 63 | $this->street1 = trim(array_shift($rows)); |
64 | 64 | |
65 | 65 | // Not so easy |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | $this->street1 = $stOrBus; |
71 | 71 | $this->business = trim(array_shift($rows)); |
72 | 72 | } else { |
73 | - $this->street1 =trim(array_shift($rows)); |
|
74 | - $this->street2 = $stOrBus; |
|
73 | + $this->street1 = trim(array_shift($rows)); |
|
74 | + $this->street2 = $stOrBus; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $this->street1 = trim(array_shift($rows)); |
60 | 60 | $this->business = trim(array_shift($rows)); |
61 | 61 | //Easy |
62 | - }else if (count($rows) == 1) { |
|
62 | + } else if (count($rows) == 1) { |
|
63 | 63 | $this->street1 = trim(array_shift($rows)); |
64 | 64 | |
65 | 65 | // Not so easy |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public static function elementExists($selector, $by = 'byId') |
12 | 12 | { |
13 | 13 | return new WebDriverExpectedCondition( |
14 | - function ($driver) use ($selector, $by) { |
|
14 | + function($driver) use ($selector, $by) { |
|
15 | 15 | try { |
16 | 16 | $element = $driver->$by($selector); |
17 | 17 | return $element instanceof WebDriverElement; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public static function elementRemoved(WebDriverElement $element) |
27 | 27 | { |
28 | 28 | return new WebDriverExpectedCondition( |
29 | - function () use ($element) { |
|
29 | + function() use ($element) { |
|
30 | 30 | try { |
31 | 31 | $element->isDisplayed(); |
32 | 32 | return false; |
@@ -279,7 +279,6 @@ |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
282 | - |
|
283 | 282 | * @param string $theme |
284 | 283 | * @return \Magium\Themes\ThemeConfigurationInterface |
285 | 284 | */ |
@@ -175,6 +175,9 @@ discard block |
||
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | + /** |
|
179 | + * @param null|string $selector |
|
180 | + */ |
|
178 | 181 | public function assertElementClickable($selector, $by = WebDriver::BY_ID) |
179 | 182 | { |
180 | 183 | $this->elementAssertion($selector, $by, Clickable::ASSERTION); |
@@ -187,6 +190,9 @@ discard block |
||
187 | 190 | |
188 | 191 | } |
189 | 192 | |
193 | + /** |
|
194 | + * @param string $namespace |
|
195 | + */ |
|
190 | 196 | public static function addBaseNamespace($namespace) |
191 | 197 | { |
192 | 198 | if (!in_array($namespace, self::$baseNamespaces)) { |
@@ -194,6 +200,9 @@ discard block |
||
194 | 200 | } |
195 | 201 | } |
196 | 202 | |
203 | + /** |
|
204 | + * @param string $prefix |
|
205 | + */ |
|
197 | 206 | public static function resolveClass( $class, $prefix = null) |
198 | 207 | { |
199 | 208 | $origClass = $class; |
@@ -235,6 +244,9 @@ discard block |
||
235 | 244 | |
236 | 245 | } |
237 | 246 | |
247 | + /** |
|
248 | + * @return string |
|
249 | + */ |
|
238 | 250 | protected function normalizeClassRequest($class) |
239 | 251 | { |
240 | 252 | return str_replace('/', '\\', $class); |
@@ -521,7 +533,7 @@ discard block |
||
521 | 533 | } |
522 | 534 | |
523 | 535 | /** |
524 | - * @param $xpath |
|
536 | + * @param string $xpath |
|
525 | 537 | * @return \Facebook\WebDriver\Remote\RemoteWebElement |
526 | 538 | */ |
527 | 539 | |
@@ -550,6 +562,12 @@ discard block |
||
550 | 562 | return $this->webdriver->byCssSelector($selector); |
551 | 563 | } |
552 | 564 | |
565 | + /** |
|
566 | + * @param string $xpathTemplate |
|
567 | + * @param string $text |
|
568 | + * @param string $specificNodeType |
|
569 | + * @param string $parentElementSelector |
|
570 | + */ |
|
553 | 571 | protected function getElementByTextXpath($xpathTemplate, $text, $specificNodeType = null, $parentElementSelector = null) |
554 | 572 | { |
555 | 573 |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | - public static function resolveClass( $class, $prefix = null) |
|
214 | + public static function resolveClass($class, $prefix = null) |
|
215 | 215 | { |
216 | 216 | $origClass = $class; |
217 | 217 | if ($prefix !== null) { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | foreach (self::$baseNamespaces as $namespace) { |
228 | - $fqClass = $namespace . '\\' . $class; |
|
228 | + $fqClass = $namespace.'\\'.$class; |
|
229 | 229 | try { |
230 | 230 | if (class_exists($fqClass)) { |
231 | 231 | return $fqClass; |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | $element = $this->byXpath(sprintf('//%s[contains(., "%s")]', $node, addslashes($text))); |
518 | 518 | self::assertWebDriverElement($element); |
519 | 519 | } catch (\Exception $e) { |
520 | - $this->fail('The body did not contain the text: ' . $text); |
|
520 | + $this->fail('The body did not contain the text: '.$text); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | // If the element is not found then an exception will be thrown |
529 | 529 | self::assertWebDriverElement($element); |
530 | 530 | } catch (\Exception $e) { |
531 | - $this->fail('The body did not contain the text: ' . $text); |
|
531 | + $this->fail('The body did not contain the text: '.$text); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | { |
537 | 537 | try { |
538 | 538 | $this->webdriver->byXpath(sprintf('//body[contains(., "%s")]', $text)); |
539 | - $this->fail('The page contains the words: ' . $text); |
|
539 | + $this->fail('The page contains the words: '.$text); |
|
540 | 540 | } catch (NoSuchElementException $e) { |
541 | 541 | // Exception thrown is a success |
542 | 542 | self::assertInstanceOf(NoSuchElementException::class, $e); |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | { |
578 | 578 | |
579 | 579 | if ($parentElementSelector !== null) { |
580 | - $xpathTemplate = $parentElementSelector . $xpathTemplate; |
|
580 | + $xpathTemplate = $parentElementSelector.$xpathTemplate; |
|
581 | 581 | } |
582 | 582 | if ($specificNodeType !== null) { |
583 | 583 | return $this->byXpath(sprintf($xpathTemplate, $specificNodeType, $this->getTranslator()->translatePlaceholders($text))); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | } |
591 | 591 | } |
592 | 592 | // This is here for consistency with the other by* methods |
593 | - WebDriverException::throwException(7, 'Could not find element with text: ' . $this->getTranslator()->translatePlaceholders($text), []); |
|
593 | + WebDriverException::throwException(7, 'Could not find element with text: '.$this->getTranslator()->translatePlaceholders($text), []); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | /** |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function __call($name, $arguments) |
28 | 28 | { |
29 | 29 | if (strpos($name, '::') > 0) { |
30 | - list( , $name) = explode('::', $name); |
|
30 | + list(, $name) = explode('::', $name); |
|
31 | 31 | } |
32 | 32 | if (!$this->element instanceof WebDriverElement) { |
33 | 33 | $this->element = $this->webDriver->{$this->by}($this->selector); |