1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
<?php
namespace dokuwiki\Remote\OpenApiDoc;
use ReflectionClass;
class DocBlockClass extends DocBlock
{
/** @var DocBlockMethod[] */
protected $methods = [];
/** @var DocBlockProperty[] */
protected $properties = [];
/**
* Parse the given docblock
*
* The docblock can be of a method, class or property.
*
* @param ReflectionClass $reflector
*/
public function __construct(ReflectionClass $reflector)
{
parent::__construct($reflector);
}
/** @inheritdoc */
protected function getContext()
{
return $this->reflector->getName();
}
/**
* Get the public methods of this class
*
* @return DocBlockMethod[]
*/
public function getMethodDocs()
{
if ($this->methods) return $this->methods;
foreach ($this->reflector->getMethods() as $method) {
/** @var \ReflectionMethod $method */
if ($method->isConstructor()) continue;
if ($method->isDestructor()) continue;
if (!$method->isPublic()) continue;
$this->methods[$method->getName()] = new DocBlockMethod($method);
}
return $this->methods;
}
/**
* Get the public properties of this class
*
* @return DocBlockProperty[]
*/
public function getPropertyDocs()
{
if ($this->properties) return $this->properties;
foreach ($this->reflector->getProperties() as $property) {
/** @var \ReflectionProperty $property */
if (!$property->isPublic()) continue;
$this->properties[$property->getName()] = new DocBlockProperty($property);
}
return $this->properties;
}
}
|