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 remote-tracking branch 'upstream/master'
Conflicts: library/Zend/Soap/Wsdl.php tests/Zend/Soap/Server/DocumentLiteralWrapperTest.php tests/Zend/Soap/WsdlTest.php
- Loading branch information
Grzegorz Drozd
committed
Jan 25, 2013
101 parents
46b0d8f
+
82264b3
+
39c88ce
+
cee064b
+
c303bed
+
ea247e3
+
1f87514
+
8896fc2
+
313a38d
+
42848d4
+
8f5c457
+
e035a2a
+
544e341
+
467f8b2
+
30bb6f0
+
f8cc896
+
2ee0afd
+
656f0b0
+
7092cb4
+
5e1b259
+
abb3ff8
+
39a873f
+
b6e6c92
+
83055d8
+
1dd5d72
+
9bc304a
+
479b8c7
+
41fab24
+
80aee85
+
3962f1e
+
6c6b004
+
acb7af7
+
39aca71
+
9d55623
+
8e87de6
+
754bd9a
+
c36f6c0
+
3ead99d
+
be05873
+
34e7aec
+
2fcaf1c
+
3f9b994
+
ea3acc3
+
fe35f10
+
45cc91b
+
aa77760
+
4959b82
+
35e2edb
+
7717bd8
+
127fcbd
+
fc52973
+
528f461
+
8e251cd
+
d95b25a
+
0f89697
+
c941b0e
+
3dc45ae
+
180e140
+
67c3033
+
533cd3e
+
29e7718
+
936c9be
+
2d11657
+
fa66751
+
2b778cc
+
ba628cd
+
ff761e1
+
5b64ee3
+
9456811
+
1c2d797
+
c2210f2
+
50b7a31
+
327d366
+
00cfdb8
+
77c12db
+
4a66170
+
4bd5c7f
+
9549d20
+
d3a95e2
+
5e04377
+
d9da2cf
+
1049b39
+
001d281
+
ca437e5
+
a5cb2da
+
e2db3b8
+
27f50b4
+
8008d6f
+
4a6bead
+
e2df9ad
+
9045ea9
+
0d18a05
+
48cc7df
+
dc08391
+
ceec2bd
+
c5fc623
+
6335bda
+
2a78ec6
+
56c198e
+
3fab1eb
+
6e15982
commit 541f1f3
Showing
39 changed files
with
2,018 additions
and
474 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,28 +1,31 @@ | ||
{ | ||
"name": "zendframework/zend-service-manager", | ||
"description": "Zend\\ServiceManager component", | ||
"name": "zendframework/zend-servicemanager", | ||
"description": " ", | ||
"license": "BSD-3-Clause", | ||
"keywords": [ | ||
"zf2", | ||
"service-manager" | ||
"servicemanager" | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Zend\\ServiceManager\\": "src/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=5.3.23" | ||
"php": ">=5.3.3" | ||
}, | ||
"require-dev": { | ||
"fabpot/php-cs-fixer": "1.7.*", | ||
"satooshi/php-coveralls": "dev-master", | ||
"phpunit/PHPUnit": "~4.0" | ||
"suggest": { | ||
"zendframework/zend-di": "Zend\\Di component" | ||
}, | ||
"homepage": "https://github.com/zendframework/zend-service-manager", | ||
"autoload-dev": { | ||
"psr-4": { | ||
"ZendTest\\ServiceManager\\": "test/" | ||
} | ||
}, | ||
"require-dev": { | ||
"fabpot/php-cs-fixer": "1.7.*", | ||
"satooshi/php-coveralls": "dev-master", | ||
"phpunit/PHPUnit": "~4.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,38 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link https://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_ServiceManager | ||
*/ | ||
|
||
namespace Zend\ServiceManager; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_ServiceManager | ||
*/ | ||
interface AbstractFactoryInterface | ||
{ | ||
public function canCreateServiceWithName($name /*, $requestedName */); | ||
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name /*, $requestedName */); | ||
/** | ||
* Determine if we can create a service with name | ||
* | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @param $name | ||
* @param $requestedName | ||
* @return bool | ||
*/ | ||
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName); | ||
|
||
/** | ||
* Create service with name | ||
* | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @param $name | ||
* @param $requestedName | ||
* @return mixed | ||
*/ | ||
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName); | ||
} |
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,221 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link https://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_ServiceManager | ||
*/ | ||
|
||
namespace Zend\ServiceManager; | ||
|
||
/** | ||
* ServiceManager implementation for managing plugins | ||
* | ||
* Automatically registers an initializer which should be used to verify that | ||
* a plugin instance is of a valid type. Additionally, allows plugins to accept | ||
* an array of options for the constructor, which can be used to configure | ||
* the plugin when retrieved. Finally, enables the allowOverride property by | ||
* default to allow registering factories, aliases, and invokables to take | ||
* the place of those provided by the implementing class. | ||
* | ||
* @category Zend | ||
* @package Zend_ServiceManager | ||
*/ | ||
abstract class AbstractPluginManager extends ServiceManager implements ServiceLocatorAwareInterface | ||
{ | ||
/** | ||
* Allow overriding by default | ||
* | ||
* @var bool | ||
*/ | ||
protected $allowOverride = true; | ||
|
||
/** | ||
* Whether or not to auto-add a class as an invokable class if it exists | ||
* | ||
* @var bool | ||
*/ | ||
protected $autoAddInvokableClass = true; | ||
|
||
/** | ||
* Options to use when creating an instance | ||
* | ||
* @var mixed | ||
*/ | ||
protected $creationOptions = null; | ||
|
||
/** | ||
* The main service locator | ||
* | ||
* @var ServiceLocatorInterface | ||
*/ | ||
protected $serviceLocator; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* Add a default initializer to ensure the plugin is valid after instance | ||
* creation. | ||
* | ||
* @param null|ConfigInterface $configuration | ||
*/ | ||
public function __construct(ConfigInterface $configuration = null) | ||
{ | ||
parent::__construct($configuration); | ||
$self = $this; | ||
$this->addInitializer(function ($instance) use ($self) { | ||
if ($instance instanceof ServiceLocatorAwareInterface) { | ||
$instance->setServiceLocator($self); | ||
} | ||
if ($instance instanceof ServiceManagerAwareInterface) { | ||
$instance->setServiceManager($self); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Validate the plugin | ||
* | ||
* Checks that the filter loaded is either a valid callback or an instance | ||
* of FilterInterface. | ||
* | ||
* @param mixed $plugin | ||
* @return void | ||
* @throws Exception\RuntimeException if invalid | ||
*/ | ||
abstract public function validatePlugin($plugin); | ||
|
||
/** | ||
* Retrieve a service from the manager by name | ||
* | ||
* Allows passing an array of options to use when creating the instance. | ||
* createFromInvokable() will use these and pass them to the instance | ||
* constructor if not null and a non-empty array. | ||
* | ||
* @param string $name | ||
* @param array $options | ||
* @param bool $usePeeringServiceManagers | ||
* @return object | ||
*/ | ||
public function get($name, $options = array(), $usePeeringServiceManagers = true) | ||
{ | ||
// Allow specifying a class name directly; registers as an invokable class | ||
if (!$this->has($name) && $this->autoAddInvokableClass && class_exists($name)) { | ||
$this->setInvokableClass($name, $name); | ||
} | ||
|
||
$this->creationOptions = $options; | ||
$instance = parent::get($name, $usePeeringServiceManagers); | ||
$this->creationOptions = null; | ||
$this->validatePlugin($instance); | ||
return $instance; | ||
} | ||
|
||
/** | ||
* Register a service with the locator. | ||
* | ||
* Validates that the service object via validatePlugin() prior to | ||
* attempting to register it. | ||
* | ||
* @param string $name | ||
* @param mixed $service | ||
* @param bool $shared | ||
* @return AbstractPluginManager | ||
* @throws Exception\InvalidServiceNameException | ||
*/ | ||
public function setService($name, $service, $shared = true) | ||
{ | ||
if ($service) { | ||
$this->validatePlugin($service); | ||
} | ||
parent::setService($name, $service, $shared); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Set the main service locator so factories can have access to it to pull deps | ||
* | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return AbstractPluginManager | ||
*/ | ||
public function setServiceLocator(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$this->serviceLocator = $serviceLocator; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Get the main plugin manager. Useful for fetching dependencies from within factories. | ||
* | ||
* @return mixed | ||
*/ | ||
public function getServiceLocator() | ||
{ | ||
return $this->serviceLocator; | ||
} | ||
|
||
/** | ||
* Attempt to create an instance via an invokable class | ||
* | ||
* Overrides parent implementation by passing $creationOptions to the | ||
* constructor, if non-null. | ||
* | ||
* @param string $canonicalName | ||
* @param string $requestedName | ||
* @return null|\stdClass | ||
* @throws Exception\ServiceNotCreatedException If resolved class does not exist | ||
*/ | ||
protected function createFromInvokable($canonicalName, $requestedName) | ||
{ | ||
$invokable = $this->invokableClasses[$canonicalName]; | ||
|
||
if (null === $this->creationOptions | ||
|| (is_array($this->creationOptions) && empty($this->creationOptions)) | ||
) { | ||
$instance = new $invokable(); | ||
} else { | ||
$instance = new $invokable($this->creationOptions); | ||
} | ||
|
||
return $instance; | ||
} | ||
|
||
/** | ||
* Attempt to create an instance via a factory class | ||
* | ||
* Overrides parent implementation by passing $creationOptions to the | ||
* constructor, if non-null. | ||
* | ||
* @param string $canonicalName | ||
* @param string $requestedName | ||
* @return mixed | ||
* @throws Exception\ServiceNotCreatedException If factory is not callable | ||
*/ | ||
protected function createFromFactory($canonicalName, $requestedName) | ||
{ | ||
$factory = $this->factories[$canonicalName]; | ||
if (is_string($factory) && class_exists($factory, true)) { | ||
if (null === $this->creationOptions || (is_array($this->creationOptions) && empty($this->creationOptions))) { | ||
$factory = new $factory(); | ||
} else { | ||
$factory = new $factory($this->creationOptions); | ||
} | ||
|
||
$this->factories[$canonicalName] = $factory; | ||
} | ||
|
||
if ($factory instanceof FactoryInterface) { | ||
$instance = $this->createServiceViaCallback(array($factory, 'createService'), $canonicalName, $requestedName); | ||
} elseif (is_callable($factory)) { | ||
$instance = $this->createServiceViaCallback($factory, $canonicalName, $requestedName); | ||
} else { | ||
throw new Exception\ServiceNotCreatedException(sprintf( | ||
'While attempting to create %s%s an invalid factory was registered for this instance type.', $canonicalName, ($requestedName ? '(alias: ' . $requestedName . ')' : '') | ||
)); | ||
} | ||
|
||
return $instance; | ||
} | ||
} |
Oops, something went wrong.