|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Kunstmaan\Skylab\Provider; |
|
4
|
|
|
|
|
5
|
|
|
use Cilex\Application; |
|
6
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
7
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
8
|
|
|
|
|
9
|
|
|
trait UsesProviders |
|
10
|
|
|
{ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @var FileSystemProvider |
|
14
|
|
|
*/ |
|
15
|
|
|
protected $fileSystemProvider; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @var ProjectConfigProvider |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $projectConfigProvider; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var SkeletonProvider |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $skeletonProvider; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var ProcessProvider |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $processProvider; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var PermissionsProvider |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $permissionsProvider; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var DialogProvider |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $dialogProvider; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @var RemoteProvider |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $remoteProvider; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var OutputInterface |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $output; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @var InputInterface |
|
54
|
|
|
*/ |
|
55
|
|
|
protected $input; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @var Application |
|
59
|
|
|
*/ |
|
60
|
|
|
protected $app; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @var \Twig_Environment |
|
64
|
|
|
*/ |
|
65
|
|
|
protected $twig; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @var bool |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $noInteraction = false; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param Application $app |
|
74
|
|
|
* @param InputInterface $input |
|
|
|
|
|
|
75
|
|
|
* @param OutputInterface $output |
|
|
|
|
|
|
76
|
|
|
* @param bool $setupClassVars |
|
77
|
|
|
*/ |
|
78
|
|
|
public function setup(Application $app, InputInterface $input = null, OutputInterface $output = null, $setupClassVars = false) |
|
79
|
|
|
{ |
|
80
|
|
|
$providers = array( |
|
81
|
|
|
'filesystem' => 'fileSystemProvider', |
|
82
|
|
|
'projectconfig' => 'projectConfigProvider', |
|
83
|
|
|
'skeleton' => 'skeletonProvider', |
|
84
|
|
|
'process' => 'processProvider', |
|
85
|
|
|
'permission' => 'permissionsProvider', |
|
86
|
|
|
'dialog' => 'dialogProvider', |
|
87
|
|
|
'remote' => 'remoteProvider', |
|
88
|
|
|
); |
|
89
|
|
|
foreach ($providers as $service => $variable) { |
|
90
|
|
|
$this->$variable = $app[$service]; |
|
91
|
|
|
if ($setupClassVars) { |
|
92
|
|
|
$this->$variable->setup($app, $input, $output); |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
$this->output = $output; |
|
96
|
|
|
$this->input = $input; |
|
97
|
|
|
$this->app = $app; |
|
98
|
|
|
$this->twig = $app["twig"]; |
|
99
|
|
|
|
|
100
|
|
|
if ($input) { |
|
101
|
|
|
$this->noInteraction = (bool) $input->getOption("no-interaction"); |
|
102
|
|
|
$app["no-interaction"] = true; |
|
103
|
|
|
} elseif ($app["no-interaction"]) { |
|
104
|
|
|
$this->noInteraction = $app["no-interaction"]; |
|
105
|
|
|
} else { |
|
106
|
|
|
$this->noInteraction = false; |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
} |
|
111
|
|
|
|
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.