diff --git a/.github/workflows/apigen.yml b/.github/workflows/apigen.yml
deleted file mode 100644
index b5a4ec9..0000000
--- a/.github/workflows/apigen.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-name: ApiGen
-
-on:
- workflow_run:
- workflows: ["Unit Tests"]
- branches: [master]
- types:
- - completed
-
-jobs:
- Document_Generator:
- runs-on: ubuntu-latest
- if: ${{ github.event.workflow_run.conclusion == 'success' }}
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: '8.4'
-
- - name: Download phpDocumentor
- run: |
- curl -fsSL -o phpDocumentor.phar https://phpdoc.org/phpDocumentor.phar
- chmod +x phpDocumentor.phar
-
- - name: Generate API docs
- run: php phpDocumentor.phar -d src -t docs --no-interaction
-
- - name: Deploy to GitHub Pages
- uses: peaceiris/actions-gh-pages@v4
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: ./docs
- publish_branch: gh-pages
- user_name: 'github-actions[bot]'
- user_email: 'github-actions[bot]@users.noreply.github.com'
- commit_message: 'Docs updated by GitHub Actions'
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
deleted file mode 100644
index 8830b94..0000000
--- a/.github/workflows/test.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Unit Tests
-
-on: [push, pull_request]
-
-jobs:
- run:
- name: PHP ${{ matrix.php-versions }}
- runs-on: ubuntu-latest
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
-
- strategy:
- matrix:
- php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
- fail-fast: false
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-versions }}
-
- - name: Setup problem matchers
- run: |
- echo ::add-matcher::${{ runner.tool_cache }}/php.json
- echo ::add-matcher::${{ runner.tool_cache }}/phpunit.json
-
- - name: Setup Dependencies
- run: |
- composer update
- composer install
- - name: Run PHPUnit
- run: |
- ./vendor/bin/phpunit --verbose
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 8f47dcd..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.iml
-.idea/
-composer.phar
-vendor/
-composer.lock
-apigen.phar
-docs/
-.phpdoc/
-.phpunit.result.cache
diff --git a/.nojekyll b/.nojekyll
new file mode 100644
index 0000000..e69de29
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 4a8abc3..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Andreas Gohr
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/README.md b/README.md
deleted file mode 100644
index fcae998..0000000
--- a/README.md
+++ /dev/null
@@ -1,164 +0,0 @@
-# PHP-CLI
-
-PHP-CLI is a simple library that helps with creating nice looking command line scripts.
-
-It takes care of
-
-- **option parsing**
-- **help page generation**
-- **automatic width adjustment**
-- **colored output**
-- **optional PSR3 compatibility**
-
-It is lightweight and has **no 3rd party dependencies**. Note: this is for non-interactive scripts only. It has no readline or similar support.
-
-## Installation
-
-Use composer:
-
-```php composer.phar require splitbrain/php-cli```
-
-## Usage and Examples
-
-Minimal example:
-
-```php
-#!/usr/bin/php
-setHelp('A very minimal example that does nothing but print a version');
- $options->registerOption('version', 'print version', 'v');
- }
-
- // implement your code
- protected function main(Options $options)
- {
- if ($options->getOpt('version')) {
- $this->info('1.0.0');
- } else {
- echo $options->help();
- }
- }
-}
-// execute it
-$cli = new Minimal();
-$cli->run();
-```
-
-
-
-
-The basic usage is simple:
-
-- create a class and ``extend splitbrain\phpcli\CLI``
-- implement the ```setup($options)``` method and register options, arguments, commands and set help texts
- - ``$options->setHelp()`` adds a general description
- - ``$options->registerOption()`` adds an option
- - ``$options->registerArgument()`` adds an argument
- - ``$options->registerCommand()`` adds a sub command
-- implement the ```main($options)``` method and do your business logic there
- - ``$options->getOpts`` lets you access set options
- - ``$options->getArgs()`` returns the remaining arguments after removing the options
- - ``$options->getCmd()`` returns the sub command the user used
-- instantiate your class and call ```run()``` on it
-
-More examples can be found in the examples directory. Please refer to the [API docs](https://splitbrain.github.io/php-cli/)
-for further info.
-
-## Exceptions
-
-By default, the CLI class registers an exception handler and will print the exception's message to the end user and
-exit the programm with a non-zero exit code. You can disable this behaviour and catch all exceptions yourself by
-passing false to the constructor.
-
-You can use the provided ``splitbrain\phpcli\Exception`` to signal any problems within your main code yourself. The
-exception's code will be used as the exit code then.
-
-Stacktraces will be printed on log level `debug`.
-
-## Colored output
-
-Colored output is handled through the ``Colors`` class. It tries to detect if a color terminal is available and only
-then uses terminal colors. You can always suppress colored output by passing ``--no-colors`` to your scripts.
-Disabling colors will also disable the emoticon prefixes.
-
-Simple colored log messages can be printed by you using the convinence methods ``success()`` (green), ``info()`` (cyan),
-``error()`` (red) or ``fatal()`` (red). The latter will also exit the programm with a non-zero exit code.
-
-For more complex coloring you can access the color class through ``$this->colors`` in your script. The ``wrap()`` method
-is probably what you want to use.
-
-The table formatter allows coloring full columns. To use that mechanism pass an array of colors as third parameter to
-its ``format()`` method. Please note that you can not pass colored texts in the second parameters (text length calculation
-and wrapping will fail, breaking your texts).
-
-## Table Formatter
-
-The ``TableFormatter`` class allows you to align texts in multiple columns. It tries to figure out the available
-terminal width on its own. It can be overwritten by setting a ``COLUMNS`` environment variable.
-
-The formatter is used through the ``format()`` method which expects at least two arrays: The first defines the column
-widths, the second contains the texts to fill into the columns. Between each column a border is printed (a single space
-by default).
-
-See the ``example/table.php`` for sample usage.
-
-Columns width can be given in three forms:
-
-- fixed width in characters by providing an integer (eg. ``15``)
-- precentages by provifing an integer and a percent sign (eg. ``25%``)
-- a single fluid "rest" column marked with an asterisk (eg. ``*``)
-
-When mixing fixed and percentage widths, percentages refer to the remaining space after all fixed columns have been
-assigned.
-
-Space for borders is automatically calculated. It is recommended to always have some relative (percentage) or a fluid
-column to adjust for different terminal widths.
-
-The table formatter is used for the automatic help screen accessible when calling your script with ``-h`` or ``--help``.
-
-## PSR-3 Logging
-
-The CLI class is a fully PSR-3 compatible logger (printing colored log data to STDOUT and STDERR). This is useful when
-you call backend code from your CLI that expects a Logger instance to produce any sensible status output while running.
-
-If you need to pass a class implementing the `Psr\Log\LoggerInterface` you can do so by inheriting from one of the two provided classes implementing this interface instead of `splitbrain\phpcli\CLI`.
-
- * Use `splitbrain\phpcli\PSR3CLI` if you're using version 2 of PSR3 (PHP < 8.0)
- * Use `splitbrain\phpcli\PSR3CLIv3` if you're using version 3 of PSR3 (PHP >= 8.0)
-
-The resulting object then can be passed as the logger instance. The difference between the two is in adjusted method signatures (with appropriate type hinting) only. Be sure you have the suggested `psr/log` composer package installed when using these classes.
-
-Note: if your backend code calls for a PSR-3 logger but does not actually type check for the interface (AKA being LoggerAware only) you can also just pass an instance of `splitbrain\phpcli\CLI`.
-
-## Log Levels
-
-You can adjust the verbosity of your CLI tool using the `--loglevel` parameter. Supported loglevels are the PSR-3
-loglevels and our own `success` level:
-
-* debug
-* info
-* notice
-* success (this is not defined in PSR-3)
-* warning
-* error
-* critical
-* alert
-* emergency
-
-
-
-Convenience methods for all log levels are available. Placeholder interpolation as described in PSR-3 is available, too.
-Messages from `warning` level onwards are printed to `STDERR` all below are printed to `STDOUT`.
-
-The default log level of your script can be set by overwriting the `$logdefault` member.
-
-See `example/logging.php` for an example.
diff --git a/classes/splitbrain-phpcli-Base.html b/classes/splitbrain-phpcli-Base.html
new file mode 100644
index 0000000..018dd0f
--- /dev/null
+++ b/classes/splitbrain-phpcli-Base.html
@@ -0,0 +1,1468 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base
+
+
+
+
+
+
+
+
+
+
+
+ Class CLIBase
+
+
+ All base functionality is implemented here.
+Your commandline should not inherit from this class, but from one of the CLI classes
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+ $colors
+
+ : Colors
+
+
+
+ $bin
+
+ : string
+
+
+
+ $logdefault
+
+ : string
+
+
+
+ $loglevel
+
+ : array<string|int, mixed>
+
+
+
+ $options
+
+ : Options
+
+
+
+
+
+ Methods
+
+
+
+
+
+ __construct()
+
+ : mixed
+
+constructor
+
+
+ fatal()
+
+ : mixed
+
+Exits the program on a fatal error
+
+
+ isLogLevelEnabled()
+
+ : bool
+
+Check if a message with the given level should be logged
+
+
+ run()
+
+ : mixed
+
+Execute the CLI program
+
+
+ setLogLevel()
+
+ : mixed
+
+Set the current log level
+
+
+ success()
+
+ : mixed
+
+Normal, positive outcome (This is not a PSR-3 level)
+
+
+ checkArguments()
+
+ : mixed
+
+Wrapper around the argument checking
+
+
+ execute()
+
+ : mixed
+
+Wrapper around main
+
+
+ handleDefaultOptions()
+
+ : mixed
+
+Handle the default options
+
+
+ interpolate()
+
+ : string
+
+Interpolates context values into the message placeholders.
+
+
+ logMessage()
+
+ : mixed
+
+
+
+ main()
+
+ : void
+
+Your main program
+
+
+ parseOptions()
+
+ : mixed
+
+Wrapper around the option parsing
+
+
+ registerDefaultOptions()
+
+ : mixed
+
+Add the default help, color and log options
+
+
+ setup()
+
+ : void
+
+Register options and arguments on the given $options object
+
+
+ setupLogging()
+
+ : mixed
+
+Handle the logging options
+
+
+
+
+
+
+
+
+
+
+
+
+ $colors
+
+
+
+
+
+
+
+
+
+
+ public
+ Colors
+ $colors
+
+
+
+
+
+
+
+
+
+
+
+
+ $bin
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $bin
+
+
+
+ the executed script itself
+
+
+
+
+
+
+
+
+
+
+ $logdefault
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $logdefault
+ = 'info'
+
+
+
+
+
+
+
+
+
+
+
+
+ $loglevel
+
+
+
+
+
+
+
+
+
+
+ protected
+ array<string|int, mixed>
+ $loglevel
+ = array('debug' => array('icon' => '', 'color' => \splitbrain\phpcli\Colors::C_RESET, 'channel' => STDOUT, 'enabled' => true), 'info' => array('icon' => 'ℹ ', 'color' => \splitbrain\phpcli\Colors::C_CYAN, 'channel' => STDOUT, 'enabled' => true), 'notice' => array('icon' => '☛ ', 'color' => \splitbrain\phpcli\Colors::C_CYAN, 'channel' => STDOUT, 'enabled' => true), 'success' => array('icon' => '✓ ', 'color' => \splitbrain\phpcli\Colors::C_GREEN, 'channel' => STDOUT, 'enabled' => true), 'warning' => array('icon' => '⚠ ', 'color' => \splitbrain\phpcli\Colors::C_BROWN, 'channel' => STDERR, 'enabled' => true), 'error' => array('icon' => '✗ ', 'color' => \splitbrain\phpcli\Colors::C_RED, 'channel' => STDERR, 'enabled' => true), 'critical' => array('icon' => '☠ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true), 'alert' => array('icon' => '✖ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true), 'emergency' => array('icon' => '✘ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true))
+
+
+ PSR-3 compatible loglevels and their prefix, color, output channel, enabled status
+
+
+
+
+
+
+
+
+
+
+ $options
+
+
+
+
+
+
+
+
+
+
+ protected
+ Options
+ $options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+
+ constructor
+
+
+ public
+ __construct ( [ bool $autocatch = true ] ) : mixed
+
+
+
+
+ Initialize the arguments, set up helper classes and set up the CLI environment
+
+
+ Parameters
+
+
+ $autocatch
+ : bool
+ = true
+
+ should exceptions be catched and handled automatically?
+
+
+
+
+
+
+
+
+
+
+
+
+
+ fatal()
+
+
+
+
+
+ Exits the program on a fatal error
+
+
+ public
+ fatal ( Exception |string $error [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $error
+ : Exception |string
+
+
+ either an exception or an error message
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isLogLevelEnabled()
+
+
+
+
+
+ Check if a message with the given level should be logged
+
+
+ public
+ isLogLevelEnabled ( string $level ) : bool
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ run()
+
+
+
+
+
+ Execute the CLI program
+
+
+ public
+ run ( ) : mixed
+
+
+
+
+ Executes the setup() routine, adds default options, initiate the options parsing and argument checking
+and finally executes main() - Each part is split into their own protected function below, so behaviour
+can easily be overwritten
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setLogLevel()
+
+
+
+
+
+ Set the current log level
+
+
+ public
+ setLogLevel ( string $level ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ success()
+
+
+
+
+
+ Normal, positive outcome (This is not a PSR-3 level)
+
+
+ public
+ success ( string $string [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $string
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ checkArguments()
+
+
+
+
+
+ Wrapper around the argument checking
+
+
+ protected
+ checkArguments ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ execute()
+
+
+
+
+
+ Wrapper around main
+
+
+ protected
+ execute ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ handleDefaultOptions()
+
+
+
+
+
+ Handle the default options
+
+
+ protected
+ handleDefaultOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ interpolate()
+
+
+
+
+
+ Interpolates context values into the message placeholders.
+
+
+ protected
+ interpolate ( mixed $message [ , array<string|int, mixed> $context = array() ] ) : string
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : mixed
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ logMessage()
+
+
+
+
+
+
+
+ protected
+ logMessage ( string $level , string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ main()
+
+
+
+
+
+ Your main program
+
+
+ protected
+ abstract main ( Options $options ) : void
+
+
+
+
+ Arguments and options have been parsed when this is run
+
+
+ Parameters
+
+
+ $options
+ : Options
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ parseOptions()
+
+
+
+
+
+ Wrapper around the option parsing
+
+
+ protected
+ parseOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ registerDefaultOptions()
+
+
+
+
+
+ Add the default help, color and log options
+
+
+ protected
+ registerDefaultOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setup()
+
+
+
+
+
+ Register options and arguments on the given $options object
+
+
+ protected
+ abstract setup ( Options $options ) : void
+
+
+
+
+
+ Parameters
+
+
+ $options
+ : Options
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setupLogging()
+
+
+
+
+
+ Handle the logging options
+
+
+ protected
+ setupLogging ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/classes/splitbrain-phpcli-CLI.html b/classes/splitbrain-phpcli-CLI.html
new file mode 100644
index 0000000..9c92a3a
--- /dev/null
+++ b/classes/splitbrain-phpcli-CLI.html
@@ -0,0 +1,2027 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CLI
+
+
+ extends Base
+
+
+
+
+
+
+
+
+
+
+
+ Class CLI
+
+
+ Your commandline script should inherit from this class and implement the abstract methods.
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+ $colors
+
+ : Colors
+
+
+
+ $bin
+
+ : string
+
+
+
+ $logdefault
+
+ : string
+
+
+
+ $loglevel
+
+ : array<string|int, mixed>
+
+
+
+ $options
+
+ : Options
+
+
+
+
+
+ Methods
+
+
+
+
+
+ __construct()
+
+ : mixed
+
+constructor
+
+
+ alert()
+
+ : mixed
+
+Action must be taken immediately.
+
+
+ critical()
+
+ : mixed
+
+Critical conditions.
+
+
+ debug()
+
+ : mixed
+
+Detailed debug information.
+
+
+ emergency()
+
+ : void
+
+System is unusable.
+
+
+ error()
+
+ : mixed
+
+Runtime errors that do not require immediate action but should typically
+be logged and monitored.
+
+
+ fatal()
+
+ : mixed
+
+Exits the program on a fatal error
+
+
+ info()
+
+ : mixed
+
+Interesting events.
+
+
+ isLogLevelEnabled()
+
+ : bool
+
+Check if a message with the given level should be logged
+
+
+ log()
+
+ : mixed
+
+
+
+ notice()
+
+ : mixed
+
+Normal but significant events.
+
+
+ run()
+
+ : mixed
+
+Execute the CLI program
+
+
+ setLogLevel()
+
+ : mixed
+
+Set the current log level
+
+
+ success()
+
+ : mixed
+
+Normal, positive outcome (This is not a PSR-3 level)
+
+
+ warning()
+
+ : mixed
+
+Exceptional occurrences that are not errors.
+
+
+ checkArguments()
+
+ : mixed
+
+Wrapper around the argument checking
+
+
+ execute()
+
+ : mixed
+
+Wrapper around main
+
+
+ handleDefaultOptions()
+
+ : mixed
+
+Handle the default options
+
+
+ interpolate()
+
+ : string
+
+Interpolates context values into the message placeholders.
+
+
+ logMessage()
+
+ : mixed
+
+
+
+ main()
+
+ : void
+
+Your main program
+
+
+ parseOptions()
+
+ : mixed
+
+Wrapper around the option parsing
+
+
+ registerDefaultOptions()
+
+ : mixed
+
+Add the default help, color and log options
+
+
+ setup()
+
+ : void
+
+Register options and arguments on the given $options object
+
+
+ setupLogging()
+
+ : mixed
+
+Handle the logging options
+
+
+
+
+
+
+
+
+
+
+
+
+ $colors
+
+
+
+
+
+
+
+
+
+
+ public
+ Colors
+ $colors
+
+
+
+
+
+
+
+
+
+
+
+
+ $bin
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $bin
+
+
+
+ the executed script itself
+
+
+
+
+
+
+
+
+
+
+ $logdefault
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $logdefault
+ = 'info'
+
+
+
+
+
+
+
+
+
+
+
+
+ $loglevel
+
+
+
+
+
+
+
+
+
+
+ protected
+ array<string|int, mixed>
+ $loglevel
+ = array('debug' => array('icon' => '', 'color' => \splitbrain\phpcli\Colors::C_RESET, 'channel' => STDOUT, 'enabled' => true), 'info' => array('icon' => 'ℹ ', 'color' => \splitbrain\phpcli\Colors::C_CYAN, 'channel' => STDOUT, 'enabled' => true), 'notice' => array('icon' => '☛ ', 'color' => \splitbrain\phpcli\Colors::C_CYAN, 'channel' => STDOUT, 'enabled' => true), 'success' => array('icon' => '✓ ', 'color' => \splitbrain\phpcli\Colors::C_GREEN, 'channel' => STDOUT, 'enabled' => true), 'warning' => array('icon' => '⚠ ', 'color' => \splitbrain\phpcli\Colors::C_BROWN, 'channel' => STDERR, 'enabled' => true), 'error' => array('icon' => '✗ ', 'color' => \splitbrain\phpcli\Colors::C_RED, 'channel' => STDERR, 'enabled' => true), 'critical' => array('icon' => '☠ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true), 'alert' => array('icon' => '✖ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true), 'emergency' => array('icon' => '✘ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true))
+
+
+ PSR-3 compatible loglevels and their prefix, color, output channel, enabled status
+
+
+
+
+
+
+
+
+
+
+ $options
+
+
+
+
+
+
+
+
+
+
+ protected
+ Options
+ $options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+
+ constructor
+
+
+ public
+ __construct ( [ bool $autocatch = true ] ) : mixed
+
+
+
+
+ Initialize the arguments, set up helper classes and set up the CLI environment
+
+
+ Parameters
+
+
+ $autocatch
+ : bool
+ = true
+
+ should exceptions be catched and handled automatically?
+
+
+
+
+
+
+
+
+
+
+
+
+
+ alert()
+
+
+
+
+
+ Action must be taken immediately.
+
+
+ public
+ alert ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+ Example: Entire website down, database unavailable, etc. This should
+trigger the SMS alerts and wake you up.
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ critical()
+
+
+
+
+
+ Critical conditions.
+
+
+ public
+ critical ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+ Example: Application component unavailable, unexpected exception.
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ debug()
+
+
+
+
+
+ Detailed debug information.
+
+
+ public
+ debug ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ emergency()
+
+
+
+
+
+ System is unusable.
+
+
+ public
+ emergency ( string $message [ , array<string|int, mixed> $context = array() ] ) : void
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ error()
+
+
+
+
+
+ Runtime errors that do not require immediate action but should typically
+be logged and monitored.
+
+
+ public
+ error ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ fatal()
+
+
+
+
+
+ Exits the program on a fatal error
+
+
+ public
+ fatal ( Exception |string $error [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $error
+ : Exception |string
+
+
+ either an exception or an error message
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ info()
+
+
+
+
+
+ Interesting events.
+
+
+ public
+ info ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+ Example: User logs in, SQL logs.
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isLogLevelEnabled()
+
+
+
+
+
+ Check if a message with the given level should be logged
+
+
+ public
+ isLogLevelEnabled ( string $level ) : bool
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ log()
+
+
+
+
+
+
+
+ public
+ log ( string $level , string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ notice()
+
+
+
+
+
+ Normal but significant events.
+
+
+ public
+ notice ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ run()
+
+
+
+
+
+ Execute the CLI program
+
+
+ public
+ run ( ) : mixed
+
+
+
+
+ Executes the setup() routine, adds default options, initiate the options parsing and argument checking
+and finally executes main() - Each part is split into their own protected function below, so behaviour
+can easily be overwritten
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setLogLevel()
+
+
+
+
+
+ Set the current log level
+
+
+ public
+ setLogLevel ( string $level ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ success()
+
+
+
+
+
+ Normal, positive outcome (This is not a PSR-3 level)
+
+
+ public
+ success ( string $string [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $string
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ warning()
+
+
+
+
+
+ Exceptional occurrences that are not errors.
+
+
+ public
+ warning ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+ Example: Use of deprecated APIs, poor use of an API, undesirable things
+that are not necessarily wrong.
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ checkArguments()
+
+
+
+
+
+ Wrapper around the argument checking
+
+
+ protected
+ checkArguments ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ execute()
+
+
+
+
+
+ Wrapper around main
+
+
+ protected
+ execute ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ handleDefaultOptions()
+
+
+
+
+
+ Handle the default options
+
+
+ protected
+ handleDefaultOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ interpolate()
+
+
+
+
+
+ Interpolates context values into the message placeholders.
+
+
+ protected
+ interpolate ( mixed $message [ , array<string|int, mixed> $context = array() ] ) : string
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : mixed
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ logMessage()
+
+
+
+
+
+
+
+ protected
+ logMessage ( string $level , string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ main()
+
+
+
+
+
+ Your main program
+
+
+ protected
+ abstract main ( Options $options ) : void
+
+
+
+
+ Arguments and options have been parsed when this is run
+
+
+ Parameters
+
+
+ $options
+ : Options
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ parseOptions()
+
+
+
+
+
+ Wrapper around the option parsing
+
+
+ protected
+ parseOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ registerDefaultOptions()
+
+
+
+
+
+ Add the default help, color and log options
+
+
+ protected
+ registerDefaultOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setup()
+
+
+
+
+
+ Register options and arguments on the given $options object
+
+
+ protected
+ abstract setup ( Options $options ) : void
+
+
+
+
+
+ Parameters
+
+
+ $options
+ : Options
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setupLogging()
+
+
+
+
+
+ Handle the logging options
+
+
+ protected
+ setupLogging ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/classes/splitbrain-phpcli-Colors.html b/classes/splitbrain-phpcli-Colors.html
new file mode 100644
index 0000000..045b33c
--- /dev/null
+++ b/classes/splitbrain-phpcli-Colors.html
@@ -0,0 +1,1721 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Colors
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Class Colors
+
+
+ Handles color output on (Linux) terminals
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+
+
+
+ Constants
+
+
+
+
+
+ C_BLACK
+
+ = 'black'
+
+
+
+ C_BLUE
+
+ = 'blue'
+
+
+
+ C_BROWN
+
+ = 'brown'
+
+
+
+ C_CODE_REGEX
+
+ = "/(\x1b\\[[0-9;]+m)/"
+
+
+
+ C_CYAN
+
+ = 'cyan'
+
+
+
+ C_DARKGRAY
+
+ = 'darkgray'
+
+
+
+ C_GREEN
+
+ = 'green'
+
+
+
+ C_LIGHTBLUE
+
+ = 'lightblue'
+
+
+
+ C_LIGHTCYAN
+
+ = 'lightcyan'
+
+
+
+ C_LIGHTGRAY
+
+ = 'lightgray'
+
+
+
+ C_LIGHTGREEN
+
+ = 'lightgreen'
+
+
+
+ C_LIGHTPURPLE
+
+ = 'lightpurple'
+
+
+
+ C_LIGHTRED
+
+ = 'lightred'
+
+
+
+ C_PURPLE
+
+ = 'purple'
+
+
+
+ C_RED
+
+ = 'red'
+
+
+
+ C_RESET
+
+ = 'reset'
+
+
+
+ C_WHITE
+
+ = 'white'
+
+
+
+ C_YELLOW
+
+ = 'yellow'
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+ $colors
+
+ : array<string|int, mixed>
+
+
+
+ $enabled
+
+ : bool
+
+
+
+
+
+ Methods
+
+
+
+
+
+ __construct()
+
+ : mixed
+
+Constructor
+
+
+ disable()
+
+ : mixed
+
+disable color output
+
+
+ enable()
+
+ : mixed
+
+enable color output
+
+
+ getColorCode()
+
+ : string
+
+Gets the appropriate terminal code for the given color
+
+
+ isEnabled()
+
+ : bool
+
+
+
+ ptln()
+
+ : mixed
+
+Convenience function to print a line in a given color
+
+
+ reset()
+
+ : mixed
+
+reset the terminal color
+
+
+ set()
+
+ : mixed
+
+Set the given color for consecutive output
+
+
+ wrap()
+
+ : string
+
+Returns the given text wrapped in the appropriate color and reset code
+
+
+
+
+
+
+
+
+
+
+ C_BLACK
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_BLACK
+ = 'black'
+
+
+
+
+
+
+
+
+
+
+
+ C_BLUE
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_BLUE
+ = 'blue'
+
+
+
+
+
+
+
+
+
+
+
+ C_BROWN
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_BROWN
+ = 'brown'
+
+
+
+
+
+
+
+
+
+
+
+ C_CODE_REGEX
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_CODE_REGEX
+ = "/(\x1b\\[[0-9;]+m)/"
+
+
+
+
+
+
+
+
+
+
+
+ C_CYAN
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_CYAN
+ = 'cyan'
+
+
+
+
+
+
+
+
+
+
+
+ C_DARKGRAY
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_DARKGRAY
+ = 'darkgray'
+
+
+
+
+
+
+
+
+
+
+
+ C_GREEN
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_GREEN
+ = 'green'
+
+
+
+
+
+
+
+
+
+
+
+ C_LIGHTBLUE
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_LIGHTBLUE
+ = 'lightblue'
+
+
+
+
+
+
+
+
+
+
+
+ C_LIGHTCYAN
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_LIGHTCYAN
+ = 'lightcyan'
+
+
+
+
+
+
+
+
+
+
+
+ C_LIGHTGRAY
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_LIGHTGRAY
+ = 'lightgray'
+
+
+
+
+
+
+
+
+
+
+
+ C_LIGHTGREEN
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_LIGHTGREEN
+ = 'lightgreen'
+
+
+
+
+
+
+
+
+
+
+
+ C_LIGHTPURPLE
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_LIGHTPURPLE
+ = 'lightpurple'
+
+
+
+
+
+
+
+
+
+
+
+ C_LIGHTRED
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_LIGHTRED
+ = 'lightred'
+
+
+
+
+
+
+
+
+
+
+
+ C_PURPLE
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_PURPLE
+ = 'purple'
+
+
+
+
+
+
+
+
+
+
+
+ C_RED
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_RED
+ = 'red'
+
+
+
+
+
+
+
+
+
+
+
+ C_RESET
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_RESET
+ = 'reset'
+
+
+
+
+
+
+
+
+
+
+
+ C_WHITE
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_WHITE
+ = 'white'
+
+
+
+
+
+
+
+
+
+
+
+ C_YELLOW
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ C_YELLOW
+ = 'yellow'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $colors
+
+
+
+
+
+
+
+
+
+
+ protected
+ array<string|int, mixed>
+ $colors
+ = array(self::C_RESET => "\x1b[0m", self::C_BLACK => "\x1b[0;30m", self::C_DARKGRAY => "\x1b[1;30m", self::C_BLUE => "\x1b[0;34m", self::C_LIGHTBLUE => "\x1b[1;34m", self::C_GREEN => "\x1b[0;32m", self::C_LIGHTGREEN => "\x1b[1;32m", self::C_CYAN => "\x1b[0;36m", self::C_LIGHTCYAN => "\x1b[1;36m", self::C_RED => "\x1b[0;31m", self::C_LIGHTRED => "\x1b[1;31m", self::C_PURPLE => "\x1b[0;35m", self::C_LIGHTPURPLE => "\x1b[1;35m", self::C_BROWN => "\x1b[0;33m", self::C_YELLOW => "\x1b[1;33m", self::C_LIGHTGRAY => "\x1b[0;37m", self::C_WHITE => "\x1b[1;37m")
+
+
+
+
+
+
+
+
+
+
+
+
+ $enabled
+
+
+
+
+
+
+
+
+
+
+ protected
+ bool
+ $enabled
+ = true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+
+ Constructor
+
+
+ public
+ __construct ( ) : mixed
+
+
+
+
+ Tries to disable colors for non-terminals
+
+
+
+
+
+
+
+
+
+
+
+ disable()
+
+
+
+
+
+ disable color output
+
+
+ public
+ disable ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ enable()
+
+
+
+
+
+ enable color output
+
+
+ public
+ enable ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getColorCode()
+
+
+
+
+
+ Gets the appropriate terminal code for the given color
+
+
+ public
+ getColorCode ( string $color ) : string
+
+
+
+
+
+ Parameters
+
+
+ $color
+ : string
+
+
+ one of the available color names
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+ Return values
+ string
+ —
+
+
+
+
+
+
+
+ isEnabled()
+
+
+
+
+
+
+
+ public
+ isEnabled ( ) : bool
+
+
+
+
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+ is color support enabled?
+
+
+
+
+
+
+
+ ptln()
+
+
+
+
+
+ Convenience function to print a line in a given color
+
+
+ public
+ ptln ( string $line , string $color [ , resource $channel = STDOUT ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $line
+ : string
+
+
+ the line to print, a new line is added automatically
+
+
+
+
+ $color
+ : string
+
+
+ one of the available color names
+
+
+
+
+ $channel
+ : resource
+ = STDOUT
+
+ file descriptor to write to
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ reset()
+
+
+
+
+
+ reset the terminal color
+
+
+ public
+ reset ( [ resource $channel = STDOUT ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $channel
+ : resource
+ = STDOUT
+
+ file descriptor to write to
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ set()
+
+
+
+
+
+ Set the given color for consecutive output
+
+
+ public
+ set ( string $color [ , resource $channel = STDOUT ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $color
+ : string
+
+
+ one of the supported color names
+
+
+
+
+ $channel
+ : resource
+ = STDOUT
+
+ file descriptor to write to
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ wrap()
+
+
+
+
+
+ Returns the given text wrapped in the appropriate color and reset code
+
+
+ public
+ wrap ( string $text , string $color ) : string
+
+
+
+
+
+ Parameters
+
+
+ $text
+ : string
+
+
+
+
+
+
+ $color
+ : string
+
+
+ one of the available color names
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+ Return values
+ string
+ —
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/classes/splitbrain-phpcli-Exception.html b/classes/splitbrain-phpcli-Exception.html
new file mode 100644
index 0000000..37359ba
--- /dev/null
+++ b/classes/splitbrain-phpcli-Exception.html
@@ -0,0 +1,658 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Exception
+
+
+ extends RuntimeException
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Class Exception
+
+
+ The code is used as exit code for the CLI tool. This should probably be extended. Many cases just fall back to the
+E_ANY code.
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+
+
+
+ Constants
+
+
+
+
+
+ E_ANY
+
+ = -1
+
+
+
+ E_ARG_READ
+
+ = 5
+
+
+
+ E_OPT_ABIGUOUS
+
+ = 4
+
+
+
+ E_OPT_ARG_DENIED
+
+ = 3
+
+
+
+ E_OPT_ARG_REQUIRED
+
+ = 2
+
+
+
+ E_UNKNOWN_OPT
+
+ = 1
+
+
+
+
+
+
+
+ Methods
+
+
+
+
+
+ __construct()
+
+ : mixed
+
+
+
+
+
+
+
+
+
+
+
+ E_ANY
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ E_ANY
+ = -1
+
+
+
+
+
+
+
+
+
+
+
+ E_ARG_READ
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ E_ARG_READ
+ = 5
+
+
+
+
+
+
+
+
+
+
+
+ E_OPT_ABIGUOUS
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ E_OPT_ABIGUOUS
+ = 4
+
+
+
+
+
+
+
+
+
+
+
+ E_OPT_ARG_DENIED
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ E_OPT_ARG_DENIED
+ = 3
+
+
+
+
+
+
+
+
+
+
+
+ E_OPT_ARG_REQUIRED
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ E_OPT_ARG_REQUIRED
+ = 2
+
+
+
+
+
+
+
+
+
+
+
+ E_UNKNOWN_OPT
+
+
+
+
+
+
+
+
+
+ public
+ mixed
+ E_UNKNOWN_OPT
+ = 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+
+
+
+ public
+ __construct ( [ string $message = "" ] [ , int $code = 0 ] [ , Exception $previous = null ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+ = ""
+
+ The Exception message to throw.
+
+
+
+
+ $code
+ : int
+ = 0
+
+
+
+
+
+ $previous
+ : Exception
+ = null
+
+ The previous exception used for the exception chaining.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/classes/splitbrain-phpcli-Options.html b/classes/splitbrain-phpcli-Options.html
new file mode 100644
index 0000000..ceb29a0
--- /dev/null
+++ b/classes/splitbrain-phpcli-Options.html
@@ -0,0 +1,1661 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Class Options
+
+
+ Parses command line options passed to the CLI script. Allows CLI scripts to easily register all accepted options and
+commands and even generates a help text from this setup.
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+ $args
+
+ : array<string|int, mixed>
+
+
+
+ $bin
+
+ : string
+
+
+
+ $colors
+
+ : Colors
+
+
+
+ $command
+
+ : string
+
+
+
+ $newline
+
+ : string
+
+
+
+ $options
+
+ : array<string|int, mixed>
+
+
+
+ $setup
+
+ : array<string|int, mixed>
+
+
+
+
+
+ Methods
+
+
+
+
+
+ __construct()
+
+ : mixed
+
+Constructor
+
+
+ checkArguments()
+
+ : mixed
+
+Checks the actual number of arguments against the required number
+
+
+ getArgs()
+
+ : array<string|int, mixed>
+
+Get all the arguments passed to the script
+
+
+ getBin()
+
+ : mixed
+
+Gets the bin value
+
+
+ getCmd()
+
+ : string
+
+Return the found command if any
+
+
+ getOpt()
+
+ : bool|string|array<string|int, string>
+
+Get the value of the given option
+
+
+ help()
+
+ : string
+
+Builds a help screen from the available options. You may want to call it from -h or on error
+
+
+ parseOptions()
+
+ : mixed
+
+Parses the given arguments for known options and command
+
+
+ registerArgument()
+
+ : mixed
+
+Register the names of arguments for help generation and number checking
+
+
+ registerCommand()
+
+ : mixed
+
+This registers a sub command
+
+
+ registerOption()
+
+ : mixed
+
+Register an option for option parsing and help generation
+
+
+ setCommandHelp()
+
+ : mixed
+
+Sets the help text for the tools commands itself
+
+
+ setHelp()
+
+ : mixed
+
+Sets the help text for the tool itself
+
+
+ useCompactHelp()
+
+ : mixed
+
+Use a more compact help screen with less new lines
+
+
+ readPHPArgv()
+
+ : array<string|int, mixed>
+
+Safely read the $argv PHP array across different PHP configurations.
+
+
+
+
+
+
+
+
+
+
+
+
+ $args
+
+
+
+
+
+
+
+
+
+
+ protected
+ array<string|int, mixed>
+ $args
+ = array()
+
+
+ passed non-option arguments
+
+
+
+
+
+
+
+
+
+
+ $bin
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $bin
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $colors
+
+
+
+
+
+
+
+
+
+
+ protected
+ Colors
+ $colors
+
+
+
+ for colored help output
+
+
+
+
+
+
+
+
+
+
+ $command
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $command
+ = ''
+
+
+ current parsed command if any
+
+
+
+
+
+
+
+
+
+
+ $newline
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $newline
+ = "\n"
+
+
+ newline used for spacing help texts
+
+
+
+
+
+
+
+
+
+
+ $options
+
+
+
+
+
+
+
+
+
+
+ protected
+ array<string|int, mixed>
+ $options
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+ $setup
+
+
+
+
+
+
+
+
+
+
+ protected
+ array<string|int, mixed>
+ $setup
+
+
+
+ keeps the list of options to parse
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+
+ Constructor
+
+
+ public
+ __construct ( [ Colors $colors = null ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $colors
+ : Colors
+ = null
+
+ optional configured color object
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+ when arguments can't be read
+
+
+
+
+
+
+
+
+
+
+
+ checkArguments()
+
+
+
+
+
+ Checks the actual number of arguments against the required number
+
+
+ public
+ checkArguments ( ) : mixed
+
+
+
+
+ Throws an exception if arguments are missing.
+This is run from CLI automatically and usually does not need to be called directly
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ getArgs()
+
+
+
+
+
+ Get all the arguments passed to the script
+
+
+ public
+ getArgs ( ) : array<string|int, mixed>
+
+
+
+
+ This will not contain any recognized options or the script name itself
+
+
+
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+
+
+
+
+
+ getBin()
+
+
+
+
+
+ Gets the bin value
+
+
+ public
+ getBin ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getCmd()
+
+
+
+
+
+ Return the found command if any
+
+
+ public
+ getCmd ( ) : string
+
+
+
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ getOpt()
+
+
+
+
+
+ Get the value of the given option
+
+
+ public
+ getOpt ( [ mixed $option = null ] [ , bool|string $default = false ] ) : bool|string|array<string|int, string>
+
+
+
+
+ Please note that all options are accessed by their long option names regardless of how they were
+specified on commandline.
+Can only be used after parseOptions() has been run
+
+
+ Parameters
+
+
+ $option
+ : mixed
+ = null
+
+
+
+
+ $default
+ : bool|string
+ = false
+
+ what to return if the option was not set
+
+
+
+
+
+
+
+
+
+
+ Return values
+ bool|string|array<string|int, string>
+
+
+
+
+
+ help()
+
+
+
+
+
+ Builds a help screen from the available options. You may want to call it from -h or on error
+
+
+ public
+ help ( ) : string
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ parseOptions()
+
+
+
+
+
+ Parses the given arguments for known options and command
+
+
+ public
+ parseOptions ( ) : mixed
+
+
+
+
+ The given $args array should NOT contain the executed file as first item anymore! The $args
+array is stripped from any options and possible command. All found otions can be accessed via the
+getOpt() function
+Note that command options will overwrite any global options with the same name
+This is run from CLI automatically and usually does not need to be called directly
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ registerArgument()
+
+
+
+
+
+ Register the names of arguments for help generation and number checking
+
+
+ public
+ registerArgument ( string $arg , string $help [ , bool $required = true ] [ , string $command = '' ] ) : mixed
+
+
+
+
+ This has to be called in the order arguments are expected
+
+
+ Parameters
+
+
+ $arg
+ : string
+
+
+ argument name (just for help)
+
+
+
+
+ $help
+ : string
+
+
+
+
+
+
+ $required
+ : bool
+ = true
+
+ is this a required argument
+
+
+
+
+ $command
+ : string
+ = ''
+
+ if theses apply to a sub command only
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ registerCommand()
+
+
+
+
+
+ This registers a sub command
+
+
+ public
+ registerCommand ( string $command , string $help ) : mixed
+
+
+
+
+ Sub commands have their own options and use their own function (not main()).
+
+
+ Parameters
+
+
+ $command
+ : string
+
+
+
+
+
+ $help
+ : string
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ registerOption()
+
+
+
+
+
+ Register an option for option parsing and help generation
+
+
+ public
+ registerOption ( string $long , string $help [ , string|null $short = null ] [ , bool|string $needsarg = false ] [ , string $command = '' ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $long
+ : string
+
+
+ multi character option (specified with --)
+
+
+
+
+ $help
+ : string
+
+
+ help text for this option
+
+
+
+
+ $short
+ : string|null
+ = null
+
+ one character option (specified with -)
+
+
+
+
+ $needsarg
+ : bool|string
+ = false
+
+ does this option require an argument? give it a name here
+
+
+
+
+ $command
+ : string
+ = ''
+
+ what command does this option apply to
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setCommandHelp()
+
+
+
+
+
+ Sets the help text for the tools commands itself
+
+
+ public
+ setCommandHelp ( string $help ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $help
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setHelp()
+
+
+
+
+
+ Sets the help text for the tool itself
+
+
+ public
+ setHelp ( string $help ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $help
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ useCompactHelp()
+
+
+
+
+
+ Use a more compact help screen with less new lines
+
+
+ public
+ useCompactHelp ( [ bool $set = true ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $set
+ : bool
+ = true
+
+
+
+
+
+
+
+
+
+
+
+
+
+ readPHPArgv()
+
+
+
+
+
+ Safely read the $argv PHP array across different PHP configurations.
+
+
+ private
+ readPHPArgv ( ) : array<string|int, mixed>
+
+
+
+
+ Will take care on register_globals and register_argc_argv ini directives
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+ —
+ the $argv PHP array or PEAR error if not registered
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/classes/splitbrain-phpcli-PSR3CLI.html b/classes/splitbrain-phpcli-PSR3CLI.html
new file mode 100644
index 0000000..9c44944
--- /dev/null
+++ b/classes/splitbrain-phpcli-PSR3CLI.html
@@ -0,0 +1,2030 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PSR3CLI
+
+
+ extends CLI
+
+
+
+
+
+ implements
+ LoggerInterface
+
+
+
+
+
+
+
+ Class PSR3CLI
+
+
+ This class can be used instead of the CLI class when a class implementing
+PSR3 version 2 is needed.
+
+
+
+
+
+
+ see
+
+
+ PSR3CLIv3
+
+ for a version 3 compatible class
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+ Interfaces
+
+
+
+
+ LoggerInterface
+
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+ $colors
+
+ : Colors
+
+
+
+ $bin
+
+ : string
+
+
+
+ $logdefault
+
+ : string
+
+
+
+ $loglevel
+
+ : array<string|int, mixed>
+
+
+
+ $options
+
+ : Options
+
+
+
+
+
+ Methods
+
+
+
+
+
+ __construct()
+
+ : mixed
+
+constructor
+
+
+ alert()
+
+ : mixed
+
+Action must be taken immediately.
+
+
+ critical()
+
+ : mixed
+
+Critical conditions.
+
+
+ debug()
+
+ : mixed
+
+Detailed debug information.
+
+
+ emergency()
+
+ : void
+
+System is unusable.
+
+
+ error()
+
+ : mixed
+
+Runtime errors that do not require immediate action but should typically
+be logged and monitored.
+
+
+ fatal()
+
+ : mixed
+
+Exits the program on a fatal error
+
+
+ info()
+
+ : mixed
+
+Interesting events.
+
+
+ isLogLevelEnabled()
+
+ : bool
+
+Check if a message with the given level should be logged
+
+
+ log()
+
+ : mixed
+
+
+
+ notice()
+
+ : mixed
+
+Normal but significant events.
+
+
+ run()
+
+ : mixed
+
+Execute the CLI program
+
+
+ setLogLevel()
+
+ : mixed
+
+Set the current log level
+
+
+ success()
+
+ : mixed
+
+Normal, positive outcome (This is not a PSR-3 level)
+
+
+ warning()
+
+ : mixed
+
+Exceptional occurrences that are not errors.
+
+
+ checkArguments()
+
+ : mixed
+
+Wrapper around the argument checking
+
+
+ execute()
+
+ : mixed
+
+Wrapper around main
+
+
+ handleDefaultOptions()
+
+ : mixed
+
+Handle the default options
+
+
+ interpolate()
+
+ : string
+
+Interpolates context values into the message placeholders.
+
+
+ logMessage()
+
+ : mixed
+
+
+
+ main()
+
+ : void
+
+Your main program
+
+
+ parseOptions()
+
+ : mixed
+
+Wrapper around the option parsing
+
+
+ registerDefaultOptions()
+
+ : mixed
+
+Add the default help, color and log options
+
+
+ setup()
+
+ : void
+
+Register options and arguments on the given $options object
+
+
+ setupLogging()
+
+ : mixed
+
+Handle the logging options
+
+
+
+
+
+
+
+
+
+
+
+
+ $colors
+
+
+
+
+
+
+
+
+
+
+ public
+ Colors
+ $colors
+
+
+
+
+
+
+
+
+
+
+
+
+ $bin
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $bin
+
+
+
+ the executed script itself
+
+
+
+
+
+
+
+
+
+
+ $logdefault
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $logdefault
+ = 'info'
+
+
+
+
+
+
+
+
+
+
+
+
+ $loglevel
+
+
+
+
+
+
+
+
+
+
+ protected
+ array<string|int, mixed>
+ $loglevel
+ = array('debug' => array('icon' => '', 'color' => \splitbrain\phpcli\Colors::C_RESET, 'channel' => STDOUT, 'enabled' => true), 'info' => array('icon' => 'ℹ ', 'color' => \splitbrain\phpcli\Colors::C_CYAN, 'channel' => STDOUT, 'enabled' => true), 'notice' => array('icon' => '☛ ', 'color' => \splitbrain\phpcli\Colors::C_CYAN, 'channel' => STDOUT, 'enabled' => true), 'success' => array('icon' => '✓ ', 'color' => \splitbrain\phpcli\Colors::C_GREEN, 'channel' => STDOUT, 'enabled' => true), 'warning' => array('icon' => '⚠ ', 'color' => \splitbrain\phpcli\Colors::C_BROWN, 'channel' => STDERR, 'enabled' => true), 'error' => array('icon' => '✗ ', 'color' => \splitbrain\phpcli\Colors::C_RED, 'channel' => STDERR, 'enabled' => true), 'critical' => array('icon' => '☠ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true), 'alert' => array('icon' => '✖ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true), 'emergency' => array('icon' => '✘ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true))
+
+
+ PSR-3 compatible loglevels and their prefix, color, output channel, enabled status
+
+
+
+
+
+
+
+
+
+
+ $options
+
+
+
+
+
+
+
+
+
+
+ protected
+ Options
+ $options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+
+ constructor
+
+
+ public
+ __construct ( [ bool $autocatch = true ] ) : mixed
+
+
+
+
+ Initialize the arguments, set up helper classes and set up the CLI environment
+
+
+ Parameters
+
+
+ $autocatch
+ : bool
+ = true
+
+ should exceptions be catched and handled automatically?
+
+
+
+
+
+
+
+
+
+
+
+
+
+ alert()
+
+
+
+
+
+ Action must be taken immediately.
+
+
+ public
+ alert ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+ Example: Entire website down, database unavailable, etc. This should
+trigger the SMS alerts and wake you up.
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ critical()
+
+
+
+
+
+ Critical conditions.
+
+
+ public
+ critical ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+ Example: Application component unavailable, unexpected exception.
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ debug()
+
+
+
+
+
+ Detailed debug information.
+
+
+ public
+ debug ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ emergency()
+
+
+
+
+
+ System is unusable.
+
+
+ public
+ emergency ( string $message [ , array<string|int, mixed> $context = array() ] ) : void
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ error()
+
+
+
+
+
+ Runtime errors that do not require immediate action but should typically
+be logged and monitored.
+
+
+ public
+ error ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ fatal()
+
+
+
+
+
+ Exits the program on a fatal error
+
+
+ public
+ fatal ( Exception |string $error [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $error
+ : Exception |string
+
+
+ either an exception or an error message
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ info()
+
+
+
+
+
+ Interesting events.
+
+
+ public
+ info ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+ Example: User logs in, SQL logs.
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isLogLevelEnabled()
+
+
+
+
+
+ Check if a message with the given level should be logged
+
+
+ public
+ isLogLevelEnabled ( string $level ) : bool
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ log()
+
+
+
+
+
+
+
+ public
+ log ( string $level , string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ notice()
+
+
+
+
+
+ Normal but significant events.
+
+
+ public
+ notice ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ run()
+
+
+
+
+
+ Execute the CLI program
+
+
+ public
+ run ( ) : mixed
+
+
+
+
+ Executes the setup() routine, adds default options, initiate the options parsing and argument checking
+and finally executes main() - Each part is split into their own protected function below, so behaviour
+can easily be overwritten
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setLogLevel()
+
+
+
+
+
+ Set the current log level
+
+
+ public
+ setLogLevel ( string $level ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ success()
+
+
+
+
+
+ Normal, positive outcome (This is not a PSR-3 level)
+
+
+ public
+ success ( string $string [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $string
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ warning()
+
+
+
+
+
+ Exceptional occurrences that are not errors.
+
+
+ public
+ warning ( string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+ Example: Use of deprecated APIs, poor use of an API, undesirable things
+that are not necessarily wrong.
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ checkArguments()
+
+
+
+
+
+ Wrapper around the argument checking
+
+
+ protected
+ checkArguments ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ execute()
+
+
+
+
+
+ Wrapper around main
+
+
+ protected
+ execute ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ handleDefaultOptions()
+
+
+
+
+
+ Handle the default options
+
+
+ protected
+ handleDefaultOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ interpolate()
+
+
+
+
+
+ Interpolates context values into the message placeholders.
+
+
+ protected
+ interpolate ( mixed $message [ , array<string|int, mixed> $context = array() ] ) : string
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : mixed
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ logMessage()
+
+
+
+
+
+
+
+ protected
+ logMessage ( string $level , string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ main()
+
+
+
+
+
+ Your main program
+
+
+ protected
+ abstract main ( Options $options ) : void
+
+
+
+
+ Arguments and options have been parsed when this is run
+
+
+ Parameters
+
+
+ $options
+ : Options
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ parseOptions()
+
+
+
+
+
+ Wrapper around the option parsing
+
+
+ protected
+ parseOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ registerDefaultOptions()
+
+
+
+
+
+ Add the default help, color and log options
+
+
+ protected
+ registerDefaultOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setup()
+
+
+
+
+
+ Register options and arguments on the given $options object
+
+
+ protected
+ abstract setup ( Options $options ) : void
+
+
+
+
+
+ Parameters
+
+
+ $options
+ : Options
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setupLogging()
+
+
+
+
+
+ Handle the logging options
+
+
+ protected
+ setupLogging ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/classes/splitbrain-phpcli-PSR3CLIv3.html b/classes/splitbrain-phpcli-PSR3CLIv3.html
new file mode 100644
index 0000000..d8e0ea2
--- /dev/null
+++ b/classes/splitbrain-phpcli-PSR3CLIv3.html
@@ -0,0 +1,1541 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PSR3CLIv3
+
+
+ extends Base
+
+
+
+
+
+ implements
+ LoggerInterface
+
+
+ uses
+ LoggerTrait
+
+
+
+
+
+
+ Class PSR3CLI
+
+
+ This class can be used instead of the CLI class when a class implementing
+PSR3 version 3 is needed.
+
+
+
+
+
+
+ see
+
+
+ PSR3CLI
+
+ for a version 2 compatible class
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+ Interfaces
+
+
+
+
+ LoggerInterface
+
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+ $colors
+
+ : Colors
+
+
+
+ $bin
+
+ : string
+
+
+
+ $logdefault
+
+ : string
+
+
+
+ $loglevel
+
+ : array<string|int, mixed>
+
+
+
+ $options
+
+ : Options
+
+
+
+
+
+ Methods
+
+
+
+
+
+ __construct()
+
+ : mixed
+
+constructor
+
+
+ fatal()
+
+ : mixed
+
+Exits the program on a fatal error
+
+
+ isLogLevelEnabled()
+
+ : bool
+
+Check if a message with the given level should be logged
+
+
+ log()
+
+ : void
+
+
+
+ run()
+
+ : mixed
+
+Execute the CLI program
+
+
+ setLogLevel()
+
+ : mixed
+
+Set the current log level
+
+
+ success()
+
+ : mixed
+
+Normal, positive outcome (This is not a PSR-3 level)
+
+
+ checkArguments()
+
+ : mixed
+
+Wrapper around the argument checking
+
+
+ execute()
+
+ : mixed
+
+Wrapper around main
+
+
+ handleDefaultOptions()
+
+ : mixed
+
+Handle the default options
+
+
+ interpolate()
+
+ : string
+
+Interpolates context values into the message placeholders.
+
+
+ logMessage()
+
+ : mixed
+
+
+
+ main()
+
+ : void
+
+Your main program
+
+
+ parseOptions()
+
+ : mixed
+
+Wrapper around the option parsing
+
+
+ registerDefaultOptions()
+
+ : mixed
+
+Add the default help, color and log options
+
+
+ setup()
+
+ : void
+
+Register options and arguments on the given $options object
+
+
+ setupLogging()
+
+ : mixed
+
+Handle the logging options
+
+
+
+
+
+
+
+
+
+
+
+
+ $colors
+
+
+
+
+
+
+
+
+
+
+ public
+ Colors
+ $colors
+
+
+
+
+
+
+
+
+
+
+
+
+ $bin
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $bin
+
+
+
+ the executed script itself
+
+
+
+
+
+
+
+
+
+
+ $logdefault
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $logdefault
+ = 'info'
+
+
+
+
+
+
+
+
+
+
+
+
+ $loglevel
+
+
+
+
+
+
+
+
+
+
+ protected
+ array<string|int, mixed>
+ $loglevel
+ = array('debug' => array('icon' => '', 'color' => \splitbrain\phpcli\Colors::C_RESET, 'channel' => STDOUT, 'enabled' => true), 'info' => array('icon' => 'ℹ ', 'color' => \splitbrain\phpcli\Colors::C_CYAN, 'channel' => STDOUT, 'enabled' => true), 'notice' => array('icon' => '☛ ', 'color' => \splitbrain\phpcli\Colors::C_CYAN, 'channel' => STDOUT, 'enabled' => true), 'success' => array('icon' => '✓ ', 'color' => \splitbrain\phpcli\Colors::C_GREEN, 'channel' => STDOUT, 'enabled' => true), 'warning' => array('icon' => '⚠ ', 'color' => \splitbrain\phpcli\Colors::C_BROWN, 'channel' => STDERR, 'enabled' => true), 'error' => array('icon' => '✗ ', 'color' => \splitbrain\phpcli\Colors::C_RED, 'channel' => STDERR, 'enabled' => true), 'critical' => array('icon' => '☠ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true), 'alert' => array('icon' => '✖ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true), 'emergency' => array('icon' => '✘ ', 'color' => \splitbrain\phpcli\Colors::C_LIGHTRED, 'channel' => STDERR, 'enabled' => true))
+
+
+ PSR-3 compatible loglevels and their prefix, color, output channel, enabled status
+
+
+
+
+
+
+
+
+
+
+ $options
+
+
+
+
+
+
+
+
+
+
+ protected
+ Options
+ $options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+
+ constructor
+
+
+ public
+ __construct ( [ bool $autocatch = true ] ) : mixed
+
+
+
+
+ Initialize the arguments, set up helper classes and set up the CLI environment
+
+
+ Parameters
+
+
+ $autocatch
+ : bool
+ = true
+
+ should exceptions be catched and handled automatically?
+
+
+
+
+
+
+
+
+
+
+
+
+
+ fatal()
+
+
+
+
+
+ Exits the program on a fatal error
+
+
+ public
+ fatal ( Exception |string $error [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $error
+ : Exception |string
+
+
+ either an exception or an error message
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isLogLevelEnabled()
+
+
+
+
+
+ Check if a message with the given level should be logged
+
+
+ public
+ isLogLevelEnabled ( string $level ) : bool
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ log()
+
+
+
+
+
+
+
+ public
+ log ( mixed $level , string|Stringable $message [ , array<string|int, mixed> $context = [] ] ) : void
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : mixed
+
+
+
+
+
+ $message
+ : string|Stringable
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = []
+
+
+
+
+
+
+
+
+
+
+
+
+
+ run()
+
+
+
+
+
+ Execute the CLI program
+
+
+ public
+ run ( ) : mixed
+
+
+
+
+ Executes the setup() routine, adds default options, initiate the options parsing and argument checking
+and finally executes main() - Each part is split into their own protected function below, so behaviour
+can easily be overwritten
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setLogLevel()
+
+
+
+
+
+ Set the current log level
+
+
+ public
+ setLogLevel ( string $level ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ success()
+
+
+
+
+
+ Normal, positive outcome (This is not a PSR-3 level)
+
+
+ public
+ success ( string $string [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $string
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ checkArguments()
+
+
+
+
+
+ Wrapper around the argument checking
+
+
+ protected
+ checkArguments ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ execute()
+
+
+
+
+
+ Wrapper around main
+
+
+ protected
+ execute ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ handleDefaultOptions()
+
+
+
+
+
+ Handle the default options
+
+
+ protected
+ handleDefaultOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ interpolate()
+
+
+
+
+
+ Interpolates context values into the message placeholders.
+
+
+ protected
+ interpolate ( mixed $message [ , array<string|int, mixed> $context = array() ] ) : string
+
+
+
+
+
+ Parameters
+
+
+ $message
+ : mixed
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ logMessage()
+
+
+
+
+
+
+
+ protected
+ logMessage ( string $level , string $message [ , array<string|int, mixed> $context = array() ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $level
+ : string
+
+
+
+
+
+ $message
+ : string
+
+
+
+
+
+ $context
+ : array<string|int, mixed>
+ = array()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ main()
+
+
+
+
+
+ Your main program
+
+
+ protected
+ abstract main ( Options $options ) : void
+
+
+
+
+ Arguments and options have been parsed when this is run
+
+
+ Parameters
+
+
+ $options
+ : Options
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ parseOptions()
+
+
+
+
+
+ Wrapper around the option parsing
+
+
+ protected
+ parseOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ registerDefaultOptions()
+
+
+
+
+
+ Add the default help, color and log options
+
+
+ protected
+ registerDefaultOptions ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setup()
+
+
+
+
+
+ Register options and arguments on the given $options object
+
+
+ protected
+ abstract setup ( Options $options ) : void
+
+
+
+
+
+ Parameters
+
+
+ $options
+ : Options
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+
+
+
+ setupLogging()
+
+
+
+
+
+ Handle the logging options
+
+
+ protected
+ setupLogging ( ) : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/classes/splitbrain-phpcli-TableFormatter.html b/classes/splitbrain-phpcli-TableFormatter.html
new file mode 100644
index 0000000..20fc7c2
--- /dev/null
+++ b/classes/splitbrain-phpcli-TableFormatter.html
@@ -0,0 +1,1255 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TableFormatter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Class TableFormatter
+
+
+ Output text in multiple columns
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+ $border
+
+ : string
+
+
+
+ $colors
+
+ : Colors
+
+
+
+ $max
+
+ : int
+
+
+
+
+
+ Methods
+
+
+
+
+
+ __construct()
+
+ : mixed
+
+TableFormatter constructor.
+
+
+ format()
+
+ : string
+
+Displays text in multiple word wrapped columns
+
+
+ getBorder()
+
+ : string
+
+The currently set border (defaults to ' ')
+
+
+ getMaxWidth()
+
+ : int
+
+Width of the terminal in characters
+
+
+ setBorder()
+
+ : mixed
+
+Set the border. The border is set between each column. Its width is
+added to the column widths.
+
+
+ setMaxWidth()
+
+ : mixed
+
+Set the width of the terminal to assume (in characters)
+
+
+ calculateColLengths()
+
+ : array<string|int, int>
+
+Takes an array with dynamic column width and calculates the correct width
+
+
+ getTerminalWidth()
+
+ : int
+
+Tries to figure out the width of the terminal
+
+
+ pad()
+
+ : string
+
+Pad the given string to the correct length
+
+
+ strlen()
+
+ : int
+
+Measures char length in UTF-8 when possible
+
+
+ substr()
+
+ : string
+
+
+
+ wordwrap()
+
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $border
+
+
+
+
+
+
+
+
+
+
+ protected
+ string
+ $border
+ = ' '
+
+
+
+
+
+
+
+
+
+
+
+
+ $colors
+
+
+
+
+
+
+
+
+
+
+ protected
+ Colors
+ $colors
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $max
+
+
+
+
+
+
+
+
+
+
+ protected
+ int
+ $max
+ = 74
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+
+ TableFormatter constructor.
+
+
+ public
+ __construct ( [ Colors |null $colors = null ] ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $colors
+ : Colors |null
+ = null
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Displays text in multiple word wrapped columns
+
+
+ public
+ format ( array<string|int, int> $columns , array<string|int, string> $texts [ , array<string|int, mixed> $colors = array() ] ) : string
+
+
+
+
+
+ Parameters
+
+
+ $columns
+ : array<string|int, int>
+
+
+ list of column widths (in characters, percent or '*')
+
+
+
+
+ $texts
+ : array<string|int, string>
+
+
+ list of texts for each column
+
+
+
+
+ $colors
+ : array<string|int, mixed>
+ = array()
+
+ A list of color names to use for each column. use empty string for default
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ getBorder()
+
+
+
+
+
+ The currently set border (defaults to ' ')
+
+
+ public
+ getBorder ( ) : string
+
+
+
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ getMaxWidth()
+
+
+
+
+
+ Width of the terminal in characters
+
+
+ public
+ getMaxWidth ( ) : int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setBorder()
+
+
+
+
+
+ Set the border. The border is set between each column. Its width is
+added to the column widths.
+
+
+ public
+ setBorder ( string $border ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $border
+ : string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setMaxWidth()
+
+
+
+
+
+ Set the width of the terminal to assume (in characters)
+
+
+ public
+ setMaxWidth ( int $max ) : mixed
+
+
+
+
+
+ Parameters
+
+
+ $max
+ : int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ calculateColLengths()
+
+
+
+
+
+ Takes an array with dynamic column width and calculates the correct width
+
+
+ protected
+ calculateColLengths ( array<string|int, mixed> $columns ) : array<string|int, int>
+
+
+
+
+ Column width can be given as fixed char widths, percentages and a single * width can be given
+for taking the remaining available space. When mixing percentages and fixed widths, percentages
+refer to the remaining space after allocating the fixed width
+
+
+ Parameters
+
+
+ $columns
+ : array<string|int, mixed>
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ Exception
+
+
+
+
+
+
+
+
+ Return values
+ array<string|int, int>
+
+
+
+
+
+ getTerminalWidth()
+
+
+
+
+
+ Tries to figure out the width of the terminal
+
+
+ protected
+ getTerminalWidth ( ) : int
+
+
+
+
+
+
+
+
+
+
+
+ Return values
+ int
+ —
+ terminal width, 0 if unknown
+
+
+
+
+
+
+
+ pad()
+
+
+
+
+
+ Pad the given string to the correct length
+
+
+ protected
+ pad ( string $string , int $len ) : string
+
+
+
+
+
+ Parameters
+
+
+ $string
+ : string
+
+
+
+
+
+ $len
+ : int
+
+
+
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ strlen()
+
+
+
+
+
+ Measures char length in UTF-8 when possible
+
+
+ protected
+ strlen ( mixed $string ) : int
+
+
+
+
+
+ Parameters
+
+
+ $string
+ : mixed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ substr()
+
+
+
+
+
+
+
+ protected
+ substr ( string $string [ , int $start = 0 ] [ , int|null $length = null ] ) : string
+
+
+
+
+
+ Parameters
+
+
+ $string
+ : string
+
+
+
+
+
+ $start
+ : int
+ = 0
+
+
+
+
+ $length
+ : int|null
+ = null
+
+
+
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+ wordwrap()
+
+
+
+
+
+
+
+ protected
+ wordwrap ( string $str [ , int $width = 75 ] [ , string $break = "\n" ] [ , bool $cut = false ] ) : string
+
+
+
+
+
+ Parameters
+
+
+ $str
+ : string
+
+
+
+
+
+ $width
+ : int
+ = 75
+
+
+
+
+ $break
+ : string
+ = "\n"
+
+
+
+
+ $cut
+ : bool
+ = false
+
+
+
+
+
+
+
+
+
+ link
+
+
+ http://stackoverflow.com/a/4988494
+
+
+
+
+
+
+
+ Return values
+ string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/composer.json b/composer.json
deleted file mode 100644
index 9e26290..0000000
--- a/composer.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "splitbrain/php-cli",
- "description": "Easy command line scripts for PHP with opt parsing and color output. No dependencies",
- "keywords": [
- "cli",
- "console",
- "terminal",
- "command line",
- "getopt",
- "optparse",
- "argparse"
- ],
- "license": "MIT",
- "authors": [
- {
- "name": "Andreas Gohr",
- "email": "andi@splitbrain.org"
- }
- ],
- "require": {
- "php": ">=5.3.0"
- },
- "suggest": {
- "psr/log": "Allows you to make the CLI available as PSR-3 logger"
- },
- "require-dev": {
- "phpunit/phpunit": "^8"
- },
- "autoload": {
- "psr-4": {
- "splitbrain\\phpcli\\": "src"
- }
- }
-}
diff --git a/css/base.css b/css/base.css
new file mode 100644
index 0000000..030ba07
--- /dev/null
+++ b/css/base.css
@@ -0,0 +1,1236 @@
+
+
+:root {
+ /* Typography */
+ --font-primary: 'Open Sans', Helvetica, Arial, sans-serif;
+ --font-secondary: 'Open Sans', Helvetica, Arial, sans-serif;
+ --font-monospace: 'Source Code Pro', monospace;
+ --line-height--primary: 1.6;
+ --letter-spacing--primary: .05rem;
+ --text-base-size: 1em;
+ --text-scale-ratio: 1.2;
+
+ --text-xxs: calc(var(--text-base-size) / var(--text-scale-ratio) / var(--text-scale-ratio) / var(--text-scale-ratio));
+ --text-xs: calc(var(--text-base-size) / var(--text-scale-ratio) / var(--text-scale-ratio));
+ --text-sm: calc(var(--text-base-size) / var(--text-scale-ratio));
+ --text-md: var(--text-base-size);
+ --text-lg: calc(var(--text-base-size) * var(--text-scale-ratio));
+ --text-xl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio));
+ --text-xxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
+ --text-xxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
+ --text-xxxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
+ --text-xxxxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
+
+ --color-hue-red: 4;
+ --color-hue-pink: 340;
+ --color-hue-purple: 291;
+ --color-hue-deep-purple: 262;
+ --color-hue-indigo: 231;
+ --color-hue-blue: 207;
+ --color-hue-light-blue: 199;
+ --color-hue-cyan: 187;
+ --color-hue-teal: 174;
+ --color-hue-green: 122;
+ --color-hue-phpdocumentor-green: 96;
+ --color-hue-light-green: 88;
+ --color-hue-lime: 66;
+ --color-hue-yellow: 54;
+ --color-hue-amber: 45;
+ --color-hue-orange: 36;
+ --color-hue-deep-orange: 14;
+ --color-hue-brown: 16;
+
+ /* Colors */
+ --primary-color-hue: var(--color-hue-phpdocumentor-green, --color-hue-phpdocumentor-green);
+ --primary-color-saturation: 57%;
+ --primary-color: hsl(var(--primary-color-hue), var(--primary-color-saturation), 60%);
+ --primary-color-darken: hsl(var(--primary-color-hue), var(--primary-color-saturation), 40%);
+ --primary-color-darker: hsl(var(--primary-color-hue), var(--primary-color-saturation), 25%);
+ --primary-color-darkest: hsl(var(--primary-color-hue), var(--primary-color-saturation), 10%);
+ --primary-color-lighten: hsl(var(--primary-color-hue), calc(var(--primary-color-saturation) - 20%), 85%);
+ --primary-color-lighter: hsl(var(--primary-color-hue), calc(var(--primary-color-saturation) - 45%), 97.5%);
+ --dark-gray: #d1d1d1;
+ --light-gray: #f0f0f0;
+
+ --text-color: var(--primary-color-darkest);
+
+ --header-height: var(--spacing-xxxxl);
+ --header-bg-color: var(--primary-color);
+ --code-background-color: var(--primary-color-lighter);
+ --code-border-color: --primary-color-lighten;
+ --button-border-color: var(--primary-color-darken);
+ --button-color: transparent;
+ --button-color-primary: var(--primary-color);
+ --button-text-color: #555;
+ --button-text-color-primary: white;
+ --popover-background-color: rgba(255, 255, 255, 0.75);
+ --link-color-primary: var(--primary-color-darker);
+ --link-hover-color-primary: var(--primary-color-darkest);
+ --form-field-border-color: var(--dark-gray);
+ --form-field-color: #fff;
+ --admonition-success-color: var(--primary-color);
+ --admonition-border-color: silver;
+ --table-separator-color: var(--primary-color-lighten);
+ --title-text-color: var(--primary-color);
+
+ --sidebar-border-color: var(--primary-color-lighten);
+
+ /* Grid */
+ --container-width: 1400px;
+
+ /* Spacing */
+ --spacing-base-size: 1rem;
+ --spacing-scale-ratio: 1.5;
+
+ --spacing-xxxs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio));
+ --spacing-xxs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio));
+ --spacing-xs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio));
+ --spacing-sm: calc(var(--spacing-base-size) / var(--spacing-scale-ratio));
+ --spacing-md: var(--spacing-base-size);
+ --spacing-lg: calc(var(--spacing-base-size) * var(--spacing-scale-ratio));
+ --spacing-xl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio));
+ --spacing-xxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio));
+ --spacing-xxxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio));
+ --spacing-xxxxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio));
+
+ --border-radius-base-size: 3px;
+}
+
+/* Base Styles
+-------------------------------------------------- */
+body {
+ background-color: #fff;
+ color: var(--text-color);
+ font-family: var(--font-primary);
+ font-size: var(--text-md);
+ letter-spacing: var(--letter-spacing--primary);
+ line-height: var(--line-height--primary);
+ width: 100%;
+}
+
+.phpdocumentor h1,
+.phpdocumentor h2,
+.phpdocumentor h3,
+.phpdocumentor h4,
+.phpdocumentor h5,
+.phpdocumentor h6 {
+ margin-bottom: var(--spacing-lg);
+ margin-top: var(--spacing-lg);
+ font-weight: 600;
+}
+
+.phpdocumentor h1 {
+ font-size: var(--text-xxxxl);
+ letter-spacing: var(--letter-spacing--primary);
+ line-height: 1.2;
+ margin-top: 0;
+}
+
+.phpdocumentor h2 {
+ font-size: var(--text-xxxl);
+ letter-spacing: var(--letter-spacing--primary);
+ line-height: 1.25;
+}
+
+.phpdocumentor h3 {
+ font-size: var(--text-xxl);
+ letter-spacing: var(--letter-spacing--primary);
+ line-height: 1.3;
+}
+
+.phpdocumentor h4 {
+ font-size: var(--text-xl);
+ letter-spacing: calc(var(--letter-spacing--primary) / 2);
+ line-height: 1.35;
+ margin-bottom: var(--spacing-md);
+}
+
+.phpdocumentor h5 {
+ font-size: var(--text-lg);
+ letter-spacing: calc(var(--letter-spacing--primary) / 4);
+ line-height: 1.5;
+ margin-bottom: var(--spacing-md);
+ margin-top: var(--spacing-md);
+}
+
+.phpdocumentor h6 {
+ font-size: var(--text-md);
+ letter-spacing: 0;
+ line-height: var(--line-height--primary);
+ margin-bottom: var(--spacing-md);
+ margin-top: var(--spacing-md);
+}
+.phpdocumentor h1 .headerlink,
+.phpdocumentor h2 .headerlink,
+.phpdocumentor h3 .headerlink,
+.phpdocumentor h4 .headerlink,
+.phpdocumentor h5 .headerlink,
+.phpdocumentor h6 .headerlink
+{
+ display: none;
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor h1 .headerlink,
+ .phpdocumentor h2 .headerlink,
+ .phpdocumentor h3 .headerlink,
+ .phpdocumentor h4 .headerlink,
+ .phpdocumentor h5 .headerlink,
+ .phpdocumentor h6 .headerlink {
+ display: inline;
+ transition: all .3s ease-in-out;
+ opacity: 0;
+ text-decoration: none;
+ color: silver;
+ font-size: 80%;
+ }
+
+ .phpdocumentor h1:hover .headerlink,
+ .phpdocumentor h2:hover .headerlink,
+ .phpdocumentor h3:hover .headerlink,
+ .phpdocumentor h4:hover .headerlink,
+ .phpdocumentor h5:hover .headerlink,
+ .phpdocumentor h6:hover .headerlink {
+ opacity: 1;
+ }
+}
+.phpdocumentor p {
+ margin-top: 0;
+ margin-bottom: var(--spacing-md);
+}
+.phpdocumentor figure {
+ margin-bottom: var(--spacing-md);
+}
+
+.phpdocumentor figcaption {
+ text-align: center;
+ font-style: italic;
+ font-size: 80%;
+}
+
+.phpdocumentor-uml-diagram svg {
+ max-width: 100%;
+ height: auto !important;
+}
+.phpdocumentor-line {
+ border-top: 1px solid #E1E1E1;
+ border-width: 0;
+ margin-bottom: var(--spacing-xxl);
+ margin-top: var(--spacing-xxl);
+}
+.phpdocumentor-section {
+ box-sizing: border-box;
+ margin: 0 auto;
+ max-width: var(--container-width);
+ padding: 0 var(--spacing-sm);
+ position: relative;
+ width: 100%;
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor-section {
+ padding: 0 var(--spacing-lg);
+ }
+}
+
+@media (min-width: 1200px) {
+ .phpdocumentor-section {
+ padding: 0;
+ width: 95%;
+ }
+}
+.phpdocumentor-column {
+ box-sizing: border-box;
+ float: left;
+ width: 100%;
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor-column {
+ margin-left: 4%;
+ }
+
+ .phpdocumentor-column:first-child {
+ margin-left: 0;
+ }
+
+ .-one.phpdocumentor-column {
+ width: 4.66666666667%;
+ }
+
+ .-two.phpdocumentor-column {
+ width: 13.3333333333%;
+ }
+
+ .-three.phpdocumentor-column {
+ width: 22%;
+ }
+
+ .-four.phpdocumentor-column {
+ width: 30.6666666667%;
+ }
+
+ .-five.phpdocumentor-column {
+ width: 39.3333333333%;
+ }
+
+ .-six.phpdocumentor-column {
+ width: 48%;
+ }
+
+ .-seven.phpdocumentor-column {
+ width: 56.6666666667%;
+ }
+
+ .-eight.phpdocumentor-column {
+ width: 65.3333333333%;
+ }
+
+ .-nine.phpdocumentor-column {
+ width: 74.0%;
+ }
+
+ .-ten.phpdocumentor-column {
+ width: 82.6666666667%;
+ }
+
+ .-eleven.phpdocumentor-column {
+ width: 91.3333333333%;
+ }
+
+ .-twelve.phpdocumentor-column {
+ margin-left: 0;
+ width: 100%;
+ }
+
+ .-one-third.phpdocumentor-column {
+ width: 30.6666666667%;
+ }
+
+ .-two-thirds.phpdocumentor-column {
+ width: 65.3333333333%;
+ }
+
+ .-one-half.phpdocumentor-column {
+ width: 48%;
+ }
+
+ /* Offsets */
+ .-offset-by-one.phpdocumentor-column {
+ margin-left: 8.66666666667%;
+ }
+
+ .-offset-by-two.phpdocumentor-column {
+ margin-left: 17.3333333333%;
+ }
+
+ .-offset-by-three.phpdocumentor-column {
+ margin-left: 26%;
+ }
+
+ .-offset-by-four.phpdocumentor-column {
+ margin-left: 34.6666666667%;
+ }
+
+ .-offset-by-five.phpdocumentor-column {
+ margin-left: 43.3333333333%;
+ }
+
+ .-offset-by-six.phpdocumentor-column {
+ margin-left: 52%;
+ }
+
+ .-offset-by-seven.phpdocumentor-column {
+ margin-left: 60.6666666667%;
+ }
+
+ .-offset-by-eight.phpdocumentor-column {
+ margin-left: 69.3333333333%;
+ }
+
+ .-offset-by-nine.phpdocumentor-column {
+ margin-left: 78.0%;
+ }
+
+ .-offset-by-ten.phpdocumentor-column {
+ margin-left: 86.6666666667%;
+ }
+
+ .-offset-by-eleven.phpdocumentor-column {
+ margin-left: 95.3333333333%;
+ }
+
+ .-offset-by-one-third.phpdocumentor-column {
+ margin-left: 34.6666666667%;
+ }
+
+ .-offset-by-two-thirds.phpdocumentor-column {
+ margin-left: 69.3333333333%;
+ }
+
+ .-offset-by-one-half.phpdocumentor-column {
+ margin-left: 52%;
+ }
+}
+.phpdocumentor a {
+ color: var(--link-color-primary);
+}
+
+.phpdocumentor a:hover {
+ color: var(--link-hover-color-primary);
+}
+.phpdocumentor-button {
+ background-color: var(--button-color);
+ border: 1px solid var(--button-border-color);
+ border-radius: var(--border-radius-base-size);
+ box-sizing: border-box;
+ color: var(--button-text-color);
+ cursor: pointer;
+ display: inline-block;
+ font-size: var(--text-sm);
+ font-weight: 600;
+ height: 38px;
+ letter-spacing: .1rem;
+ line-height: 38px;
+ padding: 0 var(--spacing-xxl);
+ text-align: center;
+ text-decoration: none;
+ text-transform: uppercase;
+ white-space: nowrap;
+ margin-bottom: var(--spacing-md);
+}
+
+.phpdocumentor-button .-wide {
+ width: 100%;
+}
+
+.phpdocumentor-button:hover,
+.phpdocumentor-button:focus {
+ border-color: #888;
+ color: #333;
+ outline: 0;
+}
+
+.phpdocumentor-button.-primary {
+ background-color: var(--button-color-primary);
+ border-color: var(--button-color-primary);
+ color: var(--button-text-color-primary);
+}
+
+.phpdocumentor-button.-primary:hover,
+.phpdocumentor-button.-primary:focus {
+ background-color: var(--link-color-primary);
+ border-color: var(--link-color-primary);
+ color: var(--button-text-color-primary);
+}
+.phpdocumentor form {
+ margin-bottom: var(--spacing-md);
+}
+
+.phpdocumentor-field {
+ background-color: var(--form-field-color);
+ border: 1px solid var(--form-field-border-color);
+ border-radius: var(--border-radius-base-size);
+ box-shadow: none;
+ box-sizing: border-box;
+ height: 38px;
+ padding: var(--spacing-xxxs) var(--spacing-xxs); /* The 6px vertically centers text on FF, ignored by Webkit */
+ margin-bottom: var(--spacing-md);
+}
+
+/* Removes awkward default styles on some inputs for iOS */
+input[type="email"],
+input[type="number"],
+input[type="search"],
+input[type="text"],
+input[type="tel"],
+input[type="url"],
+input[type="password"],
+textarea {
+ -moz-appearance: none;
+ -webkit-appearance: none;
+ appearance: none;
+}
+
+.phpdocumentor-textarea {
+ min-height: 65px;
+ padding-bottom: var(--spacing-xxxs);
+ padding-top: var(--spacing-xxxs);
+}
+
+.phpdocumentor-field:focus {
+ border: 1px solid var(--button-color-primary);
+ outline: 0;
+}
+
+label.phpdocumentor-label {
+ display: block;
+ margin-bottom: var(--spacing-xs);
+}
+
+.phpdocumentor-fieldset {
+ border-width: 0;
+ padding: 0;
+}
+
+input[type="checkbox"].phpdocumentor-field,
+input[type="radio"].phpdocumentor-field {
+ display: inline;
+}
+.phpdocumentor-column ul,
+div.phpdocumentor-list > ul,
+ul.phpdocumentor-list {
+ list-style: circle;
+}
+
+.phpdocumentor-column ol,
+div.phpdocumentor-list > ol,
+ol.phpdocumentor-list {
+ list-style: decimal;
+}
+
+
+.phpdocumentor-column ul,
+div.phpdocumentor-list > ul,
+ol.phpdocumentor-list,
+ul.phpdocumentor-list {
+ margin-top: 0;
+ padding-left: var(--spacing-lg);
+ margin-bottom: var(--spacing-sm);
+}
+
+.phpdocumentor-column ul.-clean,
+div.phpdocumentor-list > ul.-clean,
+ul.phpdocumentor-list.-clean {
+ list-style: none;
+ padding-left: 0;
+}
+
+dl {
+ margin-bottom: var(--spacing-md);
+}
+
+.phpdocumentor-column ul ul,
+div.phpdocumentor-list > ul ul,
+ul.phpdocumentor-list ul.phpdocumentor-list,
+ul.phpdocumentor-list ol.phpdocumentor-list,
+ol.phpdocumentor-list ol.phpdocumentor-list,
+ol.phpdocumentor-list ul.phpdocumentor-list {
+ font-size: var(--text-sm);
+ margin: 0 0 0 calc(var(--spacing-xs) * 2);
+}
+
+.phpdocumentor-column ul li,
+.phpdocumentor-list li {
+ padding-bottom: var(--spacing-xs);
+}
+
+.phpdocumentor dl dt {
+ margin-bottom: var(--spacing-xs);
+}
+
+.phpdocumentor dl dd {
+ margin-bottom: var(--spacing-md);
+}
+.phpdocumentor pre {
+ margin-bottom: var(--spacing-md);
+}
+
+.phpdocumentor-code {
+ font-family: var(--font-monospace);
+ background: var(--code-background-color);
+ border: 1px solid var(--code-border-color);
+ border-radius: var(--border-radius-base-size);
+ font-size: var(--text-sm);
+ padding: var(--spacing-sm) var(--spacing-md);
+ width: 100%;
+ box-sizing: border-box;
+}
+
+.phpdocumentor-code.-dark {
+ background: var(--primary-color-darkest);
+ color: var(--light-gray);
+ box-shadow: 0 2px 3px var(--dark-gray);
+}
+
+pre > .phpdocumentor-code {
+ display: block;
+ white-space: pre;
+}
+.phpdocumentor blockquote {
+ border-left: 4px solid var(--primary-color-darken);
+ margin: var(--spacing-md) 0;
+ padding: var(--spacing-xs) var(--spacing-sm);
+ color: var(--primary-color-darker);
+ font-style: italic;
+}
+
+.phpdocumentor blockquote p:last-of-type {
+ margin-bottom: 0;
+}
+.phpdocumentor table {
+ margin-bottom: var(--spacing-md);
+}
+
+th.phpdocumentor-heading,
+td.phpdocumentor-cell {
+ border-bottom: 1px solid var(--table-separator-color);
+ padding: var(--spacing-sm) var(--spacing-md);
+ text-align: left;
+}
+
+th.phpdocumentor-heading:first-child,
+td.phpdocumentor-cell:first-child {
+ padding-left: 0;
+}
+
+th.phpdocumentor-heading:last-child,
+td.phpdocumentor-cell:last-child {
+ padding-right: 0;
+}
+.phpdocumentor-label-line {
+ display: flex;
+ flex-direction: row;
+ gap: 1rem
+}
+
+.phpdocumentor-label {
+ background: #f6f6f6;
+ border-radius: .25rem;
+ font-size: 80%;
+ display: inline-block;
+ overflow: hidden
+}
+
+/*
+It would be better if the phpdocumentor-element class were to become a flex element with a gap, but for #3337 that
+is too big a fix and needs to be done in a new design iteration.
+*/
+.phpdocumentor-signature + .phpdocumentor-label-line .phpdocumentor-label {
+ margin-top: var(--spacing-sm);
+}
+
+.phpdocumentor-label span {
+ display: inline-block;
+ padding: .125rem .5rem;
+}
+
+.phpdocumentor-label--success span:last-of-type {
+ background: #abe1ab;
+}
+
+.phpdocumentor-header {
+ display: flex;
+ flex-direction: row;
+ align-items: stretch;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ height: auto;
+ padding: var(--spacing-md) var(--spacing-md);
+}
+
+.phpdocumentor-header__menu-button {
+ position: absolute;
+ top: -100%;
+ left: -100%;
+}
+
+.phpdocumentor-header__menu-icon {
+ font-size: 2rem;
+ color: var(--primary-color);
+}
+
+.phpdocumentor-header__menu-button:checked ~ .phpdocumentor-topnav {
+ max-height: 250px;
+ padding-top: var(--spacing-md);
+}
+
+@media (min-width: 1000px) {
+ .phpdocumentor-header {
+ flex-direction: row;
+ padding: var(--spacing-lg) var(--spacing-lg);
+ min-height: var(--header-height);
+ }
+
+ .phpdocumentor-header__menu-icon {
+ display: none;
+ }
+}
+
+@media (min-width: 1000px) {
+ .phpdocumentor-header {
+ padding-top: 0;
+ padding-bottom: 0;
+ }
+}
+@media (min-width: 1200px) {
+ .phpdocumentor-header {
+ padding: 0;
+ }
+}
+.phpdocumentor-title {
+ box-sizing: border-box;
+ color: var(--title-text-color);
+ font-size: var(--text-xxl);
+ letter-spacing: .05rem;
+ font-weight: normal;
+ width: auto;
+ margin: 0;
+ display: flex;
+ align-items: center;
+}
+
+.phpdocumentor-title.-without-divider {
+ border: none;
+}
+
+.phpdocumentor-title__link {
+ transition: all .3s ease-out;
+ display: flex;
+ color: var(--title-text-color);
+ text-decoration: none;
+ font-weight: normal;
+ white-space: nowrap;
+ transform: scale(.75);
+ transform-origin: left;
+}
+
+.phpdocumentor-title__link:hover {
+ transform: perspective(15rem) translateX(.5rem);
+ font-weight: 600;
+}
+
+@media (min-width: 1000px) {
+ .phpdocumentor-title {
+ width: 22%;
+ border-right: var(--sidebar-border-color) solid 1px;
+ }
+
+ .phpdocumentor-title__link {
+ transform-origin: left;
+ }
+}
+
+@media (min-width: 1000px) {
+ .phpdocumentor-title__link {
+ transform: scale(.85);
+ }
+}
+
+@media (min-width: 1200px) {
+ .phpdocumentor-title__link {
+ transform: scale(1);
+ }
+}
+.phpdocumentor-topnav {
+ display: flex;
+ align-items: center;
+ margin: 0;
+ max-height: 0;
+ overflow: hidden;
+ transition: max-height 0.2s ease-out;
+ flex-basis: 100%;
+}
+
+.phpdocumentor-topnav__menu {
+ text-align: right;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ flex: 1;
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: center;
+}
+
+.phpdocumentor-topnav__menu-item {
+ margin: 0;
+ width: 100%;
+ display: inline-block;
+ text-align: center;
+ padding: var(--spacing-sm) 0
+}
+
+.phpdocumentor-topnav__menu-item.-social {
+ width: auto;
+ padding: var(--spacing-sm)
+}
+
+.phpdocumentor-topnav__menu-item a {
+ display: inline-block;
+ color: var(--text-color);
+ text-decoration: none;
+ font-size: var(--text-lg);
+ transition: all .3s ease-out;
+ border-bottom: 1px dotted transparent;
+ line-height: 1;
+}
+
+.phpdocumentor-topnav__menu-item a:hover {
+ transform: perspective(15rem) translateY(.1rem);
+ border-bottom: 1px dotted var(--text-color);
+}
+
+@media (min-width: 1000px) {
+ .phpdocumentor-topnav {
+ max-height: none;
+ overflow: visible;
+ flex-basis: auto;
+ }
+
+ .phpdocumentor-topnav__menu {
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: flex-end;
+ }
+
+ .phpdocumentor-topnav__menu-item,
+ .phpdocumentor-topnav__menu-item.-social {
+ width: auto;
+ display: inline;
+ text-align: right;
+ padding: 0 0 0 var(--spacing-md)
+ }
+}
+.phpdocumentor-sidebar {
+ margin: 0;
+ overflow: hidden;
+ max-height: 0;
+}
+
+.phpdocumentor .phpdocumentor-sidebar .phpdocumentor-list {
+ padding: var(--spacing-xs) var(--spacing-md);
+ list-style: none;
+ margin: 0;
+}
+
+.phpdocumentor .phpdocumentor-sidebar li {
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ padding: 0 0 var(--spacing-xxxs) var(--spacing-md);
+}
+
+.phpdocumentor .phpdocumentor-sidebar abbr,
+.phpdocumentor .phpdocumentor-sidebar a {
+ text-decoration: none;
+ border-bottom: none;
+ color: var(--text-color);
+ font-size: var(--text-md);
+ padding-left: 0;
+ transition: padding-left .4s ease-out;
+}
+
+.phpdocumentor .phpdocumentor-sidebar a:hover,
+.phpdocumentor .phpdocumentor-sidebar a.-active {
+ padding-left: 5px;
+ font-weight: 600;
+}
+
+.phpdocumentor .phpdocumentor-sidebar__category > * {
+ border-left: 1px solid var(--primary-color-lighten);
+}
+
+.phpdocumentor .phpdocumentor-sidebar__category {
+ margin-bottom: var(--spacing-lg);
+}
+
+.phpdocumentor .phpdocumentor-sidebar__category-header {
+ font-size: var(--text-md);
+ margin-top: 0;
+ margin-bottom: var(--spacing-xs);
+ color: var(--link-color-primary);
+ font-weight: 600;
+ border-left: 0;
+}
+
+.phpdocumentor .phpdocumentor-sidebar__root-package,
+.phpdocumentor .phpdocumentor-sidebar__root-namespace {
+ font-size: var(--text-md);
+ margin: 0;
+ padding-top: var(--spacing-xs);
+ padding-left: var(--spacing-md);
+ color: var(--text-color);
+ font-weight: normal;
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor-sidebar {
+ border-right: var(--sidebar-border-color) solid 1px;
+ }
+}
+
+.phpdocumentor-sidebar__menu-button {
+ position: absolute;
+ top: -100%;
+ left: -100%;
+}
+
+.phpdocumentor-sidebar__menu-icon {
+ font-size: var(--text-md);
+ font-weight: 600;
+ background: var(--primary-color);
+ color: white;
+ margin: 0 0 var(--spacing-lg);
+ display: block;
+ padding: var(--spacing-sm);
+ text-align: center;
+ border-radius: 3px;
+ text-transform: uppercase;
+ letter-spacing: .15rem;
+}
+
+.phpdocumentor-sidebar__menu-button:checked ~ .phpdocumentor-sidebar {
+ max-height: 100%;
+ padding-top: var(--spacing-md);
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor-sidebar {
+ overflow: visible;
+ max-height: 100%;
+ }
+
+ .phpdocumentor-sidebar__menu-icon {
+ display: none;
+ }
+}
+.phpdocumentor-admonition {
+ border: 1px solid var(--admonition-border-color);
+ border-radius: var(--border-radius-base-size);
+ border-color: var(--primary-color-lighten);
+ background-color: var(--primary-color-lighter);
+ padding: var(--spacing-lg);
+ margin: var(--spacing-lg) 0;
+ display: flex;
+ flex-direction: row;
+ align-items: flex-start;
+}
+
+.phpdocumentor-admonition p:last-of-type {
+ margin-bottom: 0;
+}
+
+.phpdocumentor-admonition--success,
+.phpdocumentor-admonition.-success {
+ border-color: var(--admonition-success-color);
+}
+
+.phpdocumentor-admonition__icon {
+ margin-right: var(--spacing-md);
+ color: var(--primary-color);
+ max-width: 3rem;
+}
+.phpdocumentor ul.phpdocumentor-breadcrumbs {
+ font-size: var(--text-md);
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+.phpdocumentor ul.phpdocumentor-breadcrumbs a {
+ color: var(--text-color);
+ text-decoration: none;
+}
+
+.phpdocumentor ul.phpdocumentor-breadcrumbs > li {
+ display: inline-block;
+ margin: 0;
+}
+
+.phpdocumentor ul.phpdocumentor-breadcrumbs > li + li:before {
+ color: var(--dark-gray);
+ content: "\\\A0";
+ padding: 0;
+}
+.phpdocumentor .phpdocumentor-back-to-top {
+ position: fixed;
+ bottom: 2rem;
+ font-size: 2.5rem;
+ opacity: .25;
+ transition: all .3s ease-in-out;
+ right: 2rem;
+}
+
+.phpdocumentor .phpdocumentor-back-to-top:hover {
+ color: var(--link-color-primary);
+ opacity: 1;
+}
+.phpdocumentor-search {
+ position: relative;
+ display: none; /** disable by default for non-js flow */
+ opacity: .3; /** white-out default for loading indication */
+ transition: opacity .3s, background .3s;
+ margin: var(--spacing-sm) 0;
+ flex: 1;
+ min-width: 100%;
+}
+
+.phpdocumentor-search label {
+ display: flex;
+ align-items: center;
+ flex: 1;
+}
+
+.phpdocumentor-search__icon {
+ color: var(--primary-color);
+ margin-right: var(--spacing-sm);
+ width: 1rem;
+ height: 1rem;
+}
+
+.phpdocumentor-search--enabled {
+ display: flex;
+}
+
+.phpdocumentor-search--active {
+ opacity: 1;
+}
+
+.phpdocumentor-search input:disabled {
+ background-color: lightgray;
+}
+
+.phpdocumentor-search__field:focus,
+.phpdocumentor-search__field {
+ margin-bottom: 0;
+ border: 0;
+ border-bottom: 2px solid var(--primary-color);
+ padding: 0;
+ border-radius: 0;
+ flex: 1;
+}
+
+@media (min-width: 1000px) {
+ .phpdocumentor-search {
+ min-width: auto;
+ max-width: 20rem;
+ margin: 0 0 0 auto;
+ }
+}
+.phpdocumentor-search-results {
+ backdrop-filter: blur(5px);
+ background: var(--popover-background-color);
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ padding: 0;
+ opacity: 1;
+ pointer-events: all;
+
+ transition: opacity .3s, background .3s;
+}
+
+.phpdocumentor-search-results--hidden {
+ background: transparent;
+ backdrop-filter: blur(0);
+ opacity: 0;
+ pointer-events: none;
+}
+
+.phpdocumentor-search-results__dialog {
+ width: 100%;
+ background: white;
+ max-height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.phpdocumentor-search-results__body {
+ overflow: auto;
+}
+
+.phpdocumentor-search-results__header {
+ padding: var(--spacing-lg);
+ display: flex;
+ justify-content: space-between;
+ background: var(--primary-color-darken);
+ color: white;
+ align-items: center;
+}
+
+.phpdocumentor-search-results__close {
+ font-size: var(--text-xl);
+ background: none;
+ border: none;
+ padding: 0;
+ margin: 0;
+}
+
+.phpdocumentor .phpdocumentor-search-results__title {
+ font-size: var(--text-xl);
+ margin-bottom: 0;
+}
+
+.phpdocumentor-search-results__entries {
+ list-style: none;
+ padding: 0 var(--spacing-lg);
+ margin: 0;
+}
+
+.phpdocumentor-search-results__entry {
+ border-bottom: 1px solid var(--table-separator-color);
+ padding: var(--spacing-sm) 0;
+ text-align: left;
+}
+
+.phpdocumentor-search-results__entry a {
+ display: block;
+}
+
+.phpdocumentor-search-results__entry small {
+ margin-top: var(--spacing-xs);
+ margin-bottom: var(--spacing-md);
+ color: var(--primary-color-darker);
+ display: block;
+ word-break: break-word;
+}
+
+.phpdocumentor-search-results__entry h3 {
+ font-size: var(--text-lg);
+ margin: 0;
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor-search-results {
+ padding: 0 var(--spacing-lg);
+ }
+
+ .phpdocumentor-search-results__entry h3 {
+ font-size: var(--text-xxl);
+ }
+
+ .phpdocumentor-search-results__dialog {
+ margin: var(--spacing-xl) auto;
+ max-width: 40rem;
+ background: white;
+ border: 1px solid silver;
+ box-shadow: 0 2px 5px silver;
+ max-height: 40rem;
+ border-radius: 3px;
+ }
+}
+.phpdocumentor-modal {
+ position: fixed;
+ width: 100vw;
+ height: 100vh;
+ opacity: 0;
+ visibility: hidden;
+ transition: all 0.3s ease;
+ top: 0;
+ left: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 1;
+}
+
+.phpdocumentor-modal__open {
+ visibility: visible;
+ opacity: 1;
+ transition-delay: 0s;
+}
+
+.phpdocumentor-modal-bg {
+ position: absolute;
+ background: gray;
+ opacity: 50%;
+ width: 100%;
+ height: 100%;
+}
+
+.phpdocumentor-modal-container {
+ border-radius: 1em;
+ background: #fff;
+ position: relative;
+ padding: 2em;
+ box-sizing: border-box;
+ max-width:100vw;
+}
+
+.phpdocumentor-modal__close {
+ position: absolute;
+ right: 0.75em;
+ top: 0.75em;
+ outline: none;
+ appearance: none;
+ color: var(--primary-color);
+ background: none;
+ border: 0px;
+ font-weight: bold;
+ cursor: pointer;
+}
+.phpdocumentor-on-this-page__sidebar {
+ display: none;
+}
+
+.phpdocumentor-on-this-page__title {
+ display: block;
+ font-weight: bold;
+ margin-bottom: var(--spacing-sm);
+ color: var(--link-color-primary);
+}
+
+@media (min-width: 1000px) {
+ .phpdocumentor-on-this-page__sidebar {
+ display: block;
+ position: relative;
+ }
+
+ .phpdocumentor-on-this-page__content::-webkit-scrollbar,
+ [scrollbars]::-webkit-scrollbar {
+ height: 8px;
+ width: 8px;
+ }
+
+ .phpdocumentor-on-this-page__content::-webkit-scrollbar-corner,
+ [scrollbars]::-webkit-scrollbar-corner {
+ background: 0;
+ }
+
+ .phpdocumentor-on-this-page__content::-webkit-scrollbar-thumb,
+ [scrollbars]::-webkit-scrollbar-thumb {
+ background: rgba(128,134,139,0.26);
+ border-radius: 8px;
+ }
+
+ .phpdocumentor-on-this-page__content {
+ position: sticky;
+ height: calc(100vh - var(--header-height));
+ overflow-y: auto;
+ border-left: 1px solid var(--sidebar-border-color);
+ padding-left: var(--spacing-lg);
+ font-size: 90%;
+ top: -1px; /* Needed for the javascript to make the .-stuck trick work */
+ flex: 0 1 auto;
+ width: 15vw;
+ }
+
+ .phpdocumentor-on-this-page__content.-stuck {
+ height: 100vh;
+ }
+
+ .phpdocumentor-on-this-page__content li {
+ word-break: break-all;
+ line-height: normal;
+ }
+
+ .phpdocumentor-on-this-page__content li.-deprecated {
+ text-decoration: line-through;
+ }
+}
+
+/* Used for screen readers and such */
+.visually-hidden {
+ display: none;
+}
+
+.float-right {
+ float: right;
+}
+
+.float-left {
+ float: left;
+}
diff --git a/css/normalize.css b/css/normalize.css
new file mode 100644
index 0000000..653dc00
--- /dev/null
+++ b/css/normalize.css
@@ -0,0 +1,427 @@
+/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
+
+/**
+ * 1. Set default font family to sans-serif.
+ * 2. Prevent iOS text size adjust after orientation change, without disabling
+ * user zoom.
+ */
+
+html {
+ font-family: sans-serif; /* 1 */
+ -ms-text-size-adjust: 100%; /* 2 */
+ -webkit-text-size-adjust: 100%; /* 2 */
+}
+
+/**
+ * Remove default margin.
+ */
+
+body {
+ margin: 0;
+}
+
+/* HTML5 display definitions
+ ========================================================================== */
+
+/**
+ * Correct `block` display not defined for any HTML5 element in IE 8/9.
+ * Correct `block` display not defined for `details` or `summary` in IE 10/11
+ * and Firefox.
+ * Correct `block` display not defined for `main` in IE 11.
+ */
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+main,
+menu,
+nav,
+section,
+summary {
+ display: block;
+}
+
+/**
+ * 1. Correct `inline-block` display not defined in IE 8/9.
+ * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
+ */
+
+audio,
+canvas,
+progress,
+video {
+ display: inline-block; /* 1 */
+ vertical-align: baseline; /* 2 */
+}
+
+/**
+ * Prevent modern browsers from displaying `audio` without controls.
+ * Remove excess height in iOS 5 devices.
+ */
+
+audio:not([controls]) {
+ display: none;
+ height: 0;
+}
+
+/**
+ * Address `[hidden]` styling not present in IE 8/9/10.
+ * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
+ */
+
+[hidden],
+template {
+ display: none !important;
+}
+
+/* Links
+ ========================================================================== */
+
+/**
+ * Remove the gray background color from active links in IE 10.
+ */
+
+a {
+ background-color: transparent;
+}
+
+/**
+ * Improve readability when focused and also mouse hovered in all browsers.
+ */
+
+a:active,
+a:hover {
+ outline: 0;
+}
+
+/* Text-level semantics
+ ========================================================================== */
+
+/**
+ * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
+ */
+
+abbr[title] {
+ border-bottom: 1px dotted;
+}
+
+/**
+ * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
+ */
+
+b,
+strong {
+ font-weight: bold;
+}
+
+/**
+ * Address styling not present in Safari and Chrome.
+ */
+
+dfn {
+ font-style: italic;
+}
+
+/**
+ * Address variable `h1` font-size and margin within `section` and `article`
+ * contexts in Firefox 4+, Safari, and Chrome.
+ */
+
+h1 {
+ font-size: 2em;
+ margin: 0.67em 0;
+}
+
+/**
+ * Address styling not present in IE 8/9.
+ */
+
+mark {
+ background: #ff0;
+ color: #000;
+}
+
+/**
+ * Address inconsistent and variable font size in all browsers.
+ */
+
+small {
+ font-size: 80%;
+}
+
+/**
+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.
+ */
+
+sub,
+sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline;
+}
+
+sup {
+ top: -0.5em;
+}
+
+sub {
+ bottom: -0.25em;
+}
+
+/* Embedded content
+ ========================================================================== */
+
+/**
+ * Remove border when inside `a` element in IE 8/9/10.
+ */
+
+img {
+ border: 0;
+}
+
+/**
+ * Correct overflow not hidden in IE 9/10/11.
+ */
+
+svg:not(:root) {
+ overflow: hidden;
+}
+
+/* Grouping content
+ ========================================================================== */
+
+/**
+ * Address margin not present in IE 8/9 and Safari.
+ */
+
+figure {
+ margin: 1em 40px;
+}
+
+/**
+ * Address differences between Firefox and other browsers.
+ */
+
+hr {
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+ height: 0;
+}
+
+/**
+ * Contain overflow in all browsers.
+ */
+
+pre {
+ overflow: auto;
+}
+
+/**
+ * Address odd `em`-unit font size rendering in all browsers.
+ */
+
+code,
+kbd,
+pre,
+samp {
+ font-family: var(--font-monospace);
+ font-size: 1em;
+}
+
+/* Forms
+ ========================================================================== */
+
+/**
+ * Known limitation: by default, Chrome and Safari on OS X allow very limited
+ * styling of `select`, unless a `border` property is set.
+ */
+
+/**
+ * 1. Correct color not being inherited.
+ * Known issue: affects color of disabled elements.
+ * 2. Correct font properties not being inherited.
+ * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
+ */
+
+button,
+input,
+optgroup,
+select,
+textarea {
+ color: inherit; /* 1 */
+ font: inherit; /* 2 */
+ margin: 0; /* 3 */
+}
+
+/**
+ * Address `overflow` set to `hidden` in IE 8/9/10/11.
+ */
+
+button {
+ overflow: visible;
+}
+
+/**
+ * Address inconsistent `text-transform` inheritance for `button` and `select`.
+ * All other form control elements do not inherit `text-transform` values.
+ * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
+ * Correct `select` style inheritance in Firefox.
+ */
+
+button,
+select {
+ text-transform: none;
+}
+
+/**
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
+ * and `video` controls.
+ * 2. Correct inability to style clickable `input` types in iOS.
+ * 3. Improve usability and consistency of cursor style between image-type
+ * `input` and others.
+ */
+
+button,
+html input[type="button"], /* 1 */
+input[type="reset"],
+input[type="submit"] {
+ -webkit-appearance: button; /* 2 */
+ cursor: pointer; /* 3 */
+}
+
+/**
+ * Re-set default cursor for disabled elements.
+ */
+
+button[disabled],
+html input[disabled] {
+ cursor: default;
+}
+
+/**
+ * Remove inner padding and border in Firefox 4+.
+ */
+
+button::-moz-focus-inner,
+input::-moz-focus-inner {
+ border: 0;
+ padding: 0;
+}
+
+/**
+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in
+ * the UA stylesheet.
+ */
+
+input {
+ line-height: normal;
+}
+
+/**
+ * It's recommended that you don't attempt to style these elements.
+ * Firefox's implementation doesn't respect box-sizing, padding, or width.
+ *
+ * 1. Address box sizing set to `content-box` in IE 8/9/10.
+ * 2. Remove excess padding in IE 8/9/10.
+ */
+
+input[type="checkbox"],
+input[type="radio"] {
+ box-sizing: border-box; /* 1 */
+ padding: 0; /* 2 */
+}
+
+/**
+ * Fix the cursor style for Chrome's increment/decrement buttons. For certain
+ * `font-size` values of the `input`, it causes the cursor style of the
+ * decrement button to change from `default` to `text`.
+ */
+
+input[type="number"]::-webkit-inner-spin-button,
+input[type="number"]::-webkit-outer-spin-button {
+ height: auto;
+}
+
+/**
+ * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
+ * 2. Address `box-sizing` set to `border-box` in Safari and Chrome
+ * (include `-moz` to future-proof).
+ */
+
+input[type="search"] {
+ -webkit-appearance: textfield; /* 1 */
+ -moz-box-sizing: content-box;
+ -webkit-box-sizing: content-box; /* 2 */
+ box-sizing: content-box;
+}
+
+/**
+ * Remove inner padding and search cancel button in Safari and Chrome on OS X.
+ * Safari (but not Chrome) clips the cancel button when the search input has
+ * padding (and `textfield` appearance).
+ */
+
+input[type="search"]::-webkit-search-cancel-button,
+input[type="search"]::-webkit-search-decoration {
+ -webkit-appearance: none;
+}
+
+/**
+ * Define consistent border, margin, and padding.
+ */
+
+fieldset {
+ border: 1px solid #c0c0c0;
+ margin: 0 2px;
+ padding: 0.35em 0.625em 0.75em;
+}
+
+/**
+ * 1. Correct `color` not being inherited in IE 8/9/10/11.
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
+ */
+
+legend {
+ border: 0; /* 1 */
+ padding: 0; /* 2 */
+}
+
+/**
+ * Remove default vertical scrollbar in IE 8/9/10/11.
+ */
+
+textarea {
+ overflow: auto;
+}
+
+/**
+ * Don't inherit the `font-weight` (applied by a rule above).
+ * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
+ */
+
+optgroup {
+ font-weight: bold;
+}
+
+/* Tables
+ ========================================================================== */
+
+/**
+ * Remove most spacing between table cells.
+ */
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+td,
+th {
+ padding: 0;
+}
diff --git a/css/template.css b/css/template.css
new file mode 100644
index 0000000..21919c0
--- /dev/null
+++ b/css/template.css
@@ -0,0 +1,279 @@
+
+.phpdocumentor-content {
+ position: relative;
+ display: flex;
+ gap: var(--spacing-md);
+}
+
+.phpdocumentor-content > section:first-of-type {
+ width: 75%;
+ flex: 1 1 auto;
+}
+
+@media (min-width: 1900px) {
+ .phpdocumentor-content > section:first-of-type {
+ width: 100%;
+ flex: 1 1 auto;
+ }
+}
+
+.phpdocumentor .phpdocumentor-content__title {
+ margin-top: 0;
+}
+.phpdocumentor-summary {
+ font-style: italic;
+}
+.phpdocumentor-description {
+ margin-bottom: var(--spacing-md);
+}
+.phpdocumentor-element {
+ position: relative;
+}
+
+.phpdocumentor-element .phpdocumentor-element {
+ border: 1px solid var(--primary-color-lighten);
+ margin-bottom: var(--spacing-md);
+ padding: var(--spacing-xs);
+ border-radius: 5px;
+}
+
+.phpdocumentor-element.-deprecated .phpdocumentor-element__name {
+ text-decoration: line-through;
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor-element .phpdocumentor-element {
+ margin-bottom: var(--spacing-lg);
+ padding: var(--spacing-md);
+ }
+}
+
+.phpdocumentor-element__modifier {
+ font-size: var(--text-xxs);
+ padding: calc(var(--spacing-base-size) / 4) calc(var(--spacing-base-size) / 2);
+ color: var(--text-color);
+ background-color: var(--light-gray);
+ border-radius: 3px;
+ text-transform: uppercase;
+}
+
+.phpdocumentor .phpdocumentor-elements__header {
+ margin-top: var(--spacing-xxl);
+ margin-bottom: var(--spacing-lg);
+}
+
+.phpdocumentor .phpdocumentor-element__name {
+ line-height: 1;
+ margin-top: 0;
+ font-weight: 300;
+ font-size: var(--text-lg);
+ word-break: break-all;
+ margin-bottom: var(--spacing-sm);
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor .phpdocumentor-element__name {
+ font-size: var(--text-xl);
+ margin-bottom: var(--spacing-xs);
+ }
+}
+
+@media (min-width: 1200px) {
+ .phpdocumentor .phpdocumentor-element__name {
+ margin-bottom: var(--spacing-md);
+ }
+}
+
+.phpdocumentor-element__package,
+.phpdocumentor-element__extends,
+.phpdocumentor-element__implements {
+ display: block;
+ font-size: var(--text-xxs);
+ font-weight: normal;
+ opacity: .7;
+}
+
+.phpdocumentor-element__package .phpdocumentor-breadcrumbs {
+ display: inline;
+}
+.phpdocumentor .phpdocumentor-signature {
+ display: block;
+ font-size: var(--text-sm);
+ border: 1px solid #f0f0f0;
+ margin-bottom: calc(var(--spacing-sm));
+}
+
+.phpdocumentor .phpdocumentor-signature.-deprecated .phpdocumentor-signature__name {
+ text-decoration: line-through;
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor .phpdocumentor-signature {
+ margin-left: calc(var(--spacing-xl) * -1);
+ width: calc(100% + var(--spacing-xl));
+ }
+}
+
+.phpdocumentor-table-of-contents {
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry {
+ margin-bottom: var(--spacing-xxs);
+ margin-left: 2rem;
+ display: flex;
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > a {
+ flex: 0 1 auto;
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > a.-deprecated {
+ text-decoration: line-through;
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > span {
+ flex: 1;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry:after {
+ content: '';
+ height: 12px;
+ width: 12px;
+ left: 16px;
+ position: absolute;
+}
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-private:after {
+ background: url('data:image/svg+xml;utf8, ') no-repeat;
+}
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-protected:after {
+ left: 13px;
+ background: url('data:image/svg+xml;utf8, ') no-repeat;
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry:before {
+ width: 1.25rem;
+ height: 1.25rem;
+ line-height: 1.25rem;
+ background: transparent url('data:image/svg+xml;utf8, ') no-repeat center center;
+ content: '';
+ position: absolute;
+ left: 0;
+ border-radius: 50%;
+ font-weight: 600;
+ color: white;
+ text-align: center;
+ font-size: .75rem;
+ margin-top: .2rem;
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-method:before {
+ content: 'M';
+ color: '';
+ background-image: url('data:image/svg+xml;utf8, ');
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-function:before {
+ content: 'M';
+ color: ' 96';
+ background-image: url('data:image/svg+xml;utf8, ');
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-property:before {
+ content: 'P'
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-constant:before {
+ content: 'C';
+ background-color: transparent;
+ background-image: url('data:image/svg+xml;utf8, ');
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-class:before {
+ content: 'C'
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-interface:before {
+ content: 'I'
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-trait:before {
+ content: 'T'
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-namespace:before {
+ content: 'N'
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-package:before {
+ content: 'P'
+}
+
+.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-enum:before {
+ content: 'E'
+}
+
+.phpdocumentor-table-of-contents dd {
+ font-style: italic;
+ margin-left: 2rem;
+}
+.phpdocumentor-element-found-in {
+ display: none;
+}
+
+@media (min-width: 550px) {
+ .phpdocumentor-element-found-in {
+ display: block;
+ font-size: var(--text-sm);
+ color: gray;
+ margin-bottom: 1rem;
+ }
+}
+
+@media (min-width: 1200px) {
+ .phpdocumentor-element-found-in {
+ position: absolute;
+ top: var(--spacing-sm);
+ right: var(--spacing-sm);
+ font-size: var(--text-sm);
+ margin-bottom: 0;
+ }
+}
+
+.phpdocumentor-element-found-in .phpdocumentor-element-found-in__source {
+ flex: 0 1 auto;
+ display: inline-flex;
+}
+
+.phpdocumentor-element-found-in .phpdocumentor-element-found-in__source:after {
+ width: 1.25rem;
+ height: 1.25rem;
+ line-height: 1.25rem;
+ background: transparent url('data:image/svg+xml;utf8, ') no-repeat center center;
+ content: '';
+ left: 0;
+ border-radius: 50%;
+ font-weight: 600;
+ text-align: center;
+ font-size: .75rem;
+ margin-top: .2rem;
+}
+.phpdocumentor-class-graph {
+ width: 100%; height: 600px; border:1px solid black; overflow: hidden
+}
+
+.phpdocumentor-class-graph__graph {
+ width: 100%;
+}
+.phpdocumentor-tag-list__definition {
+ display: flex;
+}
+
+.phpdocumentor-tag-link {
+ margin-right: var(--spacing-sm);
+}
+.phpdocumentor-uml-diagram svg {
+ cursor: zoom-in;
+}
\ No newline at end of file
diff --git a/examples/complex.php b/examples/complex.php
deleted file mode 100755
index db0084e..0000000
--- a/examples/complex.php
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/php
-setHelp('This example sets up additional subcommands using their own options');
- $options->registerOption('longflag', 'This is a global flag that applies to all subcommands', 'l');
-
- $options->registerCommand('foo', 'The foo command');
- $options->registerCommand('bar', 'The bar command');
-
- $options->registerOption('someflag', 'This is a flag only valid for the foo command', 's', false, 'foo');
- $options->registerArgument('file', 'This argument is only required for the foo command', true, 'foo');
-
- $options->registerOption('load', 'Another flag only for the bar command, requiring an argument', 'l', 'input',
- 'bar');
-
- $options->registerCommand('compact', 'Display the help text in a more compact manner');
- }
-
- /**
- * Your main program
- *
- * Arguments and options have been parsed when this is run
- *
- * @param Options $options
- * @return void
- */
- protected function main(Options $options)
- {
-
- switch ($options->getCmd()) {
- case 'foo':
- $this->success('The foo command was called');
- break;
- case 'bar':
- $this->success('The bar command was called');
- break;
- case 'compact':
- $options->useCompactHelp();
- echo $options->help();
- exit;
- default:
- $this->error('No known command was called, we show the default help instead:');
- echo $options->help();
- exit;
- }
-
- $this->info('$options->getArgs():');
- var_dump($options->getArgs());
-
- }
-}
-
-$cli = new Complex();
-$cli->run();
diff --git a/examples/logging.php b/examples/logging.php
deleted file mode 100755
index 8c1a165..0000000
--- a/examples/logging.php
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/php
-setHelp('A very minimal example that demos the logging');
- }
-
- // implement your code
- protected function main(Options $options)
- {
- $this->debug('This is a debug message');
- $this->info('This is a info message');
- $this->notice('This is a notice message');
- $this->success('This is a success message');
- $this->warning('This is a warning message');
- $this->error('This is a error message');
- $this->critical('This is a critical message');
- $this->alert('This is a alert message');
- $this->emergency('This is a emergency message');
- throw new \Exception('Exception will be caught, too');
- }
-}
-
-// execute it
-$cli = new logging();
-$cli->run();
\ No newline at end of file
diff --git a/examples/minimal.php b/examples/minimal.php
deleted file mode 100755
index 43a5b31..0000000
--- a/examples/minimal.php
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/php
-setHelp('A very minimal example that does nothing but print a version');
- $options->registerOption('version', 'print version', 'v');
- }
-
- // implement your code
- protected function main(Options $options)
- {
- if ($options->getOpt('version')) {
- $this->info('1.0.0');
- } else {
- echo $options->help();
- }
- }
-}
-// execute it
-$cli = new Minimal();
-$cli->run();
\ No newline at end of file
diff --git a/examples/simple.php b/examples/simple.php
deleted file mode 100755
index 6511e0a..0000000
--- a/examples/simple.php
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/php
-setHelp('This is a simple example, not using any subcommands');
- $options->registerOption('longflag', 'A flag that can also be set with a short option', 'l');
- $options->registerOption('file', 'This option expects an argument.', 'f', 'filename');
- $options->registerArgument('argument', 'Arguments can be required or optional. This one is optional', false);
- }
-
- /**
- * Your main program
- *
- * Arguments and options have been parsed when this is run
- *
- * @param Options $options
- * @return void
- */
- protected function main(Options $options)
- {
- if ($options->getOpt('longflag')) {
- $this->info("longflag was set");
- } else {
- $this->info("longflag was not set");
- }
-
- if ($options->getOpt('file')) {
- $this->info("file was given as " . $options->getOpt('file'));
- }
-
- $this->info("Number of arguments: " . count($options->getArgs()));
-
- $this->success("main finished");
- }
-}
-
-$cli = new Simple();
-$cli->run();
\ No newline at end of file
diff --git a/examples/table.php b/examples/table.php
deleted file mode 100755
index 7a4ced9..0000000
--- a/examples/table.php
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/php
-setHelp('This shows how the table formatter works by printing the current php.ini values');
- }
-
- /**
- * Your main program
- *
- * Arguments and options have been parsed when this is run
- *
- * @param Options $options
- * @return void
- */
- protected function main(Options $options)
- {
- $tf = new TableFormatter($this->colors);
- $tf->setBorder(' | '); // nice border between colmns
-
- // show a header
- echo $tf->format(
- array('*', '30%', '30%'),
- array('ini setting', 'global', 'local')
- );
-
- // a line across the whole width
- echo str_pad('', $tf->getMaxWidth(), '-') . "\n";
-
- // colored columns
- $ini = ini_get_all();
- foreach ($ini as $val => $opts) {
- echo $tf->format(
- array('*', '30%', '30%'),
- array($val, $opts['global_value'], $opts['local_value']),
- array(Colors::C_CYAN, Colors::C_RED, Colors::C_GREEN)
- );
- }
- }
-}
-
-$cli = new Table();
-$cli->run();
\ No newline at end of file
diff --git a/files/src-base.html b/files/src-base.html
new file mode 100644
index 0000000..28554da
--- /dev/null
+++ b/files/src-base.html
@@ -0,0 +1,273 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base.php
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+ Classes
+
+
+
+
+ Base Class CLIBase
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/files/src-cli.html b/files/src-cli.html
new file mode 100644
index 0000000..6ffcbae
--- /dev/null
+++ b/files/src-cli.html
@@ -0,0 +1,273 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CLI.php
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+ Classes
+
+
+
+
+ CLI Class CLI
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/files/src-colors.html b/files/src-colors.html
new file mode 100644
index 0000000..1e5e51c
--- /dev/null
+++ b/files/src-colors.html
@@ -0,0 +1,273 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Colors.php
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+ Classes
+
+
+
+
+ Colors Class Colors
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/files/src-exception.html b/files/src-exception.html
new file mode 100644
index 0000000..4d1e731
--- /dev/null
+++ b/files/src-exception.html
@@ -0,0 +1,273 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Exception.php
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+ Classes
+
+
+
+
+ Exception Class Exception
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/files/src-options.html b/files/src-options.html
new file mode 100644
index 0000000..027af7e
--- /dev/null
+++ b/files/src-options.html
@@ -0,0 +1,273 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Options.php
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+ Classes
+
+
+
+
+ Options Class Options
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/files/src-psr3cli.html b/files/src-psr3cli.html
new file mode 100644
index 0000000..fb855a3
--- /dev/null
+++ b/files/src-psr3cli.html
@@ -0,0 +1,273 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PSR3CLI.php
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+ Classes
+
+
+
+
+ PSR3CLI Class PSR3CLI
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/files/src-psr3cliv3.html b/files/src-psr3cliv3.html
new file mode 100644
index 0000000..95c324e
--- /dev/null
+++ b/files/src-psr3cliv3.html
@@ -0,0 +1,273 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PSR3CLIv3.php
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+ Classes
+
+
+
+
+ PSR3CLIv3 Class PSR3CLI
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/files/src-tableformatter.html b/files/src-tableformatter.html
new file mode 100644
index 0000000..4fad079
--- /dev/null
+++ b/files/src-tableformatter.html
@@ -0,0 +1,273 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TableFormatter.php
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+
+
+
+ Classes
+
+
+
+
+ TableFormatter Class TableFormatter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/graphs/classes.html b/graphs/classes.html
new file mode 100644
index 0000000..bd0e861
--- /dev/null
+++ b/graphs/classes.html
@@ -0,0 +1,116 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..62b2de0
--- /dev/null
+++ b/index.html
@@ -0,0 +1,159 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Documentation
+
+
+
+
+ Table of Contents
+
+
+
+
+
+ Packages
+
+
+
+
+ Application
+
+
+
+ Namespaces
+
+
+
+
+ splitbrain
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/indices/files.html b/indices/files.html
new file mode 100644
index 0000000..a865d0c
--- /dev/null
+++ b/indices/files.html
@@ -0,0 +1,147 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Files
+ B
+
+ C
+
+ E
+
+ O
+
+ P
+
+ T
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/js/search.js b/js/search.js
new file mode 100644
index 0000000..093d6d0
--- /dev/null
+++ b/js/search.js
@@ -0,0 +1,173 @@
+// Search module for phpDocumentor
+//
+// This module is a wrapper around fuse.js that will use a given index and attach itself to a
+// search form and to a search results pane identified by the following data attributes:
+//
+// 1. data-search-form
+// 2. data-search-results
+//
+// The data-search-form is expected to have a single input element of type 'search' that will trigger searching for
+// a series of results, were the data-search-results pane is expected to have a direct UL child that will be populated
+// with rendered results.
+//
+// The search has various stages, upon loading this stage the data-search-form receives the CSS class
+// 'phpdocumentor-search--enabled'; this indicates that JS is allowed and indices are being loaded. It is recommended
+// to hide the form by default and show it when it receives this class to achieve progressive enhancement for this
+// feature.
+//
+// After loading this module, it is expected to load a search index asynchronously, for example:
+//
+//
+//
+// In this script the generated index should attach itself to the search module using the `appendIndex` function. By
+// doing it like this the page will continue loading, unhindered by the loading of the search.
+//
+// After the page has fully loaded, and all these deferred indexes loaded, the initialization of the search module will
+// be called and the form will receive the class 'phpdocumentor-search--active', indicating search is ready. At this
+// point, the input field will also have it's 'disabled' attribute removed.
+var Search = (function () {
+ var fuse;
+ var index = [];
+ var options = {
+ shouldSort: true,
+ threshold: 0.6,
+ location: 0,
+ distance: 100,
+ maxPatternLength: 32,
+ minMatchCharLength: 1,
+ keys: [
+ "fqsen",
+ "name",
+ "summary",
+ "url"
+ ]
+ };
+
+ // Credit David Walsh (https://davidwalsh.name/javascript-debounce-function)
+ // Returns a function, that, as long as it continues to be invoked, will not
+ // be triggered. The function will be called after it stops being called for
+ // N milliseconds. If `immediate` is passed, trigger the function on the
+ // leading edge, instead of the trailing.
+ function debounce(func, wait, immediate) {
+ var timeout;
+
+ return function executedFunction() {
+ var context = this;
+ var args = arguments;
+
+ var later = function () {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ };
+
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
+ };
+ }
+
+ function close() {
+ // Start scroll prevention: https://css-tricks.com/prevent-page-scrolling-when-a-modal-is-open/
+ const scrollY = document.body.style.top;
+ document.body.style.position = '';
+ document.body.style.top = '';
+ window.scrollTo(0, parseInt(scrollY || '0') * -1);
+ // End scroll prevention
+
+ var form = document.querySelector('[data-search-form]');
+ var searchResults = document.querySelector('[data-search-results]');
+
+ form.classList.toggle('phpdocumentor-search--has-results', false);
+ searchResults.classList.add('phpdocumentor-search-results--hidden');
+ var searchField = document.querySelector('[data-search-form] input[type="search"]');
+ searchField.blur();
+ }
+
+ function search(event) {
+ // Start scroll prevention: https://css-tricks.com/prevent-page-scrolling-when-a-modal-is-open/
+ document.body.style.position = 'fixed';
+ document.body.style.top = `-${window.scrollY}px`;
+ // End scroll prevention
+
+ // prevent enter's from autosubmitting
+ event.stopPropagation();
+
+ var form = document.querySelector('[data-search-form]');
+ var searchResults = document.querySelector('[data-search-results]');
+ var searchResultEntries = document.querySelector('[data-search-results] .phpdocumentor-search-results__entries');
+
+ searchResultEntries.innerHTML = '';
+
+ if (!event.target.value) {
+ close();
+ return;
+ }
+
+ form.classList.toggle('phpdocumentor-search--has-results', true);
+ searchResults.classList.remove('phpdocumentor-search-results--hidden');
+ var results = fuse.search(event.target.value, {limit: 25});
+
+ results.forEach(function (result) {
+ var entry = document.createElement("li");
+ entry.classList.add("phpdocumentor-search-results__entry");
+ entry.innerHTML += '\n";
+ entry.innerHTML += '' + result.fqsen + " \n";
+ entry.innerHTML += '' + result.summary + '
';
+ searchResultEntries.appendChild(entry)
+ });
+ }
+
+ function appendIndex(added) {
+ index = index.concat(added);
+
+ // re-initialize search engine when appending an index after initialisation
+ if (typeof fuse !== 'undefined') {
+ fuse = new Fuse(index, options);
+ }
+ }
+
+ function init() {
+ fuse = new Fuse(index, options);
+
+ var form = document.querySelector('[data-search-form]');
+ var searchField = document.querySelector('[data-search-form] input[type="search"]');
+
+ var closeButton = document.querySelector('.phpdocumentor-search-results__close');
+ closeButton.addEventListener('click', function() { close() }.bind(this));
+
+ var searchResults = document.querySelector('[data-search-results]');
+ searchResults.addEventListener('click', function() { close() }.bind(this));
+
+ form.classList.add('phpdocumentor-search--active');
+
+ searchField.setAttribute('placeholder', 'Search (Press "/" to focus)');
+ searchField.removeAttribute('disabled');
+ searchField.addEventListener('keyup', debounce(search, 300));
+
+ window.addEventListener('keyup', function (event) {
+ if (event.key === '/') {
+ searchField.focus();
+ }
+ if (event.code === 'Escape') {
+ close();
+ }
+ }.bind(this));
+ }
+
+ return {
+ appendIndex,
+ init
+ }
+})();
+
+window.addEventListener('DOMContentLoaded', function () {
+ var form = document.querySelector('[data-search-form]');
+
+ // When JS is supported; show search box. Must be before including the search for it to take effect immediately
+ form.classList.add('phpdocumentor-search--enabled');
+});
+
+window.addEventListener('load', function () {
+ Search.init();
+});
diff --git a/js/searchIndex.js b/js/searchIndex.js
new file mode 100644
index 0000000..f36c3cf
--- /dev/null
+++ b/js/searchIndex.js
@@ -0,0 +1,579 @@
+Search.appendIndex(
+ [
+ {
+ "fqsen": "\\splitbrain\\phpcli\\Base",
+ "name": "Base",
+ "summary": "Class\u0020CLIBase",
+ "url": "classes/splitbrain-phpcli-Base.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003A__construct\u0028\u0029",
+ "name": "__construct",
+ "summary": "constructor",
+ "url": "classes/splitbrain-phpcli-Base.html#method___construct"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003Asetup\u0028\u0029",
+ "name": "setup",
+ "summary": "Register\u0020options\u0020and\u0020arguments\u0020on\u0020the\u0020given\u0020\u0024options\u0020object",
+ "url": "classes/splitbrain-phpcli-Base.html#method_setup"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003Amain\u0028\u0029",
+ "name": "main",
+ "summary": "Your\u0020main\u0020program",
+ "url": "classes/splitbrain-phpcli-Base.html#method_main"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003Arun\u0028\u0029",
+ "name": "run",
+ "summary": "Execute\u0020the\u0020CLI\u0020program",
+ "url": "classes/splitbrain-phpcli-Base.html#method_run"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003AregisterDefaultOptions\u0028\u0029",
+ "name": "registerDefaultOptions",
+ "summary": "Add\u0020the\u0020default\u0020help,\u0020color\u0020and\u0020log\u0020options",
+ "url": "classes/splitbrain-phpcli-Base.html#method_registerDefaultOptions"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003AhandleDefaultOptions\u0028\u0029",
+ "name": "handleDefaultOptions",
+ "summary": "Handle\u0020the\u0020default\u0020options",
+ "url": "classes/splitbrain-phpcli-Base.html#method_handleDefaultOptions"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003AsetupLogging\u0028\u0029",
+ "name": "setupLogging",
+ "summary": "Handle\u0020the\u0020logging\u0020options",
+ "url": "classes/splitbrain-phpcli-Base.html#method_setupLogging"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003AparseOptions\u0028\u0029",
+ "name": "parseOptions",
+ "summary": "Wrapper\u0020around\u0020the\u0020option\u0020parsing",
+ "url": "classes/splitbrain-phpcli-Base.html#method_parseOptions"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003AcheckArguments\u0028\u0029",
+ "name": "checkArguments",
+ "summary": "Wrapper\u0020around\u0020the\u0020argument\u0020checking",
+ "url": "classes/splitbrain-phpcli-Base.html#method_checkArguments"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003Aexecute\u0028\u0029",
+ "name": "execute",
+ "summary": "Wrapper\u0020around\u0020main",
+ "url": "classes/splitbrain-phpcli-Base.html#method_execute"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003AsetLogLevel\u0028\u0029",
+ "name": "setLogLevel",
+ "summary": "Set\u0020the\u0020current\u0020log\u0020level",
+ "url": "classes/splitbrain-phpcli-Base.html#method_setLogLevel"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003AisLogLevelEnabled\u0028\u0029",
+ "name": "isLogLevelEnabled",
+ "summary": "Check\u0020if\u0020a\u0020message\u0020with\u0020the\u0020given\u0020level\u0020should\u0020be\u0020logged",
+ "url": "classes/splitbrain-phpcli-Base.html#method_isLogLevelEnabled"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003Afatal\u0028\u0029",
+ "name": "fatal",
+ "summary": "Exits\u0020the\u0020program\u0020on\u0020a\u0020fatal\u0020error",
+ "url": "classes/splitbrain-phpcli-Base.html#method_fatal"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003Asuccess\u0028\u0029",
+ "name": "success",
+ "summary": "Normal,\u0020positive\u0020outcome\u0020\u0028This\u0020is\u0020not\u0020a\u0020PSR\u002D3\u0020level\u0029",
+ "url": "classes/splitbrain-phpcli-Base.html#method_success"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003AlogMessage\u0028\u0029",
+ "name": "logMessage",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Base.html#method_logMessage"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003Ainterpolate\u0028\u0029",
+ "name": "interpolate",
+ "summary": "Interpolates\u0020context\u0020values\u0020into\u0020the\u0020message\u0020placeholders.",
+ "url": "classes/splitbrain-phpcli-Base.html#method_interpolate"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003A\u0024bin",
+ "name": "bin",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Base.html#property_bin"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003A\u0024options",
+ "name": "options",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Base.html#property_options"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003A\u0024colors",
+ "name": "colors",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Base.html#property_colors"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003A\u0024loglevel",
+ "name": "loglevel",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Base.html#property_loglevel"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Base\u003A\u003A\u0024logdefault",
+ "name": "logdefault",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Base.html#property_logdefault"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI",
+ "name": "CLI",
+ "summary": "Class\u0020CLI",
+ "url": "classes/splitbrain-phpcli-CLI.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Aemergency\u0028\u0029",
+ "name": "emergency",
+ "summary": "System\u0020is\u0020unusable.",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_emergency"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Aalert\u0028\u0029",
+ "name": "alert",
+ "summary": "Action\u0020must\u0020be\u0020taken\u0020immediately.",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_alert"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Acritical\u0028\u0029",
+ "name": "critical",
+ "summary": "Critical\u0020conditions.",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_critical"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Aerror\u0028\u0029",
+ "name": "error",
+ "summary": "Runtime\u0020errors\u0020that\u0020do\u0020not\u0020require\u0020immediate\u0020action\u0020but\u0020should\u0020typically\nbe\u0020logged\u0020and\u0020monitored.",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_error"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Awarning\u0028\u0029",
+ "name": "warning",
+ "summary": "Exceptional\u0020occurrences\u0020that\u0020are\u0020not\u0020errors.",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_warning"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Anotice\u0028\u0029",
+ "name": "notice",
+ "summary": "Normal\u0020but\u0020significant\u0020events.",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_notice"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Ainfo\u0028\u0029",
+ "name": "info",
+ "summary": "Interesting\u0020events.",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_info"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Adebug\u0028\u0029",
+ "name": "debug",
+ "summary": "Detailed\u0020debug\u0020information.",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_debug"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\CLI\u003A\u003Alog\u0028\u0029",
+ "name": "log",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-CLI.html#method_log"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors",
+ "name": "Colors",
+ "summary": "Class\u0020Colors",
+ "url": "classes/splitbrain-phpcli-Colors.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003A__construct\u0028\u0029",
+ "name": "__construct",
+ "summary": "Constructor",
+ "url": "classes/splitbrain-phpcli-Colors.html#method___construct"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003Aenable\u0028\u0029",
+ "name": "enable",
+ "summary": "enable\u0020color\u0020output",
+ "url": "classes/splitbrain-phpcli-Colors.html#method_enable"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003Adisable\u0028\u0029",
+ "name": "disable",
+ "summary": "disable\u0020color\u0020output",
+ "url": "classes/splitbrain-phpcli-Colors.html#method_disable"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AisEnabled\u0028\u0029",
+ "name": "isEnabled",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#method_isEnabled"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003Aptln\u0028\u0029",
+ "name": "ptln",
+ "summary": "Convenience\u0020function\u0020to\u0020print\u0020a\u0020line\u0020in\u0020a\u0020given\u0020color",
+ "url": "classes/splitbrain-phpcli-Colors.html#method_ptln"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003Awrap\u0028\u0029",
+ "name": "wrap",
+ "summary": "Returns\u0020the\u0020given\u0020text\u0020wrapped\u0020in\u0020the\u0020appropriate\u0020color\u0020and\u0020reset\u0020code",
+ "url": "classes/splitbrain-phpcli-Colors.html#method_wrap"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AgetColorCode\u0028\u0029",
+ "name": "getColorCode",
+ "summary": "Gets\u0020the\u0020appropriate\u0020terminal\u0020code\u0020for\u0020the\u0020given\u0020color",
+ "url": "classes/splitbrain-phpcli-Colors.html#method_getColorCode"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003Aset\u0028\u0029",
+ "name": "set",
+ "summary": "Set\u0020the\u0020given\u0020color\u0020for\u0020consecutive\u0020output",
+ "url": "classes/splitbrain-phpcli-Colors.html#method_set"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003Areset\u0028\u0029",
+ "name": "reset",
+ "summary": "reset\u0020the\u0020terminal\u0020color",
+ "url": "classes/splitbrain-phpcli-Colors.html#method_reset"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_RESET",
+ "name": "C_RESET",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_RESET"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_BLACK",
+ "name": "C_BLACK",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_BLACK"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_DARKGRAY",
+ "name": "C_DARKGRAY",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_DARKGRAY"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_BLUE",
+ "name": "C_BLUE",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_BLUE"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_LIGHTBLUE",
+ "name": "C_LIGHTBLUE",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_LIGHTBLUE"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_GREEN",
+ "name": "C_GREEN",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_GREEN"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_LIGHTGREEN",
+ "name": "C_LIGHTGREEN",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_LIGHTGREEN"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_CYAN",
+ "name": "C_CYAN",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_CYAN"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_LIGHTCYAN",
+ "name": "C_LIGHTCYAN",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_LIGHTCYAN"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_RED",
+ "name": "C_RED",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_RED"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_LIGHTRED",
+ "name": "C_LIGHTRED",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_LIGHTRED"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_PURPLE",
+ "name": "C_PURPLE",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_PURPLE"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_LIGHTPURPLE",
+ "name": "C_LIGHTPURPLE",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_LIGHTPURPLE"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_BROWN",
+ "name": "C_BROWN",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_BROWN"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_YELLOW",
+ "name": "C_YELLOW",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_YELLOW"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_LIGHTGRAY",
+ "name": "C_LIGHTGRAY",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_LIGHTGRAY"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_WHITE",
+ "name": "C_WHITE",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_WHITE"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003AC_CODE_REGEX",
+ "name": "C_CODE_REGEX",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#constant_C_CODE_REGEX"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003A\u0024colors",
+ "name": "colors",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#property_colors"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Colors\u003A\u003A\u0024enabled",
+ "name": "enabled",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Colors.html#property_enabled"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Exception",
+ "name": "Exception",
+ "summary": "Class\u0020Exception",
+ "url": "classes/splitbrain-phpcli-Exception.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Exception\u003A\u003A__construct\u0028\u0029",
+ "name": "__construct",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Exception.html#method___construct"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Exception\u003A\u003AE_ANY",
+ "name": "E_ANY",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Exception.html#constant_E_ANY"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Exception\u003A\u003AE_UNKNOWN_OPT",
+ "name": "E_UNKNOWN_OPT",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Exception.html#constant_E_UNKNOWN_OPT"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Exception\u003A\u003AE_OPT_ARG_REQUIRED",
+ "name": "E_OPT_ARG_REQUIRED",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Exception.html#constant_E_OPT_ARG_REQUIRED"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Exception\u003A\u003AE_OPT_ARG_DENIED",
+ "name": "E_OPT_ARG_DENIED",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Exception.html#constant_E_OPT_ARG_DENIED"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Exception\u003A\u003AE_OPT_ABIGUOUS",
+ "name": "E_OPT_ABIGUOUS",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Exception.html#constant_E_OPT_ABIGUOUS"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Exception\u003A\u003AE_ARG_READ",
+ "name": "E_ARG_READ",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Exception.html#constant_E_ARG_READ"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options",
+ "name": "Options",
+ "summary": "Class\u0020Options",
+ "url": "classes/splitbrain-phpcli-Options.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003A__construct\u0028\u0029",
+ "name": "__construct",
+ "summary": "Constructor",
+ "url": "classes/splitbrain-phpcli-Options.html#method___construct"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AgetBin\u0028\u0029",
+ "name": "getBin",
+ "summary": "Gets\u0020the\u0020bin\u0020value",
+ "url": "classes/splitbrain-phpcli-Options.html#method_getBin"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AsetHelp\u0028\u0029",
+ "name": "setHelp",
+ "summary": "Sets\u0020the\u0020help\u0020text\u0020for\u0020the\u0020tool\u0020itself",
+ "url": "classes/splitbrain-phpcli-Options.html#method_setHelp"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AsetCommandHelp\u0028\u0029",
+ "name": "setCommandHelp",
+ "summary": "Sets\u0020the\u0020help\u0020text\u0020for\u0020the\u0020tools\u0020commands\u0020itself",
+ "url": "classes/splitbrain-phpcli-Options.html#method_setCommandHelp"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AuseCompactHelp\u0028\u0029",
+ "name": "useCompactHelp",
+ "summary": "Use\u0020a\u0020more\u0020compact\u0020help\u0020screen\u0020with\u0020less\u0020new\u0020lines",
+ "url": "classes/splitbrain-phpcli-Options.html#method_useCompactHelp"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AregisterArgument\u0028\u0029",
+ "name": "registerArgument",
+ "summary": "Register\u0020the\u0020names\u0020of\u0020arguments\u0020for\u0020help\u0020generation\u0020and\u0020number\u0020checking",
+ "url": "classes/splitbrain-phpcli-Options.html#method_registerArgument"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AregisterCommand\u0028\u0029",
+ "name": "registerCommand",
+ "summary": "This\u0020registers\u0020a\u0020sub\u0020command",
+ "url": "classes/splitbrain-phpcli-Options.html#method_registerCommand"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AregisterOption\u0028\u0029",
+ "name": "registerOption",
+ "summary": "Register\u0020an\u0020option\u0020for\u0020option\u0020parsing\u0020and\u0020help\u0020generation",
+ "url": "classes/splitbrain-phpcli-Options.html#method_registerOption"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AcheckArguments\u0028\u0029",
+ "name": "checkArguments",
+ "summary": "Checks\u0020the\u0020actual\u0020number\u0020of\u0020arguments\u0020against\u0020the\u0020required\u0020number",
+ "url": "classes/splitbrain-phpcli-Options.html#method_checkArguments"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AparseOptions\u0028\u0029",
+ "name": "parseOptions",
+ "summary": "Parses\u0020the\u0020given\u0020arguments\u0020for\u0020known\u0020options\u0020and\u0020command",
+ "url": "classes/splitbrain-phpcli-Options.html#method_parseOptions"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AgetOpt\u0028\u0029",
+ "name": "getOpt",
+ "summary": "Get\u0020the\u0020value\u0020of\u0020the\u0020given\u0020option",
+ "url": "classes/splitbrain-phpcli-Options.html#method_getOpt"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AgetCmd\u0028\u0029",
+ "name": "getCmd",
+ "summary": "Return\u0020the\u0020found\u0020command\u0020if\u0020any",
+ "url": "classes/splitbrain-phpcli-Options.html#method_getCmd"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AgetArgs\u0028\u0029",
+ "name": "getArgs",
+ "summary": "Get\u0020all\u0020the\u0020arguments\u0020passed\u0020to\u0020the\u0020script",
+ "url": "classes/splitbrain-phpcli-Options.html#method_getArgs"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003Ahelp\u0028\u0029",
+ "name": "help",
+ "summary": "Builds\u0020a\u0020help\u0020screen\u0020from\u0020the\u0020available\u0020options.\u0020You\u0020may\u0020want\u0020to\u0020call\u0020it\u0020from\u0020\u002Dh\u0020or\u0020on\u0020error",
+ "url": "classes/splitbrain-phpcli-Options.html#method_help"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003AreadPHPArgv\u0028\u0029",
+ "name": "readPHPArgv",
+ "summary": "Safely\u0020read\u0020the\u0020\u0024argv\u0020PHP\u0020array\u0020across\u0020different\u0020PHP\u0020configurations.",
+ "url": "classes/splitbrain-phpcli-Options.html#method_readPHPArgv"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003A\u0024setup",
+ "name": "setup",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Options.html#property_setup"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003A\u0024options",
+ "name": "options",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Options.html#property_options"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003A\u0024command",
+ "name": "command",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Options.html#property_command"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003A\u0024args",
+ "name": "args",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Options.html#property_args"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003A\u0024bin",
+ "name": "bin",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Options.html#property_bin"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003A\u0024colors",
+ "name": "colors",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Options.html#property_colors"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\Options\u003A\u003A\u0024newline",
+ "name": "newline",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-Options.html#property_newline"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\PSR3CLI",
+ "name": "PSR3CLI",
+ "summary": "Class\u0020PSR3CLI",
+ "url": "classes/splitbrain-phpcli-PSR3CLI.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\PSR3CLIv3",
+ "name": "PSR3CLIv3",
+ "summary": "Class\u0020PSR3CLI",
+ "url": "classes/splitbrain-phpcli-PSR3CLIv3.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\PSR3CLIv3\u003A\u003Alog\u0028\u0029",
+ "name": "log",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-PSR3CLIv3.html#method_log"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter",
+ "name": "TableFormatter",
+ "summary": "Class\u0020TableFormatter",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003A__construct\u0028\u0029",
+ "name": "__construct",
+ "summary": "TableFormatter\u0020constructor.",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method___construct"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003AgetBorder\u0028\u0029",
+ "name": "getBorder",
+ "summary": "The\u0020currently\u0020set\u0020border\u0020\u0028defaults\u0020to\u0020\u0027\u0020\u0027\u0029",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_getBorder"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003AsetBorder\u0028\u0029",
+ "name": "setBorder",
+ "summary": "Set\u0020the\u0020border.\u0020The\u0020border\u0020is\u0020set\u0020between\u0020each\u0020column.\u0020Its\u0020width\u0020is\nadded\u0020to\u0020the\u0020column\u0020widths.",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_setBorder"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003AgetMaxWidth\u0028\u0029",
+ "name": "getMaxWidth",
+ "summary": "Width\u0020of\u0020the\u0020terminal\u0020in\u0020characters",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_getMaxWidth"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003AsetMaxWidth\u0028\u0029",
+ "name": "setMaxWidth",
+ "summary": "Set\u0020the\u0020width\u0020of\u0020the\u0020terminal\u0020to\u0020assume\u0020\u0028in\u0020characters\u0029",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_setMaxWidth"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003AgetTerminalWidth\u0028\u0029",
+ "name": "getTerminalWidth",
+ "summary": "Tries\u0020to\u0020figure\u0020out\u0020the\u0020width\u0020of\u0020the\u0020terminal",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_getTerminalWidth"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003AcalculateColLengths\u0028\u0029",
+ "name": "calculateColLengths",
+ "summary": "Takes\u0020an\u0020array\u0020with\u0020dynamic\u0020column\u0020width\u0020and\u0020calculates\u0020the\u0020correct\u0020width",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_calculateColLengths"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003Aformat\u0028\u0029",
+ "name": "format",
+ "summary": "Displays\u0020text\u0020in\u0020multiple\u0020word\u0020wrapped\u0020columns",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_format"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003Apad\u0028\u0029",
+ "name": "pad",
+ "summary": "Pad\u0020the\u0020given\u0020string\u0020to\u0020the\u0020correct\u0020length",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_pad"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003Astrlen\u0028\u0029",
+ "name": "strlen",
+ "summary": "Measures\u0020char\u0020length\u0020in\u0020UTF\u002D8\u0020when\u0020possible",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_strlen"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003Asubstr\u0028\u0029",
+ "name": "substr",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_substr"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003Awordwrap\u0028\u0029",
+ "name": "wordwrap",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#method_wordwrap"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003A\u0024border",
+ "name": "border",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#property_border"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003A\u0024max",
+ "name": "max",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#property_max"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli\\TableFormatter\u003A\u003A\u0024colors",
+ "name": "colors",
+ "summary": "",
+ "url": "classes/splitbrain-phpcli-TableFormatter.html#property_colors"
+ }, {
+ "fqsen": "\\",
+ "name": "\\",
+ "summary": "",
+ "url": "namespaces/default.html"
+ }, {
+ "fqsen": "\\splitbrain\\phpcli",
+ "name": "phpcli",
+ "summary": "",
+ "url": "namespaces/splitbrain-phpcli.html"
+ }, {
+ "fqsen": "\\splitbrain",
+ "name": "splitbrain",
+ "summary": "",
+ "url": "namespaces/splitbrain.html"
+ } ]
+);
diff --git a/js/template.js b/js/template.js
new file mode 100644
index 0000000..83931d2
--- /dev/null
+++ b/js/template.js
@@ -0,0 +1,34 @@
+(function(){
+ window.addEventListener('load', () => {
+ const el = document.querySelector('.phpdocumentor-on-this-page__content')
+ if (!el) {
+ return;
+ }
+
+ const observer = new IntersectionObserver(
+ ([e]) => {
+ e.target.classList.toggle("-stuck", e.intersectionRatio < 1);
+ },
+ {threshold: [1]}
+ );
+
+ observer.observe(el);
+ })
+})();
+function openSvg(svg) {
+ // convert to a valid XML source
+ const as_text = new XMLSerializer().serializeToString(svg);
+ // store in a Blob
+ const blob = new Blob([as_text], { type: "image/svg+xml" });
+ // create an URI pointing to that blob
+ const url = URL.createObjectURL(blob);
+ const win = open(url);
+ // so the Garbage Collector can collect the blob
+ win.onload = (evt) => URL.revokeObjectURL(url);
+};
+
+
+var svgs = document.querySelectorAll(".phpdocumentor-uml-diagram svg");
+for( var i=0,il = svgs.length; i< il; i ++ ) {
+ svgs[i].onclick = (evt) => openSvg(evt.target);
+}
\ No newline at end of file
diff --git a/namespaces/default.html b/namespaces/default.html
new file mode 100644
index 0000000..11222a2
--- /dev/null
+++ b/namespaces/default.html
@@ -0,0 +1,266 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ API Documentation
+
+
+
+ Table of Contents
+
+
+
+
+
+
+ Namespaces
+
+
+
+
+ splitbrain
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/namespaces/splitbrain-phpcli.html b/namespaces/splitbrain-phpcli.html
new file mode 100644
index 0000000..93db11e
--- /dev/null
+++ b/namespaces/splitbrain-phpcli.html
@@ -0,0 +1,267 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/namespaces/splitbrain.html b/namespaces/splitbrain.html
new file mode 100644
index 0000000..1849b07
--- /dev/null
+++ b/namespaces/splitbrain.html
@@ -0,0 +1,266 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ splitbrain
+
+
+
+ Table of Contents
+
+
+
+
+
+
+ Namespaces
+
+
+
+
+ phpcli
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/Application.html b/packages/Application.html
new file mode 100644
index 0000000..ef014d4
--- /dev/null
+++ b/packages/Application.html
@@ -0,0 +1,266 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/default.html b/packages/default.html
new file mode 100644
index 0000000..34a3cb0
--- /dev/null
+++ b/packages/default.html
@@ -0,0 +1,266 @@
+
+
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ API Documentation
+
+
+
+ Table of Contents
+
+
+
+
+
+ Packages
+
+
+
+
+ Application
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index 51d8a7a..0000000
--- a/phpunit.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- ./tests/
-
-
-
diff --git a/reports/deprecated.html b/reports/deprecated.html
new file mode 100644
index 0000000..8934f31
--- /dev/null
+++ b/reports/deprecated.html
@@ -0,0 +1,132 @@
+
+
+
+
+ Documentation » Deprecated elements
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Deprecated
+
+
+
+ No deprecated elements have been found in this project.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/reports/errors.html b/reports/errors.html
new file mode 100644
index 0000000..388a0bf
--- /dev/null
+++ b/reports/errors.html
@@ -0,0 +1,131 @@
+
+
+
+
+ Documentation » Compilation errors
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Errors
+
+
+
No errors have been found in this project.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/reports/markers.html b/reports/markers.html
new file mode 100644
index 0000000..21b2e5e
--- /dev/null
+++ b/reports/markers.html
@@ -0,0 +1,132 @@
+
+
+
+
+ Documentation » Markers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Markers
+
+
+ No markers have been found in this project.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/screenshot.png b/screenshot.png
deleted file mode 100644
index 171f641..0000000
Binary files a/screenshot.png and /dev/null differ
diff --git a/screenshot2.png b/screenshot2.png
deleted file mode 100644
index 686bcdf..0000000
Binary files a/screenshot2.png and /dev/null differ
diff --git a/src/Base.php b/src/Base.php
deleted file mode 100644
index a3b6049..0000000
--- a/src/Base.php
+++ /dev/null
@@ -1,333 +0,0 @@
-
- * @license MIT
- */
-abstract class Base
-{
- /** @var string the executed script itself */
- protected $bin;
- /** @var Options the option parser */
- protected $options;
- /** @var Colors */
- public $colors;
-
- /** @var array PSR-3 compatible loglevels and their prefix, color, output channel, enabled status */
- protected $loglevel = array(
- 'debug' => array(
- 'icon' => '',
- 'color' => Colors::C_RESET,
- 'channel' => STDOUT,
- 'enabled' => true
- ),
- 'info' => array(
- 'icon' => 'ℹ ',
- 'color' => Colors::C_CYAN,
- 'channel' => STDOUT,
- 'enabled' => true
- ),
- 'notice' => array(
- 'icon' => '☛ ',
- 'color' => Colors::C_CYAN,
- 'channel' => STDOUT,
- 'enabled' => true
- ),
- 'success' => array(
- 'icon' => '✓ ',
- 'color' => Colors::C_GREEN,
- 'channel' => STDOUT,
- 'enabled' => true
- ),
- 'warning' => array(
- 'icon' => '⚠ ',
- 'color' => Colors::C_BROWN,
- 'channel' => STDERR,
- 'enabled' => true
- ),
- 'error' => array(
- 'icon' => '✗ ',
- 'color' => Colors::C_RED,
- 'channel' => STDERR,
- 'enabled' => true
- ),
- 'critical' => array(
- 'icon' => '☠ ',
- 'color' => Colors::C_LIGHTRED,
- 'channel' => STDERR,
- 'enabled' => true
- ),
- 'alert' => array(
- 'icon' => '✖ ',
- 'color' => Colors::C_LIGHTRED,
- 'channel' => STDERR,
- 'enabled' => true
- ),
- 'emergency' => array(
- 'icon' => '✘ ',
- 'color' => Colors::C_LIGHTRED,
- 'channel' => STDERR,
- 'enabled' => true
- ),
- );
-
- /** @var string default log level */
- protected $logdefault = 'info';
-
- /**
- * constructor
- *
- * Initialize the arguments, set up helper classes and set up the CLI environment
- *
- * @param bool $autocatch should exceptions be catched and handled automatically?
- */
- public function __construct($autocatch = true)
- {
- if ($autocatch) {
- set_exception_handler(array($this, 'fatal'));
- }
- $this->setLogLevel($this->logdefault);
- $this->colors = new Colors();
- $this->options = new Options($this->colors);
- }
-
- /**
- * Register options and arguments on the given $options object
- *
- * @param Options $options
- * @return void
- *
- * @throws Exception
- */
- abstract protected function setup(Options $options);
-
- /**
- * Your main program
- *
- * Arguments and options have been parsed when this is run
- *
- * @param Options $options
- * @return void
- *
- * @throws Exception
- */
- abstract protected function main(Options $options);
-
- /**
- * Execute the CLI program
- *
- * Executes the setup() routine, adds default options, initiate the options parsing and argument checking
- * and finally executes main() - Each part is split into their own protected function below, so behaviour
- * can easily be overwritten
- *
- * @throws Exception
- */
- public function run()
- {
- if ('cli' != php_sapi_name()) {
- throw new Exception('This has to be run from the command line');
- }
-
- $this->setup($this->options);
- $this->registerDefaultOptions();
- $this->parseOptions();
- $this->handleDefaultOptions();
- $this->setupLogging();
- $this->checkArguments();
- $this->execute();
- }
-
- // region run handlers - for easier overriding
-
- /**
- * Add the default help, color and log options
- */
- protected function registerDefaultOptions()
- {
- $this->options->registerOption(
- 'help',
- 'Display this help screen and exit immediately.',
- 'h'
- );
- $this->options->registerOption(
- 'no-colors',
- 'Do not use any colors in output. Useful when piping output to other tools or files.'
- );
- $this->options->registerOption(
- 'loglevel',
- 'Minimum level of messages to display. Default is ' . $this->colors->wrap($this->logdefault, Colors::C_CYAN) . '. ' .
- 'Valid levels are: debug, info, notice, success, warning, error, critical, alert, emergency.',
- null,
- 'level'
- );
- }
-
- /**
- * Handle the default options
- */
- protected function handleDefaultOptions()
- {
- if ($this->options->getOpt('no-colors')) {
- $this->colors->disable();
- }
- if ($this->options->getOpt('help')) {
- echo $this->options->help();
- exit(0);
- }
- }
-
- /**
- * Handle the logging options
- */
- protected function setupLogging()
- {
- $level = $this->options->getOpt('loglevel', $this->logdefault);
- $this->setLogLevel($level);
- }
-
- /**
- * Wrapper around the option parsing
- */
- protected function parseOptions()
- {
- $this->options->parseOptions();
- }
-
- /**
- * Wrapper around the argument checking
- */
- protected function checkArguments()
- {
- $this->options->checkArguments();
- }
-
- /**
- * Wrapper around main
- */
- protected function execute()
- {
- $this->main($this->options);
- }
-
- // endregion
-
- // region logging
-
- /**
- * Set the current log level
- *
- * @param string $level
- */
- public function setLogLevel($level)
- {
- if (!isset($this->loglevel[$level])) $this->fatal('Unknown log level');
- $enable = false;
- foreach (array_keys($this->loglevel) as $l) {
- if ($l == $level) $enable = true;
- $this->loglevel[$l]['enabled'] = $enable;
- }
- }
-
- /**
- * Check if a message with the given level should be logged
- *
- * @param string $level
- * @return bool
- */
- public function isLogLevelEnabled($level)
- {
- if (!isset($this->loglevel[$level])) $this->fatal('Unknown log level');
- return $this->loglevel[$level]['enabled'];
- }
-
- /**
- * Exits the program on a fatal error
- *
- * @param \Exception|string $error either an exception or an error message
- * @param array $context
- */
- public function fatal($error, array $context = array())
- {
- $code = 0;
- if (is_object($error) && is_a($error, 'Exception')) {
- /** @var Exception $error */
- $this->logMessage('debug', get_class($error) . ' caught in ' . $error->getFile() . ':' . $error->getLine());
- $this->logMessage('debug', $error->getTraceAsString());
- $code = $error->getCode();
- $error = $error->getMessage();
-
- }
- if (!$code) {
- $code = Exception::E_ANY;
- }
-
- $this->logMessage('critical', $error, $context);
- exit($code);
- }
-
- /**
- * Normal, positive outcome (This is not a PSR-3 level)
- *
- * @param string $string
- * @param array $context
- */
- public function success($string, array $context = array())
- {
- $this->logMessage('success', $string, $context);
- }
-
- /**
- * @param string $level
- * @param string $message
- * @param array $context
- */
- protected function logMessage($level, $message, array $context = array())
- {
- // unknown level is always an error
- if (!isset($this->loglevel[$level])) $level = 'error';
-
- $info = $this->loglevel[$level];
- if (!$this->isLogLevelEnabled($level)) return; // no logging for this level
-
- $message = $this->interpolate($message, $context);
-
- // when colors are wanted, we also add the icon
- if ($this->colors->isEnabled()) {
- $message = $info['icon'] . $message;
- }
-
- $this->colors->ptln($message, $info['color'], $info['channel']);
- }
-
- /**
- * Interpolates context values into the message placeholders.
- *
- * @param $message
- * @param array $context
- * @return string
- */
- protected function interpolate($message, array $context = array())
- {
- // build a replacement array with braces around the context keys
- $replace = array();
- foreach ($context as $key => $val) {
- // check that the value can be casted to string
- if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
- $replace['{' . $key . '}'] = $val;
- }
- }
-
- // interpolate replacement values into the message and return
- return strtr((string)$message, $replace);
- }
-
- // endregion
-}
diff --git a/src/CLI.php b/src/CLI.php
deleted file mode 100644
index 217983a..0000000
--- a/src/CLI.php
+++ /dev/null
@@ -1,127 +0,0 @@
-
- * @license MIT
- */
-abstract class CLI extends Base
-{
- /**
- * System is unusable.
- *
- * @param string $message
- * @param array $context
- *
- * @return void
- */
- public function emergency($message, array $context = array())
- {
- $this->log('emergency', $message, $context);
- }
-
- /**
- * Action must be taken immediately.
- *
- * Example: Entire website down, database unavailable, etc. This should
- * trigger the SMS alerts and wake you up.
- *
- * @param string $message
- * @param array $context
- */
- public function alert($message, array $context = array())
- {
- $this->log('alert', $message, $context);
- }
-
- /**
- * Critical conditions.
- *
- * Example: Application component unavailable, unexpected exception.
- *
- * @param string $message
- * @param array $context
- */
- public function critical($message, array $context = array())
- {
- $this->log('critical', $message, $context);
- }
-
- /**
- * Runtime errors that do not require immediate action but should typically
- * be logged and monitored.
- *
- * @param string $message
- * @param array $context
- */
- public function error($message, array $context = array())
- {
- $this->log('error', $message, $context);
- }
-
- /**
- * Exceptional occurrences that are not errors.
- *
- * Example: Use of deprecated APIs, poor use of an API, undesirable things
- * that are not necessarily wrong.
- *
- * @param string $message
- * @param array $context
- */
- public function warning($message, array $context = array())
- {
- $this->log('warning', $message, $context);
- }
-
-
-
- /**
- * Normal but significant events.
- *
- * @param string $message
- * @param array $context
- */
- public function notice($message, array $context = array())
- {
- $this->log('notice', $message, $context);
- }
-
- /**
- * Interesting events.
- *
- * Example: User logs in, SQL logs.
- *
- * @param string $message
- * @param array $context
- */
- public function info($message, array $context = array())
- {
- $this->log('info', $message, $context);
- }
-
- /**
- * Detailed debug information.
- *
- * @param string $message
- * @param array $context
- */
- public function debug($message, array $context = array())
- {
- $this->log('debug', $message, $context);
- }
-
- /**
- * @param string $level
- * @param string $message
- * @param array $context
- */
- public function log($level, $message, array $context = array())
- {
- $this->logMessage($level, $message, $context);
- }
-}
diff --git a/src/Colors.php b/src/Colors.php
deleted file mode 100644
index dd1fd04..0000000
--- a/src/Colors.php
+++ /dev/null
@@ -1,177 +0,0 @@
-
- * @license MIT
- */
-class Colors
-{
- // these constants make IDE autocompletion easier, but color names can also be passed as strings
- const C_RESET = 'reset';
- const C_BLACK = 'black';
- const C_DARKGRAY = 'darkgray';
- const C_BLUE = 'blue';
- const C_LIGHTBLUE = 'lightblue';
- const C_GREEN = 'green';
- const C_LIGHTGREEN = 'lightgreen';
- const C_CYAN = 'cyan';
- const C_LIGHTCYAN = 'lightcyan';
- const C_RED = 'red';
- const C_LIGHTRED = 'lightred';
- const C_PURPLE = 'purple';
- const C_LIGHTPURPLE = 'lightpurple';
- const C_BROWN = 'brown';
- const C_YELLOW = 'yellow';
- const C_LIGHTGRAY = 'lightgray';
- const C_WHITE = 'white';
-
- // Regex pattern to match color codes
- const C_CODE_REGEX = "/(\33\[[0-9;]+m)/";
-
- /** @var array known color names */
- protected $colors = array(
- self::C_RESET => "\33[0m",
- self::C_BLACK => "\33[0;30m",
- self::C_DARKGRAY => "\33[1;30m",
- self::C_BLUE => "\33[0;34m",
- self::C_LIGHTBLUE => "\33[1;34m",
- self::C_GREEN => "\33[0;32m",
- self::C_LIGHTGREEN => "\33[1;32m",
- self::C_CYAN => "\33[0;36m",
- self::C_LIGHTCYAN => "\33[1;36m",
- self::C_RED => "\33[0;31m",
- self::C_LIGHTRED => "\33[1;31m",
- self::C_PURPLE => "\33[0;35m",
- self::C_LIGHTPURPLE => "\33[1;35m",
- self::C_BROWN => "\33[0;33m",
- self::C_YELLOW => "\33[1;33m",
- self::C_LIGHTGRAY => "\33[0;37m",
- self::C_WHITE => "\33[1;37m",
- );
-
- /** @var bool should colors be used? */
- protected $enabled = true;
-
- /**
- * Constructor
- *
- * Tries to disable colors for non-terminals
- */
- public function __construct()
- {
- if (function_exists('posix_isatty') && !posix_isatty(STDOUT)) {
- $this->enabled = false;
- return;
- }
- if (!getenv('TERM')) {
- $this->enabled = false;
- return;
- }
- if (getenv('NO_COLOR')) { // https://no-color.org/
- $this->enabled = false;
- return;
- }
- }
-
- /**
- * enable color output
- */
- public function enable()
- {
- $this->enabled = true;
- }
-
- /**
- * disable color output
- */
- public function disable()
- {
- $this->enabled = false;
- }
-
- /**
- * @return bool is color support enabled?
- */
- public function isEnabled()
- {
- return $this->enabled;
- }
-
- /**
- * Convenience function to print a line in a given color
- *
- * @param string $line the line to print, a new line is added automatically
- * @param string $color one of the available color names
- * @param resource $channel file descriptor to write to
- *
- * @throws Exception
- */
- public function ptln($line, $color, $channel = STDOUT)
- {
- $this->set($color, $channel);
- fwrite($channel, rtrim($line) . "\n");
- $this->reset($channel);
- }
-
- /**
- * Returns the given text wrapped in the appropriate color and reset code
- *
- * @param string $text string to wrap
- * @param string $color one of the available color names
- * @return string the wrapped string
- * @throws Exception
- */
- public function wrap($text, $color)
- {
- return $this->getColorCode($color) . $text . $this->getColorCode('reset');
- }
-
- /**
- * Gets the appropriate terminal code for the given color
- *
- * @param string $color one of the available color names
- * @return string color code
- * @throws Exception
- */
- public function getColorCode($color)
- {
- if (!$this->enabled) {
- return '';
- }
- if (!isset($this->colors[$color])) {
- throw new Exception("No such color $color");
- }
-
- return $this->colors[$color];
- }
-
- /**
- * Set the given color for consecutive output
- *
- * @param string $color one of the supported color names
- * @param resource $channel file descriptor to write to
- * @throws Exception
- */
- public function set($color, $channel = STDOUT)
- {
- fwrite($channel, $this->getColorCode($color));
- }
-
- /**
- * reset the terminal color
- *
- * @param resource $channel file descriptor to write to
- *
- * @throws Exception
- */
- public function reset($channel = STDOUT)
- {
- $this->set('reset', $channel);
- }
-}
diff --git a/src/Exception.php b/src/Exception.php
deleted file mode 100644
index 0dd58ca..0000000
--- a/src/Exception.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
- * @license MIT
- */
-class Exception extends \RuntimeException
-{
- const E_ANY = -1; // no error code specified
- const E_UNKNOWN_OPT = 1; //Unrecognized option
- const E_OPT_ARG_REQUIRED = 2; //Option requires argument
- const E_OPT_ARG_DENIED = 3; //Option not allowed argument
- const E_OPT_ABIGUOUS = 4; //Option abiguous
- const E_ARG_READ = 5; //Could not read argv
-
- /**
- * @param string $message The Exception message to throw.
- * @param int $code The Exception code
- * @param \Exception $previous The previous exception used for the exception chaining.
- */
- public function __construct($message = "", $code = 0, ?\Exception $previous = null)
- {
- if (!$code) {
- $code = self::E_ANY;
- }
- parent::__construct($message, $code, $previous);
- }
-}
diff --git a/src/Options.php b/src/Options.php
deleted file mode 100644
index 1c0752b..0000000
--- a/src/Options.php
+++ /dev/null
@@ -1,504 +0,0 @@
-
- * @license MIT
- */
-class Options
-{
- /** @var array keeps the list of options to parse */
- protected $setup;
-
- /** @var array store parsed options */
- protected $options = array();
-
- /** @var string current parsed command if any */
- protected $command = '';
-
- /** @var array passed non-option arguments */
- protected $args = array();
-
- /** @var string the executed script */
- protected $bin;
-
- /** @var Colors for colored help output */
- protected $colors;
-
- /** @var string newline used for spacing help texts */
- protected $newline = "\n";
-
- /**
- * Constructor
- *
- * @param Colors $colors optional configured color object
- * @throws Exception when arguments can't be read
- */
- public function __construct(?Colors $colors = null)
- {
- if (!is_null($colors)) {
- $this->colors = $colors;
- } else {
- $this->colors = new Colors();
- }
-
- $this->setup = array(
- '' => array(
- 'opts' => array(),
- 'args' => array(),
- 'help' => '',
- 'commandhelp' => 'This tool accepts a command as first parameter as outlined below:'
- )
- ); // default command
-
- $this->args = $this->readPHPArgv();
- $this->bin = basename(array_shift($this->args));
-
- $this->options = array();
- }
-
- /**
- * Gets the bin value
- */
- public function getBin()
- {
- return $this->bin;
- }
-
- /**
- * Sets the help text for the tool itself
- *
- * @param string $help
- */
- public function setHelp($help)
- {
- $this->setup['']['help'] = $help;
- }
-
- /**
- * Sets the help text for the tools commands itself
- *
- * @param string $help
- */
- public function setCommandHelp($help)
- {
- $this->setup['']['commandhelp'] = $help;
- }
-
- /**
- * Use a more compact help screen with less new lines
- *
- * @param bool $set
- */
- public function useCompactHelp($set = true)
- {
- $this->newline = $set ? '' : "\n";
- }
-
- /**
- * Register the names of arguments for help generation and number checking
- *
- * This has to be called in the order arguments are expected
- *
- * @param string $arg argument name (just for help)
- * @param string $help help text
- * @param bool $required is this a required argument
- * @param string $command if theses apply to a sub command only
- * @throws Exception
- */
- public function registerArgument($arg, $help, $required = true, $command = '')
- {
- if (!isset($this->setup[$command])) {
- throw new Exception("Command $command not registered");
- }
-
- $this->setup[$command]['args'][] = array(
- 'name' => $arg,
- 'help' => $help,
- 'required' => $required
- );
- }
-
- /**
- * This registers a sub command
- *
- * Sub commands have their own options and use their own function (not main()).
- *
- * @param string $command
- * @param string $help
- * @throws Exception
- */
- public function registerCommand($command, $help)
- {
- if (isset($this->setup[$command])) {
- throw new Exception("Command $command already registered");
- }
-
- $this->setup[$command] = array(
- 'opts' => array(),
- 'args' => array(),
- 'help' => $help
- );
-
- }
-
- /**
- * Register an option for option parsing and help generation
- *
- * @param string $long multi character option (specified with --)
- * @param string $help help text for this option
- * @param string|null $short one character option (specified with -)
- * @param bool|string $needsarg does this option require an argument? give it a name here
- * @param string $command what command does this option apply to
- * @throws Exception
- */
- public function registerOption($long, $help, $short = null, $needsarg = false, $command = '')
- {
- if (!isset($this->setup[$command])) {
- throw new Exception("Command $command not registered");
- }
-
- $this->setup[$command]['opts'][$long] = array(
- 'needsarg' => $needsarg,
- 'help' => $help,
- 'short' => $short
- );
-
- if ($short) {
- if (strlen($short) > 1) {
- throw new Exception("Short options should be exactly one ASCII character");
- }
-
- $this->setup[$command]['short'][$short] = $long;
- }
- }
-
- /**
- * Checks the actual number of arguments against the required number
- *
- * Throws an exception if arguments are missing.
- *
- * This is run from CLI automatically and usually does not need to be called directly
- *
- * @throws Exception
- */
- public function checkArguments()
- {
- $argc = count($this->args);
-
- $req = 0;
- foreach ($this->setup[$this->command]['args'] as $arg) {
- if (!$arg['required']) {
- break;
- } // last required arguments seen
- $req++;
- }
-
- if ($req > $argc) {
- throw new Exception("Not enough arguments", Exception::E_OPT_ARG_REQUIRED);
- }
- }
-
- /**
- * Parses the given arguments for known options and command
- *
- * The given $args array should NOT contain the executed file as first item anymore! The $args
- * array is stripped from any options and possible command. All found otions can be accessed via the
- * getOpt() function
- *
- * Note that command options will overwrite any global options with the same name
- *
- * This is run from CLI automatically and usually does not need to be called directly
- *
- * @throws Exception
- */
- public function parseOptions()
- {
- $non_opts = array();
-
- $argc = count($this->args);
- for ($i = 0; $i < $argc; $i++) {
- $arg = $this->args[$i];
-
- // The special element '--' means explicit end of options. Treat the rest of the arguments as non-options
- // and end the loop.
- if ($arg == '--') {
- $non_opts = array_merge($non_opts, array_slice($this->args, $i + 1));
- break;
- }
-
- // '-' is stdin - a normal argument
- if ($arg == '-') {
- $non_opts = array_merge($non_opts, array_slice($this->args, $i));
- break;
- }
-
- // first non-option
- if ($arg[0] != '-') {
- $non_opts = array_merge($non_opts, array_slice($this->args, $i));
- break;
- }
-
- // long option
- if (strlen($arg) > 1 && $arg[1] === '-') {
- $arg = explode('=', substr($arg, 2), 2);
- $opt = array_shift($arg);
- $val = array_shift($arg);
-
- if (!isset($this->setup[$this->command]['opts'][$opt])) {
- throw new Exception("No such option '$opt'", Exception::E_UNKNOWN_OPT);
- }
-
- // argument required?
- if ($this->setup[$this->command]['opts'][$opt]['needsarg']) {
- if (is_null($val) && $i + 1 < $argc && !preg_match('/^--?[\w]/', $this->args[$i + 1])) {
- $val = $this->args[++$i];
- }
- if (is_null($val)) {
- throw new Exception("Option $opt requires an argument",
- Exception::E_OPT_ARG_REQUIRED);
- }
- $this->options[$opt] = $val;
- } else {
- $this->options[$opt] = true;
- }
-
- continue;
- }
-
- // short option
- $opt = substr($arg, 1);
- if (!isset($this->setup[$this->command]['short'][$opt])) {
- throw new Exception("No such option $arg", Exception::E_UNKNOWN_OPT);
- } else {
- $opt = $this->setup[$this->command]['short'][$opt]; // store it under long name
- }
-
- // argument required?
- if ($this->setup[$this->command]['opts'][$opt]['needsarg']) {
- $val = null;
- if ($i + 1 < $argc && !preg_match('/^--?[\w]/', $this->args[$i + 1])) {
- $val = $this->args[++$i];
- }
- if (is_null($val)) {
- throw new Exception("Option $arg requires an argument",
- Exception::E_OPT_ARG_REQUIRED);
- }
- $this->options[$opt] = $val;
- } else {
- $this->options[$opt] = true;
- }
- }
-
- // parsing is now done, update args array
- $this->args = $non_opts;
-
- // if not done yet, check if first argument is a command and reexecute argument parsing if it is
- if (!$this->command && $this->args && isset($this->setup[$this->args[0]])) {
- // it is a command!
- $this->command = array_shift($this->args);
- $this->parseOptions(); // second pass
- }
- }
-
- /**
- * Get the value of the given option
- *
- * Please note that all options are accessed by their long option names regardless of how they were
- * specified on commandline.
- *
- * Can only be used after parseOptions() has been run
- *
- * @param mixed $option
- * @param bool|string $default what to return if the option was not set
- * @return bool|string|string[]
- */
- public function getOpt($option = null, $default = false)
- {
- if ($option === null) {
- return $this->options;
- }
-
- if (isset($this->options[$option])) {
- return $this->options[$option];
- }
- return $default;
- }
-
- /**
- * Return the found command if any
- *
- * @return string
- */
- public function getCmd()
- {
- return $this->command;
- }
-
- /**
- * Get all the arguments passed to the script
- *
- * This will not contain any recognized options or the script name itself
- *
- * @return array
- */
- public function getArgs()
- {
- return $this->args;
- }
-
- /**
- * Builds a help screen from the available options. You may want to call it from -h or on error
- *
- * @return string
- *
- * @throws Exception
- */
- public function help()
- {
- $tf = new TableFormatter($this->colors);
- $text = '';
-
- $hascommands = (count($this->setup) > 1);
- $commandhelp = $this->setup['']["commandhelp"];
-
- foreach ($this->setup as $command => $config) {
- $hasopts = (bool)$this->setup[$command]['opts'];
- $hasargs = (bool)$this->setup[$command]['args'];
-
- // usage or command syntax line
- if (!$command) {
- $text .= $this->colors->wrap('USAGE:', Colors::C_BROWN);
- $text .= "\n";
- $text .= ' ' . $this->bin;
- $mv = 2;
- } else {
- $text .= $this->newline;
- $text .= $this->colors->wrap(' ' . $command, Colors::C_PURPLE);
- $mv = 4;
- }
-
- if ($hasopts) {
- $text .= ' ' . $this->colors->wrap('', Colors::C_GREEN);
- }
-
- if (!$command && $hascommands) {
- $text .= ' ' . $this->colors->wrap(' ...', Colors::C_PURPLE);
- }
-
- foreach ($this->setup[$command]['args'] as $arg) {
- $out = $this->colors->wrap('<' . $arg['name'] . '>', Colors::C_CYAN);
-
- if (!$arg['required']) {
- $out = '[' . $out . ']';
- }
- $text .= ' ' . $out;
- }
- $text .= $this->newline;
-
- // usage or command intro
- if ($this->setup[$command]['help']) {
- $text .= "\n";
- $text .= $tf->format(
- array($mv, '*'),
- array('', $this->setup[$command]['help'] . $this->newline)
- );
- }
-
- // option description
- if ($hasopts) {
- if (!$command) {
- $text .= "\n";
- $text .= $this->colors->wrap('OPTIONS:', Colors::C_BROWN);
- }
- $text .= "\n";
- foreach ($this->setup[$command]['opts'] as $long => $opt) {
-
- $name = '';
- if ($opt['short']) {
- $name .= '-' . $opt['short'];
- if ($opt['needsarg']) {
- $name .= ' <' . $opt['needsarg'] . '>';
- }
- $name .= ', ';
- }
- $name .= "--$long";
- if ($opt['needsarg']) {
- $name .= ' <' . $opt['needsarg'] . '>';
- }
-
- $text .= $tf->format(
- array($mv, '30%', '*'),
- array('', $name, $opt['help']),
- array('', 'green', '')
- );
- $text .= $this->newline;
- }
- }
-
- // argument description
- if ($hasargs) {
- if (!$command) {
- $text .= "\n";
- $text .= $this->colors->wrap('ARGUMENTS:', Colors::C_BROWN);
- }
- $text .= $this->newline;
- foreach ($this->setup[$command]['args'] as $arg) {
- $name = '<' . $arg['name'] . '>';
-
- $text .= $tf->format(
- array($mv, '30%', '*'),
- array('', $name, $arg['help']),
- array('', 'cyan', '')
- );
- }
- }
-
- // head line and intro for following command documentation
- if (!$command && $hascommands) {
- $text .= "\n";
- $text .= $this->colors->wrap('COMMANDS:', Colors::C_BROWN);
- $text .= "\n";
- $text .= $tf->format(
- array($mv, '*'),
- array('', $commandhelp)
- );
- $text .= $this->newline;
- }
- }
-
- return $text;
- }
-
- /**
- * Safely read the $argv PHP array across different PHP configurations.
- * Will take care on register_globals and register_argc_argv ini directives
- *
- * @throws Exception
- * @return array the $argv PHP array or PEAR error if not registered
- */
- private function readPHPArgv()
- {
- global $argv;
- if (!is_array($argv)) {
- if (!@is_array($_SERVER['argv'])) {
- if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
- throw new Exception(
- "Could not read cmd args (register_argc_argv=Off?)",
- Exception::E_ARG_READ
- );
- }
- return $GLOBALS['HTTP_SERVER_VARS']['argv'];
- }
- return $_SERVER['argv'];
- }
- return $argv;
- }
-}
-
diff --git a/src/PSR3CLI.php b/src/PSR3CLI.php
deleted file mode 100644
index 0078cd7..0000000
--- a/src/PSR3CLI.php
+++ /dev/null
@@ -1,16 +0,0 @@
-logMessage($level, $message, $context);
- }
-}
diff --git a/src/TableFormatter.php b/src/TableFormatter.php
deleted file mode 100644
index d952a6e..0000000
--- a/src/TableFormatter.php
+++ /dev/null
@@ -1,338 +0,0 @@
-
- * @license MIT
- */
-class TableFormatter
-{
- /** @var string border between columns */
- protected $border = ' ';
-
- /** @var int the terminal width */
- protected $max = 74;
-
- /** @var Colors for coloring output */
- protected $colors;
-
- /**
- * TableFormatter constructor.
- *
- * @param Colors|null $colors
- */
- public function __construct(?Colors $colors = null)
- {
- // try to get terminal width
- $width = $this->getTerminalWidth();
- if ($width) {
- $this->max = $width - 1;
- }
-
- if ($colors) {
- $this->colors = $colors;
- } else {
- $this->colors = new Colors();
- }
- }
-
- /**
- * The currently set border (defaults to ' ')
- *
- * @return string
- */
- public function getBorder()
- {
- return $this->border;
- }
-
- /**
- * Set the border. The border is set between each column. Its width is
- * added to the column widths.
- *
- * @param string $border
- */
- public function setBorder($border)
- {
- $this->border = $border;
- }
-
- /**
- * Width of the terminal in characters
- *
- * initially autodetected
- *
- * @return int
- */
- public function getMaxWidth()
- {
- return $this->max;
- }
-
- /**
- * Set the width of the terminal to assume (in characters)
- *
- * @param int $max
- */
- public function setMaxWidth($max)
- {
- $this->max = $max;
- }
-
- /**
- * Tries to figure out the width of the terminal
- *
- * @return int terminal width, 0 if unknown
- */
- protected function getTerminalWidth()
- {
- // from environment
- if (isset($_SERVER['COLUMNS'])) return (int)$_SERVER['COLUMNS'];
-
- // via tput
- $process = proc_open('tput cols', array(
- 1 => array('pipe', 'w'),
- 2 => array('pipe', 'w'),
- ), $pipes);
- $width = (int)stream_get_contents($pipes[1]);
- proc_close($process);
-
- return $width;
- }
-
- /**
- * Takes an array with dynamic column width and calculates the correct width
- *
- * Column width can be given as fixed char widths, percentages and a single * width can be given
- * for taking the remaining available space. When mixing percentages and fixed widths, percentages
- * refer to the remaining space after allocating the fixed width
- *
- * @param array $columns
- * @return int[]
- * @throws Exception
- */
- protected function calculateColLengths($columns)
- {
- $idx = 0;
- $border = $this->strlen($this->border);
- $fixed = (count($columns) - 1) * $border; // borders are used already
- $fluid = -1;
-
- // first pass for format check and fixed columns
- foreach ($columns as $idx => $col) {
- // handle fixed columns
- if ((string)intval($col) === (string)$col) {
- $fixed += $col;
- continue;
- }
- // check if other colums are using proper units
- if (substr($col, -1) == '%') {
- continue;
- }
- if ($col == '*') {
- // only one fluid
- if ($fluid < 0) {
- $fluid = $idx;
- continue;
- } else {
- throw new Exception('Only one fluid column allowed!');
- }
- }
- throw new Exception("unknown column format $col");
- }
-
- $alloc = $fixed;
- $remain = $this->max - $alloc;
-
- // second pass to handle percentages
- foreach ($columns as $idx => $col) {
- if (substr($col, -1) != '%') {
- continue;
- }
- $perc = floatval($col);
-
- $real = (int)floor(($perc * $remain) / 100);
-
- $columns[$idx] = $real;
- $alloc += $real;
- }
-
- $remain = $this->max - $alloc;
- if ($remain < 0) {
- throw new Exception("Wanted column widths exceed available space");
- }
-
- // assign remaining space
- if ($fluid < 0) {
- $columns[$idx] += ($remain); // add to last column
- } else {
- $columns[$fluid] = $remain;
- }
-
- return $columns;
- }
-
- /**
- * Displays text in multiple word wrapped columns
- *
- * @param int[] $columns list of column widths (in characters, percent or '*')
- * @param string[] $texts list of texts for each column
- * @param array $colors A list of color names to use for each column. use empty string for default
- * @return string
- * @throws Exception
- */
- public function format($columns, $texts, $colors = array())
- {
- $columns = $this->calculateColLengths($columns);
-
- $wrapped = array();
- $maxlen = 0;
-
- foreach ($columns as $col => $width) {
- $wrapped[$col] = explode("\n", $this->wordwrap($texts[$col], $width, "\n", true));
- $len = count($wrapped[$col]);
- if ($len > $maxlen) {
- $maxlen = $len;
- }
-
- }
-
- $last = count($columns) - 1;
- $out = '';
- for ($i = 0; $i < $maxlen; $i++) {
- foreach ($columns as $col => $width) {
- if (isset($wrapped[$col][$i])) {
- $val = $wrapped[$col][$i];
- } else {
- $val = '';
- }
- $chunk = $this->pad($val, $width);
- if (isset($colors[$col]) && $colors[$col]) {
- $chunk = $this->colors->wrap($chunk, $colors[$col]);
- }
- $out .= $chunk;
-
- // border
- if ($col != $last) {
- $out .= $this->border;
- }
- }
- $out .= "\n";
- }
- return $out;
-
- }
-
- /**
- * Pad the given string to the correct length
- *
- * @param string $string
- * @param int $len
- * @return string
- */
- protected function pad($string, $len)
- {
- $strlen = $this->strlen($string);
- if ($strlen > $len) return $string;
-
- $pad = $len - $strlen;
- return $string . str_pad('', $pad, ' ');
- }
-
- /**
- * Measures char length in UTF-8 when possible
- *
- * @param $string
- * @return int
- */
- protected function strlen($string)
- {
- // don't count color codes
- $string = preg_replace("/\33\\[\\d+(;\\d+)?m/", '', $string);
-
- if (function_exists('mb_strlen')) {
- return mb_strlen($string, 'utf-8');
- }
-
- return strlen($string);
- }
-
- /**
- * @param string $string
- * @param int $start
- * @param int|null $length
- * @return string
- */
- protected function substr($string, $start = 0, $length = null)
- {
- if (function_exists('mb_substr')) {
- return mb_substr($string, $start, $length);
- } else {
- // mb_substr() treats $length differently than substr()
- if ($length) {
- return substr($string, $start, $length);
- } else {
- return substr($string, $start);
- }
- }
- }
-
- /**
- * @param string $str
- * @param int $width
- * @param string $break
- * @param bool $cut
- * @return string
- * @link http://stackoverflow.com/a/4988494
- */
- protected function wordwrap($str, $width = 75, $break = "\n", $cut = false)
- {
- $lines = explode($break, $str);
- $color_reset = $this->colors->getColorCode(Colors::C_RESET);
- foreach ($lines as &$line) {
- $line = rtrim($line);
- if ($this->strlen($line) <= $width) {
- continue;
- }
- $words = explode(' ', $line);
- $line = '';
- $actual = '';
- $color = '';
- foreach ($words as $word) {
- if (preg_match_all(Colors::C_CODE_REGEX, $word, $color_codes) ) {
- # Word contains color codes
- foreach ($color_codes[0] as $code) {
- if ($code == $color_reset) {
- $color = '';
- } else {
- # Remember color so we can reapply it after a line break
- $color = $code;
- }
- }
- }
- if ($this->strlen($actual . $word) <= $width) {
- $actual .= $word . ' ';
- } else {
- if ($actual != '') {
- $line .= rtrim($actual) . $break;
- }
- $actual = $color . $word;
- if ($cut) {
- while ($this->strlen($actual) > $width) {
- $line .= $this->substr($actual, 0, $width) . $break;
- $actual = $color . $this->substr($actual, $width);
- }
- }
- $actual .= ' ';
- }
- }
- $line .= trim($actual);
- }
- return implode($break, $lines);
- }
-}
diff --git a/tests/LogLevelTest.php b/tests/LogLevelTest.php
deleted file mode 100644
index 1e5fcc8..0000000
--- a/tests/LogLevelTest.php
+++ /dev/null
@@ -1,91 +0,0 @@
-setLogLevel($level);
- foreach ($enabled as $e) {
- $this->assertTrue($cli->isLogLevelEnabled($e), "$e is not enabled but should be");
- }
- foreach ($disabled as $d) {
- $this->assertFalse($cli->isLogLevelEnabled($d), "$d is enabled but should not be");
- }
- }
-
-
-}
diff --git a/tests/OptionsTest.php b/tests/OptionsTest.php
deleted file mode 100644
index b8f2782..0000000
--- a/tests/OptionsTest.php
+++ /dev/null
@@ -1,90 +0,0 @@
-registerOption('exclude', 'exclude files', 'x', 'file');
-
- $options->args = array($option, $value, $argument);
- $options->parseOptions();
-
- $this->assertEquals($value, $options->getOpt('exclude'));
- $this->assertEquals(array($argument), $options->args);
- $this->assertFalse($options->getOpt('nothing'));
- }
-
- /**
- * @return array
- */
- public function optionDataProvider() {
- return array(
- array('-x', 'foo', 'bang'),
- array('--exclude', 'foo', 'bang'),
- array('-x', 'foo-bar', 'bang'),
- array('--exclude', 'foo-bar', 'bang'),
- array('-x', 'foo', 'bang--bang'),
- array('--exclude', 'foo', 'bang--bang'),
- );
- }
-
- function test_simplelong2()
- {
- $options = new Options();
- $options->registerOption('exclude', 'exclude files', 'x', 'file');
-
- $options->args = array('--exclude=foo', 'bang');
- $options->parseOptions();
-
- $this->assertEquals('foo', $options->getOpt('exclude'));
- $this->assertEquals(array('bang'), $options->args);
- $this->assertFalse($options->getOpt('nothing'));
- }
-
- function test_complex()
- {
- $options = new Options();
-
- $options->registerOption('plugins', 'run on plugins only', 'p');
- $options->registerCommand('status', 'display status info');
- $options->registerOption('long', 'display long lines', 'l', false, 'status');
-
- $options->args = array('-p', 'status', '--long', 'foo');
- $options->parseOptions();
-
- $this->assertEquals('status', $options->getCmd());
- $this->assertTrue($options->getOpt('plugins'));
- $this->assertTrue($options->getOpt('long'));
- $this->assertEquals(array('foo'), $options->args);
- }
-
- function test_commandhelp()
- {
- $options = new Options();
- $options->registerCommand('cmd', 'a command');
- $this->assertStringContainsString('accepts a command as first parameter', $options->help());
-
- $options->setCommandHelp('foooooobaar');
- $this->assertStringNotContainsString('accepts a command as first parameter', $options->help());
- $this->assertStringContainsString('foooooobaar', $options->help());
- }
-}
diff --git a/tests/TableFormatterTest.php b/tests/TableFormatterTest.php
deleted file mode 100644
index 3b1860a..0000000
--- a/tests/TableFormatterTest.php
+++ /dev/null
@@ -1,188 +0,0 @@
-setMaxWidth($max);
- $tf->setBorder($border);
-
- $result = $tf->calculateColLengths($input);
-
- $this->assertEquals($max, array_sum($result) + (strlen($border) * (count($input) - 1)));
- $this->assertEquals($expect, $result);
-
- }
-
- /**
- * Check wrapping
- */
- public function test_wrap()
- {
- $text = "this is a long string something\n" .
- "123456789012345678901234567890";
-
- $expt = "this is a long\n" .
- "string\n" .
- "something\n" .
- "123456789012345\n" .
- "678901234567890";
-
- $tf = new TableFormatter();
- $this->assertEquals($expt, $tf->wordwrap($text, 15, "\n", true));
-
- }
-
- public function test_length()
- {
- $text = "this is häppy ☺";
- $expect = "$text |test";
-
- $tf = new TableFormatter();
- $tf->setBorder('|');
- $result = $tf->format(array(20, '*'), array($text, 'test'));
-
- $this->assertEquals($expect, trim($result));
- }
-
- public function test_colorlength()
- {
- $color = new Colors();
-
- $text = 'this is ' . $color->wrap('green', Colors::C_GREEN);
- $expect = "$text |test";
-
- $tf = new TableFormatter();
- $tf->setBorder('|');
- $result = $tf->format(array(20, '*'), array($text, 'test'));
-
- $this->assertEquals($expect, trim($result));
- }
-
- public function test_onewrap()
- {
- $col1 = "test\nwrap";
- $col2 = "test";
-
- $expect = "test |test \n" .
- "wrap | \n";
-
- $tf = new TableFormatter();
- $tf->setMaxWidth(11);
- $tf->setBorder('|');
-
- $result = $tf->format(array(5, '*'), array($col1, $col2));
- $this->assertEquals($expect, $result);
- }
-
- /**
- * Test that colors are correctly applied when text is wrapping across lines.
- *
- * @dataProvider colorwrapProvider
- */
- public function test_colorwrap($text, $expect)
- {
- $tf = new TableFormatter();
- $tf->setMaxWidth(15);
-
- $this->assertEquals($expect, $tf->format(array('*'), array($text)));
- }
-
- /**
- * Data provider for test_colorwrap.
- *
- * @return array[]
- */
- public function colorwrapProvider()
- {
- $color = new Colors();
- $cyan = $color->getColorCode(Colors::C_CYAN);
- $reset = $color->getColorCode(Colors::C_RESET);
- $wrap = function ($str) use ($color) {
- return $color->wrap($str, Colors::C_CYAN);
- };
-
- return array(
- 'color word line 1' => array(
- "This is ". $wrap("cyan") . " text wrapping",
- "This is {$cyan}cyan{$reset} \ntext wrapping \n",
- ),
- 'color word line 2' => array(
- "This is text ". $wrap("cyan") . " wrapping",
- "This is text \n{$cyan}cyan{$reset} wrapping \n",
- ),
- 'color across lines' => array(
- "This is ". $wrap("cyan text") . " wrapping",
- "This is {$cyan}cyan \ntext{$reset} wrapping \n",
- ),
- 'color across lines until end' => array(
- "This is ". $wrap("cyan text wrapping"),
- "This is {$cyan}cyan \n{$cyan}text wrapping{$reset} \n",
- ),
- );
- }
-}