FAF: Documentation UI Twig Blocks (get @see comments)

This commit is contained in:
Eric
2021-05-31 13:42:30 +02:00
parent 9a9856fb0d
commit 94fbb91ad2
22 changed files with 84 additions and 62 deletions

View File

@@ -211,15 +211,15 @@ EOF;
/**
* @param \ReflectionMethod $oMethod
* @param string $sFullComment
*
* @return array
* @throws \ReflectionException
*/
function GetMethodParameters(ReflectionMethod $oMethod, string $sFullComment): array
function GetMethodParameters(ReflectionMethod $oMethod): array
{
$aDocParams = [];
$aParameters = $oMethod->getParameters();
$sFullComment = $oMethod->getDocComment();
foreach ($aParameters as $oParameter) {
$sName = $oParameter->getName();
$aDocParam['name'] = $sName;
@@ -245,14 +245,36 @@ function GetMethodParameters(ReflectionMethod $oMethod, string $sFullComment): a
}
if ($sFullComment !== false) {
$sComment = $sFullComment;
$iPos = strpos($sComment, $sName);
if ($iPos !== false) {
$sComment = substr($sComment, strpos($sComment, '@param'));
$iPos = strpos($sComment, $sName);
$sComment = substr($sComment, $iPos + strlen($sName));
$sComment = substr($sComment, 0, strpos($sComment, "\n"));
$sComment = trim($sComment);
if (preg_match("#^\s*\*\s*@param\s+\S*\s*.$sName(?<comment>.*)$#m", $sFullComment, $aMatches)) {
$sComment = trim($aMatches['comment']);
if (preg_match("#^{@see (?<class>\S+)::.(?<property>\S+)}#", $sComment, $aMatches)) {
$sClass = $aMatches['class'];
$sProperty = $aMatches['property'];
try {
$oTargetClass = new ReflectionClass($sClass);
$oProperty = $oTargetClass->getProperty($sProperty);
$sComment = $oProperty->getDocComment();
if (preg_match("#/\*\*\s*@var.*$sProperty\s*(?<comment>.*)\*/#", $sComment, $aMatches)) {
$sComment = trim($aMatches['comment']);
}
}
catch (ReflectionException $e) {
// Try with the current name space
$oLocalClass = new ReflectionClass($oMethod->class);
$sNameSpace = $oLocalClass->getNamespaceName();
$sClass = $sNameSpace.'\\'.$sClass;
try {
$oTargetClass = new ReflectionClass($sClass);
$oProperty = $oTargetClass->getProperty($sProperty);
$sComment = $oProperty->getDocComment();
if (preg_match("#/\*\*\s*@var.*$sProperty\s*(?<comment>.*)\*/#", $sComment, $aMatches)) {
$sComment = trim($aMatches['comment']);
}
}
catch (ReflectionException $e) {
}
}
}
} else {
$sComment = '';
}
@@ -354,7 +376,7 @@ foreach ($aFactoryClasses as $sFactoryClass) {
$sType = substr($sMethodName, strlen('Make'));
$aDocType['comment'] = $sComment;
$aDocType['params'] = GetMethodParameters($oMethod, $sFullComment);
$aDocType['params'] = GetMethodParameters($oMethod);
$aDocTypes[$sType] = $aDocType;
}
}
@@ -376,7 +398,7 @@ foreach ($aFactoryClasses as $sFactoryClass) {
$aReflectionParameters = $oMethod->getParameters();
$oReflectionParameter = $aReflectionParameters[0];
$sFullComment = GetMethodComment($oMethod, $oReflectionParameter->getName());
$aParams = GetMethodParameters($oMethod, $sFullComment)[0];
$aParams = GetMethodParameters($oMethod)[0];
$aParams['name'] = $sName;
$aDocGeneralParams[] = $aParams;
}

View File

@@ -239,13 +239,13 @@ Alert common parameters
+-------------------+----------+------------------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------------------+

View File

@@ -72,13 +72,13 @@ Button Neutral
:parameters:
+--------+--------+-----------+------+----------------------------+
| sLabel | string | mandatory | | |
+--------+--------+-----------+------+----------------------------+
| sName | string | optional | NULL | See {@link Button::$sName} |
+--------+--------+-----------+------+----------------------------+
| sId | string | optional | NULL | |
+--------+--------+-----------+------+----------------------------+
+--------+--------+-----------+------+--------------------------------------------+
| sLabel | string | mandatory | | |
+--------+--------+-----------+------+--------------------------------------------+
| sName | string | optional | NULL | The HTML name of the button, used by forms |
+--------+--------+-----------+------+--------------------------------------------+
| sId | string | optional | NULL | UIBBlock main HTML tag id |
+--------+--------+-----------+------+--------------------------------------------+
.. _ButtonForPrimaryAction:
@@ -443,11 +443,11 @@ Button common parameters
+-------------------+--------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+--------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -61,13 +61,13 @@ ButtonGroup common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddExtraBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| Buttons | array | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -61,13 +61,13 @@ CollapsibleSection common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -202,13 +202,13 @@ DataTable common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -155,13 +155,13 @@ Field common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -61,13 +61,13 @@ FieldBadge common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -61,13 +61,13 @@ FieldSet common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -61,13 +61,13 @@ Form common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -57,11 +57,11 @@ FileSelect common parameters
+-------------------+--------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+--------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| ButtonText | string | |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -111,11 +111,11 @@ Input common parameters
+-------------------+--------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+--------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -86,13 +86,13 @@ Select common parameters
+-------------------+--------------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+--------------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+--------------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+--------------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+--------------+------------------------------------------------------------+
| AddOption | SelectOption | |
+-------------------+--------------+------------------------------------------------------------+

View File

@@ -61,11 +61,11 @@ SelectOption common parameters
+-------------------+--------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+--------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -247,19 +247,19 @@ Panel common parameters
+-------------------------+-----------------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------------+-----------------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------------+-----------------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------------+-----------------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------------+-----------------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------------+-----------------+------------------------------------------------------------+
| AddMainBlock | iUIBlock | |
+-------------------------+-----------------+------------------------------------------------------------+
| AddMainBlocks | array | |
+-------------------------+-----------------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | directly in the main area |
| AddSubBlock | iUIBlock | |
+-------------------------+-----------------+------------------------------------------------------------+
| AddSubTitleBlock | iUIBlock | |
+-------------------------+-----------------+------------------------------------------------------------+

View File

@@ -55,11 +55,11 @@ Spinner common parameters
+-------------------+--------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+--------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -140,13 +140,13 @@ Title common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -105,13 +105,13 @@ Toolbar common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -55,11 +55,11 @@ ToolbarSpacer common parameters
+-------------------+--------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+--------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+--------+------------------------------------------------------------+
| CSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+--------+------------------------------------------------------------+

View File

@@ -82,13 +82,13 @@ Column common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -61,13 +61,13 @@ MultiColumn common parameters
+-------------------+----------+------------------------------------------------------------+
| AddColumn | Column | |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+

View File

@@ -85,13 +85,13 @@ UIContentBlock common parameters
+-------------------+----------+------------------------------------------------------------+
| AddCSSClasses | array | like <code>['ibo-is-hidden', 'ibo-alert--body']</code> |
+-------------------+----------+------------------------------------------------------------+
| AddCssFileRelPath | string | relative path of a CSS file to add |
| AddCssFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddDeferredBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+
| AddHtml | string | |
+-------------------+----------+------------------------------------------------------------+
| AddJsFileRelPath | string | relative path of a JS file to add |
| AddJsFileRelPath | string | |
+-------------------+----------+------------------------------------------------------------+
| AddSubBlock | iUIBlock | |
+-------------------+----------+------------------------------------------------------------+