update config
This commit is contained in:
parent
081e90ede2
commit
ec3976e39a
@ -5,7 +5,7 @@ namespace DavidBadura\Taskwarrior;
|
||||
/**
|
||||
* @author David Badura <d.a.badura@gmail.com>
|
||||
*/
|
||||
class Config
|
||||
class Config implements \IteratorAggregate, \Countable
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
@ -42,11 +42,35 @@ class Config
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
public function keys()
|
||||
{
|
||||
return array_keys($this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @return array
|
||||
@ -64,6 +88,12 @@ class Config
|
||||
|
||||
list($key, $value) = explode('=', $line);
|
||||
|
||||
if ($value == 'no' || $value == 'off') {
|
||||
$value = false;
|
||||
} elseif ($value == 'yes' || $value == 'on') {
|
||||
$value = true;
|
||||
}
|
||||
|
||||
$config[$key] = $value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user