| Total Complexity | 15 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 6 | trait JScriptTrait{ |
||
| 7 | |||
| 8 | protected function checkInScript(bool $inScript, string $value): bool |
||
| 9 | { |
||
| 10 | if((substr(ltrim($value),0,8) === '<script>' && !strpos($value,'src'))){ |
||
| 11 | $inScript = true; |
||
| 12 | } |
||
| 13 | if((substr(ltrim($value),0,9) === '</script>')){ |
||
| 14 | $inScript = false; |
||
| 15 | } |
||
| 16 | return $inScript; |
||
| 17 | } |
||
| 18 | |||
| 19 | protected function checkCommentInScript(bool $inComment, string $value): bool |
||
| 20 | { |
||
| 21 | if(strpos($value,'/*') && !strpos($value,'*/')){ |
||
| 22 | $inComment = true; |
||
| 23 | }else{ |
||
| 24 | $inComment = (strpos($value,'*/')) ? false : $inComment; |
||
| 25 | } |
||
| 26 | return $inComment; |
||
| 27 | } |
||
| 28 | |||
| 29 | protected function checkScriptNeed(bool $inComment, string $value): bool |
||
| 30 | { |
||
| 31 | if(($inComment || strpos($value,'//'))){ |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | return true; |
||
| 35 | } |
||
| 36 | |||
| 37 | protected function treatScript(string $value): string |
||
| 47 | } |
||
| 48 | |||
| 49 | } |