LinkRenderJavaScriptAction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0
eloc 6
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isApplicable() 0 2 1
A renderLink() 0 5 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Menu;
5
6
/**
7
 * LinkRenderJavaScriptAction
8
 *
9
 * @author Jakub Konečný
10
 */
11 1
final class LinkRenderJavaScriptAction extends BaseLinkRender {
12
  protected string $name = "javascript";
13
  
14
  public function isApplicable(string $link): bool {
15 1
    return str_starts_with($link, "javascript:");
16
  }
17
  
18
  public function renderLink(string $link): string {
19 1
    if(!$this->isApplicable($link)) {
20 1
      return "";
21
    }
22 1
    return $link;
23
  }
24
}
25
?>