1 | <?php |
||
24 | class Versioner |
||
25 | { |
||
26 | /** |
||
27 | * The readers |
||
28 | * |
||
29 | * @var Reader[] |
||
30 | **/ |
||
31 | private $readers; |
||
32 | |||
33 | /** |
||
34 | * Constructor |
||
35 | * |
||
36 | * @param Reader[] $readers |
||
37 | * @return void |
||
|
|||
38 | **/ |
||
39 | public function __construct(array $readers = array()) |
||
43 | |||
44 | /** |
||
45 | * Get the version for a directory |
||
46 | * |
||
47 | * @param string $directory |
||
48 | * @return string |
||
49 | **/ |
||
50 | public function get($directory) |
||
63 | |||
64 | /** |
||
65 | * Get the version for a directory |
||
66 | * |
||
67 | * Combining the output of all writers using the given separator |
||
68 | * |
||
69 | * Version will be considered "found" if at least one versioner returns |
||
70 | * output. |
||
71 | * |
||
72 | * @param string $directory |
||
73 | * @param string $separator |
||
74 | * @return string |
||
75 | **/ |
||
76 | public function getCombined($directory, $separator = '-') |
||
94 | |||
95 | /** |
||
96 | * Does a directory have a version? |
||
97 | * |
||
98 | * @param string $directory |
||
99 | * @return bool |
||
100 | **/ |
||
101 | public function has($directory) |
||
111 | |||
112 | /** |
||
113 | * Get the set of readers |
||
114 | * |
||
115 | * @return Reader[] |
||
116 | */ |
||
117 | public function getReaders() |
||
121 | |||
122 | /** |
||
123 | * Set the set of readers |
||
124 | * |
||
125 | * @param Reader[] $readers |
||
126 | * @return Versioner |
||
127 | */ |
||
128 | public function setReaders(array $readers) |
||
134 | |||
135 | /** |
||
136 | * Add a reader |
||
137 | * |
||
138 | * @param Reader[] $reader |
||
139 | * @return Versioner |
||
140 | */ |
||
141 | public function addReader(Reader $reader) |
||
147 | } |
||
148 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.