| Conditions | 28 |
| Paths | 28 |
| Total Lines | 34 |
| Code Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 812 |
| 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 |
||
| 188 | public function getPartialRegex($const) |
||
| 189 | { |
||
| 190 | @trigger_error('RegexHelper no longer supports the getPartialRegex() function. Directly grab the PARTIAL_ constant you need instead.', E_USER_DEPRECATED); |
||
|
1 ignored issue
–
show
|
|||
| 191 | |||
| 192 | switch ($const) { |
||
| 193 | case self::ESCAPABLE: return self::PARTIAL_ESCAPABLE; |
||
|
1 ignored issue
–
show
|
|||
| 194 | case self::ESCAPED_CHAR: return self::PARTIAL_ESCAPED_CHAR; |
||
|
1 ignored issue
–
show
|
|||
| 195 | case self::IN_DOUBLE_QUOTES: return self::PARTIAL_IN_DOUBLE_QUOTES; |
||
|
1 ignored issue
–
show
|
|||
| 196 | case self::IN_SINGLE_QUOTES: return self::PARTIAL_IN_SINGLE_QUOTES; |
||
|
1 ignored issue
–
show
|
|||
| 197 | case self::IN_PARENS: return self::PARTIAL_IN_PARENS; |
||
|
1 ignored issue
–
show
|
|||
| 198 | case self::REG_CHAR: return self::PARTIAL_REG_CHAR; |
||
|
1 ignored issue
–
show
|
|||
| 199 | case self::IN_PARENS_NOSP: return self::PARTIAL_IN_PARENS_NOSP; |
||
|
1 ignored issue
–
show
|
|||
| 200 | case self::TAGNAME: return self::PARTIAL_TAGNAME; |
||
|
1 ignored issue
–
show
|
|||
| 201 | case self::BLOCKTAGNAME: return self::PARTIAL_BLOCKTAGNAME; |
||
|
1 ignored issue
–
show
|
|||
| 202 | case self::ATTRIBUTENAME: return self::PARTIAL_ATTRIBUTENAME; |
||
|
1 ignored issue
–
show
|
|||
| 203 | case self::UNQUOTEDVALUE: return self::PARTIAL_UNQUOTEDVALUE; |
||
|
1 ignored issue
–
show
|
|||
| 204 | case self::SINGLEQUOTEDVALUE: return self::PARTIAL_SINGLEQUOTEDVALUE; |
||
|
1 ignored issue
–
show
|
|||
| 205 | case self::DOUBLEQUOTEDVALUE: return self::PARTIAL_DOUBLEQUOTEDVALUE; |
||
|
1 ignored issue
–
show
|
|||
| 206 | case self::ATTRIBUTEVALUE: return self::PARTIAL_ATTRIBUTEVALUE; |
||
|
1 ignored issue
–
show
|
|||
| 207 | case self::ATTRIBUTEVALUESPEC: return self::PARTIAL_ATTRIBUTEVALUESPEC; |
||
|
1 ignored issue
–
show
|
|||
| 208 | case self::ATTRIBUTE: return self::PARTIAL_ATTRIBUTE; |
||
|
1 ignored issue
–
show
|
|||
| 209 | case self::OPENTAG: return self::PARTIAL_OPENTAG; |
||
|
1 ignored issue
–
show
|
|||
| 210 | case self::CLOSETAG: return self::PARTIAL_CLOSETAG; |
||
|
1 ignored issue
–
show
|
|||
| 211 | case self::OPENBLOCKTAG: return self::PARTIAL_OPENBLOCKTAG; |
||
|
1 ignored issue
–
show
|
|||
| 212 | case self::CLOSEBLOCKTAG: return self::PARTIAL_CLOSEBLOCKTAG; |
||
|
1 ignored issue
–
show
|
|||
| 213 | case self::HTMLCOMMENT: return self::PARTIAL_HTMLCOMMENT; |
||
|
1 ignored issue
–
show
|
|||
| 214 | case self::PROCESSINGINSTRUCTION: return self::PARTIAL_PROCESSINGINSTRUCTION; |
||
|
1 ignored issue
–
show
|
|||
| 215 | case self::DECLARATION: return self::PARTIAL_DECLARATION; |
||
|
1 ignored issue
–
show
|
|||
| 216 | case self::CDATA: return self::PARTIAL_CDATA; |
||
|
1 ignored issue
–
show
|
|||
| 217 | case self::HTMLTAG: return self::PARTIAL_HTMLTAG; |
||
|
1 ignored issue
–
show
|
|||
| 218 | case self::HTMLBLOCKOPEN: return self::PARTIAL_HTMLBLOCKOPEN; |
||
|
1 ignored issue
–
show
|
|||
| 219 | case self::LINK_TITLE: return self::PARTIAL_LINK_TITLE; |
||
|
1 ignored issue
–
show
|
|||
| 220 | } |
||
| 221 | } |
||
| 222 | |||
| 400 |
If you suppress an error, we recommend checking for the error condition explicitly: