@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
140140 */
141141 public static $ sort = self ::SORT_NONE ;
142142
143+ /**
144+ * Timestamp to print in footer in date() format.
145+ *
146+ * @var ?string
147+ */
148+ public static $ timestamp = null ;
149+
143150 public static $ needs_pre_render = true ;
144151 public static $ needs_folder_render = true ;
145152
@@ -465,29 +472,7 @@ public function postRender(): string
465472 $ output .= '<nav></nav> ' ;
466473 }
467474
468- if (isset ($ this ->call_info ['callee ' ]['file ' ])) {
469- $ output .= 'Called from ' .$ this ->ideLink (
470- $ this ->call_info ['callee ' ]['file ' ],
471- $ this ->call_info ['callee ' ]['line ' ]
472- );
473- }
474-
475- if (
476- isset ($ this ->call_info ['callee ' ]['function ' ]) &&
477- (
478- !empty ($ this ->call_info ['callee ' ]['class ' ]) ||
479- !\in_array (
480- $ this ->call_info ['callee ' ]['function ' ],
481- ['include ' , 'include_once ' , 'require ' , 'require_once ' ],
482- true
483- )
484- )
485- ) {
486- $ output .= ' [ ' ;
487- $ output .= $ this ->call_info ['callee ' ]['class ' ] ?? '' ;
488- $ output .= $ this ->call_info ['callee ' ]['type ' ] ?? '' ;
489- $ output .= $ this ->call_info ['callee ' ]['function ' ].'()] ' ;
490- }
475+ $ output .= $ this ->calledFrom ();
491476
492477 if (!empty ($ this ->call_info ['trace ' ]) && \count ($ this ->call_info ['trace ' ]) > 1 ) {
493478 $ output .= '<ol> ' ;
@@ -497,8 +482,8 @@ public function postRender(): string
497482 }
498483
499484 $ output .= '<li> ' .$ this ->ideLink ($ step ['file ' ], $ step ['line ' ]); // closing tag not required
500- if (isset ($ step ['function ' ])
501- && !\in_array ($ step ['function ' ], ['include ' , 'include_once ' , 'require ' , 'require_once ' ], true )
485+ if (isset ($ step ['function ' ]) &&
486+ !\in_array ($ step ['function ' ], ['include ' , 'include_once ' , 'require ' , 'require_once ' ], true )
502487 ) {
503488 $ output .= ' [ ' ;
504489 $ output .= $ step ['class ' ] ?? '' ;
@@ -516,8 +501,6 @@ public function postRender(): string
516501
517502 /**
518503 * @psalm-param Encoding $encoding
519- *
520- * @param mixed $encoding
521504 */
522505 public function escape (string $ string , $ encoding = false ): string
523506 {
@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
559542 return '<a ' .$ class .'href=" ' .$ this ->escape ($ ideLink ).'"> ' .$ path .'</a> ' ;
560543 }
561544
545+ protected function calledFrom (): string
546+ {
547+ $ output = '' ;
548+
549+ if (isset ($ this ->call_info ['callee ' ]['file ' ])) {
550+ $ output .= ' ' .$ this ->ideLink (
551+ $ this ->call_info ['callee ' ]['file ' ],
552+ $ this ->call_info ['callee ' ]['line ' ]
553+ );
554+ }
555+
556+ if (
557+ isset ($ this ->call_info ['callee ' ]['function ' ]) &&
558+ (
559+ !empty ($ this ->call_info ['callee ' ]['class ' ]) ||
560+ !\in_array (
561+ $ this ->call_info ['callee ' ]['function ' ],
562+ ['include ' , 'include_once ' , 'require ' , 'require_once ' ],
563+ true
564+ )
565+ )
566+ ) {
567+ $ output .= ' [ ' ;
568+ $ output .= $ this ->call_info ['callee ' ]['class ' ] ?? '' ;
569+ $ output .= $ this ->call_info ['callee ' ]['type ' ] ?? '' ;
570+ $ output .= $ this ->call_info ['callee ' ]['function ' ].'()] ' ;
571+ }
572+
573+ if ('' !== $ output ) {
574+ $ output = 'Called from ' .$ output ;
575+ }
576+
577+ if (null !== self ::$ timestamp ) {
578+ $ output .= ' ' .\date (self ::$ timestamp );
579+ }
580+
581+ return $ output ;
582+ }
583+
562584 protected function renderTab (Value $ o , Representation $ rep ): string
563585 {
564586 if (($ plugin = $ this ->getPlugin (self ::$ tab_plugins , $ rep ->hints )) && $ plugin instanceof TabPluginInterface) {
0 commit comments