Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
BaseAttribute.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\attributes\items
;
4
5
use
Ubiquity\annotations\BaseAnnotationTrait
;
6
use Ubiquity\utils\base\UArray;
7
15
abstract
class
BaseAttribute
extends
BaseAnnotationTrait
{
16
17
public
function
__construct
() {
18
19
}
20
21
public
function
asAnnotation
(): string {
22
return $this->
__toString
();
23
}
24
25
public
function
getNamespace
(): string {
26
return (new \ReflectionClass($this))->getNamespaceName();
27
}
28
29
protected
function
getDefaultParameters
(): array {
30
$r = new \ReflectionMethod(get_class($this),
'__construct'
);
31
$result = [];
32
foreach
($r->getParameters() as $param) {
33
if
($param->isOptional() && $param->isDefaultValueAvailable()) {
34
$result[$param->getName()] = $param->getDefaultValue();
35
}
36
}
37
return
$result;
38
}
39
40
public
function
__toString
(): string {
41
$fields = $this->getPropertiesAndValues();
42
$extsStr = UArray::asPhpAttribute($fields);
43
$className = (new \ReflectionClass($this))->getShortName();
44
return
'#['
. $className . $extsStr .
']'
;
45
}
46
}
47
Ubiquity\annotations\BaseAnnotationTrait
Ubiquity\annotations$BaseAnnotationTrait This class is part of Ubiquity.
Definition
BaseAnnotationTrait.php:13
Ubiquity\attributes\items\BaseAttribute
Ubiquity\attributes$BaseAttribute This class is part of Ubiquity.
Definition
BaseAttribute.php:15
Ubiquity\attributes\items\BaseAttribute\__construct
__construct()
Definition
BaseAttribute.php:17
Ubiquity\attributes\items\BaseAttribute\getNamespace
getNamespace()
Definition
BaseAttribute.php:25
Ubiquity\attributes\items\BaseAttribute\asAnnotation
asAnnotation()
Definition
BaseAttribute.php:21
Ubiquity\attributes\items\BaseAttribute\__toString
__toString()
Definition
BaseAttribute.php:40
Ubiquity\attributes\items\BaseAttribute\getDefaultParameters
getDefaultParameters()
Definition
BaseAttribute.php:29
Ubiquity\attributes\items
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity-attributes
src
Ubiquity
attributes
items
BaseAttribute.php
Generated on Sun Dec 10 2023 15:04:04 for
Ubiquity
by
doxygen
1.9.8