PatchBase: dirty adaptation of json parser for yaml files
This commit is contained in:
parent
0d92958a84
commit
9f682b5465
1 changed files with 14 additions and 0 deletions
|
|
@ -46,6 +46,17 @@ abstract class PatchBase {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
protected function fetch_yaml(string $url) : bool {
|
||||
$str = $this->curl($url);
|
||||
if ($str) {
|
||||
if (!($this->data = yaml_parse($str)))
|
||||
return false;
|
||||
//if ($this->array_isMulti($this->data))
|
||||
// $this->data = array_shift($this->data);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
protected function parse(string $re) : bool {
|
||||
if ($str = $this->regex_str($re)) {
|
||||
$this->patch->setVersion($str, true);
|
||||
|
|
@ -61,6 +72,9 @@ abstract class PatchBase {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
protected function parse_yaml(string $key, string $re = '/(.*)/') : bool {
|
||||
return $this->parse_json($key, $re);
|
||||
}
|
||||
private function array_isMulti(array $arr) : bool {
|
||||
foreach ($arr as $val) {
|
||||
if (!is_array($val))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue