Ferreteria/v0.6/clade/Sys/Diag/Data/Stack/Deck/@code/removed
Jump to navigation
Jump to search
|
Removed Code
|
Not seeing the need for this:
#
public function RenderFull() : string { return $this->RenderTrace(); }
From the `foreach()` loop in `SimpleDump()` (I think it's the striping support which I dropped on 2024-06-28):
#
$arCall = $oCall->OAData()->GetAll();
$cssStripe = $bStripe ? '#eef' : 'inherit';
$bStripe = !$bStripe;
echo ''"`UNIQ--pre-00000002-QINU`"'';
$sFile = array_key_exists('file',$arCall) ? $arCall['file'] : '-';
$nLine = array_key_exists('line',$arCall) ? $arCall['line'] : '-';
$sClass = array_key_exists('class',$arCall) ? $arCall['class'] : '-';
$sCType = array_key_exists('type',$arCall) ? $arCall['type'] : '-';
$sFunc = array_key_exists('function',$arCall) ? $arCall['function'] : '-';
$scObj = array_key_exists('object',$arCall) ? get_class($arCall['object']) : NULL;
$sObj = is_null($scObj) ? '-' : (($scObj == $sClass) ? '(same)' : $scObj);
$sOut .= "<tr style='background-color: $cssStripe;'>
<td align=right>$nIdx</td>
<td>$sFile</td>
<td align=right>$nLine</td>
<td>$sClass</td>
<td>$sCType</td>
<td>$sFunc</td>
<td>$sObj</td>
</tr>
";
The "RETIRED" section, all pieces commented out months ago:
#
// ++ RETIRED ++ //
static public function FromThrowWrap(ThrowIface $o) : iDeck {
$oThis = new static;
$oThis->WithThrowWrap($o);
return $oThis;
}
private $oThr;
protected function WithThrowWrap(ThrowIface $o) {
$this->oThr = $o;
#$this->WithErrorWrap($o->Error());
#echo 'StackWrap class: '.get_class($o->Stack()).'<br>';
#$this->WithStackWrap($o->Stack());
echo self::GotToHere('THROW WRAP CLASS: ['.get_class($o).']');
echo self::GotToHere('STACK WRAP CLASS: ['.get_class($o->Stack()).']');
#$this->WithStackArray($o->Stack()->
}
private $oErr;
protected function WithErrorWrap(ErrorIface $o) { $this->oErr = $o; }
public function ErrorWrap() : ErrorIface { return $this->ThrowWrap()->Error(); }
// This is essentially a cloner. 2024-08-23 in which case we either shouldn't need it or it should be named "Clone" OSLT.
protected function WithStackWrap(self $o) {
#echo '$this: '.$this->ObjectInfo().'<br>';
#echo 'input: '.$o->ObjectInfo().'<br>';
}
// ACTION: Wraps the native Throwable in a ThrowClass, then calls WithFerretThrown().
protected function WithNativeThrown(Throwable $e) {
#echo static::GotToHere();
$oNative = ThrowClass::FromNative($e);
#echo 'NATIVE CLASS: '.get_class($oNative).'<br>';
#echo static::GotToHere();
$this->WithThrowWrap($oNative);
#echo static::GotToHere();
}
// ACTION: nicely format information about where in the code the problem happened
protected function RenderCodepoint() : string {
// 2024-01-10 This is just a first guess / placeholder -- likely wrong.
#return $this->ShowCalledFrom(3);
$arTrace = $this->DataArray();
#$sTrace = print_r($arTrace,TRUE);
#return "RAW TRACE: '"`UNIQ--pre-00000005-QINU`"'<br>";
$oCall = $arTrace[0];
return $oCall->RenderLineSimple();
}
// 2024-08-24 I don't think this belongs here anymore. Maybe in Break?
// CEMENT Triggery
protected function ReadoutToEmail() : string {
echo static::GotToHere(__FUNCTION__.' - THIS IS PROBABLY BROKEN because Message()');
$sPfx = $this->MessagePrefix();
$sMsg = $this->Message();
$sDiag = $this->TextDetails();
$sStack = $this->TraceArray();
$sFile = $this->getFile();
$nLine = $this->getLine();
return
"$sPfx: $sMsg"
."\nFile $sFile line $nLine"
."\nDiagnostic: $sDiag"
."\nCall stack: $sStack"
;
// 2020-12-02 writing in progress
}
/**
* THINKING: For this, we only need to retrieve one line at the given offset.
* NOTE: the integer parameters were arrived at after trial-and-error, and
* may need adjusting if the sequence of calls in this class changes.
* The arg to FromCurrent() needs to be one more than the arg to ShowCalledFrom().
*/
static public function ShowCurrentCaller() : string {
$oThis = self::FromCurrent(4);
$out = $oThis->ShowCalledFrom(3);
return $out;
}
/*----
2021-07-29 Rescued from old version -- may be a little tacked-on now; TODO: re-examine
2022-05-23 WAS: This reloads the stack, but only the last 3 elements. Why?
NOW: Just uses the existing stack. Call LoadCurrentStack() if we need something else.
*/
protected function ShowCalledFrom($nDepth=1) {
$arTrace = $this->DataArray();
if (count($arTrace) == 0) {
// kluge
$this->WithCurrentFull();
echo "Narcissa: stack not provided, so I'm fetching one.".CRLF;
}
if ($this->HasIt($nDepth)) {
$oElem = $this->GetIt($nDepth);
$sElem = $oElem->RenderLine();
} else {
$nCount = count($arTrace);
$nDepth = $nCount-1;
$oElem = $this->GetIt($nDepth);
$sElem = "stack depth $nDepth is too deep; returning level $nDepth: "
.$oElem->RenderLine();
;
}
return $sElem;
}
/**
* PURPOSE: full rendering with links
* HISTORY:
* 2024-06-11 I was creating the Bridge here, but... shouldn't Deck (and Card) have a link to their container Bridge?
* Also, it turns out I never use the resulting $arStack array... so, commenting things out.
* Actually, this is an output method -- shouldn't even be here; should call Linker or something.
* 2024-02-23 Except when we want to deal with the possibility of Narcissa being unavailable (due to dev work
* that makes it crash, I guess).
* 2024-07-16 commenting this out; it just calls Render(), which tries to call it back...
*/
protected function RenderTrace() : string { return $this->Render();
/* wait, actually...
$oSet = SettingsClass::Me();
$osView = $oSet->QStackViewer();
if ($osView->HasIt()) {
$oView->WithStack($this);
echo $oView->Render();
} else {
echo static::CodingPrompt('If stack trace is needed, call QStackViewer()->SetIt().');
} */
// 2024-07-15 old
$scFancy = $oSet->DiagsManagerClass();
if (is_null($scFancy)) {
return $this->FailbackTrace();
} else {
$oBridge = $scFancy::FromInfo($this);
echo 'BRIDGE class: '.get_class($oBridge).'<br>';
$oLink = $oBridge->Linker();
$scThis = get_class($this);
$nRows = $this->Scribe()->RowCount();
if ($nRows > 0) {
$htRows = $nRows.' row'.(($nRows == 1)?'':'s');
$htLbl = Screen::Me()->BoldIt('Stack');
return "$htLbl ($htRows / class $scThis) RenderTrace():".$oLink->Render();
} else {
return $this->FailbackTrace();
}
}
}
// -- RETIRED -- //