Completed
Push — master ( 3a3759...49115f )
by Jakub
17:00
created

LinkRenderJavaScriptAction::renderLink()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Menu;
5
6
use Nette\Utils\Strings;
7
8
/**
9
 * LinkRendererJavaScriptAction
10
 *
11
 * @author Jakub Konečný
12
 */
13 1
final class LinkRenderJavaScriptAction extends BaseLinkRender {
14
  protected $name = "javascript";
15
  
16
  public function isApplicable(string $link): bool {
17 1
    return Strings::startsWith($link, "javascript:");
18
  }
19
  
20
  public function renderLink(string $link): string {
21 1
    if(!$this->isApplicable($link)) {
22 1
      return "";
23
    }
24 1
    return $link;
25
  }
26
}
27
?>