Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:lib:controller:searchcontroller

This is an old revision of the document!


SearchController

Layer: Controller · Source: lib/controller/SearchController.php:21 (lines 21–301)


class SearchController

Handles frontend search requests with HTMX fragment support.

Docblock Metadata

^ Tag ^ Value ^
| ''@category'' | Controller |
| ''@author'' | Scriptlog |
| ''@license'' | MIT |
| ''@version'' | 1.0 |

Inheritance

No parent, interface or trait. This is a root type.

Constants (0)

None.

Properties (3)

^ Visibility ^ Type ^ Name ^ Default ^ Line ^
| ''private'' | ''(untyped)'' | ''$perPage'' | ''10;'' | 36 |
| ''private'' | ''(untyped)'' | ''$rateLimitMax'' | ''30;'' | 41 |
| ''private'' | ''(untyped)'' | ''$rateLimitWindow'' | ''60;'' | 46 |

Methods (6)

^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''__construct()'' | (undocumented) | 48 |
| private | ''checkRateLimit()'' | Check rate limit for search endpoint. | 59 |
| public | ''search()'' | Handle search request — returns full page or fragment. | 78 |
| private | ''buildPagination()'' | Build pagination data from search results. | 182 |
| private | ''renderPaginationHtml()'' | Render pagination HTML matching existing theme pattern. | 221 |
| private | ''renderFullSearch()'' | Render full search results page. | 285 |

__construct()

public function __construct(?ThemeRendererInterface $themeRenderer = null, ?SearchFinder $searchFinder = null)

lines 48–52 (5)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$themeRenderer'' | [[scriptlog:lib:core:themerendererinterface|''?ThemeRendererInterface'']] | ''null'' | //none// |
| ''$searchFinder'' | [[scriptlog:lib:core:searchfinder|''?SearchFinder'']] | ''null'' | //none// |

checkRateLimit()

private function checkRateLimit(): bool

lines 59–73 (15)

Check rate limit for search endpoint.

Takes no parameters.

Returns: bool — bool

search()

public function search(): void

lines 78–173 (96)

Handle search request — returns full page or fragment.

Takes no parameters.

Returns: void

buildPagination()

private function buildPagination(array $results, string $keyword): array

lines 182–211 (30)

Build pagination data from search results.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$results'' | ''array'' | //required// | //none// |
| ''$keyword'' | ''string'' | //required// | //none// |

Returns: array — array

renderPaginationHtml()

private function renderPaginationHtml(int $currentPage, int $totalPages, string $path): string

lines 221–276 (56)

Render pagination HTML matching existing theme pattern.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$currentPage'' | ''int'' | //required// | //none// |
| ''$totalPages'' | ''int'' | //required// | //none// |
| ''$path'' | ''string'' | //required// | //none// |

Returns: string — string

renderFullSearch()

private function renderFullSearch(array $results, string $keyword = '', array $pagination = []): void

lines 285–300 (16)

Render full search results page.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$results'' | ''array'' | //required// | //none// |
| ''$keyword'' | ''string'' | '''''' | //none// |
| ''$pagination'' | ''array'' | ''[]'' | //none// |

Returns: void

Imports

^ Alias ^ Fully-qualified name ^
| ''SearchFinder'' | [[scriptlog:lib:core:searchfinder|''Scriptlog\Core\SearchFinder'']] |
| ''ThemeRendererInterface'' | [[scriptlog:lib:core:themerendererinterface|''Scriptlog\Core\ThemeRendererInterface'']] |

This page is generated from source by 'tools/gendoc'. Edits will be overwritten.

scriptlog/lib/controller/searchcontroller.1790413759.txt.gz · Last modified: by admin