| Conditions | 13 |
| Paths | 17 |
| Total Lines | 52 |
| Code Lines | 34 |
| 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 |
||
| 99 | protected function IsOK(&$msg) |
||
| 100 | { |
||
| 101 | if (!$this->isStringNotNullOrEmpty($this->termNamespace)) { |
||
| 102 | $msg = "Term Namespace Must be defined"; |
||
| 103 | return false; |
||
| 104 | } |
||
| 105 | if (!$this->isNCName($this->termNamespace)) { |
||
| 106 | $msg = "Term Namespace Must be a valid NCName"; |
||
| 107 | return false; |
||
| 108 | } |
||
| 109 | //<!-- one or more SimpleIdentifiers separated by dots --> |
||
| 110 | if (!$this->MatchesRegexPattern("[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}", $this->termNamespace)) { |
||
| 111 | $msg = "the term namespace dose not match the regex in the xsd."; |
||
| 112 | return false; |
||
| 113 | } |
||
| 114 | |||
| 115 | if (null != $this->qualifier) { |
||
| 116 | if (!is_string($this->qualifier)) { |
||
| 117 | $msg = "qualifier must be either a string or null"; |
||
| 118 | return false; |
||
| 119 | } |
||
| 120 | if (!$this->isNCName($this->qualifier)) { |
||
| 121 | $msg = "qualifier Must be a valid NCName"; |
||
| 122 | return false; |
||
| 123 | } |
||
| 124 | if (strlen($this->qualifier > 128)) { |
||
| 125 | $msg = "the maximum length permitted for qualifier is 128"; |
||
| 126 | return false; |
||
| 127 | } |
||
| 128 | // <!-- ECMAScript identifiers not starting with a '$' --> |
||
| 129 | if (!$this->MatchesRegexPattern("[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}", $this->qualifier)) { |
||
| 130 | $msg = "the qualifier dose not match the regex in the xsd."; |
||
| 131 | return false; |
||
| 132 | } |
||
| 133 | } |
||
| 134 | if (null != $this->targetNamespace) { |
||
| 135 | if (!is_string($this->targetNamespace)) { |
||
| 136 | $msg = "targetNamespace must be either a string or null"; |
||
| 137 | return false; |
||
| 138 | } |
||
| 139 | if (!$this->isNCName($this->targetNamespace)) { |
||
| 140 | $msg = "targetNamespace Must be a valid NCName"; |
||
| 141 | return false; |
||
| 142 | } |
||
| 143 | //<!-- one or more SimpleIdentifiers separated by dots --> |
||
| 144 | if (!$this->MatchesRegexPattern("[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}", $this->targetNamespace)) { |
||
| 145 | $msg = "the targetNamespace dose not match the regex in the xsd."; |
||
| 146 | return false; |
||
| 147 | } |
||
| 148 | } |
||
| 149 | return true; |
||
| 150 | } |
||
| 151 | } |
||
| 152 |