Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 26 changed files with 198 additions and 450 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zendframework/zend-tag",
"description": "Zend\\Tag component",
"description": "a component suite which provides a facility to work with taggable Items",
"license": "BSD-3-Clause",
"keywords": [
"zf2",
Expand All @@ -9,11 +9,11 @@
"homepage": "https://github.com/zendframework/zend-tag",
"autoload": {
"psr-4": {
"Zend\\Tag\\": "src/"
"Zend\\Tag": "src/"
}
},
"require": {
"php": ">=5.3.23",
"php": ">=5.3.3",
"zendframework/zend-escaper": "self.version",
"zendframework/zend-stdlib": "self.version"
},
Expand Down
76 changes: 29 additions & 47 deletions src/Cloud.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* 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
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Tag
*/

namespace Zend\Tag;
Expand All @@ -27,8 +16,6 @@
/**
* @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
*/
class Cloud
{
Expand All @@ -37,35 +24,35 @@ class Cloud
*
* @var Cloud
*/
protected $_cloudDecorator = null;
protected $cloudDecorator = null;

/**
* DecoratorInterface for the tags
*
* @var Tag
*/
protected $_tagDecorator = null;
protected $tagDecorator = null;

/**
* List of all tags
*
* @var ItemList
*/
protected $_tags = null;
protected $tags = null;

/**
* Plugin manager for decorators
*
* @var Cloud\DecoratorPluginManager
*/
protected $_decorators = null;
protected $decorators = null;

/**
* Option keys to skip when calling setOptions()
*
* @var array
*/
protected $_skipOptions = array(
protected $skipOptions = array(
'options',
'config',
);
Expand Down Expand Up @@ -93,17 +80,12 @@ public function __construct($options = null)
*/
public function setOptions(array $options)
{
if (isset($options['prefixPath'])) {
$this->addPrefixPaths($options['prefixPath']);
unset($options['prefixPath']);
}

foreach ($options as $key => $value) {
if (in_array(strtolower($key), $this->_skipOptions)) {
if (in_array(strtolower($key), $this->skipOptions)) {
continue;
}

$method = 'set' . ucfirst($key);
$method = 'set' . $key;
if (method_exists($this, $method)) {
$this->$method($value);
}
Expand Down Expand Up @@ -147,7 +129,7 @@ public function appendTag($tag)
if ($tag instanceof TaggableInterface) {
$tags[] = $tag;
return $this;
}
}

if (!is_array($tag)) {
throw new Exception\InvalidArgumentException(sprintf(
Expand All @@ -170,7 +152,7 @@ public function appendTag($tag)
*/
public function setItemList(ItemList $itemList)
{
$this->_tags = $itemList;
$this->tags = $itemList;
return $this;
}

Expand All @@ -183,10 +165,10 @@ public function setItemList(ItemList $itemList)
*/
public function getItemList()
{
if (null === $this->_tags) {
if (null === $this->tags) {
$this->setItemList(new ItemList());
}
return $this->_tags;
return $this->tags;
}

/**
Expand Down Expand Up @@ -214,11 +196,11 @@ public function setCloudDecorator($decorator)
$decorator = $this->getDecoratorPluginManager()->get($decorator, $options);
}

if (!($decorator instanceof Cloud\Decorator\Cloud)) {
throw new Exception\InvalidArgumentException('DecoratorInterface is no instance of Cloud\Decorator\Cloud');
if (!($decorator instanceof Cloud\Decorator\AbstractCloud)) {
throw new Exception\InvalidArgumentException('DecoratorInterface is no instance of Cloud\Decorator\AbstractCloud');
}

$this->_cloudDecorator = $decorator;
$this->cloudDecorator = $decorator;

return $this;
}
Expand All @@ -230,10 +212,10 @@ public function setCloudDecorator($decorator)
*/
public function getCloudDecorator()
{
if (null === $this->_cloudDecorator) {
if (null === $this->cloudDecorator) {
$this->setCloudDecorator('htmlCloud');
}
return $this->_cloudDecorator;
return $this->cloudDecorator;
}

/**
Expand Down Expand Up @@ -261,11 +243,11 @@ public function setTagDecorator($decorator)
$decorator = $this->getDecoratorPluginManager()->get($decorator, $options);
}

if (!($decorator instanceof Cloud\Decorator\Tag)) {
if (!($decorator instanceof Cloud\Decorator\AbstractTag)) {
throw new Exception\InvalidArgumentException('DecoratorInterface is no instance of Cloud\Decorator\Tag');
}

$this->_tagDecorator = $decorator;
$this->tagDecorator = $decorator;

return $this;
}
Expand All @@ -277,10 +259,10 @@ public function setTagDecorator($decorator)
*/
public function getTagDecorator()
{
if (null === $this->_tagDecorator) {
if (null === $this->tagDecorator) {
$this->setTagDecorator('htmlTag');
}
return $this->_tagDecorator;
return $this->tagDecorator;
}

/**
Expand All @@ -291,7 +273,7 @@ public function getTagDecorator()
*/
public function setDecoratorPluginManager(Cloud\DecoratorPluginManager $decorators)
{
$this->_decorators = $decorators;
$this->decorators = $decorators;
return $this;
}

Expand All @@ -302,11 +284,11 @@ public function setDecoratorPluginManager(Cloud\DecoratorPluginManager $decorato
*/
public function getDecoratorPluginManager()
{
if ($this->_decorators === null) {
$this->_decorators = new Cloud\DecoratorPluginManager();
if ($this->decorators === null) {
$this->decorators = new Cloud\DecoratorPluginManager();
}

return $this->_decorators;
return $this->decorators;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* 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
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Tag
*/

namespace Zend\Tag\Cloud\Decorator;
Expand All @@ -30,10 +19,8 @@
*
* @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
abstract class AbstractCloud implements Decorator
{
/**
* Option keys to skip when calling setOptions()
Expand Down Expand Up @@ -64,7 +51,7 @@ public function __construct($options = null)
* Set options from array
*
* @param array $options Configuration for the decorator
* @return \Zend\Tag\Cloud
* @return AbstractCloud
*/
public function setOptions(array $options)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* 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
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Tag
*/

namespace Zend\Tag\Cloud\Decorator;
Expand All @@ -30,10 +19,8 @@
*
* @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 Tag implements Decorator
abstract class AbstractTag implements Decorator
{
/**
* Option keys to skip when calling setOptions()
Expand Down Expand Up @@ -64,7 +51,7 @@ public function __construct($options = null)
* Set options from array
*
* @param array $options Configuration for the decorator
* @return \Zend\Tag\Cloud
* @return AbstractTag
*/
public function setOptions(array $options)
{
Expand Down
31 changes: 9 additions & 22 deletions src/Cloud/Decorator/DecoratorInterface.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* 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
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Tag
*/

namespace Zend\Tag\Cloud\Decorator;
Expand All @@ -27,25 +16,23 @@
* @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
*/
interface DecoratorInterface
{
/**
* Constructor
*
* Allow passing options to the constructor.
*
* @param mixed $options
*
* @param mixed $options
* @return void
*/
public function __construct($options = null);

/**
* Render a list of tags
*
* @param mixed $tags
*
* @param mixed $tags
* @return string
*/
public function render($tags);
Expand Down
Loading

0 comments on commit 65eecd8

Please sign in to comment.