This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".  
Status: 2023-12-28

Traits


TraitDataType

use TraitDataType;

getDocCommentValueOfProperty

returns the value from a DocCommentKey (such as @var) from a class property.

Example: read the value from DocComment key @max from class property $iFoo

class Index extends \MVC\Controller
{
    use TraitDataType;

    /**
     * @min 0
     * @max 100
     * @minlength 1
     * @maxlength 3
     * @var int
     */
    public int $iFoo = 7;    

    /**
     * @return void
     * @throws \ReflectionException
     */
    public function index()
    {
        // get '@max' value from property 'iFoo' 
        $iMax = $this->getDocCommentValueOfProperty('iFoo', '@max');
    }
}