| Conditions | 16 |
| Paths | 512 |
| Total Lines | 41 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 60 | protected function prepareDumpOptions() |
||
| 61 | { |
||
| 62 | $command = "{$this->dumpCommandPath}mongodump"; |
||
| 63 | |||
| 64 | if ($this->isCompress) { |
||
| 65 | $command .= " --archive --gzip"; |
||
| 66 | } |
||
| 67 | |||
| 68 | if ($this->uri) { |
||
| 69 | $command .= " " . $this->uri; |
||
| 70 | } |
||
| 71 | // Database |
||
| 72 | if ($this->dbName && !$this->uri) { |
||
| 73 | $command .= " --db {$this->dbName}"; |
||
| 74 | } |
||
| 75 | // Username |
||
| 76 | if ($this->username && !$this->uri) { |
||
| 77 | $command .= " --username {$this->username}"; |
||
| 78 | } |
||
| 79 | //Password |
||
| 80 | if ($this->password && !$this->uri) { |
||
| 81 | $command .= " --password {$this->password}"; |
||
| 82 | } |
||
| 83 | // Host |
||
| 84 | if ($this->host && !$this->uri) { |
||
| 85 | $command .= " --host {$this->host}"; |
||
| 86 | } |
||
| 87 | // Port |
||
| 88 | if ($this->port && !$this->uri) { |
||
| 89 | $command .= " --port {$this->port}"; |
||
| 90 | } |
||
| 91 | // Collection |
||
| 92 | if ($this->collection) { |
||
| 93 | $command .= " --collection {$this->collection}"; |
||
| 94 | } |
||
| 95 | // Authentication Database |
||
| 96 | if ($this->authenticationDatabase && !$this->uri) { |
||
| 97 | $command .= " --authenticationDatabase {$this->authenticationDatabase}"; |
||
| 98 | } |
||
| 99 | |||
| 100 | return $command; |
||
| 101 | } |
||
| 146 |