Conditions | 11 |
Paths | > 20000 |
Total Lines | 98 |
Code Lines | 54 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
44 | public function run($rejected = false) |
||
45 | { |
||
46 | $this->validateStep(self::STEP); |
||
47 | |||
48 | /* |
||
49 | * Field DNI: |
||
50 | */ |
||
51 | try { |
||
52 | $name = $this->webDriver->findElement(WebDriverBy::name('dni')); |
||
53 | $name->clear()->sendKeys($this->getDNI()); |
||
54 | } catch (\Exception $exception) { |
||
55 | unset($exception); |
||
56 | } |
||
57 | /* |
||
58 | * Field BirthDate: |
||
59 | */ |
||
60 | try { |
||
61 | $dob = $this->webDriver->findElement(WebDriverBy::name('dob')); |
||
62 | $dob->clear()->sendKeys( |
||
63 | $this->faker->numberBetween(1, 28). |
||
|
|||
64 | $this->faker->numberBetween(1, 12). |
||
65 | '1975' |
||
66 | ); |
||
67 | } catch (\Exception $exception) { |
||
68 | unset($exception); |
||
69 | } |
||
70 | /* |
||
71 | * Field address: |
||
72 | */ |
||
73 | try { |
||
74 | $name = $this->webDriver->findElement(WebDriverBy::name('address')); |
||
75 | $name->clear()->sendKeys($this->faker->address. ' ' . $this->faker->city); |
||
76 | } catch (\Exception $exception) { |
||
77 | unset($exception); |
||
78 | } |
||
79 | /* |
||
80 | * Field city: |
||
81 | */ |
||
82 | try { |
||
83 | $name = $this->webDriver->findElement(WebDriverBy::name('city')); |
||
84 | $name->clear()->sendKeys($this->faker->city); |
||
85 | } catch (\Exception $exception) { |
||
86 | unset($exception); |
||
87 | } |
||
88 | /* |
||
89 | * Field zipcode: |
||
90 | */ |
||
91 | try { |
||
92 | $name = $this->webDriver->findElement(WebDriverBy::name('zipcode')); |
||
93 | $name->clear()->sendKeys('28045'); |
||
94 | } catch (\Exception $exception) { |
||
95 | unset($exception); |
||
96 | } |
||
97 | /* |
||
98 | * Field Phone: |
||
99 | */ |
||
100 | try { |
||
101 | $name = $this->webDriver->findElement(WebDriverBy::name('mobilePhone')); |
||
102 | $name->clear()->sendKeys('6' . $this->faker->randomNumber(8)); |
||
103 | } catch (\Exception $exception) { |
||
104 | unset($exception); |
||
105 | } |
||
106 | /* |
||
107 | * Field Full Name: |
||
108 | */ |
||
109 | try { |
||
110 | $name = $this->webDriver->findElement(WebDriverBy::name('name')); |
||
111 | $name->clear()->sendKeys( |
||
112 | $this->faker->firstName . ' ' . $this->faker->lastName |
||
113 | ); |
||
114 | } catch (\Exception $exception) { |
||
115 | unset($exception); |
||
116 | } |
||
117 | |||
118 | /* |
||
119 | * Field password: |
||
120 | */ |
||
121 | try { |
||
122 | $name = $this->webDriver->findElement(WebDriverBy::name('password')); |
||
123 | if (null === SeleniumHelper::$mobilePhone) { |
||
124 | throw new \Exception('Please provide mobile phone for returning customer'); |
||
125 | } else { |
||
126 | $name->clear()->sendKeys(substr(SeleniumHelper::$mobilePhone, -4)); |
||
127 | } |
||
128 | } catch (\Exception $exception) { |
||
129 | unset($exception); |
||
130 | } |
||
131 | |||
132 | /* |
||
133 | * Click form continue |
||
134 | */ |
||
135 | try { |
||
136 | $formContinue = $this->webDriver->findElement(WebDriverBy::name('continue_button')); |
||
137 | $formContinue->click(); |
||
138 | } catch (\Exception $exception) { |
||
139 | unset($exception); |
||
140 | } |
||
141 | return true; |
||
142 | } |
||
144 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.