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

BaseCondition::getName()   A

Complexity

Conditions 4
Paths 5

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 8
cts 8
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 9
nc 5
nop 0
crap 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
?>