mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 03:06:55 +00:00
phpdoc armageddon for master, pass 1
This commit is contained in:
@ -129,20 +129,11 @@ class Config{
|
||||
$this->changed = $changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function fixYAMLIndexes(string $str) : string{
|
||||
return preg_replace("#^( *)(y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)( *)\:#m", "$1\"$2\"$3:", $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
* @param int $type
|
||||
* @param array $default
|
||||
*
|
||||
* @throws \InvalidArgumentException if config type could not be auto-detected
|
||||
* @throws \InvalidStateException if config type is invalid
|
||||
*/
|
||||
@ -196,8 +187,6 @@ class Config{
|
||||
|
||||
/**
|
||||
* Returns the path of the config.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPath() : string{
|
||||
return $this->file;
|
||||
@ -238,8 +227,6 @@ class Config{
|
||||
/**
|
||||
* Sets the options for the JSON encoding when saving
|
||||
*
|
||||
* @param int $options
|
||||
*
|
||||
* @return Config $this
|
||||
* @throws \RuntimeException if the Config is not in JSON
|
||||
* @see json_encode
|
||||
@ -257,8 +244,6 @@ class Config{
|
||||
/**
|
||||
* Enables the given option in addition to the currently set JSON options
|
||||
*
|
||||
* @param int $option
|
||||
*
|
||||
* @return Config $this
|
||||
* @throws \RuntimeException if the Config is not in JSON
|
||||
* @see json_encode
|
||||
@ -276,8 +261,6 @@ class Config{
|
||||
/**
|
||||
* Disables the given option for the JSON encoding when saving
|
||||
*
|
||||
* @param int $option
|
||||
*
|
||||
* @return Config $this
|
||||
* @throws \RuntimeException if the Config is not in JSON
|
||||
* @see json_encode
|
||||
@ -295,7 +278,6 @@ class Config{
|
||||
/**
|
||||
* Returns the options for the JSON encoding when saving
|
||||
*
|
||||
* @return int
|
||||
* @throws \RuntimeException if the Config is not in JSON
|
||||
* @see json_encode
|
||||
*/
|
||||
@ -442,9 +424,6 @@ class Config{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $v
|
||||
*/
|
||||
public function setAll(array $v) : void{
|
||||
$this->config = $v;
|
||||
$this->changed = true;
|
||||
@ -453,8 +432,6 @@ class Config{
|
||||
/**
|
||||
* @param string $k
|
||||
* @param bool $lowercase If set, searches Config in single-case / lowercase.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function exists($k, bool $lowercase = false) : bool{
|
||||
if($lowercase){
|
||||
@ -474,27 +451,16 @@ class Config{
|
||||
$this->changed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAll(bool $keys = false) : array{
|
||||
return ($keys ? array_keys($this->config) : $this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $defaults
|
||||
*/
|
||||
public function setDefaults(array $defaults) : void{
|
||||
$this->fillDefaults($defaults, $this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $default
|
||||
* @param array $data reference parameter
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function fillDefaults(array $default, &$data) : int{
|
||||
$changed = 0;
|
||||
@ -517,9 +483,6 @@ class Config{
|
||||
return $changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
private function parseList(string $content) : void{
|
||||
foreach(explode("\n", trim(str_replace("\r\n", "\n", $content))) as $v){
|
||||
$v = trim($v);
|
||||
@ -530,9 +493,6 @@ class Config{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function writeProperties() : string{
|
||||
$content = "#Properties Config file\r\n#" . date("D M j H:i:s T Y") . "\r\n";
|
||||
foreach($this->config as $k => $v){
|
||||
@ -547,9 +507,6 @@ class Config{
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
private function parseProperties(string $content) : void{
|
||||
if(preg_match_all('/^\s*([a-zA-Z0-9\-_\.]+)[ \t]*=([^\r\n]*)/um', $content, $matches) > 0){ //false or 0 matches
|
||||
foreach($matches[1] as $i => $k){
|
||||
|
Reference in New Issue
Block a user