1 | <?php |
||
20 | class WebHelper |
||
21 | { |
||
22 | /** @var WebHelperRepository a Repository instance */ |
||
23 | private $repository; |
||
24 | |||
25 | /** @var VersionParser a VersionParser instance */ |
||
26 | private $versionParser; |
||
27 | |||
28 | /** @var Comparator a Comparator instance */ |
||
29 | private $comparator; |
||
30 | |||
31 | /** @var WebServer\WebServerInterface a Web Server instance */ |
||
32 | private $server; |
||
33 | |||
34 | /** @var WebProject\WebProjectInterface the PHP Webapp to configure */ |
||
35 | private $project; |
||
36 | |||
37 | /** |
||
38 | * Base constructor. |
||
39 | */ |
||
40 | 6 | public function __construct() |
|
45 | |||
46 | /** |
||
47 | * Sets the Repository Instance. |
||
48 | * |
||
49 | * @param string $resDir a Path of a Directives Repository |
||
50 | */ |
||
51 | 6 | public function setRepository($resDir = '') |
|
57 | |||
58 | /** |
||
59 | * Gets the Repository Instance. |
||
60 | * |
||
61 | * @return WebHelperRepository the Repository Instance |
||
62 | */ |
||
63 | 6 | public function getRepository() |
|
67 | |||
68 | /** |
||
69 | * Sets the web server instance. |
||
70 | * |
||
71 | * @param string $server a web server name |
||
72 | * @param string $version a semver-like version |
||
73 | */ |
||
74 | 6 | public function setServer($server, $version) |
|
81 | |||
82 | /** |
||
83 | * Gets the web server instance. |
||
84 | * |
||
85 | * @return WebServer\WebServerInterface the web server instance |
||
86 | */ |
||
87 | 4 | public function getServer() |
|
91 | |||
92 | /** |
||
93 | * Sets the PHP Webapp to configure. |
||
94 | * |
||
95 | * @param string $projectname a PHP Webapp name |
||
96 | * @param string $version a semver-like version |
||
97 | */ |
||
98 | 2 | public function setProject($projectname, $version) |
|
105 | |||
106 | /** |
||
107 | * Gets the PHP Webapp to configure. |
||
108 | * |
||
109 | * @return WebProject\WebProjectInterface the PHP Webapp instance |
||
110 | */ |
||
111 | 2 | public function getProject() |
|
115 | |||
116 | /** |
||
117 | * Finds the best template for a web server directive according to its version. |
||
118 | * |
||
119 | * @param string $directive a directive |
||
120 | * |
||
121 | * @return string the relative path to the template |
||
122 | */ |
||
123 | 4 | public function find($directive) |
|
142 | |||
143 | /** |
||
144 | * Outputs a webserver directive. |
||
145 | * |
||
146 | * @param string $twigFile a relative path of a template |
||
147 | * @param array $params parameters |
||
148 | * |
||
149 | * @return string the directive output |
||
150 | */ |
||
151 | 4 | public function render($twigFile, array $params = array()) |
|
159 | } |
||
160 |