|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the XabbuhPandaBundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Christian Flothmann <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Xabbuh\PandaBundle\DependencyInjection; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
15
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* XabbuhPandaExtension configuration structure. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Christian Flothmann <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
class Configuration implements ConfigurationInterface |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* {@inheritDoc} |
|
26
|
|
|
*/ |
|
27
|
4 |
|
public function getConfigTreeBuilder() |
|
28
|
|
|
{ |
|
29
|
4 |
|
$treeBuilder = new TreeBuilder('xabbuh_panda'); |
|
30
|
|
|
|
|
31
|
4 |
|
if (method_exists($treeBuilder, 'getRootNode')) { |
|
32
|
4 |
|
$rootNode = $treeBuilder->getRootNode(); |
|
33
|
|
|
} else { |
|
34
|
|
|
$rootNode = $treeBuilder->root('xabbuh_panda'); |
|
|
|
|
|
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
$rootNode |
|
38
|
4 |
|
->fixXmlConfig('account') |
|
39
|
4 |
|
->fixXmlConfig('cloud') |
|
40
|
4 |
|
->children() |
|
41
|
4 |
|
->scalarNode('default_account')->defaultValue('default')->end() |
|
42
|
4 |
|
->arrayNode('accounts') |
|
43
|
4 |
|
->useAttributeAsKey('name') |
|
44
|
4 |
|
->prototype('array') |
|
45
|
4 |
|
->children() |
|
46
|
4 |
|
->scalarNode('access_key')->isRequired()->end() |
|
47
|
4 |
|
->scalarNode('secret_key')->isRequired()->end() |
|
48
|
4 |
|
->scalarNode('api_host')->defaultValue('api.pandastream.com')->end() |
|
49
|
4 |
|
->end() |
|
50
|
4 |
|
->end() |
|
51
|
4 |
|
->end() |
|
52
|
4 |
|
->scalarNode('default_cloud')->defaultValue('default')->end() |
|
53
|
4 |
|
->arrayNode('clouds') |
|
54
|
4 |
|
->useAttributeAsKey('name') |
|
55
|
4 |
|
->prototype('array') |
|
56
|
4 |
|
->children() |
|
57
|
4 |
|
->scalarNode('id')->isRequired()->end() |
|
58
|
4 |
|
->scalarNode('account')->end() |
|
59
|
4 |
|
->end() |
|
60
|
4 |
|
->end() |
|
61
|
4 |
|
->end() |
|
62
|
4 |
|
->arrayNode('video_uploader') |
|
63
|
4 |
|
->addDefaultsIfNotSet() |
|
64
|
4 |
|
->children() |
|
65
|
4 |
|
->booleanNode('multiple_files') |
|
66
|
4 |
|
->defaultValue(false) |
|
67
|
4 |
|
->end() |
|
68
|
4 |
|
->booleanNode('cancel_button') |
|
69
|
4 |
|
->defaultValue(true) |
|
70
|
4 |
|
->end() |
|
71
|
4 |
|
->booleanNode('progress_bar') |
|
72
|
4 |
|
->defaultValue(true) |
|
73
|
4 |
|
->end() |
|
74
|
4 |
|
->end() |
|
75
|
4 |
|
->end() |
|
76
|
4 |
|
->arrayNode('httplug') |
|
77
|
4 |
|
->info('Allow configuring the HTTPlug objects being used, instead of creating new ones using the discovery system.') |
|
78
|
4 |
|
->addDefaultsIfNotSet() |
|
79
|
4 |
|
->children() |
|
80
|
4 |
|
->scalarNode('client')->defaultNull()->end() |
|
81
|
4 |
|
->scalarNode('request_factory')->defaultNull()->end() |
|
82
|
4 |
|
->scalarNode('stream_factory')->defaultNull()->end() |
|
83
|
4 |
|
->end() |
|
84
|
4 |
|
->end() |
|
85
|
4 |
|
->end() |
|
86
|
4 |
|
->validate() |
|
87
|
|
|
->ifTrue(function ($v) { |
|
88
|
4 |
|
return !empty($v['clouds']) && !isset($v['clouds'][$v['default_cloud']]); |
|
89
|
4 |
|
}) |
|
90
|
4 |
|
->thenInvalid('The configured default cloud is not one of the configured clouds.') |
|
91
|
4 |
|
->end() |
|
92
|
4 |
|
->validate() |
|
93
|
|
|
->ifTrue(function ($v) { |
|
94
|
4 |
|
return !empty($v['accounts']) && !isset($v['accounts'][$v['default_account']]); |
|
95
|
4 |
|
}) |
|
96
|
4 |
|
->thenInvalid('The configured default account is not one of the configured accounts.') |
|
97
|
4 |
|
->end() |
|
98
|
|
|
; |
|
99
|
|
|
|
|
100
|
4 |
|
return $treeBuilder; |
|
101
|
|
|
} |
|
102
|
|
|
} |
|
103
|
|
|
|
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.