1 | <?php |
||
5 | class VersionIdentifiers |
||
6 | { |
||
7 | protected $data = []; |
||
8 | protected $vidPattern; |
||
9 | protected $vvalPattern; |
||
10 | protected $preamble = 'Update to '; |
||
11 | |||
12 | const DEFAULT_VID = '[A-Za-z_-]+ ?'; |
||
13 | const DEFAULT_VVAL = '#.#.#'; |
||
14 | const EXTRA = '(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?'; |
||
15 | const NUMBER = '[0-9]+'; |
||
16 | |||
17 | /** |
||
18 | * VersionIdentifiers constructor |
||
19 | */ |
||
20 | public function __construct() |
||
25 | |||
26 | public function getPreamble() |
||
30 | |||
31 | public function setPreamble($preamble) |
||
35 | |||
36 | public function getVidPattern() |
||
40 | |||
41 | public function setVidPattern($vidPattern) |
||
45 | |||
46 | public function getVvalPattern() |
||
50 | |||
51 | public function setVvalPattern($vvalPattern) |
||
55 | |||
56 | /** |
||
57 | * Multiple provided value with our multiplier |
||
58 | * |
||
59 | * @param $value multiplicand |
||
60 | * @return integer product of multiplier and multiplicand |
||
61 | */ |
||
62 | public function add($vid, $vval) |
||
66 | |||
67 | public function pattern() |
||
79 | |||
80 | /** |
||
81 | * Given a simple message like "Update to WordPress 4.9.8", return the |
||
82 | * correct vid/vval pair. In this case, the vid is "WordPress " and the |
||
83 | * vval is "4.9.8". |
||
84 | * |
||
85 | * @param string $message a commit message |
||
86 | */ |
||
87 | public function addVidsFromMessage($message) |
||
105 | |||
106 | /** |
||
107 | * Check to see if a list of PR titles collectively contain all of the |
||
108 | * vids with vvals. |
||
109 | * |
||
110 | * @param string[] $titles |
||
111 | */ |
||
112 | public function allExist($titles) |
||
127 | |||
128 | /** |
||
129 | * foreach ($existingPRs as $pr) { |
||
130 | * if (strpos($pr['title'], $value) !== false) { |
||
131 | */ |
||
132 | protected function someTitleContains($titles, $value) |
||
141 | |||
142 | public function isEmpty() |
||
146 | |||
147 | public function all() |
||
155 | |||
156 | public function ids() |
||
160 | |||
161 | public function __toString() |
||
177 | } |
||
178 |