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