Class luya\admin\openapi\phpdoc\PhpDocMethod
Inheritance | luya\admin\openapi\phpdoc\PhpDocMethod |
---|---|
Available since version | 3.3.1 |
Source Code | https://github.com/luyadev/luya-module-admin/blob/master/src/openapi/phpdoc/PhpDocMethod.php |
Php DOc Method
The @method phpdoc describer.
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$definition | array | luya\admin\openapi\phpdoc\PhpDocMethod | |
$phpDocParser | luya\admin\openapi\phpdoc\PhpDocParser | luya\admin\openapi\phpdoc\PhpDocMethod |
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Constructor | luya\admin\openapi\phpdoc\PhpDocMethod |
getDescription() | Description. | luya\admin\openapi\phpdoc\PhpDocMethod |
getMethodName() | Method Name | luya\admin\openapi\phpdoc\PhpDocMethod |
getMethodParams() | Method Param Description | luya\admin\openapi\phpdoc\PhpDocMethod |
getNormalizedMethodName() | Returns a readable name for an action | luya\admin\openapi\phpdoc\PhpDocMethod |
getReturnType() | Type | luya\admin\openapi\phpdoc\PhpDocMethod |
Property Details
Method Details
Constructor
public void __construct ( luya\admin\openapi\phpdoc\PhpDocParser $phpDocParser, array $definition ) | ||
$phpDocParser | luya\admin\openapi\phpdoc\PhpDocParser | |
$definition | array |
public function __construct(PhpDocParser $phpDocParser, array $definition)
{
$this->phpDocParser = $phpDocParser;
$this->definition = $definition;
}
Description.
public string getDescription ( ) |
public function getDescription()
{
return $this->definition[4] ?? '';
}
Method Name
Returns only the method name without arguments, for example actionView($id) should return actionView
public string getMethodName ( ) |
public function getMethodName()
{
return isset($this->definition[2]) ? trim($this->definition[2]) : false;
}
Method Param Description
Returns the definition of the action inside the () params.
public string getMethodParams ( ) |
public function getMethodParams()
{
return isset($this->definition[3]) ? trim($this->definition[3]) : false;
}
Returns a readable name for an action
For example the action is actionFooBar it will return Foo Bar
.
public void getNormalizedMethodName ( ) |
public function getNormalizedMethodName()
{
$methodName = StringHelper::replaceFirst('action', '', $this->getMethodName());
return Inflector::camel2words($methodName);
}
Type
Returns a Type definition.
public luya\admin\openapi\phpdoc\PhpDocType getReturnType ( ) |
public function getReturnType()
{
return new PhpDocType($this->phpDocParser, $this->definition[1] ?? null);
}