Completed
Push — master ( ab21ee...9f62da )
by Jakub
01:59
created

BaseCondition   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getName() 0 13 4
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Menu;
5
6
use Nette\Utils\Strings;
7
8
/**
9
 * BaseCondition
10
 *
11
 * @author Jakub Konečný
12
 * @property-read string $name
13
 */
14 1
abstract class BaseCondition implements IMenuItemCondition {
0 ignored issues
show
Coding Style introduced by
BaseCondition does not seem to conform to the naming convention (^Abstract|Factory$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
15 1
  use \Nette\SmartObject;
16
  
17
  public function getName(): string {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after closing parenthesis; found 0
Loading history...
18 1
    $reflection = new \ReflectionClass($this);
19 1
    if($reflection->hasProperty("name")) {
20 1
      if(is_string($this->name)) {
21 1
        return $this->name;
22
      }
23
    }
24 1
    $class = Strings::after(static::class, "\\", -1);
25 1
    if(Strings::startsWith($class, "Condition")) {
26 1
      $class = Strings::after($class, "Condition");
27
    }
28 1
    return Strings::lower($class);
29
  }
30
}
31
?>