Skip to content
This repository was archived by the owner on May 2, 2023. It is now read-only.

Commit 6b16f72

Browse files
Merge pull request #28 from vierbergenlars/typos
Fix typo in standardize function name.
2 parents 201f4fd + 59a8924 commit 6b16f72

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

src/vierbergenlars/SemVer/expression.php

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class expression {
1313
private $chunks = array();
1414

1515
/**
16-
* standarizes the comparator/range/whatever-string to chunks
16+
* standardizes the comparator/range/whatever-string to chunks
1717
* @param string $versions
1818
*/
1919
function __construct($versions) {
@@ -32,7 +32,7 @@ function __construct($versions) {
3232
foreach ($or as &$orchunk) {
3333
$and = explode(' ', trim($orchunk));
3434
foreach ($and as $order => &$achunk) {
35-
$achunk = self::standarizeSingleComparator($achunk);
35+
$achunk = self::standardizeSingleComparator($achunk);
3636
if (strstr($achunk, ' ')) {
3737
$pieces = explode(' ', $achunk);
3838
unset($and[$order]);
@@ -143,13 +143,13 @@ function maxSatisfying($versions) {
143143
}
144144

145145
/**
146-
* standarizes a single version
146+
* standardizes a single version
147147
* @param string $version
148148
* @param bool $padZero Set to true if the version string should be padded with zeros instead of x-es
149149
* @throws SemVerException
150150
* @return string
151151
*/
152-
static function standarize($version, $padZero = false) {
152+
static function standardize($version, $padZero = false) {
153153
$matches = array();
154154
$expression = sprintf(self::$dirty_regexp_mask, self::$global_single_version);
155155
if (!preg_match($expression, $version, $matches))
@@ -168,14 +168,26 @@ static function standarize($version, $padZero = false) {
168168
return self::xRangesToComparators($version);
169169
}
170170
}
171+
172+
/**
173+
* standardizes a single version (typeo'd version for BC)
174+
* @deprecated 2.1.0
175+
* @param string $version
176+
* @param bool $padZero Set to true if the version string should be padded with zeros instead of x-es
177+
* @throws SemVerException
178+
* @return string
179+
*/
180+
static function standarize($version, $padZero = false) {
181+
return self::standardize($version, $padZero);
182+
}
171183

172184
/**
173-
* standarizes a single version with comparators
185+
* standardizes a single version with comparators
174186
* @param string $version
175187
* @throws SemVerException
176188
* @return string
177189
*/
178-
static protected function standarizeSingleComparator($version) {
190+
static protected function standardizeSingleComparator($version) {
179191
$expression = sprintf(self::$regexp_mask, self::$global_single_comparator . self::$global_single_version);
180192
$matches = array();
181193
if (!preg_match($expression, $version, $matches))
@@ -185,24 +197,24 @@ static protected function standarizeSingleComparator($version) {
185197
$hasComparators = true;
186198
if ($comparators === '')
187199
$hasComparators = false;
188-
$version = self::standarize($version, $hasComparators);
200+
$version = self::standardize($version, $hasComparators);
189201
return $comparators . $version;
190202
}
191203

192204
/**
193-
* standarizes a bunch of versions with comparators
205+
* standardizes a bunch of versions with comparators
194206
* @param string $versions
195207
* @return string
196208
*/
197-
static protected function standarizeMultipleComparators($versions) {
209+
static protected function standardizeMultipleComparators($versions) {
198210
$versions = preg_replace('/' . self::$global_single_comparator . self::$global_single_xrange . '/', '$1$2', $versions); //Paste comparator and version together
199211
$versions = preg_replace('/\\s+/', ' ', $versions); //Condense multiple spaces to one
200212
$or = explode('||', $versions);
201213
foreach ($or as &$orchunk) {
202214
$orchunk = trim($orchunk); //Remove spaces
203215
$and = explode(' ', $orchunk);
204216
foreach ($and as &$achunk) {
205-
$achunk = self::standarizeSingleComparator($achunk);
217+
$achunk = self::standardizeSingleComparator($achunk);
206218
}
207219
$orchunk = implode(' ', $and);
208220
}
@@ -211,7 +223,7 @@ static protected function standarizeMultipleComparators($versions) {
211223
}
212224

213225
/**
214-
* standarizes a bunch of version ranges to comparators
226+
* standardizes a bunch of version ranges to comparators
215227
* @param string $range
216228
* @throws SemVerException
217229
* @return string
@@ -222,12 +234,12 @@ static protected function rangesToComparators($range) {
222234
if (!preg_match($expression, $range, $matches))
223235
throw new SemVerException('Invalid range given', $range);
224236
$versions = preg_replace($expression, '>=$1 <=$11', $range);
225-
$versions = self::standarizeMultipleComparators($versions);
237+
$versions = self::standardizeMultipleComparators($versions);
226238
return $versions;
227239
}
228240

229241
/**
230-
* standarizes a bunch of x-ranges to comparators
242+
* standardizes a bunch of x-ranges to comparators
231243
* @param string $ranges
232244
* @return string
233245
*/
@@ -256,7 +268,7 @@ static private function xRangesToComparatorsCallback($matches) {
256268
}
257269

258270
/**
259-
* standarizes a bunch of ~-ranges to comparators
271+
* standardizes a bunch of ~-ranges to comparators
260272
* @param string $spermies
261273
* @return string
262274
*/

0 commit comments

Comments
 (0)