Ubiquity  2.0.3
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)) {
29  $ret[$prop->getName()]=$v;
30  }
31  }
32  return $ret;
33  }
34 
35  public function asPhpArray() {
36  $fields=$this->getPropertiesAndValues();
37  return UArray::asPhpArray($fields);
38  }
39 
40  public function __toString() {
41  $extsStr=$this->asPhpArray();
42  $className=get_class($this);
43  $annotName=\substr($className, \strlen("Ubiquity\annotations\\"));
44  $annotName=\substr($annotName, 0, \strlen($annotName) - \strlen("Annotation"));
45  return "@" . \lcfirst($annotName) . $extsStr;
46  }
47 }
(&#39;property&#39;=>true, &#39;inherited&#39;=>true)
static asPhpArray($array, $prefix="", $depth=1, $format=false)
Definition: UArray.php:53