Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/dceprojects.corals.io/vendor/vierbergenlars/php-semver/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/dceprojects.corals.io/vendor/vierbergenlars/php-semver/bin/semver
#!/usr/bin/env php
<?php

namespace vierbergenlars\SemVer\Application\SemVer;

if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
    require_once __DIR__ . '/../vendor/autoload.php';
} else {
    if (file_exists(__DIR__ . '/../../../autoload.php')) {
        require_once __DIR__ . '/../../../autoload.php';
    }
}

use vierbergenlars\SemVer\version;
use vierbergenlars\SemVer\expression;
use vierbergenlars\SemVer\SemVerException;

$version = false;
$range = array();
$increment = false;

// Get all arguments
while (\count($argv) > 0) {
    $arg = \array_shift($argv);
    switch ($arg) {
        case '-v':
        case '--version':
            $version[] = \array_shift($argv);
            break;
        case '-r':
        case '--range':
            $range[] = \array_shift($argv);
            break;
        case '-i':
        case '--increment':
            $increment = \array_shift($argv);
            break;
        case '-?':
        case '-h':
        case '--help':
            help();
            break;
    }
}
main();

function help() {
    $e = array(
        'Usage: semver -v|--version <version> [options]'
        , ''
        , '  -r <range>			Test if version satisfies the supplied range.'
        , '  --range <range>'
        , '  -i [major|minor|patch|build]	Increment the given version number.'
        , '  --increment [major|minor|patch|build]'
        , ''
        , 'Multiple versions or ranges may be supplied.'
        , ''
        , 'Program exits successfully if any valid version satisfies'
        , 'all supplied ranges, and prints all satisfying versions.'
        , ''
        , 'If no versions are valid, or ranges are not satisfied,'
        , 'then exits failure.'
        , ''
        , 'Versions are printed in ascending order, so supplying'
        , 'multiple versions to the utility will just sort them.'
    );
    echo \implode(PHP_EOL, $e);
    exit;
}

function main() {
    global $version, $range, $increment;
    if ($increment !== false) {
        increment($version[0], $increment);
    }
    if ($version !== false) {
        filter($version, $range);
    }
    help();
}

function fail($message = '') {
    fwrite(STDERR, $message);
    exit(1);
}

function increment($version, $what) {
    if (\file_exists($version))
        $version = \file_get_contents($version);
    if ($version == '-')
        $version = \fgets(STDIN);
    try {
        $v = new version($version);
        echo $v->inc($what);
        exit;
    } catch (SemVerException $e) {
        fail($e->getMessage());
    }
}

function filter($versions, $ranges) {
    if (\file_exists($versions[0]))
        $versions = \file($versions[0], \FILE_IGNORE_NEW_LINES | \FILE_SKIP_EMPTY_LINES);
    if ($versions[0] == '-') {
        unset($versions[0]);
        while ($version = \fgets(\STDIN)) {
            $versions[] = $version;
        }
    }
    $matching_versions = array();
    foreach ($versions as $version) {
        $ok = true;
        try {
            $v = new version($version);
            foreach ($ranges as $range) {
                if ($v->satisfies(new expression($range)))
                    continue;
                $ok = false;
                break;
            }
            if ($ok)
                $matching_versions[] = $v;
        } catch (SemVerException $e) {

        }
    }
    \usort($matching_versions, '\\vierbergenlars\\SemVer\\version::compare');
    foreach ($matching_versions as $version) {
        echo $version . PHP_EOL;
    }
    if (\count($matching_versions) == 0)
        fail();
    exit;
}

Spamworldpro Mini