PHP Класс Prado\PradoBase

PradoBase implements a few fundamental static methods. To use the static methods, Use Prado as the class name rather than PradoBase. PradoBase is meant to serve as the base class of Prado. The latter might be rewritten for customization.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$classMap list of namespaces currently in use

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

Свойство Тип Описание
$classExists list of class exists checks

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

Метод Описание
autoload ( $className ) Class autoload loader.
createComponent ( $requestedType ) : TComponent Creates a component with the specified type.
exceptionHandler ( $exception ) Default exception handler.
fatalError ( $msg ) Fatal error handler.
getApplication ( ) : TApplication
getFrameworkPath ( ) : string
getLogger ( ) : TLogger
getPathOfAlias ( $alias ) : string
getPathOfNamespace ( $namespace, $ext = '' ) : string Translates a namespace into a file path.
getPreferredLanguage ( ) : string Returns the most preferred language by the client user.
getUserLanguages ( ) : array Returns a list of user preferred languages.
getVersion ( ) : string
init ( )
initAutoloader ( ) Loads the static classmap and registers the autoload function.
initErrorHandlers ( ) Initializes error handlers.
localize ( $text, $parameters = [], $catalogue = null, $charset = null ) : string Localize a text to the locale/culture specified in the globalization handler.
log ( $msg, $level = TLogger::INFO, $category = 'Uncategorized', $ctl = null ) Logs a message.
phpErrorHandler ( $errno, $errstr, $errfile, $errline ) PHP error handler.
phpFatalErrorHandler ( ) PHP shutdown function used to catch fatal errors.
poweredByPrado ( $logoType ) : string
setApplication ( $application ) Stores the application instance in the class static member.
setPathOfAlias ( $alias, $path )
trace ( $msg, $category = 'Uncategorized', $ctl = null ) Writes a log message.
using ( $namespace, $checkClassExistence = true ) Uses a namespace.
varDump ( $var, $depth = 10, $highlight = false ) : string Converts a variable into a string representation.

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

Метод Описание
getPathAliases ( )
prado3NamespaceToPhpNamespace ( $type ) : string Convert old Prado namespaces to PHP namespaces

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

autoload() публичный статический Метод

This method is provided to be invoked within an __autoload() magic method.
public static autoload ( $className )

createComponent() публичный статический Метод

A component type can be either the component class name or a namespace referring to the path of the component class file. For example, 'TButton', '\Prado\Web\UI\WebControls\TButton' are both valid component type. This method can also pass parameters to component constructors. All parameters passed to this method except the first one (the component type) will be supplied as component constructor parameters.
public static createComponent ( $requestedType ) : TComponent
Результат TComponent component instance of the specified type

exceptionHandler() публичный статический Метод

This method should be registered as default exception handler using {@link set_exception_handler}. The method tries to use the errorhandler module of the Prado application to handle the exception. If the application or the module does not exist, it simply echoes the exception.
public static exceptionHandler ( $exception )

fatalError() публичный статический Метод

This method displays an error message together with the current call stack. The application will exit after calling this method.
public static fatalError ( $msg )

getApplication() публичный статический Метод

public static getApplication ( ) : TApplication
Результат TApplication the application singleton, null if the singleton has not be created yet.

getFrameworkPath() публичный статический Метод

public static getFrameworkPath ( ) : string
Результат string the path of the framework

getLogger() публичный статический Метод

public static getLogger ( ) : TLogger
Результат Prado\Util\TLogger message logger

getPathAliases() защищенный статический Метод

protected static getPathAliases ( )

getPathOfAlias() публичный статический Метод

public static getPathOfAlias ( $alias ) : string
Результат string the path corresponding to the alias, null if alias not defined.

getPathOfNamespace() публичный статический Метод

The first segment of the namespace is considered as a path alias which is replaced with the actual path. The rest segments are subdirectory names appended to the aliased path. If the namespace ends with an asterisk '*', it represents a directory; Otherwise it represents a file whose extension name is specified by the second parameter (defaults to empty). Note, this method does not ensure the existence of the resulting file path.
public static getPathOfNamespace ( $namespace, $ext = '' ) : string
Результат string file path corresponding to the namespace, null if namespace is invalid

getPreferredLanguage() публичный статический Метод

Returns the most preferred language by the client user.
public static getPreferredLanguage ( ) : string
Результат string the most preferred language by the client user, defaults to English.

getUserLanguages() публичный статический Метод

The languages are returned as an array. Each array element represents a single language preference. The languages are ordered according to user preferences. The first language is the most preferred.
public static getUserLanguages ( ) : array
Результат array list of user preferred languages.

getVersion() публичный статический Метод

public static getVersion ( ) : string
Результат string the version of Prado framework

init() публичный статический Метод

public static init ( )

initAutoloader() публичный статический Метод

Loads the static classmap and registers the autoload function.
public static initAutoloader ( )

initErrorHandlers() публичный статический Метод

This method set error and exception handlers to be functions defined in this class.
public static initErrorHandlers ( )

localize() публичный статический Метод

Localize a text to the locale/culture specified in the globalization handler.
См. также: TTranslate::formatter()
См. также: TTranslate::init()
public static localize ( $text, $parameters = [], $catalogue = null, $charset = null ) : string
Результат string localized text.

log() публичный статический Метод

Messages logged by this method may be retrieved via {@link TLogger::getLogs} and may be recorded in different media, such as file, email, database, using {@link TLogRouter}.
public static log ( $msg, $level = TLogger::INFO, $category = 'Uncategorized', $ctl = null )

phpErrorHandler() публичный статический Метод

This method should be registered as PHP error handler using {@link set_error_handler}. The method throws an exception that contains the error information.
public static phpErrorHandler ( $errno, $errstr, $errfile, $errline )

phpFatalErrorHandler() публичный статический Метод

This method should be registered as PHP error handler using {@link register_shutdown_function}. The method throws an exception that contains the error information.
public static phpFatalErrorHandler ( )

poweredByPrado() публичный статический Метод

public static poweredByPrado ( $logoType ) : string
Результат string a string that can be displayed on your Web page showing powered-by-PRADO information

prado3NamespaceToPhpNamespace() защищенный статический Метод

Convert old Prado namespaces to PHP namespaces
protected static prado3NamespaceToPhpNamespace ( $type ) : string
Результат string Equivalent class name in PHP namespace format

setApplication() публичный статический Метод

This method helps implement a singleton pattern for TApplication. Repeated invocation of this method or the application constructor will cause the throw of an exception. This method should only be used by framework developers.
public static setApplication ( $application )

setPathOfAlias() публичный статический Метод

public static setPathOfAlias ( $alias, $path )

trace() публичный статический Метод

This method wraps {@link log()} by checking the application mode. When the application is in Debug mode, debug backtrace information is appended to the message and the message is logged at DEBUG level. When the application is in Performance mode, this method does nothing. Otherwise, the message is logged at INFO level.
public static trace ( $msg, $category = 'Uncategorized', $ctl = null )

using() публичный статический Метод

A namespace ending with an asterisk '*' refers to a directory, otherwise it represents a PHP file. If the namespace corresponds to a directory, the directory will be appended to the include path. If the namespace corresponds to a file, it will be included (include_once).
public static using ( $namespace, $checkClassExistence = true )

varDump() публичный статический Метод

This method achieves the similar functionality as var_dump and print_r but is more robust when handling complex objects such as PRADO controls.
public static varDump ( $var, $depth = 10, $highlight = false ) : string
Результат string the string representation of the variable

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

$classExists защищенное статическое свойство

list of class exists checks
protected static $classExists

$classMap публичное статическое свойство

list of namespaces currently in use
public static $classMap