diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-07 12:32:05 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-07 12:32:05 +0100 |
commit | 7f81afd7efbeb931d16ce1f3a1ed53a54226d553 (patch) | |
tree | 180720cd96aa66ae8964f13734e090d4b82a178e /vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php | |
parent | a6d6288e65aa416aca7535e81d9e8837c2cfb103 (diff) |
move 3rdparty directory to vendor to be more consistent with composer standard and because we also use js/vendor for third party libs
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php')
-rw-r--r-- | vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php b/vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php new file mode 100644 index 000000000..298b9a2d7 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php @@ -0,0 +1,90 @@ +<?php + +namespace PicoFeed\Config; + +/** + * Config class + * + * @author Frederic Guillot + * @package picofeed + * + * @method \PicoFeed\Config\Config setClientTimeout(integer $value) + * @method \PicoFeed\Config\Config setClientUserAgent(string $value) + * @method \PicoFeed\Config\Config setMaxRedirections(integer $value) + * @method \PicoFeed\Config\Config setMaxBodySize(integer $value) + * @method \PicoFeed\Config\Config setProxyHostname(string $value) + * @method \PicoFeed\Config\Config setProxyPort(integer $value) + * @method \PicoFeed\Config\Config setProxyUsername(string $value) + * @method \PicoFeed\Config\Config setProxyPassword(string $value) + * @method \PicoFeed\Config\Config setGrabberTimeout(integer $value) + * @method \PicoFeed\Config\Config setGrabberUserAgent(string $value) + * @method \PicoFeed\Config\Config setParserHashAlgo(string $value) + * @method \PicoFeed\Config\Config setContentFiltering(boolean $value) + * @method \PicoFeed\Config\Config setTimezone(string $value) + * @method \PicoFeed\Config\Config setFilterIframeWhitelist(array $value) + * @method \PicoFeed\Config\Config setFilterIntegerAttributes(array $value) + * @method \PicoFeed\Config\Config setFilterAttributeOverrides(array $value) + * @method \PicoFeed\Config\Config setFilterRequiredAttributes(array $value) + * @method \PicoFeed\Config\Config setFilterMediaBlacklist(array $value) + * @method \PicoFeed\Config\Config setFilterMediaAttributes(array $value) + * @method \PicoFeed\Config\Config setFilterSchemeWhitelist(array $value) + * @method \PicoFeed\Config\Config setFilterWhitelistedTags(array $value) + * @method \PicoFeed\Config\Config setFilterBlacklistedTags(array $value) + * + * @method integer getClientTimeout() + * @method string getClientUserAgent() + * @method integer getMaxRedirections() + * @method integer getMaxBodySize() + * @method string getProxyHostname() + * @method integer getProxyPort() + * @method string getProxyUsername() + * @method string getProxyPassword() + * @method integer getGrabberTimeout() + * @method string getGrabberUserAgent() + * @method string getParserHashAlgo() + * @method boolean getContentFiltering(bool $default_value) + * @method string getTimezone() + * @method array getFilterIframeWhitelist(array $default_value) + * @method array getFilterIntegerAttributes(array $default_value) + * @method array getFilterAttributeOverrides(array $default_value) + * @method array getFilterRequiredAttributes(array $default_value) + * @method array getFilterMediaBlacklist(array $default_value) + * @method array getFilterMediaAttributes(array $default_value) + * @method array getFilterSchemeWhitelist(array $default_value) + * @method array getFilterWhitelistedTags(array $default_value) + * @method array getFilterBlacklistedTags(array $default_value) + */ +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; + } + } +} |