One Hat Cyber Team
Your IP:
216.73.216.30
Server IP:
198.54.114.155
Server:
Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
Server Software:
LiteSpeed
PHP Version:
5.6.40
Create File
|
Create Folder
Execute
Dir :
~
/
proc
/
self
/
root
/
proc
/
thread-self
/
cwd
/
Edit File:
cli-parser.tar
src/exceptions/OptionDoesNotAllowArgumentException.php 0000644 00000001232 15110666235 0017355 0 ustar 00 <?php declare(strict_types=1); /* * This file is part of sebastian/cli-parser. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\CliParser; use function sprintf; use RuntimeException; final class OptionDoesNotAllowArgumentException extends RuntimeException implements Exception { public function __construct(string $option) { parent::__construct( sprintf( 'Option "%s" does not allow an argument', $option ) ); } } src/exceptions/UnknownOptionException.php 0000644 00000001172 15110666235 0014742 0 ustar 00 <?php declare(strict_types=1); /* * This file is part of sebastian/cli-parser. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\CliParser; use function sprintf; use RuntimeException; final class UnknownOptionException extends RuntimeException implements Exception { public function __construct(string $option) { parent::__construct( sprintf( 'Unknown option "%s"', $option ) ); } } src/exceptions/Exception.php 0000644 00000000554 15110666235 0012174 0 ustar 00 <?php declare(strict_types=1); /* * This file is part of sebastian/cli-parser. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\CliParser; use Throwable; interface Exception extends Throwable { } src/exceptions/AmbiguousOptionException.php 0000644 00000001201 15110666235 0015227 0 ustar 00 <?php declare(strict_types=1); /* * This file is part of sebastian/cli-parser. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\CliParser; use function sprintf; use RuntimeException; final class AmbiguousOptionException extends RuntimeException implements Exception { public function __construct(string $option) { parent::__construct( sprintf( 'Option "%s" is ambiguous', $option ) ); } } src/exceptions/error_log 0000644 00000003004 15110666235 0011433 0 ustar 00 [19-Nov-2025 13:26:22 UTC] PHP Fatal error: Uncaught Error: Interface "SebastianBergmann\CliParser\Exception" not found in /home/fluxyjvi/public_html/project/vendor/sebastian/cli-parser/src/exceptions/AmbiguousOptionException.php:15 Stack trace: #0 {main} thrown in /home/fluxyjvi/public_html/project/vendor/sebastian/cli-parser/src/exceptions/AmbiguousOptionException.php on line 15 [19-Nov-2025 19:39:36 UTC] PHP Fatal error: Uncaught Error: Interface "SebastianBergmann\CliParser\Exception" not found in /home/fluxyjvi/public_html/project/vendor/sebastian/cli-parser/src/exceptions/AmbiguousOptionException.php:15 Stack trace: #0 {main} thrown in /home/fluxyjvi/public_html/project/vendor/sebastian/cli-parser/src/exceptions/AmbiguousOptionException.php on line 15 [20-Nov-2025 01:37:41 UTC] PHP Fatal error: Uncaught Error: Interface "SebastianBergmann\CliParser\Exception" not found in /home/fluxyjvi/public_html/project/vendor/sebastian/cli-parser/src/exceptions/UnknownOptionException.php:15 Stack trace: #0 {main} thrown in /home/fluxyjvi/public_html/project/vendor/sebastian/cli-parser/src/exceptions/UnknownOptionException.php on line 15 [20-Nov-2025 05:31:40 UTC] PHP Fatal error: Uncaught Error: Interface "SebastianBergmann\CliParser\Exception" not found in /home/fluxyjvi/public_html/project/vendor/sebastian/cli-parser/src/exceptions/UnknownOptionException.php:15 Stack trace: #0 {main} thrown in /home/fluxyjvi/public_html/project/vendor/sebastian/cli-parser/src/exceptions/UnknownOptionException.php on line 15 src/exceptions/RequiredOptionArgumentMissingException.php 0000644 00000001243 15110666235 0020117 0 ustar 00 <?php declare(strict_types=1); /* * This file is part of sebastian/cli-parser. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\CliParser; use function sprintf; use RuntimeException; final class RequiredOptionArgumentMissingException extends RuntimeException implements Exception { public function __construct(string $option) { parent::__construct( sprintf( 'Required argument for option "%s" is missing', $option ) ); } } src/Parser.php 0000644 00000013250 15110666235 0007306 0 ustar 00 <?php declare(strict_types=1); /* * This file is part of sebastian/cli-parser. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\CliParser; use function array_map; use function array_merge; use function array_shift; use function array_slice; use function assert; use function count; use function current; use function explode; use function is_array; use function is_int; use function is_string; use function key; use function next; use function preg_replace; use function reset; use function sort; use function str_ends_with; use function str_starts_with; use function strlen; use function strstr; use function substr; final class Parser { /** * @psalm-param list<string> $argv * @psalm-param list<string> $longOptions * * @psalm-return array{0: array, 1: array} * * @throws AmbiguousOptionException * @throws OptionDoesNotAllowArgumentException * @throws RequiredOptionArgumentMissingException * @throws UnknownOptionException */ public function parse(array $argv, string $shortOptions, array $longOptions = null): array { if (empty($argv)) { return [[], []]; } $options = []; $nonOptions = []; if ($longOptions) { sort($longOptions); } if (isset($argv[0][0]) && $argv[0][0] !== '-') { array_shift($argv); } reset($argv); $argv = array_map('trim', $argv); while (false !== $arg = current($argv)) { $i = key($argv); assert(is_int($i)); next($argv); if ($arg === '') { continue; } if ($arg === '--') { $nonOptions = array_merge($nonOptions, array_slice($argv, $i + 1)); break; } if ($arg[0] !== '-' || (strlen($arg) > 1 && $arg[1] === '-' && !$longOptions)) { $nonOptions[] = $arg; continue; } if (strlen($arg) > 1 && $arg[1] === '-' && is_array($longOptions)) { $this->parseLongOption( substr($arg, 2), $longOptions, $options, $argv ); continue; } $this->parseShortOption( substr($arg, 1), $shortOptions, $options, $argv ); } return [$options, $nonOptions]; } /** * @throws RequiredOptionArgumentMissingException */ private function parseShortOption(string $argument, string $shortOptions, array &$options, array &$argv): void { $argumentLength = strlen($argument); for ($i = 0; $i < $argumentLength; $i++) { $option = $argument[$i]; $optionArgument = null; if ($argument[$i] === ':' || ($spec = strstr($shortOptions, $option)) === false) { throw new UnknownOptionException('-' . $option); } if (strlen($spec) > 1 && $spec[1] === ':') { if ($i + 1 < $argumentLength) { $options[] = [$option, substr($argument, $i + 1)]; break; } if (!(strlen($spec) > 2 && $spec[2] === ':')) { $optionArgument = current($argv); if (!$optionArgument) { throw new RequiredOptionArgumentMissingException('-' . $option); } assert(is_string($optionArgument)); next($argv); } } $options[] = [$option, $optionArgument]; } } /** * @psalm-param list<string> $longOptions * * @throws AmbiguousOptionException * @throws OptionDoesNotAllowArgumentException * @throws RequiredOptionArgumentMissingException * @throws UnknownOptionException */ private function parseLongOption(string $argument, array $longOptions, array &$options, array &$argv): void { $count = count($longOptions); $list = explode('=', $argument); $option = $list[0]; $optionArgument = null; if (count($list) > 1) { $optionArgument = $list[1]; } $optionLength = strlen($option); foreach ($longOptions as $i => $longOption) { $opt_start = substr($longOption, 0, $optionLength); if ($opt_start !== $option) { continue; } $opt_rest = substr($longOption, $optionLength); if ($opt_rest !== '' && $i + 1 < $count && $option[0] !== '=' && str_starts_with($longOptions[$i + 1], $option)) { throw new AmbiguousOptionException('--' . $option); } if (str_ends_with($longOption, '=')) { if (!str_ends_with($longOption, '==') && !strlen((string) $optionArgument)) { if (false === $optionArgument = current($argv)) { throw new RequiredOptionArgumentMissingException('--' . $option); } next($argv); } } elseif ($optionArgument) { throw new OptionDoesNotAllowArgumentException('--' . $option); } $fullOption = '--' . preg_replace('/={1,2}$/', '', $longOption); $options[] = [$fullOption, $optionArgument]; return; } throw new UnknownOptionException('--' . $option); } } README.md 0000644 00000002053 15110666235 0006030 0 ustar 00 [](https://packagist.org/packages/sebastian/cli-parser) [](https://github.com/sebastianbergmann/cli-parser/actions) [](https://shepherd.dev/github/sebastianbergmann/cli-parser) [](https://codecov.io/gh/sebastianbergmann/cli-parser) # sebastian/cli-parser Library for parsing `$_SERVER['argv']`, extracted from `phpunit/phpunit`. ## Installation You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): ``` composer require sebastian/cli-parser ``` If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: ``` composer require --dev sebastian/cli-parser ``` LICENSE 0000644 00000002773 15110666235 0005567 0 ustar 00 BSD 3-Clause License Copyright (c) 2020-2023, Sebastian Bergmann All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ChangeLog.md 0000644 00000001252 15110666235 0006722 0 ustar 00 # ChangeLog All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. ## [2.0.0] - 2023-02-03 ### Removed * This component is no longer supported on PHP 7.3, PHP 7.4, and PHP 8.0 ## [1.0.1] - 2020-09-28 ### Changed * Changed PHP version constraint in `composer.json` from `^7.3 || ^8.0` to `>=7.3` ## [1.0.0] - 2020-08-12 * Initial release [2.0.0]: https://github.com/sebastianbergmann/cli-parser/compare/1.0.1...2.0.0 [1.0.1]: https://github.com/sebastianbergmann/cli-parser/compare/1.0.0...1.0.1 [1.0.0]: https://github.com/sebastianbergmann/cli-parser/compare/bb7bb3297957927962b0a3335befe7b66f7462e9...1.0.0 composer.json 0000644 00000001636 15110666235 0007301 0 ustar 00 { "name": "sebastian/cli-parser", "description": "Library for parsing CLI options", "type": "library", "homepage": "https://github.com/sebastianbergmann/cli-parser", "license": "BSD-3-Clause", "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues" }, "prefer-stable": true, "require": { "php": ">=8.1" }, "require-dev": { "phpunit/phpunit": "^10.0" }, "config": { "platform": { "php": "8.1.0" }, "optimize-autoloader": true, "sort-packages": true }, "autoload": { "classmap": [ "src/" ] }, "extra": { "branch-alias": { "dev-main": "2.0-dev" } } } SECURITY.md 0000644 00000001120 15110666235 0006334 0 ustar 00 # Security Policy This library is intended to be used in development environments only. For instance, it is used by the testing framework PHPUnit. There is no reason why this library should be installed on a webserver. **If you upload this library to a webserver then your deployment process is broken. On a more general note, if your `vendor` directory is publicly accessible on your webserver then your deployment process is also broken.** ## Security Contact Information After the above, if you still would like to report a security vulnerability, please email `sebastian@phpunit.de`.
Simpan