| Conditions | 12 |
| Paths | 259 |
| Total Lines | 44 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 56 | public function fire() |
||
| 57 | { |
||
| 58 | $this->transportProvider = '\Thruway\Transport\PawlTransportProvider'; |
||
| 59 | |||
| 60 | $this->parseOptions(); |
||
| 61 | $this->changeWampLogger(); |
||
| 62 | |||
| 63 | if (!$this->runInBackground) { |
||
| 64 | if ($this->realm) { |
||
| 65 | config('wamp.realm', $this->realm); |
||
|
|
|||
| 66 | app()->wampClient = new Client($this->realm); |
||
| 67 | if ($this->routePath) { |
||
| 68 | app()->wampClient->setRoutePath($this->routePath); |
||
| 69 | } |
||
| 70 | } |
||
| 71 | |||
| 72 | $client = app()->wampClient; |
||
| 73 | $client->addTransportProvider($this->getTransportProvider()); |
||
| 74 | $client->start(!$this->runOnce); |
||
| 75 | } else { |
||
| 76 | $command = $this->getName().($this->port ? ' --port='.$this->port : ''). |
||
| 77 | ($this->host ? ' --host='.$this->host : ''). |
||
| 78 | ($this->realm ? ' --realm='.$this->realm : ''); |
||
| 79 | |||
| 80 | if ($this->transportProvider) { |
||
| 81 | $command .= ' --transport-provider='.str_replace('\\', '\\\\', $this->transportProvider); |
||
| 82 | } |
||
| 83 | |||
| 84 | if ($this->noDebug) { |
||
| 85 | $command .= ' --no-debug'; |
||
| 86 | } |
||
| 87 | |||
| 88 | if ($this->tls) { |
||
| 89 | $command .= ' --tls'; |
||
| 90 | } |
||
| 91 | |||
| 92 | if ($this->routePath) { |
||
| 93 | $command .= ' --route-path='.$this->routePath; |
||
| 94 | } |
||
| 95 | |||
| 96 | if ($this->noLoop) { |
||
| 97 | $command .= ' --no-loop'; |
||
| 98 | } |
||
| 99 | $this->addPidToLog(RunCommandInBackground::factory($command)->runInBackground(), DownWAMP::CLIENT_PID_FILE); |
||
| 100 | } |
||
| 167 |