Conditions | 6 |
Paths | 6 |
Total Lines | 51 |
Code Lines | 30 |
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 |
||
81 | public function createTextFile( |
||
82 | Session $session, |
||
83 | $name = null, |
||
84 | $useDefaultFileExtension = false |
||
85 | ) { |
||
86 | $newFileFolderButton |
||
87 | = $this->find("xpath", $this->newFileFolderButtonXpath); |
||
88 | |||
89 | if ($newFileFolderButton === null) { |
||
90 | throw new ElementNotFoundException( |
||
91 | "could not find new file/folder button" |
||
92 | ); |
||
93 | } |
||
94 | |||
95 | $newFileFolderButton->click(); |
||
96 | |||
97 | $newTextFileButton = $this->find("xpath", $this->newTextFileButtonXpath); |
||
98 | |||
99 | if ($newTextFileButton === null) { |
||
100 | throw new ElementNotFoundException( |
||
101 | "could not find new text file button" |
||
102 | ); |
||
103 | } |
||
104 | |||
105 | $newTextFileButton->click(); |
||
106 | |||
107 | if (strlen($name)) { |
||
108 | if ($useDefaultFileExtension) { |
||
109 | $this->typeInFieldAndPressEnter( |
||
110 | $this->newTextFileNameInputXpath, |
||
111 | $name, |
||
112 | $session |
||
113 | ); |
||
114 | } else { |
||
115 | try { |
||
116 | $this->fillField($this->newTextFileNameInputLabel, $name . "\n"); |
||
117 | } catch (\WebDriver\Exception\NoSuchElement $e) { |
||
|
|||
118 | // this seems to be a bug in MinkSelenium2Driver. |
||
119 | // used to work fine in 1.3.1 but now throws this exception |
||
120 | // actually all that we need does happen, |
||
121 | // so we just don't do anything |
||
122 | } |
||
123 | } |
||
124 | } else { |
||
125 | $this->typeInFieldAndPressEnter( |
||
126 | $this->newTextFileNameInputXpath, |
||
127 | '', |
||
128 | $session |
||
129 | ); |
||
130 | } |
||
131 | } |
||
132 | |||
185 | } |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.