| Conditions | 3 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 69 | protected function setLinkAttributes(Tag $tag, $linkInfo, $attrName) |
|
| 23 | { |
||
| 24 | 69 | $url = trim($linkInfo); |
|
| 25 | 69 | $title = ''; |
|
| 26 | 69 | $pos = strpos($url, ' '); |
|
| 27 | 69 | if ($pos !== false) |
|
| 28 | 69 | { |
|
| 29 | 30 | $title = substr(trim(substr($url, $pos)), 1, -1); |
|
| 30 | 30 | $url = substr($url, 0, $pos); |
|
| 31 | 30 | } |
|
| 32 | |||
| 33 | 69 | $tag->setAttribute($attrName, $this->text->decode($url)); |
|
|
1 ignored issue
–
show
|
|||
| 34 | 69 | if ($title > '') |
|
| 35 | 69 | { |
|
| 36 | 29 | $tag->setAttribute('title', $this->text->decode($title)); |
|
| 37 | 29 | } |
|
| 38 | } |
||
| 39 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: