| Conditions | 10 |
| Paths | 5 |
| Total Lines | 29 |
| Code Lines | 19 |
| 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 |
||
| 69 | protected function _watch($path) |
||
| 70 | { |
||
| 71 | if ($this->isExcluded($path)) { |
||
| 72 | return false; |
||
| 73 | } |
||
| 74 | $wd = inotify_add_watch($this->fd, $path, $this->watchMask); |
||
| 75 | if ($wd === false) { |
||
| 76 | return false; |
||
| 77 | } |
||
| 78 | $this->bind($wd, $path); |
||
| 79 | |||
| 80 | if (is_dir($path)) { |
||
| 81 | $wd = inotify_add_watch($this->fd, $path, $this->watchMask); |
||
| 82 | if ($wd === false) { |
||
| 83 | return false; |
||
| 84 | } |
||
| 85 | $this->bind($wd, $path); |
||
| 86 | $files = scandir($path); |
||
| 87 | foreach ($files as $file) { |
||
| 88 | if ($file === '.' || $file === '..' || $this->isExcluded($file)) { |
||
| 89 | continue; |
||
| 90 | } |
||
| 91 | $file = $path . DIRECTORY_SEPARATOR . $file; |
||
| 92 | if (is_dir($file)) { |
||
| 93 | $this->_watch($file); |
||
| 94 | } |
||
| 95 | } |
||
| 96 | } |
||
| 97 | return true; |
||
| 98 | } |
||
| 168 |