PHP Class Scalr

Exibir arquivo Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$emergencyMemory string Emergency memory that is used in the case of the memory limit error to handle error safely

Public Methods

Method Description
AttachObserver ( AbstractEventObserver $observer ) Attach observer
FireEvent ( integer $farmid, AbstractServerEvent $event ) File event in database
GenerateAPIKeys ( )
GenerateRandomKey ( integer $length = 128 ) : string Generates random key of specified length
GenerateSecurePassword ( integer $length = 16, array $sets = null, array $enabledSets = null ) : string Generates password that includes at least one symbols from each set: l - lower case characters u - upper case characters d - digits s - special characters
GenerateUID ( $short = false, $startWithLetter = false )
LaunchServer ( ServerCreateInfo $ServerCreateInfo = null, DBServer $DBServer = null, boolean $delayed = false, integer | array $reason, Scalr_Account_User | integer $user = null ) : DBServer | null Launches server
ReconfigureObservers ( ) Method for multiprocess scripts. We must recreate DB connection created in constructor
StoreEvent ( integer $farmid, AbstractServerEvent $event, $eventTime = null ) Store event in database
camelize ( string $input ) : string Camelizes string
config ( string $name ) : mixed Gets config value
decamelize ( string $str ) : string Decamelizes a string
errorHandler ( integer $errno, string $errstr, string $errfile, integer $errline ) Scalr error handler
getAllHeaders ( ) : array Get all http headers in camel-case form
getContainer ( ) : Container Gets DI container
getDb ( boolean $forceNewConnection = null ) : ADODB_mysqli Gets an ADO Database Connection as singleton
initializeContainer ( ) Performs preliminary initialization of the DI container
isAllowedAnalyticsOnHostedScalrAccount ( integer $accountId ) : boolean Checks whether specified account is allowed to manage Cost centers and Projects on hosted scalr account
isHostedScalr ( ) : boolean Checks whether current install is hosted scalr
logException ( Exception $e ) Adds catchable exception to standart PHP error log
processHostDown ( DBServer $dbServer )

Private Methods

Method Description
setupObservers ( )

Method Details

AttachObserver() public static method

Attach observer
public static AttachObserver ( AbstractEventObserver $observer )
$observer Scalr\Observer\AbstractEventObserver

FireEvent() public static method

File event in database
public static FireEvent ( integer $farmid, AbstractServerEvent $event )
$farmid integer
$event AbstractServerEvent

GenerateAPIKeys() public static method

public static GenerateAPIKeys ( )

GenerateRandomKey() public static method

Generates random key of specified length
public static GenerateRandomKey ( integer $length = 128 ) : string
$length integer optional The length of the key
return string Returns the random string of specified length

GenerateSecurePassword() public static method

Generates password that includes at least one symbols from each set: l - lower case characters u - upper case characters d - digits s - special characters
public static GenerateSecurePassword ( integer $length = 16, array $sets = null, array $enabledSets = null ) : string
$length integer optional Password length
$sets array optional User (re-)defined characters sets
$enabledSets array optional Names of enabled sets, if null — all sets are enabled
return string Returns generated password

GenerateUID() public static method

public static GenerateUID ( $short = false, $startWithLetter = false )

LaunchServer() public static method

Launches server
public static LaunchServer ( ServerCreateInfo $ServerCreateInfo = null, DBServer $DBServer = null, boolean $delayed = false, integer | array $reason, Scalr_Account_User | integer $user = null ) : DBServer | null
$ServerCreateInfo ServerCreateInfo optional The server create info
$DBServer DBServer optional The DBServer object
$delayed boolean optional
$reason integer | array optional
$user Scalr_Account_User | integer optional The Scalr_Account_User object or its unique identifier
return DBServer | null Returns the DBServer object on cussess or null otherwise

ReconfigureObservers() public static method

Method for multiprocess scripts. We must recreate DB connection created in constructor
public static ReconfigureObservers ( )

StoreEvent() public static method

Store event in database
public static StoreEvent ( integer $farmid, AbstractServerEvent $event, $eventTime = null )
$farmid integer
$event AbstractServerEvent

camelize() public static method

Camelizes string
public static camelize ( string $input ) : string
$input string A string to camelize
return string Returns Camelized string

config() public static method

Gets config value
public static config ( string $name ) : mixed
$name string An option name
return mixed Returns configuration value for the specified key

decamelize() public static method

Decamelizes a string
public static decamelize ( string $str ) : string
$str string A string
return string Returns decamelized string

errorHandler() public static method

Scalr error handler
public static errorHandler ( integer $errno, string $errstr, string $errfile, integer $errline )
$errno integer
$errstr string
$errfile string
$errline integer

getAllHeaders() public static method

Get all http headers in camel-case form
public static getAllHeaders ( ) : array
return array

getContainer() public static method

Gets DI container
public static getContainer ( ) : Container
return Scalr\DependencyInjection\Container

getDb() public static method

Gets an ADO Database Connection as singleton
public static getDb ( boolean $forceNewConnection = null ) : ADODB_mysqli
$forceNewConnection boolean optional Force new connection. (false by default)
return ADODB_mysqli

initializeContainer() public static method

Performs preliminary initialization of the DI container
public static initializeContainer ( )

isAllowedAnalyticsOnHostedScalrAccount() public static method

Checks whether specified account is allowed to manage Cost centers and Projects on hosted scalr account
public static isAllowedAnalyticsOnHostedScalrAccount ( integer $accountId ) : boolean
$accountId integer Identifier of the client's account
return boolean Returns true if it is allowed of false otherwise

isHostedScalr() public static method

Checks whether current install is hosted scalr
public static isHostedScalr ( ) : boolean
return boolean Returns true if current install is a hosted Scalr

logException() public static method

Adds catchable exception to standart PHP error log
public static logException ( Exception $e )
$e Exception The exception to log

processHostDown() public static method

public static processHostDown ( DBServer $dbServer )
$dbServer DBServer

Property Details

$emergencyMemory public_oe static_oe property

Emergency memory that is used in the case of the memory limit error to handle error safely
public static string $emergencyMemory
return string