Implement Section::toArray()

refs #10150
This commit is contained in:
Alexander A. Klimov 2015-09-22 14:03:19 +02:00
parent b441156934
commit 777c4d0baf
1 changed files with 14 additions and 0 deletions

View File

@ -169,4 +169,18 @@ class Section
$str = str_replace(';', '\\;', $str);
return str_replace(PHP_EOL, ' ', $str);
}
/**
* Convert $this to an array
*
* @return array
*/
public function toArray()
{
$a = array();
foreach ($this->directives as $directive) {
$a[$directive->getKey()] = $directive->getValue();
}
return $a;
}
}