PHP Класс PPI\Framework\App

This class sets various app settings, and allows you to override classes used in the bootup process.
Автор: Paul Dragoonis ([email protected])
Автор: Vítor Brandão ([email protected])
Наследование: implements PPI\Framework\AppInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$booted boolean
$configManager PPI\Framework\Config\ConfigManager Configuration loader.
$debug boolean
$environment string Application environment: "dev|development" vs "prod|production".
$errorReportingLevel
$logger Psr\Log\LoggerInterface
$matchedRoute null | array
$moduleManager Zend\ModuleManager\ModuleManager The Module Manager.
$name string
$resolver PPI\Framework\Module\Controller\ControllerResolver
$rootDir null | string Path to the application root dir aka the "app" directory.
$serviceManager PPI\Framework\ServiceManager\ServiceManager Service Manager.
$startTime float Unix timestamp with microseconds.

Открытые методы

Метод Описание
__clone ( )
__construct ( array $options = [] ) App constructor.
boot ( ) Run the boot process, load our modules and their dependencies.
dispatch ( PPI\Framework\Http\Request $request, PPI\Framework\Http\Response $response ) : PPI\Framework\Http\Response Decide on a route to use and dispatch our module's controller action.
getCacheDir ( ) : string Gets the cache directory.
getCharset ( ) : string Gets the charset of the application.
getConfig ( ) : array | object Returns the application configuration.
getConfigManager ( ) : PPI\Framework\Config\ConfigManager Returns a ConfigManager instance.
getContainer ( ) : null | PPI\Framework\ServiceManager\ServiceManager
getEnvironment ( ) : string Get the environment mode the application is in.
getLogDir ( ) : string Gets the log directory.
getModuleManager ( ) : Zend\ModuleManager\ModuleManager Returns the Module Manager.
getModules ( ) : array Get an array of the loaded modules.
getName ( ) : string Gets the name of the application.
getRootDir ( ) : string Gets the application root dir.
getServiceManager ( ) : PPI\Framework\ServiceManager\ServiceManager Get the service manager.
getStartTime ( ) : integer Gets the request start time (not available if debug is disabled).
getVersion ( ) : string Gets the version of the application.
isDebug ( ) : boolean Checks if debug mode is enabled.
isEnvironment ( $env ) : boolean
loadConfig ( $resource, null $type = null ) : App Loads a configuration file or PHP array.
locateResource ( string $name, string $dir = null, boolean $first = true ) : string | array
run ( PPI\Framework\Http\Request $request = null, PPI\Framework\Http\Response $response = null ) : PPI\Framework\Http\Response Run the application and send the response.
serialize ( ) : string
setSymfonyKernel ( Symfony\Component\HttpKernel\KernelInterface $kernel )
unserialize ( $data )

Защищенные методы

Метод Описание
buildServiceManager ( ) : PPI\Framework\ServiceManager\ServiceManager Creates and initializes a ServiceManager instance.
getAppParameters ( ) : array Returns the application parameters.
getEnvParameters ( ) : array Gets the environment parameters.
handleRouting ( PPI\Framework\Http\Request $request ) : array Perform the matching of a route and return a set of routing parameters if a valid one is found.
log ( mixed $level, string $message, array $context = [] ) Logs with an arbitrary level.

Описание методов

__clone() публичный метод

public __clone ( )

__construct() публичный метод

App constructor.
public __construct ( array $options = [] )
$options array

boot() публичный метод

This method is automatically called by dispatch(), but you can use it to build all services when not handling a request.
public boot ( )

buildServiceManager() защищенный метод

Creates and initializes a ServiceManager instance.
protected buildServiceManager ( ) : PPI\Framework\ServiceManager\ServiceManager
Результат PPI\Framework\ServiceManager\ServiceManager The compiled service manager

dispatch() публичный метод

Decide on a route to use and dispatch our module's controller action.
public dispatch ( PPI\Framework\Http\Request $request, PPI\Framework\Http\Response $response ) : PPI\Framework\Http\Response
$request PPI\Framework\Http\Request
$response PPI\Framework\Http\Response
Результат PPI\Framework\Http\Response

getAppParameters() защищенный метод

Returns the application parameters.
protected getAppParameters ( ) : array
Результат array An array of application parameters

getCacheDir() публичный метод

Gets the cache directory.
public getCacheDir ( ) : string
Результат string The cache directory

getCharset() публичный метод

Gets the charset of the application.
public getCharset ( ) : string
Результат string The charset

getConfig() публичный метод

Returns the application configuration.
public getConfig ( ) : array | object
Результат array | object

getConfigManager() публичный метод

Returns a ConfigManager instance.
public getConfigManager ( ) : PPI\Framework\Config\ConfigManager
Результат PPI\Framework\Config\ConfigManager

getContainer() публичный метод

public getContainer ( ) : null | PPI\Framework\ServiceManager\ServiceManager
Результат null | PPI\Framework\ServiceManager\ServiceManager

getEnvParameters() защищенный метод

Only the parameters starting with "PPI__" are considered.
protected getEnvParameters ( ) : array
Результат array An array of parameters

getEnvironment() публичный метод

Get the environment mode the application is in.
public getEnvironment ( ) : string
Результат string The current environment

getLogDir() публичный метод

Gets the log directory.
public getLogDir ( ) : string
Результат string The log directory

getModuleManager() публичный метод

Returns the Module Manager.
public getModuleManager ( ) : Zend\ModuleManager\ModuleManager
Результат Zend\ModuleManager\ModuleManager

getModules() публичный метод

Get an array of the loaded modules.
public getModules ( ) : array
Результат array An array of Module objects, keyed by module name

getName() публичный метод

Gets the name of the application.
public getName ( ) : string
Результат string The application name

getRootDir() публичный метод

Gets the application root dir.
public getRootDir ( ) : string
Результат string The application root dir

getServiceManager() публичный метод

Get the service manager.
public getServiceManager ( ) : PPI\Framework\ServiceManager\ServiceManager
Результат PPI\Framework\ServiceManager\ServiceManager

getStartTime() публичный метод

Gets the request start time (not available if debug is disabled).
public getStartTime ( ) : integer
Результат integer The request start timestamp

getVersion() публичный метод

Gets the version of the application.
public getVersion ( ) : string
Результат string The application version

handleRouting() защищенный метод

Otherwise exceptions get thrown.
protected handleRouting ( PPI\Framework\Http\Request $request ) : array
$request PPI\Framework\Http\Request
Результат array

isDebug() публичный метод

Checks if debug mode is enabled.
public isDebug ( ) : boolean
Результат boolean true if debug mode is enabled, false otherwise

isEnvironment() публичный метод

public isEnvironment ( $env ) : boolean
$env
Результат boolean

loadConfig() публичный метод

Loads a configuration file or PHP array.
public loadConfig ( $resource, null $type = null ) : App
$resource
$type null
Результат App The current instance

locateResource() публичный метод

См. также: PPI\Framework\Module\ModuleManager::locateResource()
public locateResource ( string $name, string $dir = null, boolean $first = true ) : string | array
$name string A resource name to locate
$dir string A directory where to look for the resource first
$first boolean Whether to return the first path or paths for all matching bundles
Результат string | array The absolute path of the resource or an array if $first is false

log() защищенный метод

Logs with an arbitrary level.
protected log ( mixed $level, string $message, array $context = [] )
$level mixed
$message string
$context array

run() публичный метод

Run the application and send the response.
public run ( PPI\Framework\Http\Request $request = null, PPI\Framework\Http\Response $response = null ) : PPI\Framework\Http\Response
$request PPI\Framework\Http\Request
$response PPI\Framework\Http\Response
Результат PPI\Framework\Http\Response

serialize() публичный метод

public serialize ( ) : string
Результат string

setSymfonyKernel() публичный метод

public setSymfonyKernel ( Symfony\Component\HttpKernel\KernelInterface $kernel )
$kernel Symfony\Component\HttpKernel\KernelInterface

unserialize() публичный метод

public unserialize ( $data )

Описание свойств

$booted защищенное свойство

protected bool $booted
Результат boolean

$configManager защищенное свойство

Configuration loader.
protected ConfigManager,PPI\Framework\Config $configManager
Результат PPI\Framework\Config\ConfigManager

$debug защищенное свойство

protected bool $debug
Результат boolean

$environment защищенное свойство

Application environment: "dev|development" vs "prod|production".
protected string $environment
Результат string

$errorReportingLevel защищенное свойство

protected $errorReportingLevel

$logger защищенное свойство

protected LoggerInterface,Psr\Log $logger
Результат Psr\Log\LoggerInterface

$matchedRoute защищенное свойство

protected null|array $matchedRoute
Результат null | array

$moduleManager защищенное свойство

The Module Manager.
protected ModuleManager,Zend\ModuleManager $moduleManager
Результат Zend\ModuleManager\ModuleManager

$name защищенное свойство

protected string $name
Результат string

$resolver защищенное свойство

protected ControllerResolver,PPI\Framework\Module\Controller $resolver
Результат PPI\Framework\Module\Controller\ControllerResolver

$rootDir защищенное свойство

Path to the application root dir aka the "app" directory.
protected null|string $rootDir
Результат null | string

$serviceManager защищенное свойство

Service Manager.
protected ServiceManager,PPI\Framework\ServiceManager $serviceManager
Результат PPI\Framework\ServiceManager\ServiceManager

$startTime защищенное свойство

Unix timestamp with microseconds.
protected float $startTime
Результат float