@@ -120,6 +120,7 @@ protected function formatComments(?\phpDocumentor\Reflection\DocBlock $docBlock,
120
120
}
121
121
122
122
$ attributes = $ this ->getAttributes ($ reflectionMethod );
123
+
123
124
foreach ($ attributes as $ attribute )
124
125
{
125
126
$ ul ->addItem (new \PHPFUI \ListItem ($ this ->getColor ('name ' , 'attribute ' ) . ' ' . $ this ->formatAttribute ($ attribute )));
@@ -166,15 +167,15 @@ protected function getClassName(string $class, bool $asLink = true) : string
166
167
// if fully qualified, we are done
167
168
if (\PHPFUI \InstaDoc \NamespaceTree::hasClass ($ class ))
168
169
{
169
- return new \PHPFUI \Link ($ this ->controller ->getClassUrl ($ class ), $ class , false ) . $ array ;
170
+ return new \PHPFUI \Link ($ this ->controller ->getClassUrl ($ class ), \str_replace ( '\\' , ' <wbr> \\' , $ class) , false ) . $ array ;
170
171
}
171
172
172
173
// try name in current namespace tree
173
174
$ namespacedClass = $ this ->reflection ->getNamespaceName () . '\\' . $ class ;
174
175
175
176
if (\PHPFUI \InstaDoc \NamespaceTree::hasClass ($ namespacedClass ))
176
177
{
177
- return new \PHPFUI \Link ($ this ->controller ->getClassUrl ($ namespacedClass ), $ namespacedClass , false ) . $ array ;
178
+ return new \PHPFUI \Link ($ this ->controller ->getClassUrl ($ namespacedClass ), \str_replace ( '\\' , ' <wbr> \\' , $ namespacedClass) , false ) . $ array ;
178
179
}
179
180
180
181
}
@@ -221,7 +222,6 @@ protected function getDocBlock($method) : ?\phpDocumentor\Reflection\DocBlock
221
222
* @todo get attributes everywhere
222
223
* $attributes = $this->getAttributes($method);
223
224
*/
224
-
225
225
$ comments = $ method ->getDocComment ();
226
226
$ comments = \str_ireplace ('{@inheritdoc} ' , '@inheritdoc ' , $ comments );
227
227
@@ -253,12 +253,14 @@ protected function getHtmlClass(string $class) : string
253
253
protected function getInheritedSummary (\phpDocumentor \Reflection \DocBlock $ docBlock , ?\ReflectionMethod $ reflectionMethod = null ) : string
254
254
{
255
255
$ summary = $ docBlock ->getSummary ();
256
+
256
257
if (! $ reflectionMethod )
257
258
{
258
259
return $ summary ;
259
260
}
260
261
261
262
$ tags = $ docBlock ->getTags ();
263
+
262
264
foreach ($ tags as $ index => $ tag )
263
265
{
264
266
if (0 >= \stripos ($ tag ->getName (), 'inheritdoc ' ))
@@ -276,6 +278,7 @@ protected function getInheritedSummary(\phpDocumentor\Reflection\DocBlock $docBl
276
278
{
277
279
$ method = null ;
278
280
}
281
+
279
282
if ($ method )
280
283
{
281
284
$ docBlock = $ this ->getDocBlock ($ method );
@@ -314,6 +317,7 @@ protected function getInheritedDocBlock(array $tags, \ReflectionMethod $reflecti
314
317
{
315
318
$ method = null ;
316
319
}
320
+
317
321
if ($ method )
318
322
{
319
323
$ docBlock = $ this ->getDocBlock ($ method );
@@ -391,7 +395,6 @@ protected function getParameters($method) : string
391
395
* @todo add attributes for parameters
392
396
* $attributes = $this->getAttributes($parameter);
393
397
*/
394
-
395
398
if (isset ($ parameterComments [$ name ]))
396
399
{
397
400
$ tip = new \PHPFUI \ToolTip ($ tip , $ parameterComments [$ name ]);
@@ -513,41 +516,29 @@ protected function section(string $name) : string
513
516
514
517
protected function getAttributes ($ reflection ) : array
515
518
{
516
- if ($ reflection && method_exists ($ reflection , 'getAttributes ' ))
519
+ if ($ reflection && \ method_exists ($ reflection , 'getAttributes ' ))
517
520
{
518
521
return $ reflection ->getAttributes ();
519
522
}
520
523
521
524
return [];
522
525
}
523
526
524
- private function getAttributeName (string $ name , bool $ asValue = false ) : string
525
- {
526
- $ link = $ this ->getClassName ($ name );
527
- if (strpos ($ link , 'href= ' ))
528
- {
529
- $ name = $ link ;
530
- }
531
- elseif ($ asValue )
532
- {
533
- $ name = $ this ->getValueString ($ name );
534
- }
535
-
536
- return $ name ;
537
- }
538
-
539
527
protected function formatAttribute (\ReflectionAttribute $ attribute ) : string
540
528
{
541
529
$ parameters = '' ;
542
530
$ arguments = $ attribute ->getArguments ();
531
+
543
532
if ($ arguments )
544
533
{
545
534
$ parameters = ' ( ' ;
546
535
$ comma = '' ;
536
+
547
537
foreach ($ arguments as $ name => $ argument )
548
538
{
549
- $ name = is_int ($ name ) ? '' : $ this ->getAttributeName ($ name ) . ': ' ;
550
- if (is_string ($ argument ))
539
+ $ name = \is_int ($ name ) ? '' : $ this ->getAttributeName ($ name ) . ': ' ;
540
+
541
+ if (\is_string ($ argument ))
551
542
{
552
543
$ link = $ this ->getAttributeName ($ argument , true );
553
544
}
@@ -592,9 +583,24 @@ protected function formatAttribute(\ReflectionAttribute $attribute) : string
592
583
{
593
584
$targeting = ' ' . implode(' | ', $targets);
594
585
}
595
- */
586
+ */
596
587
597
588
return $ this ->getClassName ($ attribute ->getName ()) . $ parameters . $ targeting ;
598
589
}
599
590
591
+ private function getAttributeName (string $ name , bool $ asValue = false ) : string
592
+ {
593
+ $ link = $ this ->getClassName ($ name );
594
+
595
+ if (\strpos ($ link , 'href= ' ))
596
+ {
597
+ $ name = $ link ;
598
+ }
599
+ elseif ($ asValue )
600
+ {
601
+ $ name = $ this ->getValueString ($ name );
602
+ }
603
+
604
+ return $ name ;
605
+ }
600
606
}
0 commit comments