Config Class for simple config manipulation of multiple formats.
Definition at line 62 of file Config.php.
◆ __construct()
pocketmine\utils\Config::__construct |
( |
string | $file, |
|
|
int | $type = Config::DETECT, |
|
|
array | $default = [] ) |
- Parameters
-
string | $file | Path of the file to be loaded |
int | $type | Config type to load, -1 by default (detect) |
mixed[] | $default | Array with the default values that will be written to the file if it did not exist @phpstan-param array<string, mixed> $default |
Definition at line 116 of file Config.php.
◆ __get()
pocketmine\utils\Config::__get |
( |
| $k | ) |
|
- Parameters
-
- Returns
- bool|mixed
Definition at line 313 of file Config.php.
◆ __isset()
pocketmine\utils\Config::__isset |
( |
| $k | ) |
|
- Parameters
-
- Returns
- bool
Definition at line 330 of file Config.php.
◆ __set()
pocketmine\utils\Config::__set |
( |
| $k, |
|
|
| $v ) |
◆ __unset()
pocketmine\utils\Config::__unset |
( |
| $k | ) |
|
◆ disableJsonOption()
pocketmine\utils\Config::disableJsonOption |
( |
int | $option | ) |
|
Disables the given option for the JSON encoding when saving
- Returns
- $this
- Exceptions
-
RuntimeException if the Config is not in JSON
- See also
- json_encode
Definition at line 285 of file Config.php.
◆ enableJsonOption()
pocketmine\utils\Config::enableJsonOption |
( |
int | $option | ) |
|
Enables the given option in addition to the currently set JSON options
- Returns
- $this
- Exceptions
-
RuntimeException if the Config is not in JSON
- See also
- json_encode
Definition at line 268 of file Config.php.
◆ exists()
pocketmine\utils\Config::exists |
( |
string | $k, |
|
|
bool | $lowercase = false ) |
- Parameters
-
bool | $lowercase | If set, searches Config in single-case / lowercase. |
Definition at line 436 of file Config.php.
◆ fixYAMLIndexes()
static pocketmine\utils\Config::fixYAMLIndexes |
( |
string | $str | ) |
|
|
static |
◆ get()
pocketmine\utils\Config::get |
( |
string | $k, |
|
|
mixed | $default = false ) |
◆ getAll()
pocketmine\utils\Config::getAll |
( |
bool | $keys = false | ) |
|
- Returns
- mixed[] @phpstan-return list<string>|array<string, mixed>
Definition at line 455 of file Config.php.
◆ getJsonOptions()
pocketmine\utils\Config::getJsonOptions |
( |
| ) |
|
Returns the options for the JSON encoding when saving
- Exceptions
-
RuntimeException if the Config is not in JSON
- See also
- json_encode
Definition at line 301 of file Config.php.
◆ getNested()
pocketmine\utils\Config::getNested |
( |
string | $key, |
|
|
mixed | $default = null ) |
◆ getPath()
pocketmine\utils\Config::getPath |
( |
| ) |
|
Returns the path of the config.
Definition at line 210 of file Config.php.
◆ hasChanged()
pocketmine\utils\Config::hasChanged |
( |
| ) |
|
◆ parseList()
static pocketmine\utils\Config::parseList |
( |
string | $content | ) |
|
|
static |
- Returns
- string[] @phpstan-return list<string>
Definition at line 499 of file Config.php.
◆ parseProperties()
static pocketmine\utils\Config::parseProperties |
( |
string | $content | ) |
|
|
static |
- Returns
- string[]|int[]|float[]|bool[] @phpstan-return array<string, string|int|float|bool>
Definition at line 539 of file Config.php.
◆ reload()
pocketmine\utils\Config::reload |
( |
| ) |
|
Removes all the changes in memory and loads the file again
Definition at line 123 of file Config.php.
◆ remove()
pocketmine\utils\Config::remove |
( |
string | $k | ) |
|
◆ removeNested()
pocketmine\utils\Config::removeNested |
( |
string | $key | ) |
|
◆ save()
pocketmine\utils\Config::save |
( |
| ) |
|
Flushes the config to disk in the appropriate format.
Definition at line 217 of file Config.php.
◆ set()
pocketmine\utils\Config::set |
( |
string | $k, |
|
|
mixed | $v = true ) |
◆ setAll()
pocketmine\utils\Config::setAll |
( |
array | $v | ) |
|
- Parameters
-
mixed[] | $v | @phpstan-param array<string, mixed> $v |
Definition at line 428 of file Config.php.
◆ setChanged()
pocketmine\utils\Config::setChanged |
( |
bool | $changed = true | ) |
|
◆ setDefaults()
pocketmine\utils\Config::setDefaults |
( |
array | $defaults | ) |
|
- Parameters
-
mixed[] | $defaults | @phpstan-param array<string, mixed> $defaults |
Definition at line 463 of file Config.php.
◆ setJsonOptions()
pocketmine\utils\Config::setJsonOptions |
( |
int | $options | ) |
|
Sets the options for the JSON encoding when saving
- Returns
- $this
- Exceptions
-
RuntimeException if the Config is not in JSON
- See also
- json_encode
Definition at line 251 of file Config.php.
◆ setNested()
pocketmine\utils\Config::setNested |
( |
string | $key, |
|
|
mixed | $value ) |
◆ writeList()
static pocketmine\utils\Config::writeList |
( |
array | $entries | ) |
|
|
static |
- Parameters
-
string[] | $entries | @phpstan-param list<string> $entries |
Definition at line 515 of file Config.php.
◆ writeProperties()
static pocketmine\utils\Config::writeProperties |
( |
array | $config | ) |
|
|
static |
- Parameters
-
string[] | int[] | float[] | bool[] | $config | @phpstan-param array<string, string|int|float|bool> $config |
Definition at line 523 of file Config.php.
◆ $formats
array pocketmine\utils\Config::$formats |
|
static |
Initial value:= [
"properties" => Config::PROPERTIES,
"cnf" => 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
]
Definition at line 92 of file Config.php.
◆ CNF
const pocketmine\utils\Config::CNF = Config::PROPERTIES |
◆ DETECT
const pocketmine\utils\Config::DETECT = -1 |
◆ ENUM
const pocketmine\utils\Config::ENUM = 5 |
◆ ENUMERATION
const pocketmine\utils\Config::ENUMERATION = Config::ENUM |
◆ JSON
const pocketmine\utils\Config::JSON = 1 |
◆ PROPERTIES
const pocketmine\utils\Config::PROPERTIES = 0 |
◆ SERIALIZED
const pocketmine\utils\Config::SERIALIZED = 4 |
◆ YAML
const pocketmine\utils\Config::YAML = 2 |
The documentation for this class was generated from the following file: