Fix gitignore: missing file PicoFeed/Config.php

This commit is contained in:
Frédéric Guillot 2014-05-20 20:24:20 -04:00
parent 3840a87128
commit c5ed4d97be
2 changed files with 45 additions and 0 deletions

1
.gitignore vendored
View File

@ -43,5 +43,6 @@ Thumbs.db
# App specific #
################
config.php
!vendor/PicoFeed/*
!models/*
!controllers/*

44
vendor/PicoFeed/Config.php vendored Normal file
View 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;
}
}
}