| @@ 14-30 (lines=17) @@ | ||
| 11 | * @author Jakub Konečný |
|
| 12 | * @property-read string $name |
|
| 13 | */ |
|
| 14 | abstract class BaseCondition implements IMenuItemCondition { |
|
| 15 | use \Nette\SmartObject; |
|
| 16 | ||
| 17 | public function getName(): string { |
|
| 18 | $reflection = new \ReflectionClass($this); |
|
| 19 | if($reflection->hasProperty("name")) { |
|
| 20 | if(is_string($this->name)) { |
|
| 21 | return $this->name; |
|
| 22 | } |
|
| 23 | } |
|
| 24 | $class = Strings::after(static::class, "\\", -1); |
|
| 25 | if(Strings::startsWith($class, "Condition")) { |
|
| 26 | $class = Strings::after($class, "Condition"); |
|
| 27 | } |
|
| 28 | return Strings::lower($class); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ?> |
|
| @@ 14-30 (lines=17) @@ | ||
| 11 | * @author Jakub Konečný |
|
| 12 | * @property-read string $name |
|
| 13 | */ |
|
| 14 | abstract class BaseLinkRender implements IMenuItemLinkRender { |
|
| 15 | use \Nette\SmartObject; |
|
| 16 | ||
| 17 | public function getName(): string { |
|
| 18 | $reflection = new \ReflectionClass($this); |
|
| 19 | if($reflection->hasProperty("name")) { |
|
| 20 | if(is_string($this->name)) { |
|
| 21 | return $this->name; |
|
| 22 | } |
|
| 23 | } |
|
| 24 | $class = Strings::after(static::class, "\\", -1); |
|
| 25 | if(Strings::startsWith($class, "LinkRender")) { |
|
| 26 | $class = Strings::after($class, "LinkRender"); |
|
| 27 | } |
|
| 28 | return Strings::lower($class); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ?> |
|