/library/Zend/Tag/Cloud/Decorator/Cloud.php
PHP | 86 lines | 32 code | 8 blank | 46 comment | 4 complexity | b62cdd3a961d73b68c0f94d45d05e6ef MD5 | raw file
Possible License(s): BSD-3-Clause
- <?php
- /**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Tag
- * @subpackage Cloud
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
- /**
- * @namespace
- */
- namespace Zend\Tag\Cloud\Decorator;
- use Zend\Tag\Cloud\Decorator;
- /**
- * Abstract class for cloud decorators
- *
- * @category Zend
- * @package Zend_Tag
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
- abstract class Cloud implements Decorator
- {
- /**
- * Option keys to skip when calling setOptions()
- *
- * @var array
- */
- protected $_skipOptions = array(
- 'options',
- 'config',
- );
- /**
- * Create a new cloud decorator with options
- *
- * @param mixed $options
- */
- public function __construct($options = null)
- {
- if ($options instanceof \Zend\Config\Config) {
- $options = $options->toArray();
- }
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
- /**
- * Set options from array
- *
- * @param array $options Configuration for the decorator
- * @return \Zend\Tag\Cloud
- */
- public function setOptions(array $options)
- {
- foreach ($options as $key => $value) {
- if (in_array(strtolower($key), $this->_skipOptions)) {
- continue;
- }
- $method = 'set' . $key;
- if (method_exists($this, $method)) {
- $this->$method($value);
- }
- }
- return $this;
- }
- }