|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @author cbleek |
|
8
|
|
|
* @license AGPLv3 |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Jobs\Factory; |
|
12
|
|
|
|
|
13
|
|
|
use Interop\Container\ContainerInterface; |
|
14
|
|
|
use Interop\Container\Exception\ContainerException; |
|
15
|
|
|
use Zend\ServiceManager\Exception\ServiceNotCreatedException; |
|
16
|
|
|
use Zend\ServiceManager\Exception\ServiceNotFoundException; |
|
17
|
|
|
use Zend\ServiceManager\FactoryInterface; |
|
18
|
|
|
use Zend\ServiceManager\ServiceLocatorInterface; |
|
19
|
|
|
use Jobs\Options\ModuleOptions; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Class ModuleOptionsFactory |
|
23
|
|
|
* @package Jobs\Factory |
|
24
|
|
|
*/ |
|
25
|
|
|
class ModuleOptionsFactory implements FactoryInterface |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* Create an object |
|
29
|
|
|
* |
|
30
|
|
|
* @param ContainerInterface $container |
|
31
|
|
|
* @param string $requestedName |
|
32
|
|
|
* @param null|array $options |
|
33
|
|
|
* |
|
34
|
|
|
* @return object |
|
35
|
|
|
* @throws ServiceNotFoundException if unable to resolve the service. |
|
36
|
|
|
* @throws ServiceNotCreatedException if an exception is raised when |
|
37
|
|
|
* creating a service. |
|
38
|
|
|
* @throws ContainerException if any other error occurs |
|
39
|
|
|
*/ |
|
40
|
|
|
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
41
|
|
|
{ |
|
42
|
|
|
$config = $container->get('Config'); |
|
43
|
|
|
|
|
44
|
|
|
$jobs_options = isset($config['jobs_options']) ? $config['jobs_options'] : array(); |
|
|
|
|
|
|
45
|
|
|
|
|
46
|
|
|
if (!array_key_exists('multipostingApprovalMail', $jobs_options) || '' == trim($jobs_options['multipostingApprovalMail'])) { |
|
|
|
|
|
|
47
|
|
|
$coreOptions = $container->get('Core/Options'); |
|
48
|
|
|
$jobs_options['multipostingApprovalMail'] = $coreOptions->getSystemMessageEmail(); |
|
|
|
|
|
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
return new ModuleOptions($jobs_options); |
|
|
|
|
|
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* {@inheritDoc} |
|
57
|
|
|
* |
|
58
|
|
|
* @param ServiceLocatorInterface $serviceLocator |
|
|
|
|
|
|
59
|
|
|
* @return ModuleOptions |
|
60
|
|
|
*/ |
|
61
|
|
|
public function createService(ServiceLocatorInterface $services) |
|
62
|
|
|
{ |
|
63
|
|
|
return $this($services, ModuleOptions::class); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.