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 | const OPTIONAL_NUMBER = '[0-9]*'; |
||
17 | |||
18 | /** |
||
19 | * VersionIdentifiers constructor |
||
20 | */ |
||
21 | public function __construct() |
||
26 | |||
27 | public function getPreamble() |
||
31 | |||
32 | public function setPreamble($preamble) |
||
36 | |||
37 | public function getVidPattern() |
||
41 | |||
42 | public function setVidPattern($vidPattern) |
||
46 | |||
47 | public function getVvalPattern() |
||
51 | |||
52 | public function setVvalPattern($vvalPattern) |
||
56 | |||
57 | /** |
||
58 | * Multiple provided value with our multiplier |
||
59 | * |
||
60 | * @param $value multiplicand |
||
61 | * @return integer product of multiplier and multiplicand |
||
62 | */ |
||
63 | public function add($vid, $vval) |
||
67 | |||
68 | public function pattern() |
||
81 | |||
82 | /** |
||
83 | * Given a simple message like "Update to WordPress 4.9.8", return the |
||
84 | * correct vid/vval pair. In this case, the vid is "WordPress " and the |
||
85 | * vval is "4.9.8". |
||
86 | * |
||
87 | * @param string $message a commit message |
||
88 | */ |
||
89 | public function addVidsFromMessage($message) |
||
107 | |||
108 | /** |
||
109 | * Check to see if a list of PR titles collectively contain all of the |
||
110 | * vids with vvals. |
||
111 | * |
||
112 | * @param string[] $titles |
||
113 | */ |
||
114 | public function allExist($titles) |
||
129 | |||
130 | /** |
||
131 | * foreach ($existingPRs as $pr) { |
||
132 | * if (strpos($pr['title'], $value) !== false) { |
||
133 | */ |
||
134 | protected function someTitleContains($titles, $value) |
||
143 | |||
144 | public function isEmpty() |
||
148 | |||
149 | public function all() |
||
157 | |||
158 | public function ids() |
||
162 | |||
163 | public function __toString() |
||
179 | } |
||
180 |