Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
BaseAnnotationTrait.php
Go to the documentation of this file.
1<?php
3
4use Ubiquity\utils\base\UArray;
5
14 abstract protected function getDefaultParameters(): array;
15
16 public function getProperties() {
17 $reflect = new \ReflectionClass ( $this );
18 $props = $reflect->getProperties ();
19 return $props;
20 }
21
22 public function getPropertiesAndValues($props = NULL) {
23 $ret = [];
24 $defaultParameters=$this->getDefaultParameters();
25 if (\is_null ( $props ))
26 $props = $this->getProperties ();
27 foreach ( $props as $prop ) {
28 $prop->setAccessible ( true );
29 $name=$prop->getName();
30 $v = $prop->getValue ( $this );
31 if ($v !== null && $v !== '' && isset ( $v )) {
32 if(!isset($defaultParameters[$name]) || $defaultParameters[$name]!==$v){
33 $ret [$name] = $v;
34 }
35 }
36 }
37 return $ret;
38 }
39
40 public function isSameAs($annot):bool{
41 return \get_class($this)===\get_class($annot);
42 }
43}
44
Ubiquity\annotations$BaseAnnotationTrait This class is part of Ubiquity.