Futilities/human/lib/cFolderator: Difference between revisions
< Futilities | human | lib
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{fmt/title|Human Futilities: <code>cFolderator</code> class}} | {{fmt/title|Human Futilities: <code>cFolderator</code> class}} | ||
==Flow== | |||
The flow typically starts with <code>StartSpider()</code>, which retrieves the source-path from Options (<code>GetSourcePath()</code>) and then passes control to <code>OnWantedFolder</code>. (We assume that the folder in the source-path is wanted, even if it fails inclusion criteria that are applied to its sub-folders.) | |||
At its core, <syntaxhighlight lang=php inline>OnWantedFolder(caPathPiece $op)</syntaxhighlight> gets a directory listing for <code>$op$</code>, puts that list in an array, and then for each entry in the array sets that entry as the last entry in <code>$opCurr</code> and passes it to <code>OnPath($opCurr)</code> | |||
==Functions== | ==Functions== | ||
===actions=== | ===actions=== | ||
* | * StartSpider({{l/same|caMatch}} $om) | ||
** formerly DoSearch() (kept for now as an alias) | |||
===events=== | ===events=== | ||
* OnPath({{l/same|caPathPiece}} $op) | * OnPath({{l/same|caPathPiece}} $op) |
Revision as of 20:51, 27 September 2022
Human Futilities:
cFolderator class |
Flow
The flow typically starts with StartSpider()
, which retrieves the source-path from Options (GetSourcePath()
) and then passes control to OnWantedFolder
. (We assume that the folder in the source-path is wanted, even if it fails inclusion criteria that are applied to its sub-folders.)
At its core, OnWantedFolder(caPathPiece $op)
gets a directory listing for $op$
, puts that list in an array, and then for each entry in the array sets that entry as the last entry in $opCurr
and passes it to OnPath($opCurr)
Functions
actions
- StartSpider(caMatch $om)
- formerly DoSearch() (kept for now as an alias)
events
- OnPath(caPathPiece $op)
- OnFolder(caPathNamed $op)
- OnWantedFolder(caPathPiece $op)
- OnFile(caPathNamed $op)
state
protected function ResetCount() { $this->nFi = 0; $this->nFo = 0; }
protected function IncFiles() { $this->nFi++; }
protected function IncFolders() { $this->nFo++; }
protected function SummarizeCount() : string { ... }
: returns a string summarizing file & folder countsprotected function ShortCount() : string { ... }
: like SummarizeCount(), but shorter string ("fo:#/fi:#")
object
This pair sets and returns a Matcher object: