Conditions | 5 |
Paths | 36 |
Total Lines | 78 |
Code Lines | 35 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
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 |
||
42 | public function run() |
||
43 | { |
||
44 | $this->validateStep(self::STEP); |
||
45 | |||
46 | /* |
||
47 | * Mandatory DNI: |
||
48 | */ |
||
49 | $name = $this->webDriver->findElement(WebDriverBy::name('dni')); |
||
50 | $name->clear()->sendKeys($this->getDNI()); |
||
51 | |||
52 | /* |
||
53 | * Mandatory BirthDate: |
||
54 | */ |
||
55 | $dob = $this->webDriver->findElement(WebDriverBy::name('dob')); |
||
56 | $dob->clear()->sendKeys( |
||
57 | $this->faker->numberBetween(1, 28). |
||
|
|||
58 | $this->faker->numberBetween(1, 12). |
||
59 | '1975' |
||
60 | ); |
||
61 | |||
62 | /* |
||
63 | * Mandatory address: |
||
64 | */ |
||
65 | $name = $this->webDriver->findElement(WebDriverBy::name('address')); |
||
66 | $name->clear()->sendKeys($this->faker->address. ' ' . $this->faker->city); |
||
67 | |||
68 | /* |
||
69 | * Optional city: |
||
70 | */ |
||
71 | $name = $this->webDriver->findElement(WebDriverBy::name('city')); |
||
72 | $name->clear()->sendKeys($this->faker->city); |
||
73 | |||
74 | /* |
||
75 | * Optional zipcode: |
||
76 | */ |
||
77 | $name = $this->webDriver->findElement(WebDriverBy::name('zipcode')); |
||
78 | $name->clear()->sendKeys('28045'); |
||
79 | |||
80 | /* |
||
81 | * Optional Phone: |
||
82 | */ |
||
83 | $name = $this->webDriver->findElement(WebDriverBy::name('mobilePhone')); |
||
84 | $name->clear()->sendKeys('6' . $this->faker->randomNumber(8)); |
||
85 | |||
86 | /* |
||
87 | * Optional Full Name: |
||
88 | */ |
||
89 | try { |
||
90 | $name = $this->webDriver->findElement(WebDriverBy::name('name')); |
||
91 | $name->clear()->sendKeys( |
||
92 | $this->faker->firstName . ' ' . $this->faker->lastName |
||
93 | ); |
||
94 | } catch (\Exception $exception) { |
||
95 | unset($exception); |
||
96 | } |
||
97 | |||
98 | /* |
||
99 | * Optional password: |
||
100 | */ |
||
101 | try { |
||
102 | $name = $this->webDriver->findElement(WebDriverBy::name('password')); |
||
103 | if (null === SeleniumHelper::$mobilePhone) { |
||
104 | throw new \Exception('Please provide mobile phone for returning customer'); |
||
105 | } else { |
||
106 | $name->clear()->sendKeys(substr(SeleniumHelper::$mobilePhone, -4)); |
||
107 | } |
||
108 | } catch (\Exception $exception) { |
||
109 | unset($exception); |
||
110 | } |
||
111 | |||
112 | /* |
||
113 | * Click form continue |
||
114 | */ |
||
115 | try { |
||
116 | $formContinue = $this->webDriver->findElement(WebDriverBy::name('continue_button')); |
||
117 | $formContinue->click(); |
||
118 | } catch (\Exception $exception) { |
||
119 | unset($exception); |
||
120 | } |
||
123 |
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.