| Conditions | 12 |
| Paths | 10 |
| Total Lines | 40 |
| Code Lines | 28 |
| 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 |
||
| 126 | public function isOK(&$msg = null) |
||
| 127 | { |
||
| 128 | if (!$this->isStringNotNullOrEmpty($this->namespace)) { |
||
| 129 | $msg = "Namespace cannot be null or empty"; |
||
| 130 | return false; |
||
| 131 | } |
||
| 132 | if (!$this->isStringNotNullOrEmpty($this->provider)) { |
||
| 133 | $msg = "Provider cannot be null or empty"; |
||
| 134 | return false; |
||
| 135 | } |
||
| 136 | if (!$this->isStringNotNullOrEmpty($this->providerManifestToken)) { |
||
| 137 | $msg = "Provider manifest token cannot be null or empty"; |
||
| 138 | return false; |
||
| 139 | } |
||
| 140 | if (!$this->isStringNotNullOrEmpty($this->alias)) { |
||
| 141 | $msg = "Alias cannot be empty"; |
||
| 142 | return false; |
||
| 143 | } |
||
| 144 | if (!$this->isTQualifiedNameValid($this->namespace)) { |
||
| 145 | $msg = "Namespace must be valid TQualifiedName"; |
||
| 146 | return false; |
||
| 147 | } |
||
| 148 | if (null != $this->alias && !$this->isTSimpleIdentifierValid($this->alias)) { |
||
| 149 | $msg = "Alias must be valid TSimpleIdentifier"; |
||
| 150 | return false; |
||
| 151 | } |
||
| 152 | if (null != $this->providerManifestToken && !$this->isTSimpleIdentifierValid($this->providerManifestToken)) { |
||
| 153 | $msg = "Provider manifest token must be valid TSimpleIdentifier"; |
||
| 154 | return false; |
||
| 155 | } |
||
| 156 | if (!$this->isTSimpleIdentifierValid($this->provider)) { |
||
| 157 | $msg = "Provider must be valid TSimpleIdentifier"; |
||
| 158 | return false; |
||
| 159 | } |
||
| 160 | if (!$this->isBodyElementsOK($msg)) { |
||
| 161 | return false; |
||
| 162 | } |
||
| 163 | |||
| 164 | return true; |
||
| 165 | } |
||
| 166 | } |
||
| 167 |