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