Overview

Namespaces

  • MvcCore
    • Ext
      • Auth
        • Virtual
      • Debug
        • Tracy
      • Form
        • Core
        • Validators
      • Request
      • Router
        • Lang
      • View
        • Helpers
  • None

Classes

  • Config
  • Controller
  • Debug
  • Model
  • Request
  • Response
  • Route
  • Router
  • Session
  • Tool
  • View
  • Overview
  • Namespace
  • Class
  • Tree

Class Config

Core configuration: - config files reading: - reading config.ini file by relative path - parsing and typing ini data into stdClass/array by key types - typing ini values into integers, floats, booleans or strings - environment management: - simple environment name detection by comparing server and client ip - environment name detection by config records about computer name or ip

Namespace: MvcCore
Located at mvccore/src/MvcCore/Config.php
Methods summary
public static
# StaticInit( )

Static initialization - called when file is loaded into memory

Static initialization - called when file is loaded into memory

public static boolean
# IsDevelopment( )

Return true if environment is 'development'

Return true if environment is 'development'

Returns

boolean
public static boolean
# IsBeta( )

Return true if environment is 'beta'

Return true if environment is 'beta'

Returns

boolean
public static boolean
# IsAlpha( )

Return true if environment is 'alpha'

Return true if environment is 'alpha'

Returns

boolean
public static boolean
# IsProduction( )

Return true if environment is 'production'

Return true if environment is 'production'

Returns

boolean
public static string
# GetEnvironment( )

Get environment name as string, defined by constants: \MvcCore\Config::ENVIRONMENT_

Get environment name as string, defined by constants: \MvcCore\Config::ENVIRONMENT_

Returns

string
public static
# SetEnvironment( $environment = self::ENVIRONMENT_PRODUCTION )

Set environment name as string, defined by constants: \MvcCore\Config::ENVIRONMENT_

Set environment name as string, defined by constants: \MvcCore\Config::ENVIRONMENT_

public static stdClass|array|boolean &
# GetSystem( )

Get system config ini file as stdClasses and arrays, palced in /App/config.ini

Get system config ini file as stdClasses and arrays, palced in /App/config.ini

Returns

stdClass|array|boolean
protected static string
# getServerIp( )

Get server IP from $_SERVER

Get server IP from $_SERVER

Returns

string
protected static string
# getClientIp( )

Get client IP from $_SERVER

Get client IP from $_SERVER

Returns

string
public array|boolean &
# Load( string $configPath = '', string $environment,… )

Load ini file and return system configuration - load only sections for current environment name - retype all raw string values into array, float, int or boolean - where is possible - retype whole values level into stdClass, if there are no numeric keys

Load ini file and return system configuration - load only sections for current environment name - retype all raw string values into array, float, int or boolean - where is possible - retype whole values level into stdClass, if there are no numeric keys

Parameters

$configPath
$filename
$environment,…

Returns

array|boolean
protected array &
# prepareIniDataToParse( array & $rawIniData, string $environment )

Aline all raw ini data to single level array, filtered for only current environment data items.

Aline all raw ini data to single level array, filtered for only current environment data items.

Parameters

$rawIniData
$environment

Returns

array
protected string
# detectEnvironmentBySystemConfig( array & $rawIni = array() )

Detect environment name to load proper config sections

Detect environment name to load proper config sections

Parameters

$rawIni

Returns

string
protected
# processIniData( array & $iniData )

Process single level array with dotted keys into tree structure and complete object type switches about tree records to set final stdClasses or arrays

Process single level array with dotted keys into tree structure and complete object type switches about tree records to set final stdClasses or arrays

Parameters

$iniData
protected boolean
# isKeyNumeric( string $rawKey )

Return if $rawKey is numeric

Return if $rawKey is numeric

Parameters

$rawKey

Returns

boolean
protected array|float|integer|string
# getTypedValue( string|array $rawValue )

Retype raw ini value into array wth retyped it's own values or to float, int or string

Retype raw ini value into array wth retyped it's own values or to float, int or string

Parameters

$rawValue

Returns

array|float|integer|string
protected float|string|integer
# getTypedValueFloatIpOrInt( string $rawValue )

Retype raw ini value into float ip or int

Retype raw ini value into float ip or int

Parameters

$rawValue

Returns

float|string|integer
protected boolean|string
# getTypedValueBoolOrString( string $rawValue )

Retype raw ini value into bool or string

Retype raw ini value into bool or string

Parameters

$rawValue

Returns

boolean|string
Constants summary
string ENVIRONMENT_DEVELOPMENT
# 'development'
string ENVIRONMENT_BETA
# 'beta'
string ENVIRONMENT_ALPHA
# 'alpha'
string ENVIRONMENT_PRODUCTION
# 'production'
Properties summary
public static string $SystemConfigPath

System config relative path from app root

System config relative path from app root

# '/%appPath%/config.ini'
protected static string $environment

Environment name - development, beta, alpha, production

Environment name - development, beta, alpha, production

# ''
protected static stdClass|array|boolean $systemConfig

System config object placed in /App/config.ini

System config object placed in /App/config.ini

# NULL
protected static mixed $booleanValues

Ini file values to convert into booleans

Ini file values to convert into booleans

# array('yes' => TRUE, 'no' => FALSE, 'true' => TRUE, 'false' => FALSE,)
protected array|stdClass $result

Temporary variable used when ini file is parsed and loaded to store complete result to return

Temporary variable used when ini file is parsed and loaded to store complete result to return

# array()
protected array $objectTypes

Temporary variable used when ini file is parsed and loaded, to store information about final retyping. Keys are addresses into result level to by retyped or not, values are arrays. First index in values is boolean to define if result level will be retyped into stdClass or not, second index in values is reference link to object retyped at the end or not.

Temporary variable used when ini file is parsed and loaded, to store information about final retyping. Keys are addresses into result level to by retyped or not, values are arrays. First index in values is boolean to define if result level will be retyped into stdClass or not, second index in values is reference link to object retyped at the end or not.

# array()
MvcCore API documentation generated by ApiGen