Futilities/v0.6/clade/Sys/Opts/@removed
|
Removed Code
|
#
public function __construct(array $arCmdArgs) {
$this->SetupOptions();
$this->ParseCommand($arCmdArgs);
// do any app-specific setup
$this->ProcessUserInput();
}
#
protected function SetupOptions() {
$this->SetupBaseOptions();
$this->SetupAppOptions();
}
protected function SetupBaseOptions() {
$this->AddAppOptions([
self::ksOPT_CONFIG_FILE => ['-cf','--config-file'],
]);
}
abstract protected function SetupAppOptions();
#
protected function ProcessUserInput() {
// process base options
if ($this->HasCmdOption(self::ksOPT_CONFIG_FILE)) {
// a specific conf file is requested
$oOpt = $this->GetCmdOption(self::ksOPT_CONFIG_FILE);
$fnConf = $oOpt->GetVal();
// include the specified conf file; access settings via cConfig static fx().
require_once($fnConf);
}
// process unnamed terms
$arTerms = $this->GetCmdTerms();
foreach ($arTerms as $idx => $sTerm) {
$this->HandleTerm($idx,$sTerm);
}
$nTFnd = count($arTerms);
$nTReq = $this->MinQtyTerms();
if ($nTFnd < $nTReq) {
echo
'INPUT ERROR: '.$this->RenderTooFewTerms($nTFnd)."\n"
.'USAGE: '.$this->RenderAppUsage()."\n"
.$this->RenderCommonHelp()
;
die();
}
}
#
abstract protected function HandleTerm($idx,$sTerm);
protected function HandleUnknownTerm($idx,$sTerm) {
echo "Unexpected term: [$sTerm]\n";
}
#
// RETURNS: the minimum number of terms (non-option arguments) needed for usefulness
#abstract protected function MinQtyTerms() : int; // 2026-04-28 OBSOLETE
// RETURNS: string showing basic command structure for the app
#abstract protected function RenderAppUsage() : string; // 2026-04-28 OBSOLETE: handled by WUIDL
// RETURNS: string describing what is missing
protected function RenderTooFewTerms(int $qTerms) : string {
$sc = get_called_class();
$sf = __FUNCTION__;
die("CODING PROMPT: class $sc needs to define $sf().\n");
}