@@ -120,6 +120,7 @@ protected function formatComments(?\phpDocumentor\Reflection\DocBlock $docBlock,
120120 }
121121
122122 $ attributes = $ this ->getAttributes ($ reflectionMethod );
123+
123124 foreach ($ attributes as $ attribute )
124125 {
125126 $ 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
166167 // if fully qualified, we are done
167168 if (\PHPFUI \InstaDoc \NamespaceTree::hasClass ($ class ))
168169 {
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 ;
170171 }
171172
172173 // try name in current namespace tree
173174 $ namespacedClass = $ this ->reflection ->getNamespaceName () . '\\' . $ class ;
174175
175176 if (\PHPFUI \InstaDoc \NamespaceTree::hasClass ($ namespacedClass ))
176177 {
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 ;
178179 }
179180
180181 }
@@ -221,7 +222,6 @@ protected function getDocBlock($method) : ?\phpDocumentor\Reflection\DocBlock
221222 * @todo get attributes everywhere
222223 * $attributes = $this->getAttributes($method);
223224 */
224-
225225 $ comments = $ method ->getDocComment ();
226226 $ comments = \str_ireplace ('{@inheritdoc} ' , '@inheritdoc ' , $ comments );
227227
@@ -253,12 +253,14 @@ protected function getHtmlClass(string $class) : string
253253 protected function getInheritedSummary (\phpDocumentor \Reflection \DocBlock $ docBlock , ?\ReflectionMethod $ reflectionMethod = null ) : string
254254 {
255255 $ summary = $ docBlock ->getSummary ();
256+
256257 if (! $ reflectionMethod )
257258 {
258259 return $ summary ;
259260 }
260261
261262 $ tags = $ docBlock ->getTags ();
263+
262264 foreach ($ tags as $ index => $ tag )
263265 {
264266 if (0 >= \stripos ($ tag ->getName (), 'inheritdoc ' ))
@@ -276,6 +278,7 @@ protected function getInheritedSummary(\phpDocumentor\Reflection\DocBlock $docBl
276278 {
277279 $ method = null ;
278280 }
281+
279282 if ($ method )
280283 {
281284 $ docBlock = $ this ->getDocBlock ($ method );
@@ -314,6 +317,7 @@ protected function getInheritedDocBlock(array $tags, \ReflectionMethod $reflecti
314317 {
315318 $ method = null ;
316319 }
320+
317321 if ($ method )
318322 {
319323 $ docBlock = $ this ->getDocBlock ($ method );
@@ -391,7 +395,6 @@ protected function getParameters($method) : string
391395 * @todo add attributes for parameters
392396 * $attributes = $this->getAttributes($parameter);
393397 */
394-
395398 if (isset ($ parameterComments [$ name ]))
396399 {
397400 $ tip = new \PHPFUI \ToolTip ($ tip , $ parameterComments [$ name ]);
@@ -513,41 +516,29 @@ protected function section(string $name) : string
513516
514517 protected function getAttributes ($ reflection ) : array
515518 {
516- if ($ reflection && method_exists ($ reflection , 'getAttributes ' ))
519+ if ($ reflection && \ method_exists ($ reflection , 'getAttributes ' ))
517520 {
518521 return $ reflection ->getAttributes ();
519522 }
520523
521524 return [];
522525 }
523526
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-
539527 protected function formatAttribute (\ReflectionAttribute $ attribute ) : string
540528 {
541529 $ parameters = '' ;
542530 $ arguments = $ attribute ->getArguments ();
531+
543532 if ($ arguments )
544533 {
545534 $ parameters = ' ( ' ;
546535 $ comma = '' ;
536+
547537 foreach ($ arguments as $ name => $ argument )
548538 {
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 ))
551542 {
552543 $ link = $ this ->getAttributeName ($ argument , true );
553544 }
@@ -592,9 +583,24 @@ protected function formatAttribute(\ReflectionAttribute $attribute) : string
592583 {
593584 $targeting = ' ' . implode(' | ', $targets);
594585 }
595- */
586+ */
596587
597588 return $ this ->getClassName ($ attribute ->getName ()) . $ parameters . $ targeting ;
598589 }
599590
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+ }
600606 }
0 commit comments