PocketMine
Config Class Reference

Public Member Functions

 __construct ($file, $type=Config::DETECT, $default=[], &$correct=null)
 
 reload ()
 
 load ($file, $type=Config::DETECT, $default=[])
 
 check ()
 
 save ($async=false)
 
 __get ($k)
 
 __set ($k, $v)
 
 __isset ($k)
 
 __unset ($k)
 
 setNested ($key, $value)
 
 getNested ($key, $default=null)
 
 get ($k, $default=false)
 
 getPath ($path)
 
 setPath ($path, $value)
 
 set ($k, $v=true)
 
 setAll ($v)
 
 exists ($k, $lowercase=false)
 
 remove ($k)
 
 getAll ($keys=false)
 
 setDefaults (array $defaults)
 

Static Public Member Functions

static fixYAMLIndexes ($str)
 

Data Fields

const DETECT = -1
 
const PROPERTIES = 0
 
const CNF = Config::PROPERTIES
 
const JSON = 1
 
const YAML = 2
 
const SERIALIZED = 4
 
const ENUM = 5
 
const ENUMERATION = Config::ENUM
 

Static Public Attributes

static $formats
 
static cnf
 

Detailed Description

Class Config

Config Class for simple config manipulation of multiple formats.

Constructor & Destructor Documentation

__construct (   $file,
  $type = Config::DETECT,
  $default = [],
$correct = null 
)
Parameters
string$filePath of the file to be loaded
int$typeConfig type to load, -1 by default (detect)
array$defaultArray with the default values, will be set if not existent
null&$correctSets correct to true if everything has been loaded correctly

Member Function Documentation

__get (   $k)
Parameters
$k
Returns
boolean|mixed
__isset (   $k)
Parameters
$k
Returns
boolean
__set (   $k,
  $v 
)
Parameters
$k
$v
__unset (   $k)
Parameters
$k
check ( )
Returns
boolean
exists (   $k,
  $lowercase = false 
)
Parameters
$k
bool$lowercaseIf set, searches Config in single-case / lowercase.
Returns
boolean
static fixYAMLIndexes (   $str)
static
Parameters
$str
Returns
mixed
get (   $k,
  $default = false 
)
Parameters
$k
mixed$default
Returns
boolean|mixed
getAll (   $keys = false)
Parameters
bool$keys
Returns
array
getNested (   $key,
  $default = null 
)
Parameters
$key
mixed$default
Returns
mixed
getPath (   $path)
Parameters
string$path
Deprecated:
Returns
mixed
load (   $file,
  $type = Config::DETECT,
  $default = [] 
)
Parameters
$file
int$type
array$default
Returns
bool
reload ( )

Removes all the changes in memory and loads the file again

remove (   $k)
Parameters
$k
save (   $async = false)
Parameters
bool$async
Returns
boolean
set (   $k,
  $v = true 
)
Parameters
string$kkey to be set
mixed$vvalue to set key
setAll (   $v)
Parameters
array$v
setDefaults ( array  $defaults)
Parameters
array$defaults
setNested (   $key,
  $value 
)
Parameters
$key
$value
setPath (   $path,
  $value 
)
Deprecated:
Parameters
string$path
mixed$value

Field Documentation

$formats
static
Initial value:
= [
"properties" => Config::PROPERTIES
cnf
static
Initial value:
=> Config::CNF,
"conf" => Config::CNF,
"config" => Config::CNF,
"json" => Config::JSON,
"js" => Config::JSON,
"yml" => Config::YAML,
"yaml" => Config::YAML,
"sl" => Config::SERIALIZED,
"serialize" => Config::SERIALIZED,
"txt" => Config::ENUM,
"list" => Config::ENUM,
"enum" => Config::ENUM,
]

The documentation for this class was generated from the following file: