Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4070567
Comparator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
Comparator.php
View Options
<?php
/*
* This file is part of composer/semver.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace
Composer\Semver
;
use
Composer\Semver\Constraint\Constraint
;
class
Comparator
{
/**
* Evaluates the expression: $version1 > $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public
static
function
greaterThan
(
$version1
,
$version2
)
{
return
self
::
compare
(
$version1
,
'>'
,
$version2
);
}
/**
* Evaluates the expression: $version1 >= $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public
static
function
greaterThanOrEqualTo
(
$version1
,
$version2
)
{
return
self
::
compare
(
$version1
,
'>='
,
$version2
);
}
/**
* Evaluates the expression: $version1 < $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public
static
function
lessThan
(
$version1
,
$version2
)
{
return
self
::
compare
(
$version1
,
'<'
,
$version2
);
}
/**
* Evaluates the expression: $version1 <= $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public
static
function
lessThanOrEqualTo
(
$version1
,
$version2
)
{
return
self
::
compare
(
$version1
,
'<='
,
$version2
);
}
/**
* Evaluates the expression: $version1 == $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public
static
function
equalTo
(
$version1
,
$version2
)
{
return
self
::
compare
(
$version1
,
'=='
,
$version2
);
}
/**
* Evaluates the expression: $version1 != $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public
static
function
notEqualTo
(
$version1
,
$version2
)
{
return
self
::
compare
(
$version1
,
'!='
,
$version2
);
}
/**
* Evaluates the expression: $version1 $operator $version2.
*
* @param string $version1
* @param string $operator
* @param string $version2
*
* @return bool
*
* @phpstan-param Constraint::STR_OP_* $operator
*/
public
static
function
compare
(
$version1
,
$operator
,
$version2
)
{
$constraint
=
new
Constraint
(
$operator
,
$version2
);
return
$constraint
->
matchSpecific
(
new
Constraint
(
'=='
,
$version1
),
true
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 17 2026, 01:00 (11 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
90/8f/459aed215aac9b1a773e2e2afdff
Default Alt Text
Comparator.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment