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
파일 보기 프로젝트 열기: ppi/framework 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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