Fix gitignore: missing file PicoFeed/Config.php
This commit is contained in:
parent
3840a87128
commit
c5ed4d97be
1
.gitignore
vendored
1
.gitignore
vendored
@ -43,5 +43,6 @@ Thumbs.db
|
||||
# App specific #
|
||||
################
|
||||
config.php
|
||||
!vendor/PicoFeed/*
|
||||
!models/*
|
||||
!controllers/*
|
||||
|
44
vendor/PicoFeed/Config.php
vendored
Normal file
44
vendor/PicoFeed/Config.php
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace PicoFeed;
|
||||
|
||||
/**
|
||||
* Config class
|
||||
*
|
||||
* @author Frederic Guillot
|
||||
* @package picofeed
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
/**
|
||||
* Contains all parameters
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $container = array();
|
||||
|
||||
/**
|
||||
* Magic method to have any kind of setters or getters
|
||||
*
|
||||
* @access public
|
||||
* @param string $name Getter/Setter name
|
||||
* @param array $arguments Method arguments
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name , array $arguments)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
$prefix = substr($name, 0, 3);
|
||||
$parameter = substr($name, 3);
|
||||
|
||||
if ($prefix === 'set' && isset($arguments[0])) {
|
||||
$this->container[$parameter] = $arguments[0];
|
||||
return $this;
|
||||
}
|
||||
else if ($prefix === 'get') {
|
||||
$default_value = isset($arguments[0]) ? $arguments[0] : null;
|
||||
return isset($this->container[$parameter]) ? $this->container[$parameter] : $default_value;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user