| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.0466 |
| Changes | 0 | ||
| 1 | <?php |
||
| 79 | 1 | public function encode(string $str = '', string $result = ''): string |
|
| 80 | { |
||
| 81 | 1 | if (empty($str) == true) { |
|
|
|
|||
| 82 | return $this->encode($this->value); |
||
| 83 | } |
||
| 84 | |||
| 85 | 1 | foreach (str_split($str) as $char) { |
|
| 86 | 1 | if (isset($this->translation[$char])) { |
|
| 87 | 1 | $result .= " ".$this->translation[$char]; |
|
| 88 | } |
||
| 89 | } |
||
| 90 | |||
| 91 | 1 | return trim($result); |
|
| 92 | } |
||
| 93 | |||
| 114 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.