PHP Classes

File: docs/DocBlockMgr.md

Recommend this page to a friend!
  Classes of Kjell-Inge Gustafsson   PcGen   docs/DocBlockMgr.md   Download  
File: docs/DocBlockMgr.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PcGen
Generate PHP code from parameters
Author: By
Last change: 1.1.47
Date: 3 years ago
Size: 3,208 bytes
 

Contents

Class file image Download

[comment]: # (This file is part of PcGen, PHP Code Generation support package. Copyright 2020 Kjell-Inge Gustafsson, kigkonsult, All rights reserved, licence GPL 3.0)

DocBlockMgr

DocBlockMgr manages [phpdoc] docBlocks.

Methods

Inherited [Common methods]


* Convenient method for single variable/property/constant/.. (tag) docBlock
* ```tagName``` _string_, convenient constants found in PcGenInterface 
* ```tagType``` _string_, convenient constants found in PcGenInterface
* ```tagText``` _string_
* ```tagComment``` _string_
* ```tagExt``` _string_
* For eol and indents, defaults are used
* Static
* Return _static_

---

  • Return _array_, docBlock code rows (null-bytes removed) no trailing eol

* Return _string_ with code rows (extends toArray), each code row with trailing eol

---


  • Return _bool_ true, if set, false not

* ```summary``` _string_, short (top) description
* Return _static_


  • 
    
  • Return _static_

* ```summary``` _string_, short (top) description
* ```longDescr``` _string|array_, will have a leading emptyline
* Return _static_

---

  • 
    
  • Return _bool_ true if ```tagName``` set, false not

* Note, annotations are not supported, only [phpdoc] tags
* ```tagName``` _string_, convenient constants found in PcGenInterface 
* ```tagType``` _string_, convenient constants found in PcGenInterface
* ```tagText``` _string_
* ```tagComment``` _string_
* ```tagExt``` _string_
* Return _static_

---

  • 
    
  • Return ```bool``` true if tag is a [phpdoc] valid tag
  • Static

* ```tag``` _string_
* Throws _InvalidArgumentException_ on not accepted tag
* Static


---
#### Example

<?php

$code = DocBlockMgr::init()

->setSummary( 'Summary' )
->setDescription( 'Decription 1' )
->setDescription( [ 'Description 2', 'some text here...'] )
->setTag(
    DocBlockMgr::PARAM_T,
    [ DocBlockMgr::STRING_T, DocBlockMgr::STRINGARRAY_T ],
    'parameter'
)
->setTag(
    DocBlockMgr::PARAM_T,
    DocBlockMgr::INT_T,
    'quantity'
)
->setTag( DocBlockMgr::RETURN_T, DocBlockMgr::ARRAY_T )
->toString();


Result :

/
 * Summary
 *
 * Decription 1
 *
 * Description 2
 * some text here...
 *
 * @param   string|string[] $parameter
 * @param   int             $quantity
 * @return  array
 */


---

<small>Return to [README] - [Summary]</small>

[Common methods]:CommonMethods.md
[phpdoc]:https://phpdoc.org
[README]:../README.md
[Summary]:Summary.md