classCatalog
final class Catalog
implements IteratorAggregate<int, CatalogEntry>, Countable
Public API: explicitly declared with
@visibility public.Every statement the analyzed application can issue, and what stopped the analyzer.
$catalog = new \SqlCatalog\Core\Catalog\Catalog();
$catalog->count() // => 0
$catalog->entries() // => []Methods§
public function __construct(
list<CatalogEntry> $entries = [],
list<AnalysisProblem> $problems = [],
array<string, string> $sources = [],
)Parameters
$entries | list<CatalogEntry> | The statements found, in reporting order |
$problems | list<AnalysisProblem> | The files that could not be analyzed |
$sources | array<string, string> | Source snapshots keyed by the reported file path |
public function entries(): list<CatalogEntry>public function problems(): list<AnalysisProblem>public function source(string $file): ?stringThe source as it was analyzed, or null when no snapshot was supplied.
Parameters
$file | string |
Returns
?stringTest cases 1
public function find(string $id): ?CatalogEntryThe statement of that identifier, or null when the catalog has none.
Parameters
$id | string |
Returns
Test cases 1
public function filter(callable(CatalogEntry): bool $keep): selfA catalog holding only the statements the given test keeps.
Parameters
$keep | callable(CatalogEntry): bool |
Returns
selfTest cases 3
Called from 1
public function merge(self $other): selfA catalog holding these statements and the given ones.
Parameters
$other | self |
Returns
selfTest cases 2
public function sorted(): selfThe statements sorted by where they are issued, so two runs compare cleanly.
Returns
selfTest cases 1
Called from 8
- method-call SqlCatalog\Facade\Analyzer::sortRecords() packages/sql-catalog/src/Facade/Analyzer.php:180
- method-call SqlCatalog\Reporter\Html\CatalogIndex::__construct() packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:39
- method-call SqlCatalog\Reporter\Html\CatalogStatistics::flagged() packages/sql-catalog/src/Reporter/Html/CatalogStatistics.php:196
- method-call SqlCatalog\Reporter\Html\ReportSite::__construct() packages/sql-catalog/src/Reporter/Html/ReportSite.php:82
- method-call SqlCatalog\Reporter\Json\JsonReporter::toArray() packages/sql-catalog/src/Reporter/Json/JsonReporter.php:105
- method-call SqlCatalog\Reporter\Json\JsonReporter::toArray() packages/sql-catalog/src/Reporter/Json/JsonReporter.php:109
- method-call SqlCatalog\Reporter\Text\TextReporter::render() packages/sql-catalog/src/Reporter/Text/TextReporter.php:50
- method-call SqlCatalog\Reporter\Text\TextReporter::render() packages/sql-catalog/src/Reporter/Text/TextReporter.php:56
public function count(): intHow many statements the catalog holds.
Returns
intCalled from 3
- method-call SqlCatalog\Reporter\Html\CatalogStatistics::statements() packages/sql-catalog/src/Reporter/Html/CatalogStatistics.php:39
- method-call SqlCatalog\Reporter\Json\JsonReporter::summary() packages/sql-catalog/src/Reporter/Json/JsonReporter.php:140
- method-call SqlCatalog\Reporter\Text\TextReporter::summaryLine() packages/sql-catalog/src/Reporter/Text/TextReporter.php:121
Calls 1
- function-call
countline 140
public function getIterator(): Traversable<int, CatalogEntry>The statements, so a catalog can be walked directly.
Returns
Traversable<int, CatalogEntry>Calls 1
- new
ArrayIteratorline 151
Private surface 3§
Implementation details, listed for orientation only.
private list<CatalogEntry> $entriesprivate list<AnalysisProblem> $problemsprivate array<string, string> $sourcesTest cases 161§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 9
CatalogTest::testCountIsTheNumberOfStatementscallsCatalogTest::testEntriesAreReturnedInTheOrderTheyWereGivencallsCatalogTest::testFilterKeepsOnlyWhatTheTestAcceptscallsCatalogTest::testFindLooksUpAStatementByItsIdentifiercallsCatalogTest::testGetIteratorWalksTheStatementscallsCatalogTest::testMergeJoinsStatementsAndProblemscallsCatalogTest::testProblemsAreKeptcallsCatalogTest::testSortedOrdersByWhereTheStatementIsIssuedcallsCatalogTest::testSourceSurvivesFilteringSortingAndMergingcalls
Other tests reaching this symbol 152
CatalogCommandTest::testReportWritesIntoTheDirectoryItIsGivencallsCatalogCommandTest::testStatusReportsFindingsOnlyWhenAskedTocallsExpressionEvaluatorTestcallsCatalogFilterTest::testApplyKeepsEverythingWhenTheFilterIsEmptycallsCatalogFilterTest::testApplyKeepsOnlyTheMatchingStatementscallsReporterInterfaceTest::testRenderAlwaysProducesSomethingToShowcallsCallModelTestcallsAnalyzerTestcallsCatalogIndexTest::testAlongsideCountsTheTablesNamedWithOnecallsCatalogIndexTest::testByClassAndByNamespaceOrderNamesWithoutRegardToCasecallsCatalogIndexTest::testByClassGroupsMethodsUnderTheirClasscallsCatalogIndexTest::testByDirectoryGroupsFilesUnderTheirDirectorycallsCatalogIndexTest::testByFileIncludesUnreadFilesOnlyWhenTheirSourceCanBeShowncallsCatalogIndexTest::testByFileIsInPathOrdercallsCatalogIndexTest::testByFunctionKeepsTheOrderFunctionsAreMetcallsCatalogIndexTest::testByNamespaceListsTheGlobalNamespaceFirstcallsCatalogIndexTest::testByRuleListsTheMostReportedRuleFirstcallsCatalogIndexTest::testByTableBreaksTiesByNamecallsCatalogIndexTest::testByTableListsTheMostNamedTableFirstcallsCatalogIndexTest::testEntriesAreInReportingOrdercallsCatalogIndexTest::testFunctionsOfCountsMostFirstcallsCatalogIndexTest::testHotspotsKeepCountingPastAStatementNothingWasReportedOncallsCatalogIndexTest::testHotspotsRankFunctionsByWhatWasReportedcallsCatalogIndexTest::testMostFirstBreaksTiesByNamecallsCatalogIndexTest::testTablesOfCountsMostNamedFirstcallsCatalogIndexTest::testUsageCountsReadsWritesSchemaAndAttentioncallsCatalogIndexTest::testUsageOfCountsTruncateAsASchemaChangecallsCatalogIndexTest::testUsageOfTellsAReadFromAnotherStatementThatChangesNoRowcallsCatalogStatisticsTest::testAtLeastCountsTheStatementsWorthLookingAtcallsCatalogStatisticsTest::testByKindCountsTheKindsMostFirstcallsCatalogStatisticsTest::testByResolutionAccountsForEveryStatementUnderEveryResolutioncallsCatalogStatisticsTest::testByRuleCountsTheFindingsMostFirstcallsCatalogStatisticsTest::testFilesSayWhatWasFoundInEachOfThemcallsCatalogStatisticsTest::testFindingsCountsEveryFindingOfEveryStatementcallsCatalogStatisticsTest::testFlaggedListsTheReportedStatementsWorstFirstcallsCatalogStatisticsTest::testOpenCountsTheStatementsWhoseSearchDidNotClosecallsCatalogStatisticsTest::testResolvedCountsTheStatementsWithNoGapscallsCatalogStatisticsTest::testStatementsCountsWhatTheCatalogHoldscallsCatalogStatisticsTest::testTablesSayHowEachOneIsUsedcallsHtmlReporterTest::testClassPagesWriteOneDocumentPerClasscallsHtmlReporterTest::testFilePagesWriteOneDocumentPerFilecallsHtmlReporterTest::testRenderCarriesTheFilesThatCouldNotBeReadcallsHtmlReporterTest::testRenderIncludesSourceForUnresolvedAndUnanalyzedCallsAndParseFailurescallsHtmlReporterTest::testRenderKeepsACallNoStatementWasReadFromApartFromAStatementcallsHtmlReporterTest::testRenderLinksEveryRouteToTheStatementsPagecallsHtmlReporterTest::testRenderNamesThePageAReaderOpensFirstcallsHtmlReporterTest::testRenderWritesTheTrailToEveryPagecallsHtmlReporterTest::testRenderWritesTheWholeSiteOfPagescallsHtmlReporterTest::testStatementPagesWriteOneDocumentPerStatementcallsHtmlReporterTest::testTablePagesWriteOneDocumentPerTablecallsClassPageTest::testAnchorsNameTheTablesAndEveryMethodcallsClassPageTest::testContextListsTheMethodsAndTheClassesOfTheSameNamespacecallsClassPageTest::testRenderIsWrittenExactlycallsClassPageTest::testRenderListsTheStatementsMethodByMethodcallsClassPageTest::testSectionsHeadEachMethodWithWhereItStartscallsClassPageTest::testTablesSaySoWhenNoneIsNamedcallsFileIndexPageTest::testAnchorsNameEveryDirectorycallsFileIndexPageTest::testRenderIsWrittenExactlycallsFileIndexPageTest::testRenderListsFilesUnderTheirDirectoriescallsFileIndexPageTest::testRowCountsWhatWasFoundInTheFilecallsFileIndexPageTest::testSectionIsASortableTableOfTheDirectorysFilescallsFilePageTest::testAnchorsNameTheTablesAndEveryFunctioncallsFilePageTest::testContextLinksToTheSourceEvenWhenParsingFailedcallsFilePageTest::testContextListsTheFunctionsAndTheFilesOfTheSameDirectorycallsFilePageTest::testContextNamesTheRootDirectorycallsFilePageTest::testProblemsExplainsWhyThisFileCouldNotBeParsedcallsFilePageTest::testRenderIsWrittenExactlycallsFilePageTest::testRenderListsTheStatementsFunctionByFunctioncallsFilePageTest::testRenderShowsTheParseErrorBeforeTheFileContentscallsFilePageTest::testSectionsLeadFromAMethodToItsClasscallsFilePageTest::testTablesLinkToTheTablesNamedcallsFindingPageTest::testAnchorsNameTheHotspotsAndEveryRulecallsFindingPageTest::testHotspotsLinkEachFunctionAndAreSilentWhenNothingIsFlaggedcallsFindingPageTest::testRenderIsWrittenExactlycallsFindingPageTest::testRenderOpensWithWhereToLookAndThenListsEveryRulecallsFindingPageTest::testSectionHeadsTheRuleWithItsSeverityAndMeaningcallsNamespacePageTest::testAnchorsNameEveryNamespacecallsNamespacePageTest::testRenderIsWrittenExactlycallsNamespacePageTest::testRenderListsEveryNamespaceWithWhatIsDeclaredInItcallsNamespacePageTest::testSectionLeadsFromAClassToItsPageAndFromAFunctionToItsFilecallsOverviewPageTest::testAttentionListsRulesAndTheFunctionsFlaggedMostcallsOverviewPageTest::testCoverageLeadsFromEverySegmentToTheStatementsItCountscallsOverviewPageTest::testFactsLinkEachCountToItsRoutecallsOverviewPageTest::testFileRouteListsTheFilesWithTheMostStatementscallsOverviewPageTest::testKindRouteLeadsToTheListingNarrowedByKindcallsOverviewPageTest::testNamespaceRouteListsClassesOrFallsBackToFunctionscallsOverviewPageTest::testProblemsAreListedOnlyWhenThereAreSomecallsOverviewPageTest::testProblemsLinksAvailableSourceAndKeepsEveryParsingErrorcallsOverviewPageTest::testRenderIsWrittenExactlycallsOverviewPageTest::testRenderLaysOutEveryRouteToAStatementcallsOverviewPageTest::testTableRouteListsTheMostNamedTablesWithHowTheyAreUsedcallsStatementIndexPageTest::testRenderIsWrittenExactlycallsStatementIndexPageTest::testRenderListsEveryStatementUnderTheFacetsThatNarrowItcallsStatementPageTest::testContextLeadsToEveryPlaceTheStatementBelongsToAndTheRestOfItsFunctioncallsStatementPageTest::testContextOfTopLevelCodeLeadsOnlyToItsFilecallsStatementPageTest::testFactsLinkTheTablesAndExplainTheReadingcallsStatementPageTest::testRelatedListsTheFirstOfTheRestAndOnlyTheFirstTwoTablescallsStatementPageTest::testRelatedPointsAtTheRestWhenThereIsMoreThanItListscallsStatementPageTest::testRenderCarriesEverythingKnownAboutTheStatementcallsStatementPageTest::testRenderIsWrittenExactlycallsStatementPageTest::testRenderLeavesOutTheValuesWhenTheStatementTakesNonecallsStatementPageTest::testRenderOfACallNothingWasReadFromIsWrittenExactlycallsStatementPageTest::testRenderShowsUnanalyzedSourceBetweenTheCaveatAndStatementFactscallsStatementPageTest::testWhereLinksEveryPlaceAndNamesThePathTakencallsStatementPageTest::testWhereSaysNothingAboutThePathWhenTheStatementIsReadWhereItIsWrittencallsTableIndexPageTest::testRenderDoesNotGroupWhenNoTableIsQualifiedcallsTableIndexPageTest::testRenderGroupsTablesBySchemaWhenAnyIsQualifiedcallsTableIndexPageTest::testRenderIsWrittenExactlycallsTableIndexPageTest::testRowCountsHowTheTableIsUsedAndMarksAGapInItsNamecallsTableIndexPageTest::testTableIsSortableByEveryColumncallsTablePageTest::testAlongsideIsSilentWhenTheTableIsNamedAlonecallsTablePageTest::testAnchorsFollowTheSectionsPresentcallsTablePageTest::testContextListsTheSectionsAndEveryOtherTablecallsTablePageTest::testGroupsListOnlyTheUsesPresentcallsTablePageTest::testRenderIsWrittenExactlycallsTablePageTest::testRenderSaysWhatUsesTheTableAndListsItsStatementsByWhatTheyDocallsTablePageTest::testUsedFromLinksEachFunctionAndSaysWhatItDoescallsPageShellTest::testRenderIsWrittenExactlycallsPageShellTest::testRenderWritesOneCompleteDocumentWithLinksRelativeToTheRootcallsPageShellTest::testRoutesMarkTheRouteBeingReadAndCountWhatEachHoldscallsPageShellTest::testSidebarWritesTheRoutesAndThenWhatThePageIsLeftFromcallsReportSiteTest::testCatalogIsHeldInReportingOrdercallsReportSiteTest::testClassesAreInNameOrdercallsReportSiteTest::testClassPageFallsBackToTheListingForAnUnknownClasscallsReportSiteTest::testFilePageFallsBackToTheListingForAnUnknownFilecallsReportSiteTest::testFilesAreInPathOrdercallsReportSiteTest::testFunctionAnchorIsWhatAFunctionsStatementsAreGroupedUndercallsReportSiteTest::testFunctionUrlLeadsToTheClassPageForAMethodAndTheFilePageOtherwisecallsReportSiteTest::testIndexGroupsTheCatalogcallsReportSiteTest::testPagesForKeepsNamesApartWhenTheySlugAlikecallsReportSiteTest::testPrefixOfIsWhatALinkFromThatPageGoesThroughcallsReportSiteTest::testStatementPageIsNamedAfterTheIdentifiercallsReportSiteTest::testStatisticsCountTheCatalogcallsReportSiteTest::testTablePageFallsBackToTheListingForAnUnknownTablecallsReportSiteTest::testTablesAreMostNamedFirstcallsSearchIndexTest::testEntryToArrayCarriesWhatTheSearchReadscallsSearchIndexTest::testEntryToArrayMakesTheVariableNameSearchablecallsSearchIndexTest::testRenderWritesTheIndexAsAScriptThePagesLoadcallsSourceCodeTest::testExcerptClipsAtTheStartAndEndOfTheFilecallsSourceCodeTest::testExcerptOmitsUnavailableSourceWithoutReadingTheFilesystemcallsSourceCodeTest::testExcerptShowsContextAndLinksToTheHighlightedCallInTheFullFilecallsSourceCodeTest::testFileIncludesAllLinesAndMarksEveryCallcallsStatementListTest::testFacetsIsWrittenExactlycallsStatementListTest::testRowsListEveryStatementAndSaySoWhenThereIsNonecallsStatementRowTest::testMetaNamesTheFunctionUnlessTheListingAlreadyDoescallsStatementRowTest::testMetaOmitsWhatTheListingAlreadyStatesAndShowsWhatIsNotOrdinarycallsStatementRowTest::testRenderLinksTheStatementAndWhereItIsIssuedRelativeToThePagecallsJsonReporterTest::testRenderWritesTheJsonDocumentcallsJsonReporterTest::testTheSchemaIsWrittenBesideTheDocumentcallsJsonReporterTest::testToArrayCarriesTheFilesThatCouldNotBeReadcallsTextReporterTest::testRenderReportsTheFilesThatCouldNotBeReadcallsTextReporterTest::testRenderWritesOneTextFilecalls
Relations§
Instantiated in 2
Method calls 15
- method-call SqlCatalog\Core\Filter\CatalogFilter::apply() packages/sql-catalog/src/Core/Filter/CatalogFilter.php:61
- method-call SqlCatalog\Facade\Analyzer::sortRecords() packages/sql-catalog/src/Facade/Analyzer.php:180
- method-call SqlCatalog\Reporter\Html\CatalogIndex::__construct() packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:39
- method-call SqlCatalog\Reporter\Html\CatalogIndex::__construct() packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:40
- method-call SqlCatalog\Reporter\Html\CatalogIndex::__construct() packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:41
- method-call SqlCatalog\Reporter\Html\CatalogStatistics::statements() packages/sql-catalog/src/Reporter/Html/CatalogStatistics.php:39
- method-call SqlCatalog\Reporter\Html\CatalogStatistics::flagged() packages/sql-catalog/src/Reporter/Html/CatalogStatistics.php:196
- method-call SqlCatalog\Reporter\Html\ReportSite::__construct() packages/sql-catalog/src/Reporter/Html/ReportSite.php:82
- method-call SqlCatalog\Reporter\Json\JsonReporter::toArray() packages/sql-catalog/src/Reporter/Json/JsonReporter.php:105
- method-call SqlCatalog\Reporter\Json\JsonReporter::toArray() packages/sql-catalog/src/Reporter/Json/JsonReporter.php:109
- method-call SqlCatalog\Reporter\Json\JsonReporter::summary() packages/sql-catalog/src/Reporter/Json/JsonReporter.php:140
- method-call SqlCatalog\Reporter\Text\TextReporter::render() packages/sql-catalog/src/Reporter/Text/TextReporter.php:50
- method-call SqlCatalog\Reporter\Text\TextReporter::render() packages/sql-catalog/src/Reporter/Text/TextReporter.php:56
- method-call SqlCatalog\Reporter\Text\TextReporter::summaryLine() packages/sql-catalog/src/Reporter/Text/TextReporter.php:121
- method-call SqlCatalog\Reporter\Text\TextReporter::summaryLine() packages/sql-catalog/src/Reporter/Text/TextReporter.php:124
Type declarations 18
- type SqlCatalog\Cli\CatalogCommand packages/sql-catalog/src/Cli/CatalogCommand.php:131
- type SqlCatalog\Cli\CatalogCommand packages/sql-catalog/src/Cli/CatalogCommand.php:148
- type SqlCatalog\Core\Filter\CatalogFilter packages/sql-catalog/src/Core/Filter/CatalogFilter.php:59
- type SqlCatalog\Core\Reporter\ReporterInterface packages/sql-catalog/src/Core/Reporter/ReporterInterface.php:33
- type SqlCatalog\Facade\Analyzer packages/sql-catalog/src/Facade/Analyzer.php:100
- type SqlCatalog\Facade\Analyzer packages/sql-catalog/src/Facade/Analyzer.php:120
- type SqlCatalog\Reporter\Html\CatalogIndex packages/sql-catalog/src/Reporter/Html/CatalogIndex.php:37
- type SqlCatalog\Reporter\Html\CatalogStatistics packages/sql-catalog/src/Reporter/Html/CatalogStatistics.php:24
- type SqlCatalog\Reporter\Html\CatalogStatistics packages/sql-catalog/src/Reporter/Html/CatalogStatistics.php:29
- type SqlCatalog\Reporter\Html\HtmlReporter packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:70
- type SqlCatalog\Reporter\Html\ReportSite packages/sql-catalog/src/Reporter/Html/ReportSite.php:53
- type SqlCatalog\Reporter\Html\ReportSite packages/sql-catalog/src/Reporter/Html/ReportSite.php:79
- type SqlCatalog\Reporter\Html\ReportSite packages/sql-catalog/src/Reporter/Html/ReportSite.php:93
- type SqlCatalog\Reporter\Json\JsonReporter packages/sql-catalog/src/Reporter/Json/JsonReporter.php:70
- type SqlCatalog\Reporter\Json\JsonReporter packages/sql-catalog/src/Reporter/Json/JsonReporter.php:102
- type SqlCatalog\Reporter\Json\JsonReporter packages/sql-catalog/src/Reporter/Json/JsonReporter.php:128
- type SqlCatalog\Reporter\Text\TextReporter packages/sql-catalog/src/Reporter/Text/TextReporter.php:47
- type SqlCatalog\Reporter\Text\TextReporter packages/sql-catalog/src/Reporter/Text/TextReporter.php:110