This is an old revision of the document!
Table of Contents
Bootstrap
Layer: Core · Source: lib/core/Bootstrap.php:79 (lines 79–737)
class Bootstrap
Central orchestrator for this blog. This class handles the sequential loading of configurations, utility functions, core services, and global security policies.
Docblock Metadata
^ Tag ^ Value ^ | ''@category'' | Core | | ''@author'' | M.Noermoehammad | | ''@license'' | MIT | | ''@version'' | 1.0.0 | | ''@since'' | 1.0.0 |
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (3)
^ Visibility ^ Type ^ Name ^ Default ^ Line ^ | ''private static'' | ''static'' | ''$config'' | ''[];'' | 84 | | ''private static'' | ''static'' | ''$services'' | ''[];'' | 89 | | ''private static'' | ''static'' | ''$allowedExportVars'' | ''[ 'db_host', 'db_user', 'db_pwd', 'db_name', 'db_port', 'db…'' | 91 |
Methods (24)
^ Visibility ^ Method ^ Summary ^ Line ^ | public static | ''initialize()'' | Initializes the application environment. | 134 | | private static | ''loadConfiguration()'' | Loads the configuration file and extracts required environment variables. | 164 | | private static | ''initializeServices()'' | Orchestrates service instantiation and global registry setup. | 201 | | private static | ''createDatabaseConnection()'' | (undocumented) | 249 | | private static | ''defineRoutingRules()'' | (undocumented) | 277 | | private static | ''initializeRegistry()'' | (undocumented) | 296 | | private static | ''createBaseDaos()'' | (undocumented) | 306 | | private static | ''createSession()'' | (undocumented) | 327 | | private static | ''createAuthenticator()'' | (undocumented) | 355 | | private static | ''createThemeRenderer()'' | (undocumented) | 368 | | private static | ''createFrontService()'' | (undocumented) | 381 | | private static | ''createDownloadChain()'' | (undocumented) | 398 | | private static | ''createContentDaos()'' | (undocumented) | 418 | | private static | ''storeInRegistry()'' | (undocumented) | 433 | | private static | ''createDispatcher()'' | (undocumented) | 447 | | private static | ''buildServiceMap()'' | @SuppressWarnings(PHPMD.ExcessiveParameterList) | 461 | | private static | ''buildHandlerRegistry()'' | (undocumented) | 486 | | private static | ''buildAdminActionRegistry()'' | Build the admin action command registry and register known commands. | 516 | | private static | ''initializeI18n()'' | (undocumented) | 648 | | private static | ''applySecurity()'' | Configures HTTP response headers and global security handlers. | 665 | | private static | ''defineCspNonce()'' | (undocumented) | 677 | | private static | ''sendSecurityHeaders()'' | (undocumented) | 684 | | private static | ''sendContentSecurityPolicy()'' | (undocumented) | 706 | | private static | ''initializePostSecurity()'' | (undocumented) | 717 |
initialize()
public static function initialize(string $appRoot): AppContext
lines 134–156 (23)
Initializes the application environment.
\* Performs the full bootstrap sequence: configuration, utilities, service containerization, and security header enforcement.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$appRoot'' | ''string'' | //required// | The absolute path to the application root directory. |
Returns: ''AppContext'' — AppContext Merged collection of configuration variables and service instances.
loadConfiguration()
private static function loadConfiguration(string $appRoot): array
lines 164–189 (26)
Loads the configuration file and extracts required environment variables.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$appRoot'' | ''string'' | //required// | Path to search for config.php. |
Returns: array — array<string, string> Array containing db_host, app_url, cipher_key, etc.
initializeServices()
private static function initializeServices(array $core_vars): array
lines 201–247 (47)
Orchestrates service instantiation and global registry setup.
\* Note: Registry must be populated before DAOs are instantiated to ensure data access objects have access to the active database connection.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$core_vars'' | ''array'' | //required// | //none// |
Returns: array — array<string, object|null> Collection of ready-to-use services.
createDatabaseConnection()
private static function createDatabaseConnection(array $core_vars)
lines 249–275 (27)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$core_vars'' | ''array'' | //required// | //none// |
Returns: (none declared)
defineRoutingRules()
private static function defineRoutingRules(): array
lines 277–294 (18)
Takes no parameters.
Returns: array
initializeRegistry()
private static function initializeRegistry($dbc, array $core_vars, array $rules): void
lines 296–304 (9)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$dbc'' | ''(untyped)'' | //required// | //none// | | ''$core_vars'' | ''array'' | //required// | //none// | | ''$rules'' | ''array'' | //required// | //none// |
Returns: void
createBaseDaos()
private static function createBaseDaos($dbc): array
lines 306–325 (20)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$dbc'' | ''(untyped)'' | //required// | //none// |
Returns: array
createSession()
private static function createSession(array $core_vars)
lines 327–353 (27)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$core_vars'' | ''array'' | //required// | //none// |
Returns: (none declared)
createAuthenticator()
private static function createAuthenticator($dbc, $userDao, $userToken, $validator)
lines 355–366 (12)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$dbc'' | ''(untyped)'' | //required// | //none// | | ''$userDao'' | ''(untyped)'' | //required// | //none// | | ''$userToken'' | ''(untyped)'' | //required// | //none// | | ''$validator'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared)
createThemeRenderer()
private static function createThemeRenderer($dbc)
lines 368–379 (12)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$dbc'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared)
createFrontService()
private static function createFrontService()
lines 381–396 (16)
Takes no parameters.
Returns: (none declared)
createDownloadChain()
private static function createDownloadChain($dbc): array
lines 398–416 (19)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$dbc'' | ''(untyped)'' | //required// | //none// |
Returns: array
createContentDaos()
private static function createContentDaos($dbc): array
lines 418–431 (14)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$dbc'' | ''(untyped)'' | //required// | //none// |
Returns: array
storeInRegistry()
private static function storeInRegistry($mediaDao, $downloadService, $downloadController, $postDao, $pageDao, $topicDao): void
lines 433–445 (13)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$mediaDao'' | ''(untyped)'' | //required// | //none// | | ''$downloadService'' | ''(untyped)'' | //required// | //none// | | ''$downloadController'' | ''(untyped)'' | //required// | //none// | | ''$postDao'' | ''(untyped)'' | //required// | //none// | | ''$pageDao'' | ''(untyped)'' | //required// | //none// | | ''$topicDao'' | ''(untyped)'' | //required// | //none// |
Returns: void
createDispatcher()
private static function createDispatcher($dbc, $themeRenderer)
lines 447–458 (12)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$dbc'' | ''(untyped)'' | //required// | //none// | | ''$themeRenderer'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared)
buildServiceMap()
private static function buildServiceMap($sessionMaker, $sanitizer, $userDao, $userToken, $validator, $configDao, $configService, $authenticator, $dispatcher, $themeRenderer, $mediaDao, $downloadService, $downloadController, $frontService, $postDao, $pageDao, $topicDao): array
lines 461–484 (24)
@SuppressWarnings(PHPMD.ExcessiveParameterList)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$sessionMaker'' | ''(untyped)'' | //required// | //none// | | ''$sanitizer'' | ''(untyped)'' | //required// | //none// | | ''$userDao'' | ''(untyped)'' | //required// | //none// | | ''$userToken'' | ''(untyped)'' | //required// | //none// | | ''$validator'' | ''(untyped)'' | //required// | //none// | | ''$configDao'' | ''(untyped)'' | //required// | //none// | | ''$configService'' | ''(untyped)'' | //required// | //none// | | ''$authenticator'' | ''(untyped)'' | //required// | //none// | | ''$dispatcher'' | ''(untyped)'' | //required// | //none// | | ''$themeRenderer'' | ''(untyped)'' | //required// | //none// | | ''$mediaDao'' | ''(untyped)'' | //required// | //none// | | ''$downloadService'' | ''(untyped)'' | //required// | //none// | | ''$downloadController'' | ''(untyped)'' | //required// | //none// | | ''$frontService'' | ''(untyped)'' | //required// | //none// | | ''$postDao'' | ''(untyped)'' | //required// | //none// | | ''$pageDao'' | ''(untyped)'' | //required// | //none// | | ''$topicDao'' | ''(untyped)'' | //required// | //none// |
Returns: array
buildHandlerRegistry()
private static function buildHandlerRegistry($themeRenderer): void
lines 486–509 (24)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$themeRenderer'' | ''(untyped)'' | //required// | //none// |
Returns: void
buildAdminActionRegistry()
private static function buildAdminActionRegistry(): void
lines 516–646 (131)
Build the admin action command registry and register known commands.
Takes no parameters.
Returns: void — void
initializeI18n()
private static function initializeI18n(): void
lines 648–657 (10)
Takes no parameters.
Returns: void
applySecurity()
private static function applySecurity(): void
lines 665–675 (11)
Configures HTTP response headers and global security handlers.
\* Uses utility functions to set CSP, XSS protection, and frame options. Also initializes error handling (Whoops) and HTML purification. \* @return void
Takes no parameters.
Returns: void
defineCspNonce()
private static function defineCspNonce(): void
lines 677–682 (6)
Takes no parameters.
Returns: void
sendSecurityHeaders()
private static function sendSecurityHeaders(): void
lines 684–704 (21)
Takes no parameters.
Returns: void
sendContentSecurityPolicy()
private static function sendContentSecurityPolicy(): void
lines 706–715 (10)
Takes no parameters.
Returns: void
initializePostSecurity()
private static function initializePostSecurity(): void
lines 717–736 (20)
Takes no parameters.
Returns: void
Imports
^ Alias ^ Fully-qualified name ^ | ''DownloadController'' | [[scriptlog:lib:controller:downloadcontroller|''Scriptlog\Controller\DownloadController'']] | | ''ConfigurationDao'' | [[scriptlog:lib:dao:configurationdao|''Scriptlog\Dao\ConfigurationDao'']] | | ''MediaDao'' | [[scriptlog:lib:dao:mediadao|''Scriptlog\Dao\MediaDao'']] | | ''PageDao'' | [[scriptlog:lib:dao:pagedao|''Scriptlog\Dao\PageDao'']] | | ''PostDao'' | [[scriptlog:lib:dao:postdao|''Scriptlog\Dao\PostDao'']] | | ''TopicDao'' | [[scriptlog:lib:dao:topicdao|''Scriptlog\Dao\TopicDao'']] | | ''UserDao'' | [[scriptlog:lib:dao:userdao|''Scriptlog\Dao\UserDao'']] | | ''UserTokenDao'' | [[scriptlog:lib:dao:usertokendao|''Scriptlog\Dao\UserTokenDao'']] | | ''DeleteCommentCmd'' | [[scriptlog:lib:handler:deletecommentcmd|''Scriptlog\Handler\Admin\Comment\DeleteCommentCmd'']] | | ''EditCommentCmd'' | [[scriptlog:lib:handler:editcommentcmd|''Scriptlog\Handler\Admin\Comment\EditCommentCmd'']] | | ''ListCommentsCmd'' | [[scriptlog:lib:handler:listcommentscmd|''Scriptlog\Handler\Admin\Comment\ListCommentsCmd'']] | | ''DeleteTopicCmd'' | [[scriptlog:lib:handler:deletetopiccmd|''Scriptlog\Handler\Admin\Topic\DeleteTopicCmd'']] | | ''EditTopicCmd'' | [[scriptlog:lib:handler:edittopiccmd|''Scriptlog\Handler\Admin\Topic\EditTopicCmd'']] | | ''ListTopicsCmd'' | [[scriptlog:lib:handler:listtopicscmd|''Scriptlog\Handler\Admin\Topic\ListTopicsCmd'']] | | ''NewTopicCmd'' | [[scriptlog:lib:handler:newtopiccmd|''Scriptlog\Handler\Admin\Topic\NewTopicCmd'']] | | ''DeletePostCmd'' | [[scriptlog:lib:handler:deletepostcmd|''Scriptlog\Handler\Admin\Post\DeletePostCmd'']] | | ''EditPostCmd'' | [[scriptlog:lib:handler:editpostcmd|''Scriptlog\Handler\Admin\Post\EditPostCmd'']] | | ''ListPostsCmd'' | [[scriptlog:lib:handler:listpostscmd|''Scriptlog\Handler\Admin\Post\ListPostsCmd'']] | | ''NewPostCmd'' | [[scriptlog:lib:handler:newpostcmd|''Scriptlog\Handler\Admin\Post\NewPostCmd'']] | | ''DeletePageCmd'' | [[scriptlog:lib:handler:deletepagecmd|''Scriptlog\Handler\Admin\Page\DeletePageCmd'']] | | ''EditPageCmd'' | [[scriptlog:lib:handler:editpagecmd|''Scriptlog\Handler\Admin\Page\EditPageCmd'']] | | ''ListPagesCmd'' | [[scriptlog:lib:handler:listpagescmd|''Scriptlog\Handler\Admin\Page\ListPagesCmd'']] | | ''NewPageCmd'' | [[scriptlog:lib:handler:newpagecmd|''Scriptlog\Handler\Admin\Page\NewPageCmd'']] | | ''DeleteUserCmd'' | [[scriptlog:lib:handler:deleteusercmd|''Scriptlog\Handler\Admin\User\DeleteUserCmd'']] | | ''EditUserCmd'' | [[scriptlog:lib:handler:editusercmd|''Scriptlog\Handler\Admin\User\EditUserCmd'']] | | ''ListUsersCmd'' | [[scriptlog:lib:handler:listuserscmd|''Scriptlog\Handler\Admin\User\ListUsersCmd'']] | | ''NewUserCmd'' | [[scriptlog:lib:handler:newusercmd|''Scriptlog\Handler\Admin\User\NewUserCmd'']] | | ''DeleteMediaCmd'' | [[scriptlog:lib:handler:deletemediacmd|''Scriptlog\Handler\Admin\Media\DeleteMediaCmd'']] | | ''EditMediaCmd'' | [[scriptlog:lib:handler:editmediacmd|''Scriptlog\Handler\Admin\Media\EditMediaCmd'']] | | ''ListMediaCmd'' | [[scriptlog:lib:handler:listmediacmd|''Scriptlog\Handler\Admin\Media\ListMediaCmd'']] | | ''NewMediaCmd'' | [[scriptlog:lib:handler:newmediacmd|''Scriptlog\Handler\Admin\Media\NewMediaCmd'']] | | ''ActivatePluginCmd'' | [[scriptlog:lib:handler:activateplugincmd|''Scriptlog\Handler\Admin\Plugin\ActivatePluginCmd'']] | | ''DeactivatePluginCmd'' | [[scriptlog:lib:handler:deactivateplugincmd|''Scriptlog\Handler\Admin\Plugin\DeactivatePluginCmd'']] | | ''DeletePluginCmd'' | [[scriptlog:lib:handler:deleteplugincmd|''Scriptlog\Handler\Admin\Plugin\DeletePluginCmd'']] | | ''InstallPluginCmd'' | [[scriptlog:lib:handler:installplugincmd|''Scriptlog\Handler\Admin\Plugin\InstallPluginCmd'']] | | ''ListPluginsCmd'' | [[scriptlog:lib:handler:listpluginscmd|''Scriptlog\Handler\Admin\Plugin\ListPluginsCmd'']] | | ''ActivateThemeCmd'' | [[scriptlog:lib:handler:activatethemecmd|''Scriptlog\Handler\Admin\Theme\ActivateThemeCmd'']] | | ''DeactivateThemeCmd'' | [[scriptlog:lib:handler:deactivatethemecmd|''Scriptlog\Handler\Admin\Theme\DeactivateThemeCmd'']] | | ''DeleteThemeCmd'' | [[scriptlog:lib:handler:deletethemecmd|''Scriptlog\Handler\Admin\Theme\DeleteThemeCmd'']] | | ''EditThemeCmd'' | [[scriptlog:lib:handler:editthemecmd|''Scriptlog\Handler\Admin\Theme\EditThemeCmd'']] | | ''InstallThemeCmd'' | [[scriptlog:lib:handler:installthemecmd|''Scriptlog\Handler\Admin\Theme\InstallThemeCmd'']] | | ''ListThemesCmd'' | [[scriptlog:lib:handler:listthemescmd|''Scriptlog\Handler\Admin\Theme\ListThemesCmd'']] | | ''NewThemeCmd'' | [[scriptlog:lib:handler:newthemecmd|''Scriptlog\Handler\Admin\Theme\NewThemeCmd'']] | | ''AdminActionRegistry'' | [[scriptlog:lib:handler:adminactionregistry|''Scriptlog\Handler\AdminActionRegistry'']] | | ''ArchiveHandler'' | [[scriptlog:lib:handler:archivehandler|''Scriptlog\Handler\ArchiveHandler'']] | | ''BlogHandler'' | [[scriptlog:lib:handler:bloghandler|''Scriptlog\Handler\BlogHandler'']] | | ''CategoryHandler'' | [[scriptlog:lib:handler:categoryhandler|''Scriptlog\Handler\CategoryHandler'']] | | ''DownloadHandler'' | [[scriptlog:lib:handler:downloadhandler|''Scriptlog\Handler\DownloadHandler'']] | | ''HandlerRegistry'' | [[scriptlog:lib:handler:handlerregistry|''Scriptlog\Handler\HandlerRegistry'']] | | ''PageHandler'' | [[scriptlog:lib:handler:pagehandler|''Scriptlog\Handler\PageHandler'']] | | ''PostHandler'' | [[scriptlog:lib:handler:posthandler|''Scriptlog\Handler\PostHandler'']] | | ''PrivacyHandler'' | [[scriptlog:lib:handler:privacyhandler|''Scriptlog\Handler\PrivacyHandler'']] | | ''TagHandler'' | [[scriptlog:lib:handler:taghandler|''Scriptlog\Handler\TagHandler'']] | | ''DownloadModel'' | [[scriptlog:lib:model:downloadmodel|''Scriptlog\Model\DownloadModel'']] | | ''ConfigurationService'' | [[scriptlog:lib:service:configurationservice|''Scriptlog\Service\ConfigurationService'']] | | ''DownloadService'' | [[scriptlog:lib:service:downloadservice|''Scriptlog\Service\DownloadService'']] | | ''FrontService'' | [[scriptlog:lib:service:frontservice|''Scriptlog\Service\FrontService'']] |
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
