Ferreteria/v0.6/clade/Sys/Diag/Util/Reflect/@removed
|
removed code
|
I noticed that the namespace-prefix was incorrectly capitalized ("Woozalia/ferret") -- which turns out not to be an issue, probably because the prefix lookup is (I think) case-insensitive, but it made me check to see if this code is in use, which it turns out not to be. Also, if it ever were to be used, it needs to be updated in order to use the namespace-registry instead of just manually checking for Ferreteria's namespace.
Probably what I would do is separate the rendering of the namespace out into a separate function... or just use one function for all formats, but apply a different Style.
#
public function ListMethods_bullet() : string {
// + SAME CODE
$vSubj = $this->ObjOrClass();
$arPub = get_class_methods($vSubj);
$arAll = (method_exists($vSubj,'Reflect_MethodList')) ? ($vSubj::Reflect_MethodList()) : [];
sort($arAll); // put them in alphabetic order
$oScrn = self::Screen();
// - SAME CODE
$oList = $oScrn->NewList();
foreach ($arAll as $sMeth) {
$htMeth = NULL;
if (array_search($sMeth,$arPub) === FALSE) {
// method is private
$ftMeth = $sMeth;
} else {
// method is public
$ftMeth = $oScrn->BoldIt($sMeth);
}
if ($vSubj::Reflect_IsTraitMethod($sMeth)) {
// suppress the diagnostic methods provided by the Helper trait
$htMeth = $oScrn->FaintIt($sMeth); // this greys them out
// Not setting $htMeth just hides them completely.
} else {
$htMeth = $oScrn->GreenIt($ftMeth);
$scSubj = $this->ClassName();
// a little Reflection for some essential info
$orMeth = new ReflectionMethod($scSubj,$sMeth);
$fsAbs = $orMeth->getFileName();
$this->AmHere('2026-04-30 Is this still in use? Namespace was incorrectly lowercased...');
// Also, shouldn't this be using the namespace registry instead?
// TODO 2024-09-12: What happens if there's no file because it's a PHP native function?
$oPath = new PathClass(StartupAdmin::Me()->FerretCodePath());
$fsRel = $oPath->FigureRelative($fsAbs);
$ftFile = $oScrn->FaintIt("[WFe]").$oScrn->BoldIt($fsRel);
$htMeth .= ' : '
.$ftFile
.' line '
.$oScrn->BoldIt($orMeth->GetStartLine())
;
}
if (is_string($htMeth)) {
$oList->AddLine($htMeth);
}
}
return $oList->Render();
}