|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* Copyright 2012 Johannes M. Schmitt <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
|
|
* you may not use this file except in compliance with the License. |
|
8
|
|
|
* You may obtain a copy of the License at |
|
9
|
|
|
* |
|
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11
|
|
|
* |
|
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15
|
|
|
* See the License for the specific language governing permissions and |
|
16
|
|
|
* limitations under the License. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
namespace JMS\JobQueueBundle\DependencyInjection; |
|
20
|
|
|
|
|
21
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
|
22
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
23
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* JMSJobQueueBundle Configuration. |
|
27
|
|
|
* |
|
28
|
|
|
* @author Johannes M. Schmitt <[email protected]> |
|
29
|
|
|
*/ |
|
30
|
|
|
class Configuration implements ConfigurationInterface |
|
31
|
|
|
{ |
|
32
|
|
|
/** |
|
33
|
|
|
* {@inheritDoc} |
|
34
|
|
|
*/ |
|
35
|
6 |
|
public function getConfigTreeBuilder() |
|
36
|
|
|
{ |
|
37
|
6 |
|
$treeBuilder = new TreeBuilder('jms_job_queue'); |
|
38
|
|
|
|
|
39
|
6 |
|
if (method_exists($treeBuilder, 'getRootNode')) { |
|
40
|
6 |
|
$rootNode = $treeBuilder->getRootNode(); |
|
41
|
|
|
} else { |
|
42
|
|
|
// BC layer for symfony/config 4.1 and older |
|
43
|
|
|
$rootNode = $treeBuilder->root('jms_job_queue'); |
|
|
|
|
|
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
$rootNode |
|
47
|
6 |
|
->children() |
|
48
|
6 |
|
->booleanNode('statistics')->defaultTrue()->end(); |
|
49
|
|
|
|
|
50
|
|
|
$defaultOptionsNode = $rootNode |
|
51
|
6 |
|
->children() |
|
52
|
6 |
|
->arrayNode('queue_options_defaults') |
|
53
|
6 |
|
->addDefaultsIfNotSet(); |
|
54
|
6 |
|
$this->addQueueOptions($defaultOptionsNode); |
|
55
|
|
|
|
|
56
|
|
|
$queueOptionsNode = $rootNode |
|
57
|
6 |
|
->children() |
|
58
|
6 |
|
->arrayNode('queue_options') |
|
59
|
6 |
|
->useAttributeAsKey('queue') |
|
60
|
6 |
|
->prototype('array'); |
|
61
|
6 |
|
$this->addQueueOptions($queueOptionsNode); |
|
62
|
|
|
|
|
63
|
6 |
|
return $treeBuilder; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
6 |
|
private function addQueueOptions(ArrayNodeDefinition $def) |
|
67
|
|
|
{ |
|
68
|
|
|
$def |
|
69
|
6 |
|
->children() |
|
70
|
6 |
|
->scalarNode('max_concurrent_jobs')->end(); |
|
71
|
6 |
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.