This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathHelperConfig.php
62 lines (55 loc) · 1.69 KB
/
HelperConfig.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?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 Zend\Form\View;
use Zend\Form\ConfigProvider;
use Zend\ServiceManager\ConfigInterface;
use Zend\ServiceManager\ServiceManager;
/**
* Service manager configuration for form view helpers
*
* @deprecated since 2.8.0, and scheduled for removal with v3.0.0.
*/
class HelperConfig implements ConfigInterface
{
/**
* Configure the provided service manager instance with the configuration
* in this class.
*
* Adds the invokables defined in this class to the SM managing helpers.
*
* @param ServiceManager $serviceManager
* @return ServiceManager
*/
public function configureServiceManager(ServiceManager $serviceManager)
{
$config = $this->toArray();
if (method_exists($serviceManager, 'configure')) {
$serviceManager->configure($config);
return $serviceManager;
}
foreach ($config['factories'] as $service => $factory) {
$serviceManager->setFactory($service, $factory);
}
foreach ($config['aliases'] as $alias => $target) {
$serviceManager->setAlias($alias, $target);
}
return $serviceManager;
}
/**
* Provide all configuration as an array.
*
* Required by zend-servicemanager v3.
*
* @return array
*/
public function toArray()
{
return (new ConfigProvider())->getViewHelperConfig();
}
}