classScope
final class Scope
Where in the program a statement is issued, read out of the enclosing function's name.
The catalog writes the enclosing function as Class::method, function or {main}. The report needs the pieces: the namespace to group by, the class to write a page for, and the member to head a section with. Reading them once here is what keeps every page addressing the same code the same way.
Constants§
public const MAIN = '{main}'The name the catalog gives to code outside any function.
Properties§
public string $namespacepublic string|null $classpublic string $memberMethods§
public function __construct(
public string $namespace,
public string|null $class,
public string $member,
)Parameters
$namespace | string | The namespace, empty for the global one |
$class | string|null | The fully qualified class, or null outside a class |
$member | string | The method, function or `{main}` |
public static function of(string $function): selfThe scope an enclosing function's name stands for.
Parameters
$function | string |
Returns
selfTest cases 7
ScopeTest::testClassShortDropsTheNamespacecallsScopeTest::testDisplayDropsTheNamespaceAndNamesTopLevelCodecallsScopeTest::testFunctionWritesTheNameTheCatalogUsescallsScopeTest::testIsMainOnlyForTopLevelCodecallsScopeTest::testIsMethodWhenThereIsAClasscallsScopeTest::testNamespaceLabelNamesTheGlobalNamespacecallsScopeTest::testOfReadsTheNamespaceClassAndMembercalls
Called from 25
- static-call SqlCatalog\Reporter\Html\CatalogIndex::byClass() packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:101
- static-call SqlCatalog\Reporter\Html\CatalogIndex::byNamespace() packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:120
- static-call SqlCatalog\Reporter\Html\HtmlReporter::classPages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:137
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::render() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:47
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::sections() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:107
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::context() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:124
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::context() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:131
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::anchors() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:150
- static-call SqlCatalog\Reporter\Html\Page\FilePage::sections() packages/sql-catalog/src/Reporter/Html/Page/FilePage.php:115
- static-call SqlCatalog\Reporter\Html\Page\FilePage::anchors() packages/sql-catalog/src/Reporter/Html/Page/FilePage.php:165
- static-call SqlCatalog\Reporter\Html\Page\FindingPage::hotspots() packages/sql-catalog/src/Reporter/Html/Page/FindingPage.php:72
- static-call SqlCatalog\Reporter\Html\Page\NamespacePage::section() packages/sql-catalog/src/Reporter/Html/Page/NamespacePage.php:65
- static-call SqlCatalog\Reporter\Html\Page\NamespacePage::section() packages/sql-catalog/src/Reporter/Html/Page/NamespacePage.php:78
- static-call SqlCatalog\Reporter\Html\Page\NamespacePage::members() packages/sql-catalog/src/Reporter/Html/Page/NamespacePage.php:99
- static-call SqlCatalog\Reporter\Html\Page\NamespacePage::anchors() packages/sql-catalog/src/Reporter/Html/Page/NamespacePage.php:121
- static-call SqlCatalog\Reporter\Html\Page\OverviewPage::namespaceRoute() packages/sql-catalog/src/Reporter/Html/Page/OverviewPage.php:122
- static-call SqlCatalog\Reporter\Html\Page\OverviewPage::attention() packages/sql-catalog/src/Reporter/Html/Page/OverviewPage.php:211
- static-call SqlCatalog\Reporter\Html\Page\StatementPage::where() packages/sql-catalog/src/Reporter/Html/Page/StatementPage.php:115
- static-call SqlCatalog\Reporter\Html\Page\StatementPage::context() packages/sql-catalog/src/Reporter/Html/Page/StatementPage.php:275
- static-call SqlCatalog\Reporter\Html\Page\StatementPage::related() packages/sql-catalog/src/Reporter/Html/Page/StatementPage.php:304
- static-call SqlCatalog\Reporter\Html\Page\TablePage::usedFrom() packages/sql-catalog/src/Reporter/Html/Page/TablePage.php:101
- static-call SqlCatalog\Reporter\Html\ReportSite::functionAnchor() packages/sql-catalog/src/Reporter/Html/ReportSite.php:175
- static-call SqlCatalog\Reporter\Html\ReportSite::functionUrl() packages/sql-catalog/src/Reporter/Html/ReportSite.php:186
- static-call SqlCatalog\Reporter\Html\StatementRow::attributes() packages/sql-catalog/src/Reporter/Html/StatementRow.php:67
- static-call SqlCatalog\Reporter\Html\StatementRow::meta() packages/sql-catalog/src/Reporter/Html/StatementRow.php:114
public function isMain(): boolWhether the statement is issued outside any function.
Returns
boolCalled from 1
Calls 1
- class-const Scope::MAIN() line 60
public function isMethod(): boolWhether the statement is issued from a method.
Returns
boolpublic function classShort(): ?stringThe class without its namespace, or null outside a class.
Returns
?stringCalled from 1
public function function(): stringThe function written the way the catalog writes it.
Returns
stringpublic function display(): stringThe function written for a reader, without the namespace.
Returns
stringCalls 2
- method-call Scope::isMain() line 101
- method-call Scope::classShort() line 105
public function namespaceLabel(): stringThe namespace written for a reader.
Returns
stringTest cases 26§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
ScopeTest::testClassShortDropsTheNamespacecallsScopeTest::testDisplayDropsTheNamespaceAndNamesTopLevelCodecallsScopeTest::testFunctionWritesTheNameTheCatalogUsescallsScopeTest::testIsMainOnlyForTopLevelCodecallsScopeTest::testIsMethodWhenThereIsAClasscallsScopeTest::testNamespaceLabelNamesTheGlobalNamespacecallsScopeTest::testOfReadsTheNamespaceClassAndMembercalls
Other tests reaching this symbol 19
ReporterInterfaceTestcallsCatalogIndexTestcallsHtmlReporterTestcallsClassPageTestcallsFileIndexPageTestcallsFilePageTestcallsFindingPageTestcallsNamespacePageTestcallsOverviewPageTestcallsStatementIndexPageTestcallsStatementPageTestcallsTableIndexPageTestcallsTablePageTestcallsPageShellTestcallsReportSiteTestcallsSearchIndexTestcallsSourceCodeTestcallsStatementListTestcallsStatementRowTestcalls
Relations§
Static calls 25
- static-call SqlCatalog\Reporter\Html\CatalogIndex::byClass() packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:101
- static-call SqlCatalog\Reporter\Html\CatalogIndex::byNamespace() packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:120
- static-call SqlCatalog\Reporter\Html\HtmlReporter::classPages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:137
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::render() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:47
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::sections() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:107
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::context() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:124
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::context() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:131
- static-call SqlCatalog\Reporter\Html\Page\ClassPage::anchors() packages/sql-catalog/src/Reporter/Html/Page/ClassPage.php:150
- static-call SqlCatalog\Reporter\Html\Page\FilePage::sections() packages/sql-catalog/src/Reporter/Html/Page/FilePage.php:115
- static-call SqlCatalog\Reporter\Html\Page\FilePage::anchors() packages/sql-catalog/src/Reporter/Html/Page/FilePage.php:165
- static-call SqlCatalog\Reporter\Html\Page\FindingPage::hotspots() packages/sql-catalog/src/Reporter/Html/Page/FindingPage.php:72
- static-call SqlCatalog\Reporter\Html\Page\NamespacePage::section() packages/sql-catalog/src/Reporter/Html/Page/NamespacePage.php:65
- static-call SqlCatalog\Reporter\Html\Page\NamespacePage::section() packages/sql-catalog/src/Reporter/Html/Page/NamespacePage.php:78
- static-call SqlCatalog\Reporter\Html\Page\NamespacePage::members() packages/sql-catalog/src/Reporter/Html/Page/NamespacePage.php:99
- static-call SqlCatalog\Reporter\Html\Page\NamespacePage::anchors() packages/sql-catalog/src/Reporter/Html/Page/NamespacePage.php:121
- static-call SqlCatalog\Reporter\Html\Page\OverviewPage::namespaceRoute() packages/sql-catalog/src/Reporter/Html/Page/OverviewPage.php:122
- static-call SqlCatalog\Reporter\Html\Page\OverviewPage::attention() packages/sql-catalog/src/Reporter/Html/Page/OverviewPage.php:211
- static-call SqlCatalog\Reporter\Html\Page\StatementPage::where() packages/sql-catalog/src/Reporter/Html/Page/StatementPage.php:115
- static-call SqlCatalog\Reporter\Html\Page\StatementPage::context() packages/sql-catalog/src/Reporter/Html/Page/StatementPage.php:275
- static-call SqlCatalog\Reporter\Html\Page\StatementPage::related() packages/sql-catalog/src/Reporter/Html/Page/StatementPage.php:304
- static-call SqlCatalog\Reporter\Html\Page\TablePage::usedFrom() packages/sql-catalog/src/Reporter/Html/Page/TablePage.php:101
- static-call SqlCatalog\Reporter\Html\ReportSite::functionAnchor() packages/sql-catalog/src/Reporter/Html/ReportSite.php:175
- static-call SqlCatalog\Reporter\Html\ReportSite::functionUrl() packages/sql-catalog/src/Reporter/Html/ReportSite.php:186
- static-call SqlCatalog\Reporter\Html\StatementRow::attributes() packages/sql-catalog/src/Reporter/Html/StatementRow.php:67
- static-call SqlCatalog\Reporter\Html\StatementRow::meta() packages/sql-catalog/src/Reporter/Html/StatementRow.php:114