Ubiquity  2.0.2
php rapid development framework
BaseAnnotation.php
Go to the documentation of this file.
1 <?php
2 
4 
9 
13 class BaseAnnotation extends Annotation {
14 
15  public function getProperties() {
16  $reflect=new \ReflectionClass($this);
17  $props=$reflect->getProperties();
18  return $props;
19  }
20 
21  public function getPropertiesAndValues($props=NULL) {
22  $ret=array ();
23  if (is_null($props))
24  $props=$this->getProperties($this);
25  foreach ( $props as $prop ) {
26  $prop->setAccessible(true);
27  $v=$prop->getValue($this);
28  if ($v !== null && $v !== "" && isset($v)) {
30  $ret[$prop->getName()]=$v;
31  }
32  }
33  return $ret;
34  }
35 
36  public function asPhpArray() {
37  $fields=$this->getPropertiesAndValues();
38  return UArray::asPhpArray($fields);
39  }
40 
41  public function __toString() {
42  $extsStr=$this->asPhpArray();
43  $className=get_class($this);
44  $annotName=\substr($className, \strlen("Ubiquity\annotations\\"));
45  $annotName=\substr($annotName, 0, \strlen($annotName) - \strlen("Annotation"));
46  return "@" . \lcfirst($annotName) . $extsStr;
47  }
48 }
static asPhpArray($array, $prefix="")
Definition: UArray.php:27
static cleanClassname($classname)
Definition: ClassUtils.php:20
(&#39;property&#39;=>true, &#39;inherited&#39;=>true)