Files
zhamao-framework/src/ZM/Annotation/AnnotationBase.php

29 lines
713 B
PHP
Raw Normal View History

2020-03-02 16:14:20 +08:00
<?php
namespace ZM\Annotation;
use Closure;
abstract class AnnotationBase
{
public $method;
public $class;
2021-04-06 01:19:56 +08:00
public function __toString() {
2020-03-02 16:14:20 +08:00
$str = __CLASS__ . ": ";
foreach ($this as $k => $v) {
$str .= "\n\t" . $k . " => ";
if (is_string($v)) $str .= "\"$v\"";
elseif (is_numeric($v)) $str .= $v;
elseif (is_bool($v)) $str .= ($v ? "TRUE" : "FALSE");
elseif (is_array($v)) $str .= json_encode($v, JSON_UNESCAPED_UNICODE);
elseif ($v instanceof Closure) $str .= "@AnonymousFunction";
elseif (is_null($v)) $str .= "NULL";
else $str .= "@Unknown";
}
return $str;
}
}