1 | <?php |
||
22 | class WebHelper |
||
23 | { |
||
24 | /** @var WebHelperRepository a Repository instance */ |
||
25 | private $repository; |
||
26 | |||
27 | /** @var VersionParser a VersionParser instance */ |
||
28 | private $versionParser; |
||
29 | |||
30 | /** @var Comparator a Comparator instance */ |
||
31 | private $comparator; |
||
32 | |||
33 | /** @var WebServer\WebServerInterface a Web Server instance */ |
||
34 | private $server; |
||
35 | |||
36 | /** @var WebProject\WebProjectInterface the PHP Webapp to configure */ |
||
37 | private $project; |
||
38 | |||
39 | /** |
||
40 | * Base constructor. |
||
41 | */ |
||
42 | 5 | public function __construct() |
|
47 | |||
48 | /** |
||
49 | * Sets the Repository Instance. |
||
50 | * |
||
51 | * @param string $resDir a Path of a Directives Repository |
||
52 | */ |
||
53 | 5 | public function setRepository($resDir = '') |
|
59 | |||
60 | /** |
||
61 | * Gets the Repository Instance. |
||
62 | * |
||
63 | * @return WebHelperRepository the Repository Instance |
||
64 | */ |
||
65 | 5 | public function getRepository() |
|
69 | |||
70 | /** |
||
71 | * Sets the web server instance. |
||
72 | * |
||
73 | * @param string $server a web server name |
||
74 | * @param string $version a semver-like version |
||
75 | */ |
||
76 | 5 | public function setServer($server, $version) |
|
83 | |||
84 | /** |
||
85 | * Gets the web server instance. |
||
86 | * |
||
87 | * @return WebServerInterface the web server instance |
||
88 | */ |
||
89 | 3 | public function getServer() |
|
93 | |||
94 | 1 | public function setProject($projectname, $version) |
|
101 | |||
102 | 1 | public function getProject() |
|
106 | |||
107 | /** |
||
108 | * Finds the best template for a web server directive according to its version. |
||
109 | * |
||
110 | * @param string $directive a directive |
||
111 | * @return string the relative path to the template |
||
112 | */ |
||
113 | 3 | public function find($directive) |
|
132 | |||
133 | /** |
||
134 | * Outputs a webserver directive. |
||
135 | * |
||
136 | * @param string $twigFile a relative path of a template |
||
137 | * @param array $params parameters |
||
138 | * @return string the directive output |
||
139 | */ |
||
140 | 3 | public function render($twigFile, array $params = array()) |
|
148 | } |
||
149 |