Updated Namespaces

This commit is contained in:
Netkas 2022-10-22 02:02:43 -04:00
parent a142bd0665
commit 781ee06c67
8 changed files with 22 additions and 25 deletions

View file

@ -7,7 +7,7 @@
* @licence MIT * @licence MIT
*/ */
namespace Jelix\Version; namespace ncc\ThirdParty\jelix\Version;
class Parser class Parser
{ {

View file

@ -17,7 +17,7 @@ Use the `Jelix\Version\Parser` class to retrieve a `Jelix\Version\Version` objec
containing all versions informations. containing all versions informations.
```php ```php
$version = \Jelix\Version\Parser::parse('1.2.3b2'); $version = \ncc\ThirdParty\jelix\version\Parser::parse('1.2.3b2');
$version->toString(); // '1.2.3-beta.2' $version->toString(); // '1.2.3-beta.2'
$version->getMajor(); // 1 $version->getMajor(); // 1
@ -48,7 +48,7 @@ When retrieving a `Version` object for such versions, you can access to the seco
version through a method `getSecondaryVersion()` which returns a `Version` object: version through a method `getSecondaryVersion()` which returns a `Version` object:
```php ```php
$version = \Jelix\Version\Parser::parse('1.2.3:1.4.5'); $version = \ncc\ThirdParty\jelix\version\Parser::parse('1.2.3:1.4.5');
$version->toString(); // '1.2.3:1.4.5' $version->toString(); // '1.2.3:1.4.5'
$version->toString(true, false); // '1.2.3' $version->toString(true, false); // '1.2.3'
@ -65,11 +65,10 @@ $version->getBranchVersion(); // '1.2'
## Simple comparison ## Simple comparison
```php ```php
$v1 = '1.2.3'; $v1 = '1.2.3';
$v2 = '1.4.5'; $v2 = '1.4.5';
$result = \Jelix\Version\VersionComparator::compareVersion($v1, $v2); $result = \ncc\ThirdParty\jelix\version\VersionComparator::compareVersion($v1, $v2);
``` ```
`compareVersion()` returns: `compareVersion()` returns:
@ -82,7 +81,7 @@ $result = \Jelix\Version\VersionComparator::compareVersion($v1, $v2);
Example to compare two versions: Example to compare two versions:
```php ```php
\Jelix\Version\VersionComparator::compareVersion('1.2pre','1.2RC'); \ncc\ThirdParty\jelix\version\VersionComparator::compareVersion('1.2pre','1.2RC');
``` ```
Secondary versions are also compared if primary versions are equals. Secondary versions are also compared if primary versions are equals.
@ -93,11 +92,10 @@ version.
You have also an other method `compare()` taking `Version` objects as parameters: You have also an other method `compare()` taking `Version` objects as parameters:
```php ```php
$v1 = \Jelix\Version\Parser::parse('1.2.3'); $v1 = \ncc\ThirdParty\jelix\version\Parser::parse('1.2.3');
$v2 = \Jelix\Version\Parser::parse('1.4.5'); $v2 = \ncc\ThirdParty\jelix\version\Parser::parse('1.4.5');
$result = \Jelix\Version\VersionComparator::compare($v1, $v2); $result = \ncc\ThirdParty\jelix\version\VersionComparator::compare($v1, $v2);
``` ```
@ -127,18 +125,17 @@ You can combine several constraints with boolean operators :
- AND operator: `,` or ` ` - AND operator: `,` or ` `
- OR operator: `||` or `|`. - OR operator: `||` or `|`.
```php ```php
// check if 0.5 is between 0.8 and 1.0 or if it is higher than 2.0 // check if 0.5 is between 0.8 and 1.0 or if it is higher than 2.0
\Jelix\Version\VersionComparator::compareVersionRange('0.5','<1.0,>0.8|>2.0'); \ncc\ThirdParty\jelix\version\VersionComparator::compareVersionRange('0.5','<1.0,>0.8|>2.0');
// check if 0.5 is between 0.8 and 1.0 // check if 0.5 is between 0.8 and 1.0
\Jelix\Version\VersionComparator::compareVersionRange('0.5','0.8 - 1.0'); \ncc\ThirdParty\jelix\version\VersionComparator::compareVersionRange('0.5','0.8 - 1.0');
// with a wildcard // with a wildcard
\Jelix\Version\VersionComparator::compareVersionRange('1.1', '1.1.*'); // returns true \ncc\ThirdParty\jelix\version\VersionComparator::compareVersionRange('1.1', '1.1.*'); // returns true
\Jelix\Version\VersionComparator::compareVersionRange('1.1.2', '1.2.*'); // returns false \ncc\ThirdParty\jelix\version\VersionComparator::compareVersionRange('1.1.2', '1.2.*'); // returns false
\Jelix\Version\VersionComparator::compareVersionRange('1.3.0', '>=1.2.*'); // returns true \ncc\ThirdParty\jelix\version\VersionComparator::compareVersionRange('1.3.0', '>=1.2.*'); // returns true
``` ```
Note: comparison with a range is done only on primary version. If a version string contains Note: comparison with a range is done only on primary version. If a version string contains
@ -146,14 +143,14 @@ a secondary version, this secondary version is not compared. To compare a second
with a range, you should retrieve the secondary version with the `getSecondaryVersion()` method. with a range, you should retrieve the secondary version with the `getSecondaryVersion()` method.
```php ```php
$version = Jelix\Version\Parser::parse('1.2.3:1.0.0'); $version = ncc\ThirdParty\jelix\version\Parser::parse('1.2.3:1.0.0');
\Jelix\Version\VersionComparator::compareVersionRange($version, '>=1.2.*'); // returns true \ncc\ThirdParty\jelix\version\VersionComparator::compareVersionRange($version, '>=1.2.*'); // returns true
$version2 = $version->getSecondaryVersion(); $version2 = $version->getSecondaryVersion();
$version2->toString(); // '1.0.0' $version2->toString(); // '1.0.0'
\Jelix\Version\VersionComparator::compareVersionRange($version2, '>=1.2.*'); // returns false \ncc\ThirdParty\jelix\version\VersionComparator::compareVersionRange($version2, '>=1.2.*'); // returns false
``` ```

View file

@ -7,7 +7,7 @@
* @licence MIT * @licence MIT
*/ */
namespace Jelix\Version; namespace ncc\ThirdParty\jelix\Version;
/** /**
* Embed version informations. * Embed version informations.

View file

@ -7,7 +7,7 @@
* @licence MIT * @licence MIT
*/ */
namespace Jelix\Version; namespace ncc\ThirdParty\jelix\Version;
/** /**
* class to compare version numbers. it supports the following keywords: * class to compare version numbers. it supports the following keywords:

View file

@ -6,7 +6,7 @@
* @link http://www.jelix.org * @link http://www.jelix.org
* @licence MIT * @licence MIT
*/ */
namespace Jelix\Version; namespace ncc\ThirdParty\jelix\Version;
/** /**
* Represents a binary operator (AND or OR) in a version range expression. * Represents a binary operator (AND or OR) in a version range expression.

View file

@ -7,7 +7,7 @@
* @licence MIT * @licence MIT
*/ */
namespace Jelix\Version; namespace ncc\ThirdParty\jelix\Version;
interface VersionRangeOperatorInterface interface VersionRangeOperatorInterface
{ {

View file

@ -8,7 +8,7 @@
*/ */
namespace Jelix\Version; namespace ncc\ThirdParty\jelix\Version;
class VersionRangeTrueOperator implements VersionRangeOperatorInterface class VersionRangeTrueOperator implements VersionRangeOperatorInterface
{ {

View file

@ -8,7 +8,7 @@
*/ */
namespace Jelix\Version; namespace ncc\ThirdParty\jelix\Version;
/** /**
* Represents an unary operator (>,<,=,!=,<=,>=,~) in a version range expression. * Represents an unary operator (>,<,=,!=,<=,>=,~) in a version range expression.