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

Commit 315427f

Browse files
committed
Merge branch 'feature/3' into develop
Close #3
2 parents 29fd1d4 + 1a698b3 commit 315427f

File tree

6 files changed

+114
-95
lines changed

6 files changed

+114
-95
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file, in reverse chronological order by release.
4+
5+
## 3.0.0 - TBD
6+
7+
### Added
8+
9+
- Nothing.
10+
11+
### Deprecated
12+
13+
- Nothing.
14+
15+
### Removed
16+
17+
- Nothing.
18+
19+
### Fixed
20+
21+
- [#3](https://github.com/zendframework/zend-tag/pull/3) updates the component
22+
to use zend-servicemanager v3.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"require-dev": {
2121
"zendframework/zend-config": "~2.5",
22-
"zendframework/zend-servicemanager": "~2.5",
22+
"zendframework/zend-servicemanager": "dev-develop as 2.7.0",
2323
"fabpot/php-cs-fixer": "1.7.*",
2424
"phpunit/PHPUnit": "~4.0"
2525
},
@@ -31,7 +31,7 @@
3131
"extra": {
3232
"branch-alias": {
3333
"dev-master": "2.5-dev",
34-
"dev-develop": "2.6-dev"
34+
"dev-develop": "3.0-dev"
3535
}
3636
},
3737
"autoload-dev": {

src/Cloud.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
namespace Zend\Tag;
1111

1212
use Traversable;
13+
use Zend\ServiceManager\ServiceManager;
1314
use Zend\Stdlib\ArrayUtils;
15+
use Zend\Tag\Cloud\Decorator\HtmlCloud;
16+
use Zend\Tag\Cloud\Decorator\HtmlTag;
1417

1518
class Cloud
1619
{
@@ -208,7 +211,7 @@ public function setCloudDecorator($decorator)
208211
public function getCloudDecorator()
209212
{
210213
if (null === $this->cloudDecorator) {
211-
$this->setCloudDecorator('htmlCloud');
214+
$this->setCloudDecorator(HtmlCloud::class);
212215
}
213216
return $this->cloudDecorator;
214217
}
@@ -255,7 +258,7 @@ public function setTagDecorator($decorator)
255258
public function getTagDecorator()
256259
{
257260
if (null === $this->tagDecorator) {
258-
$this->setTagDecorator('htmlTag');
261+
$this->setTagDecorator(HtmlTag::class);
259262
}
260263
return $this->tagDecorator;
261264
}
@@ -280,7 +283,7 @@ public function setDecoratorPluginManager(Cloud\DecoratorPluginManager $decorato
280283
public function getDecoratorPluginManager()
281284
{
282285
if ($this->decorators === null) {
283-
$this->decorators = new Cloud\DecoratorPluginManager();
286+
$this->decorators = new Cloud\DecoratorPluginManager(new ServiceManager());
284287
}
285288

286289
return $this->decorators;

src/Cloud/DecoratorPluginManager.php

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace Zend\Tag\Cloud;
1111

1212
use Zend\ServiceManager\AbstractPluginManager;
13-
use Zend\Tag\Exception;
13+
use Zend\ServiceManager\Factory\InvokableFactory;
1414

1515
/**
1616
* Plugin manager implementation for decorators.
@@ -21,38 +21,23 @@
2121
*/
2222
class DecoratorPluginManager extends AbstractPluginManager
2323
{
24-
/**
25-
* Default set of decorators
26-
*
27-
* @var array
28-
*/
29-
protected $invokableClasses = [
30-
'htmlcloud' => 'Zend\Tag\Cloud\Decorator\HtmlCloud',
31-
'htmltag' => 'Zend\Tag\Cloud\Decorator\HtmlTag',
32-
'tag' => 'Zend\Tag\Cloud\Decorator\HtmlTag',
24+
protected $aliases = [
25+
'htmlcloud' => Decorator\HtmlCloud::class,
26+
'htmlCloud' => Decorator\HtmlCloud::class,
27+
'Htmlcloud' => Decorator\HtmlCloud::class,
28+
'HtmlCloud' => Decorator\HtmlCloud::class,
29+
'htmltag' => Decorator\HtmlTag::class,
30+
'htmlTag' => Decorator\HtmlTag::class,
31+
'Htmltag' => Decorator\HtmlTag::class,
32+
'HtmlTag' => Decorator\HtmlTag::class,
33+
'tag' => Decorator\HtmlTag::class,
34+
'Tag' => Decorator\HtmlTag::class,
3335
];
3436

35-
/**
36-
* Validate the plugin
37-
*
38-
* Checks that the decorator loaded is an instance
39-
* of Decorator\DecoratorInterface.
40-
*
41-
* @param mixed $plugin
42-
* @return void
43-
* @throws Exception\InvalidArgumentException if invalid
44-
*/
45-
public function validatePlugin($plugin)
46-
{
47-
if ($plugin instanceof Decorator\DecoratorInterface) {
48-
// we're okay
49-
return;
50-
}
37+
protected $factories = [
38+
Decorator\HtmlCloud::class => InvokableFactory::class,
39+
Decorator\HtmlTag::class => InvokableFactory::class,
40+
];
5141

52-
throw new Exception\InvalidArgumentException(sprintf(
53-
'Plugin of type %s is invalid; must implement %s\Decorator\DecoratorInterface',
54-
(is_object($plugin) ? get_class($plugin) : gettype($plugin)),
55-
__NAMESPACE__
56-
));
57-
}
42+
protected $instanceOf = Decorator\DecoratorInterface::class;
5843
}

0 commit comments

Comments
 (0)