This repository has been archived by the owner on Feb 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/81' into release-2.7
Close #81
- Loading branch information
Showing
3 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\ServiceManager\TestAsset; | ||
|
||
use Zend\ServiceManager\AbstractPluginManager; | ||
use Zend\ServiceManager\Exception\InvalidServiceException; | ||
use Zend\ServiceManager\Factory\InvokableFactory; | ||
|
||
class V2v3PluginManager extends AbstractPluginManager | ||
{ | ||
protected $aliases = [ | ||
'foo' => InvokableObject::class, | ||
]; | ||
|
||
protected $factories = [ | ||
InvokableObject::class => InvokableFactory::class, | ||
// Legacy (v2) due to alias resolution | ||
'zendtestservicemanagertestassetinvokableobject' => InvokableFactory::class, | ||
]; | ||
|
||
protected $instanceOf = InvokableObject::class; | ||
|
||
|
||
public function validate($plugin) | ||
{ | ||
if ($plugin instanceof $this->instanceOf) { | ||
return; | ||
} | ||
|
||
throw new InvalidServiceException(sprintf( | ||
"'%s' is not an instance of '%s'", | ||
get_class($plugin), | ||
$this->instanceOf | ||
)); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function validatePlugin($plugin) | ||
{ | ||
$this->validate($plugin); | ||
} | ||
} |