Renamed namespaces

This commit is contained in:
Zi Xing 2022-04-16 19:11:00 -04:00
parent f8db35135e
commit c813079e86
71 changed files with 4797 additions and 378 deletions

View file

@ -0,0 +1,85 @@
<?php
/**
* Assert
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
namespace ncc\Assert;
/**
* AssertionChain factory.
*/
abstract class Assert
{
/** @var string */
protected static $lazyAssertionExceptionClass = LazyAssertionException::class;
/** @var string */
protected static $assertionClass = Assertion::class;
/**
* Start validation on a value, returns {@link AssertionChain}.
*
* The invocation of this method starts an assertion chain
* that is happening on the passed value.
*
* @param mixed $value
* @param string|callable|null $defaultMessage
*
* @example
*
* Assert::that($value)->notEmpty()->integer();
* Assert::that($value)->nullOr()->string()->startsWith("Foo");
*
* The assertion chain can be stateful, that means be careful when you reuse
* it. You should never pass around the chain.
*/
public static function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
$assertionChain = new AssertionChain($value, $defaultMessage, $defaultPropertyPath);
return $assertionChain->setAssertionClassName(static::$assertionClass);
}
/**
* Start validation on a set of values, returns {@link AssertionChain}.
*
* @param mixed $values
* @param string|callable|null $defaultMessage
*/
public static function thatAll($values, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
return static::that($values, $defaultMessage, $defaultPropertyPath)->all();
}
/**
* Start validation and allow NULL, returns {@link AssertionChain}.
*
* @param mixed $value
* @param string|callable|null $defaultMessage
*/
public static function thatNullOr($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
return static::that($value, $defaultMessage, $defaultPropertyPath)->nullOr();
}
/**
* Create a lazy assertion object.
*/
public static function lazy(): LazyAssertion
{
$lazyAssertion = new LazyAssertion();
return $lazyAssertion
->setAssertClass(\get_called_class())
->setExceptionClass(static::$lazyAssertionExceptionClass);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,247 @@
<?php
/**
* Assert
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
namespace ncc\Assert;
use LogicException;
/**
* Chaining builder for assertions.
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
*
* @method AssertionChain alnum(string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric.
* @method AssertionChain base64(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined.
* @method AssertionChain between(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit.
* @method AssertionChain betweenExclusive(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit.
* @method AssertionChain betweenLength(int $minLength, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string length is between min and max lengths.
* @method AssertionChain boolean(string|callable $message = null, string $propertyPath = null) Assert that value is php boolean.
* @method AssertionChain choice(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices.
* @method AssertionChain choicesNotEmpty(array $choices, string|callable $message = null, string $propertyPath = null) Determines if the values array has every choice as key and that this choice has content.
* @method AssertionChain classExists(string|callable $message = null, string $propertyPath = null) Assert that the class exists.
* @method AssertionChain contains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string contains a sequence of chars.
* @method AssertionChain count(int $count, string|callable $message = null, string $propertyPath = null) Assert that the count of countable is equal to count.
* @method AssertionChain date(string $format, string|callable $message = null, string $propertyPath = null) Assert that date is valid and corresponds to the given format.
* @method AssertionChain defined(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined.
* @method AssertionChain digit(string|callable $message = null, string $propertyPath = null) Validates if an integer or integerish is a digit.
* @method AssertionChain directory(string|callable $message = null, string $propertyPath = null) Assert that a directory exists.
* @method AssertionChain e164(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid E164 Phone Number.
* @method AssertionChain email(string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL).
* @method AssertionChain endsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars.
* @method AssertionChain eq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==).
* @method AssertionChain eqArraySubset(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset.
* @method AssertionChain extensionLoaded(string|callable $message = null, string $propertyPath = null) Assert that extension is loaded.
* @method AssertionChain extensionVersion(string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed.
* @method AssertionChain false(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False.
* @method AssertionChain file(string|callable $message = null, string $propertyPath = null) Assert that a file exists.
* @method AssertionChain float(string|callable $message = null, string $propertyPath = null) Assert that value is a php float.
* @method AssertionChain greaterOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater or equal than given limit.
* @method AssertionChain greaterThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater than given limit.
* @method AssertionChain implementsInterface(string $interfaceName, string|callable $message = null, string $propertyPath = null) Assert that the class implements the interface.
* @method AssertionChain inArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. This is an alias of Assertion::choice().
* @method AssertionChain integer(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer.
* @method AssertionChain integerish(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer'ish.
* @method AssertionChain interfaceExists(string|callable $message = null, string $propertyPath = null) Assert that the interface exists.
* @method AssertionChain ip(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 or IPv6 address.
* @method AssertionChain ipv4(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 address.
* @method AssertionChain ipv6(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv6 address.
* @method AssertionChain isArray(string|callable $message = null, string $propertyPath = null) Assert that value is an array.
* @method AssertionChain isArrayAccessible(string|callable $message = null, string $propertyPath = null) Assert that value is an array or an array-accessible object.
* @method AssertionChain isCallable(string|callable $message = null, string $propertyPath = null) Determines that the provided value is callable.
* @method AssertionChain isCountable(string|callable $message = null, string $propertyPath = null) Assert that value is countable.
* @method AssertionChain isInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is instance of given class-name.
* @method AssertionChain isJsonString(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid json string.
* @method AssertionChain isObject(string|callable $message = null, string $propertyPath = null) Determines that the provided value is an object.
* @method AssertionChain isResource(string|callable $message = null, string $propertyPath = null) Assert that value is a resource.
* @method AssertionChain isTraversable(string|callable $message = null, string $propertyPath = null) Assert that value is an array or a traversable object.
* @method AssertionChain keyExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array.
* @method AssertionChain keyIsset(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object using isset().
* @method AssertionChain keyNotExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key does not exist in an array.
* @method AssertionChain length(int $length, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string has a given length.
* @method AssertionChain lessOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less or equal than given limit.
* @method AssertionChain lessThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less than given limit.
* @method AssertionChain max(mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that a number is smaller as a given limit.
* @method AssertionChain maxCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at most $count elements.
* @method AssertionChain maxLength(int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string value is not longer than $maxLength chars.
* @method AssertionChain methodExists(mixed $object, string|callable $message = null, string $propertyPath = null) Determines that the named method is defined in the provided object.
* @method AssertionChain min(mixed $minValue, string|callable $message = null, string $propertyPath = null) Assert that a value is at least as big as a given limit.
* @method AssertionChain minCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at least $count elements.
* @method AssertionChain minLength(int $minLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that a string is at least $minLength chars long.
* @method AssertionChain noContent(string|callable $message = null, string $propertyPath = null) Assert that value is empty.
* @method AssertionChain notBlank(string|callable $message = null, string $propertyPath = null) Assert that value is not blank.
* @method AssertionChain notContains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string does not contains a sequence of chars.
* @method AssertionChain notEmpty(string|callable $message = null, string $propertyPath = null) Assert that value is not empty.
* @method AssertionChain notEmptyKey(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object and its value is not empty.
* @method AssertionChain notEq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using ==).
* @method AssertionChain notInArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is not in array of choices.
* @method AssertionChain notIsInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is not instance of given class-name.
* @method AssertionChain notNull(string|callable $message = null, string $propertyPath = null) Assert that value is not null.
* @method AssertionChain notRegex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value does not match a regex.
* @method AssertionChain notSame(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using ===).
* @method AssertionChain null(string|callable $message = null, string $propertyPath = null) Assert that value is null.
* @method AssertionChain numeric(string|callable $message = null, string $propertyPath = null) Assert that value is numeric.
* @method AssertionChain objectOrClass(string|callable $message = null, string $propertyPath = null) Assert that the value is an object, or a class that exists.
* @method AssertionChain phpVersion(mixed $version, string|callable $message = null, string $propertyPath = null) Assert on PHP version.
* @method AssertionChain propertiesExist(array $properties, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the properties all exist.
* @method AssertionChain propertyExists(string $property, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the property exists.
* @method AssertionChain range(mixed $minValue, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that value is in range of numbers.
* @method AssertionChain readable(string|callable $message = null, string $propertyPath = null) Assert that the value is something readable.
* @method AssertionChain regex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value matches a regex.
* @method AssertionChain same(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are the same (using ===).
* @method AssertionChain satisfy(callable $callback, string|callable $message = null, string $propertyPath = null) Assert that the provided value is valid according to a callback.
* @method AssertionChain scalar(string|callable $message = null, string $propertyPath = null) Assert that value is a PHP scalar.
* @method AssertionChain startsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string starts with a sequence of chars.
* @method AssertionChain string(string|callable $message = null, string $propertyPath = null) Assert that value is a string.
* @method AssertionChain subclassOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is subclass of given class-name.
* @method AssertionChain true(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean True.
* @method AssertionChain uniqueValues(string|callable $message = null, string $propertyPath = null) Assert that values in array are unique (using strict equality).
* @method AssertionChain url(string|callable $message = null, string $propertyPath = null) Assert that value is an URL.
* @method AssertionChain uuid(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid UUID.
* @method AssertionChain version(string $operator, string $version2, string|callable $message = null, string $propertyPath = null) Assert comparison of two versions.
* @method AssertionChain writeable(string|callable $message = null, string $propertyPath = null) Assert that the value is something writeable.
*/
class AssertionChain
{
/**
* @var mixed
*/
private $value;
/**
* @var string|callable|null
*/
private $defaultMessage;
/**
* @var string|null
*/
private $defaultPropertyPath;
/**
* Return each assertion as always valid.
*
* @var bool
*/
private $alwaysValid = false;
/**
* Perform assertion on every element of array or traversable.
*
* @var bool
*/
private $all = false;
/** @var string|Assertion Class to use for assertion calls */
private $assertionClassName = 'Assert\Assertion';
/**
* AssertionChain constructor.
*
* @param mixed $value
* @param string|callable|null $defaultMessage
*/
public function __construct($value, $defaultMessage = null, string $defaultPropertyPath = null)
{
$this->value = $value;
$this->defaultMessage = $defaultMessage;
$this->defaultPropertyPath = $defaultPropertyPath;
}
/**
* Call assertion on the current value in the chain.
*
* @param string $methodName
* @param array $args
*/
public function __call($methodName, $args): AssertionChain
{
if (true === $this->alwaysValid) {
return $this;
}
try {
$method = new \ReflectionMethod($this->assertionClassName, $methodName);
} catch (\ReflectionException $exception) {
throw new \RuntimeException("Assertion '".$methodName."' does not exist.");
}
\array_unshift($args, $this->value);
$params = $method->getParameters();
foreach ($params as $idx => $param) {
if (isset($args[$idx])) {
continue;
}
switch ($param->getName()) {
case 'message':
$args[$idx] = $this->defaultMessage;
break;
case 'propertyPath':
$args[$idx] = $this->defaultPropertyPath;
break;
}
}
if ($this->all) {
$methodName = 'all'.$methodName;
}
\call_user_func_array([$this->assertionClassName, $methodName], $args);
return $this;
}
/**
* Switch chain into validation mode for an array of values.
*/
public function all(): AssertionChain
{
$this->all = true;
return $this;
}
/**
* Switch chain into mode allowing nulls, ignoring further assertions.
*/
public function nullOr(): AssertionChain
{
if (null === $this->value) {
$this->alwaysValid = true;
}
return $this;
}
/**
* @param string $className
*
* @return $this
*/
public function setAssertionClassName($className): AssertionChain
{
if (!\is_string($className)) {
throw new LogicException('Exception class name must be passed as a string');
}
if (Assertion::class !== $className && !\is_subclass_of($className, Assertion::class)) {
throw new LogicException($className.' is not (a subclass of) '.Assertion::class);
}
$this->assertionClassName = $className;
return $this;
}
}

View file

@ -0,0 +1,32 @@
<?php
/**
* Assert
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
namespace ncc\Assert;
use Throwable;
interface AssertionFailedException extends Throwable
{
/**
* @return string|null
*/
public function getPropertyPath();
/**
* @return mixed
*/
public function getValue();
public function getConstraints(): array;
}

View file

@ -0,0 +1,455 @@
# Change Log
All notable changes to this project will be documented in this file.
## 3.2.7 - 2019-12-19
### Fixes
- Reinstated the `@method` return type for `Assert\LazyAssertion` methods to show that the return type is `LazyAssertion`.
## 3.2.6 - 2019-10-10
### Fixes
- Make `Assert\Assertion::stringify()` UTF-8 safe (Thanks to [Pedram Azimaei](https://github.com/beberlei/assert/pull/290))
## 3.2.5 - 2019-10-10 - Fix the broken things release.
### Notice
- Sigh!
- Richard Quadling
### Fixes
- REALLY Removed dependency of the intl extension.
- Updated the Docblocks for `Assert\Assertion::all()` helper to show that the value is expected to be an array.
## 3.2.4 - 2019-10-10 - Fix the broken things release.
### Notice
- It seems I've been slightly lax in verifying the signature changes and expected extensions.
Hopefully, both of these have been fixed in this version.
Truly sorry for breaking the internet!
- Richard Quadling
### Fixes
- Restored `\Assert\Assertion::createException()` signature to 3.2.2.
- Removed dependency of the intl extension. If the extension is available, then `Assert\Assertion::count()`,
`Assert\Assertion::isCountable()`, `Assert\Assertion::minCount()`, and `Assert\Assertion::maxCount()` will operate on
`ResourceBundles`.
- Fixed the `@method` return type for `Assert\LazyAssertion` methods to show that the return type is `static` for
extensions of `Assert\LazyAssertion`.
*NOTE :* Docblock does not have the ability to differentiate between a non static `@method` whose returns type is of
the subclass and a `@method` that is called statically ([PSR-5#899](https://github.com/php-fig/fig-standards/pull/899)).
So the use of `static static` is a fudge that sort of works for IDEs that need to know about the method that MAY be
overridden in a subclass.
## 3.2.3 - 2019-08-23
### Other changes
- Added type hints and documentation consistency (Thanks to [Andru Cherny](https://github.com/beberlei/assert/pull/286))
## 3.2.2 - 2019-08-23
### Added assertions
- `Assertion::eqArraySubset()` (Thanks to [Anna Filina](https://github.com/beberlei/assert/pull/283))
## 3.2.1 - 2019-05-28
### Fixes
- Updated regex for `Assert\Assertion::url()` (Thanks to [Christophe Histaesse](https://github.com/beberlei/assert/pull/281))
- Fixed broken regex for `Assert\Assertion::url()` (Thanks to [Menno Holtkamp](https://github.com/beberlei/assert/issues/275))
### Other changes
- Added PHP 7.3.0, PHP 7.3.1, and PHP 7.3.2 to Travis pipeline as there are differences in PCRE
- Updated docblocks for `Assert\Assertion::NullOrXxxx()` to show that the first parameter can be null.
- Updated docblocks for `Assert\LazyAssertion` to show that the return type is `$this` to aid IDE's static analysis.
## 3.2.0 - 2018-12-24
### Added assertions
- `Assertion::isCountable()` (Thanks to [Baptiste Clavié](https://github.com/beberlei/assert/pull/268))
- `Assertion::maxCount()` (Thanks to [Baptiste Clavié](https://github.com/beberlei/assert/pull/269))
- `Assertion::minCount()` (Thanks to [Baptiste Clavié](https://github.com/beberlei/assert/pull/269))
- `Assertion::nonContains()` (Thanks to [Baptiste Clavié](https://github.com/beberlei/assert/pull/270))
### Other changes
- Added PHP 7.3 to Travis pipeline
- Added support for `\ResourceBundle` and `\SimpleXMLElement` to `Assertion::count()`.
## 3.1.0 - 2018-10-29
### Other changes
- Refactor assertion messages for `Assert\Assertion::notEq()`, `Assert\Assertion::notSame()`, and `Assert\Assertion::notInArray()` (Thanks to [Rick Kuipers](https://github.com/beberlei/assert/pull/259))
## 3.0.1 - 2018-07-04
### Added assertions
- `Assertion::notRegex()` (Thanks to [Thomas Müller](https://github.com/beberlei/assert/pull/261))
### Other changes
- Upgraded regex and unit tests for `Assert\Assertion::url()` to latest from Symfony/Validator
## 3.0.0 - 2018-07-04
### Changes
- Deprecate support for PHP < 7.0
### Fixes
- An `AssertionFailedException` must be a `Throwable` (Thanks to [Marco Pivetta](https://github.com/beberlei/assert/pull/256))
## 2.9.8 - 2019-05-28
### Fixes
- Updated regex for `Assert\Assertion::url()` (Thanks to [Christophe Histaesse](https://github.com/beberlei/assert/pull/281))
## 2.9.7 - 2019-02-19
### Fixes
- Fixed broken regex for `Assert\Assertion::url()` (Thanks to [Menno Holtkamp](https://github.com/beberlei/assert/issues/275))
## 2.9.6 - 2018-04-16
### Fixes
- Made constraints in exceptions consistent for all assertions (Thanks to [Peter Kruithof](https://github.com/beberlei/assert/pull/255))
## 2.9.5 - 2018-04-16
### Fixes
- Remove DocBlock entry causing exception in third party DocBlock parser (Thanks to [Koutsoumpos Valantis](https://github.com/beberlei/assert/issues/251))
## 2.9.4 - 2018-04-09
### Fixes
- Prevent date overflow in Assertion::date() by reset preset date value (Thanks to [Nobuhiro Nakamura](https://github.com/beberlei/assert/issues/250))
## 2.9.3 - 2018-03-16
### Changes
- Expand error for `\Assert\Assertion::count()` to include the supplied count (Thanks to [Yoann Blot](https://github.com/beberlei/assert/issues/247))
## 2.9.2 - 2018-01-25
### Fixes
- Usage of custom extended Assertion class in LazyAssertion (Thanks to [Marek Štípek](https://github.com/beberlei/assert/pull/245))
## 2.9.1 - 2018-01-25
### Deprecation notice
- Support for PHP 5 will be dropped at the end of 2018, in line with PHP's [supported versions](http://php.net/supported-versions.php).
### Fixes
- `\Assert\Assertion::generateMessage()` will now receive the default message for an assertion if one is not supplied (Thanks to [Romans Malinovskis](https://github.com/beberlei/assert/issues/225))
## 2.8.1 - 2017-11-30
### Fixes
- `Assertion::integerish()` has had several issues in the last couple of versions.
Hopefully these are now fixed.
Thanks to [Erik Roelofs](https://github.com/beberlei/assert/issues/243) and [Michał Mleczko](https://github.com/beberlei/assert/issues/240)
### Deprecation notice
- The functions `\Assert\that()`, `\Assert\thatAll()`, `\Assert\thatNullOr()`, and `\Assert\lazy()` are no longer marked as deprecated.
Both the functional and static constructors work together. Whichever you wish to use is a personal preference.
## 2.7.11 - 2017-11-13
### Fixes
- `Assertion::integerish(0)` and `Assertion::integerish('0')` now assert correctly.
## 2.7.10 - 2017-11-13
### Added assertions
- `Assertion::base64()` (Thanks to [Pablo Kowalczyk](https://github.com/beberlei/assert/pull/232))
## 2.7.9 - 2017-11-13
### Fixes
- `Assertion::integerish()` now correctly asserts integers with leading zeros in strings (Thanks to [Albert Casademont](https://github.com/beberlei/assert/pull/227#issuecomment-343961009))
## 2.7.8 - 2017-10-20
### Fixes
- `Assertion::integerish()` now throws exception as expected (Thanks to [Thomas Flack](https://github.com/beberlei/assert/issues/235))
## 2.7.7 - 2017-10-18
### Fixes
- Basic Auth usernames and passwords can contain '.' (Thanks to [Fede Isas](https://github.com/beberlei/assert/issues/234))
## 2.7.6 - 2017-05-04
### Fixes
- Fixed stringification of booleans (Thanks to [Philipp Rieber](https://github.com/beberlei/assert/issues/226))
## 2.7.5 - 2017-04-29
### Added assertions
- `Assert\Assertion:isResource()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/222))
### Other changes
- Corrected doc-block for `Assert\Assertion::propertiesExist()`.
## 2.7.4 - 2017-03-14
### Added assertions
- `Assert\Assertion::objectOrClass()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/218))
- `Assert\Assertion::propertyExists()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/218))
- `Assert\Assertion::propertiesExist()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/218))
### Other changes
- Unit tests no longer using deprecated exception methods (Thanks to [Richard Quadling](https://github.com/beberlei/assert/pull/217))
- All global namespaced functions have been optimised (Thanks to [Andreas Möller](https://github.com/beberlei/assert/pull/211))
## 2.7.3 - 2017-01-24
### Fixes
- Fix `Assert\Assertion::integerish()` when used with a resource (Thanks to [manuxi](https://github.com/beberlei/assert/issues/206))
## 2.7.2 - 2017-01-09
### Fixes
- Backward compatibility fixes for PHP 5.3
## 2.7.1 - 2017-01-06
### Added assertions
- `Assert\Assertion::extensionVersion()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/205))
- `Assert\Assertion::phpVersion()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/203))
- `Assert\Assertion::version()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/203))
### Other changes
- Exception messages can now be constructed via a callback.
- Documentation now includes types.
## 2.6.9 - 2017-01-04
### Added assertions
- `Assert\Assertion::defined()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/193))
- `Assert\Assertion::extensionLoaded()` (Thanks to [Timothy Younger](https://github.com/beberlei/assert/pull/201))
### Other changes
- Added types to generated documentation.
- Added PHPStan analysis for PHP 7+
## 2.6.8 - 2016-12-05
### Fixes
- All exceptions thrown by this library extend `\Assert\InvalidArgumentException` (Thanks to [Richard Quadling](https://github.com/beberlei/assert/pull/187))
### Other changes
- Update to php-cs-fixer ^2.0 release (Thanks to [Raphael Stolt](https://github.com/beberlei/assert/pull/188))
- Simplify XDebug disabling for Travis (Thanks to [Raphael Stolt](https://github.com/beberlei/assert/pull/189))
- Use PSR-4 autoloading (Thanks to [Andreas Möller](https://github.com/beberlei/assert/pull/190))
- Enable Composer package sorting (Thanks to [Raphael Stolt](https://github.com/beberlei/assert/pull/191))
- Fix grammar in documentation (Thanks to [Adrian Föder](https://github.com/beberlei/assert/pull/192))
## 2.6.7 - 2016-11-14
### Fixes
- [Fix the interfaceExists assertion](https://github.com/beberlei/assert/pull/182)
- Fixed issue in document generator (Thanks to [Taco van den Broek](https://github.com/tacovandenbroek))
### Other changes
- [Added ability to capture multiple errors on a single value in a chain](https://github.com/beberlei/assert/pull/186) (Thanks to [Alec Carpenter](https://github.com/alecgunnar))
- [Use static factory methods instead of functions in the Assert namespace](https://github.com/beberlei/assert/pull/184) (Thanks to [Taco van den Broek](https://github.com/tacovandenbroek))
### Deprecation notice
- The functions in the Assert namespace (`\Assert\that()`, `\Assert\thatAll()`, `\Assert\thatNullOr()` and `\Assert\lazy()`) are now marked as deprecated.
They will be removed in the next major release.
They have been replaced with the static methods `\Assert\Assert::that()`, `\Assert\Assert::thatAll()`, `\Assert\Assert::thatNullOr()` and `\Assert\Assert::lazy()`
## 2.6.6 - 2016-10-31
### Other changes
- [Make all assertions return true on success, so that it can be used inside PHP 7 assert()](https://github.com/beberlei/assert/issues/136)
## 2.6.5 - 2016-10-11
### Added assertions
- `Assert\Assertion::between()`
- `Assert\Assertion::betweenExclusive()`
### Fixes
- Allow `http://localhost` as a valid URL - fixes [Assertion::url('http://localhost') not a valid url?](https://github.com/beberlei/assert/issues/133)
### Other changes
- Upgraded regex and unit tests for `Assert\Assertion::url()` to latest from Symfony/Validator
- Added PHP-CS
- Speed up of builds for Travis
## 2.6.4 - 2016-10-03
### Added assertions
- `Assert\Assertion::e164()` - The international public telecommunication numbering plan
- `Assert\Assertion::interfaceExists()`
- `Assert\Assertion::ip()` / `Assert\Assertion::ipv4()` / `Assert\Assertion::ipv6()`
- `Assert\Assertion::keyNotExists()`
- `Assert\Assertion::null()`
- `Assert\Assertion::satisfy()` - Allows for a bespoke assertion, rather than a predefined one
### Fixes
- Improved the reporting of the value for min and max assertions
### Other changes
- Removed `composer.lock` file from library
- Improved travis build to detect incorrect documentation changes
## 2.6.3 - 2016-07-28
### Added assertions
- `Assert\Assertion::notInArray()`
### Fixes
- Made `Assert\Assertion::INVALID_GREATER_OR_EQUAL` unique
### Other changes
- Introduced [CONTRIBUTING.md](https://github.com/beberlei/assert/blob/v2.6.3/CONTRIBUTING.md) to get contributors to generate the docblocks when a new assertion is added
- Introduced [.editorconfig](https://github.com/beberlei/assert/blob/v2.6.3/.editorconfig) to allow IDEs that support EditorConfig to provide a consistent code style.
See [EditorConfig](http://editorconfig.org/) for further details
- Additional tests and updated documentation.
- Travis updates.
## 2.6.2 - 2016-07-26
### Fixes
- Fixed unit test to work with PHP 5.3
## 2.6.1 - 2016-07-26
### Fixes
- Fixed `Assertion::isCallable()` to with with PHP 5.3
## 2.6 - 2016-07-26
### Added assertions
- `Assert\Assertion::isCallable()`
## 2.5.2 - 2016-07-26
### Other changes
- Updated tests
- Updated `generate_method_docs.php` and regenerated all documentation
- Added Richard Quadling as collaborator
## 2.5.1 - 2016-05-20
### Other changes
- Updated missing assertions from documentation
## 2.5 - 2016-03-22
### Added assertions
- `Assert\Assertion::date()`
### Other changes
- Added appropriate guards to the additional assert functions to stop them from being defined twice
## 2.4 - 2015-08-21
### Added assertions
- `Assert\Assertion::lessThan()`
- `Assert\Assertion::lessOrEqualThan()`
- `Assert\Assertion::greaterThan()`
- `Assert\Assertion::greaterOrEqualThan()`
### Other changes
- Added support for PHP 5.6 and PHP 7.0 to Travis
## 2.3 - 2015-12-18
### Added assertions
- `Assert\Assertion::isTraversable()`
- `Assert\Assertion::isArrayAccessible()`
- `Assert\Assertion::keyIsset()`
## 2.2 - 2015-12-18
### Other changes
- Used parameterised `sprintf()` for messages
## 2.1 - 2015-11-06
### Added assertions
- `Assert\Assertion::notEq()`
- `Assert\Assertion::notSame()`
- `Assert\Assertion::scalar()`
- `Assert\Assertion::choicesNotEmpty()`
- `Assert\Assertion::methodExists()`
- `Assert\Assertion::isObject()`
## 2.0.1 - 2014-01-26
### Other changes
- Pass constraints and values to `Assert\AssertionFailedException`
## 2.0 - 2014-01-26
### Other changes
- Introduce AssertionChaining and LazyAssertions
- Introduce `Assert\Assertion::stringify()` to make a string version of a value
## 1.7 - 2014-01-25
### Added assertions
- `Assert\Assertion::float()`
### Other changes
- Added support for HHVM to Travis
## 1.6 - 2013-11-05
### Added assertions
- `Assert\Assertion::count()`
### Other changes
- Added support for PHP 5.5 to Travis
## 1.5 - 2013-10-01
### Added assertions
- `Assert\Assertion::notEmptyKey()`
- `Assert\Assertion::all....()`
## 1.4 - 2013-07-07
### Added assertions
- `Assert\Assertion::noContent()`
- `Assert\Assertion::endsWith()`
- `Assert\Assertion::notIsInstanceOf()`
- `Assert\Assertion::isJsonString()`
- `Assert\Assertion::uuid()`
### Other changes
- Added BSD-2 License
## 1.3 - 2013-03-02
### Added assertions
- `Assert\Assertion::length()`
- `Assert\Assertion::url()`
- `Assert\Assertion::false()`
- `Assert\Assertion::implementsInterface()`
### Other changes
- Travis now runs PHP Unit tests
- Added `Assert\InvalidArgumentException`
- Added `$encoding = 'UTF-8'` parameter to appropriate assertions
## 1.2 - 2012-07-23
### Added assertions
- `Assert\Assertion::nullOr....()`
## 1.1 - 2012-07-23
### Added assertions
- `Assert\Assertion::eq()`
- `Assert\Assertion::same()`
- `Assert\Assertion::inArray()`
- `Assert\Assertion::min()`
- `Assert\Assertion::max()`
- `Assert\Assertion::true()`
- `Assert\Assertion::classExists()`
### Other changes
- Added `$propertyPath = null` parameter to assertions
## 1.0 - 2012-05-20
### Added assertions
- `Assert\Assertion::integer()`
- `Assert\Assertion::digit()`
- `Assert\Assertion::integerish()`
- `Assert\Assertion::boolean()`
- `Assert\Assertion::notEmpty()`
- `Assert\Assertion::string()`
- `Assert\Assertion::regex()`
- `Assert\Assertion::minLength()`
- `Assert\Assertion::maxLength()`
- `Assert\Assertion::betweenLength()`
- `Assert\Assertion::startsWith()`
- `Assert\Assertion::contains()`
- `Assert\Assertion::choice()`
- `Assert\Assertion::isArray()`
- `Assert\Assertion::keyExists()`
- `Assert\Assertion::notBlank()`
- `Assert\Assertion::isInstanceOf()`
- `Assert\Assertion::subclassOf()`
- `Assert\Assertion::range()`
- `Assert\Assertion::file()`
- `Assert\Assertion::readable()`
- `Assert\Assertion::writeable()`
- `Assert\Assertion::email()`
- `Assert\Assertion::alnum()`

View file

@ -0,0 +1,9 @@
# How to contribute
Thanks for contributing to assert! Just follow these single guidelines:
- You must use [feature / topic branches](https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows) to ease the merge of contributions.
- Coding standard compliance must be ensured before committing or opening pull requests by running `composer assert:cs-fix` or `composer assert:cs-lint` in the root directory of this repository.
- After adding new assertions regenerate the [README.md](README.md) and the docblocks by running `composer assert:generate-docs` on the command line.
- After adding new non release relevant artifacts you must ensure they are export ignored in the [.gitattributes](.gitattributes) file.

View file

@ -0,0 +1,74 @@
<?php
/**
* Assert
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
namespace ncc\Assert;
class InvalidArgumentException extends \InvalidArgumentException implements AssertionFailedException
{
/**
* @var string|null
*/
private $propertyPath;
/**
* @var mixed
*/
private $value;
/**
* @var array
*/
private $constraints;
public function __construct($message, $code, string $propertyPath = null, $value = null, array $constraints = [])
{
parent::__construct($message, $code);
$this->propertyPath = $propertyPath;
$this->value = $value;
$this->constraints = $constraints;
}
/**
* User controlled way to define a sub-property causing
* the failure of a currently asserted objects.
*
* Useful to transport information about the nature of the error
* back to higher layers.
*
* @return string|null
*/
public function getPropertyPath()
{
return $this->propertyPath;
}
/**
* Get the value that caused the assertion to fail.
*
* @return mixed
*/
public function getValue()
{
return $this->value;
}
/**
* Get the constraints that applied to the failed assertion.
*/
public function getConstraints(): array
{
return $this->constraints;
}
}

View file

@ -0,0 +1,11 @@
Copyright (c) 2011-2013, Benjamin Eberlei
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

View file

@ -0,0 +1,228 @@
<?php
/**
* Assert
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
namespace ncc\Assert;
use LogicException;
/**
* Chaining builder for lazy assertions.
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
*
* @method LazyAssertion alnum(string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric.
* @method LazyAssertion base64(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined.
* @method LazyAssertion between(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit.
* @method LazyAssertion betweenExclusive(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit.
* @method LazyAssertion betweenLength(int $minLength, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string length is between min and max lengths.
* @method LazyAssertion boolean(string|callable $message = null, string $propertyPath = null) Assert that value is php boolean.
* @method LazyAssertion choice(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices.
* @method LazyAssertion choicesNotEmpty(array $choices, string|callable $message = null, string $propertyPath = null) Determines if the values array has every choice as key and that this choice has content.
* @method LazyAssertion classExists(string|callable $message = null, string $propertyPath = null) Assert that the class exists.
* @method LazyAssertion contains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string contains a sequence of chars.
* @method LazyAssertion count(int $count, string|callable $message = null, string $propertyPath = null) Assert that the count of countable is equal to count.
* @method LazyAssertion date(string $format, string|callable $message = null, string $propertyPath = null) Assert that date is valid and corresponds to the given format.
* @method LazyAssertion defined(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined.
* @method LazyAssertion digit(string|callable $message = null, string $propertyPath = null) Validates if an integer or integerish is a digit.
* @method LazyAssertion directory(string|callable $message = null, string $propertyPath = null) Assert that a directory exists.
* @method LazyAssertion e164(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid E164 Phone Number.
* @method LazyAssertion email(string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL).
* @method LazyAssertion endsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars.
* @method LazyAssertion eq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==).
* @method LazyAssertion eqArraySubset(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset.
* @method LazyAssertion extensionLoaded(string|callable $message = null, string $propertyPath = null) Assert that extension is loaded.
* @method LazyAssertion extensionVersion(string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed.
* @method LazyAssertion false(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False.
* @method LazyAssertion file(string|callable $message = null, string $propertyPath = null) Assert that a file exists.
* @method LazyAssertion float(string|callable $message = null, string $propertyPath = null) Assert that value is a php float.
* @method LazyAssertion greaterOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater or equal than given limit.
* @method LazyAssertion greaterThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater than given limit.
* @method LazyAssertion implementsInterface(string $interfaceName, string|callable $message = null, string $propertyPath = null) Assert that the class implements the interface.
* @method LazyAssertion inArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. This is an alias of Assertion::choice().
* @method LazyAssertion integer(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer.
* @method LazyAssertion integerish(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer'ish.
* @method LazyAssertion interfaceExists(string|callable $message = null, string $propertyPath = null) Assert that the interface exists.
* @method LazyAssertion ip(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 or IPv6 address.
* @method LazyAssertion ipv4(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 address.
* @method LazyAssertion ipv6(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv6 address.
* @method LazyAssertion isArray(string|callable $message = null, string $propertyPath = null) Assert that value is an array.
* @method LazyAssertion isArrayAccessible(string|callable $message = null, string $propertyPath = null) Assert that value is an array or an array-accessible object.
* @method LazyAssertion isCallable(string|callable $message = null, string $propertyPath = null) Determines that the provided value is callable.
* @method LazyAssertion isCountable(string|callable $message = null, string $propertyPath = null) Assert that value is countable.
* @method LazyAssertion isInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is instance of given class-name.
* @method LazyAssertion isJsonString(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid json string.
* @method LazyAssertion isObject(string|callable $message = null, string $propertyPath = null) Determines that the provided value is an object.
* @method LazyAssertion isResource(string|callable $message = null, string $propertyPath = null) Assert that value is a resource.
* @method LazyAssertion isTraversable(string|callable $message = null, string $propertyPath = null) Assert that value is an array or a traversable object.
* @method LazyAssertion keyExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array.
* @method LazyAssertion keyIsset(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object using isset().
* @method LazyAssertion keyNotExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key does not exist in an array.
* @method LazyAssertion length(int $length, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string has a given length.
* @method LazyAssertion lessOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less or equal than given limit.
* @method LazyAssertion lessThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less than given limit.
* @method LazyAssertion max(mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that a number is smaller as a given limit.
* @method LazyAssertion maxCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at most $count elements.
* @method LazyAssertion maxLength(int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string value is not longer than $maxLength chars.
* @method LazyAssertion methodExists(mixed $object, string|callable $message = null, string $propertyPath = null) Determines that the named method is defined in the provided object.
* @method LazyAssertion min(mixed $minValue, string|callable $message = null, string $propertyPath = null) Assert that a value is at least as big as a given limit.
* @method LazyAssertion minCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at least $count elements.
* @method LazyAssertion minLength(int $minLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that a string is at least $minLength chars long.
* @method LazyAssertion noContent(string|callable $message = null, string $propertyPath = null) Assert that value is empty.
* @method LazyAssertion notBlank(string|callable $message = null, string $propertyPath = null) Assert that value is not blank.
* @method LazyAssertion notContains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string does not contains a sequence of chars.
* @method LazyAssertion notEmpty(string|callable $message = null, string $propertyPath = null) Assert that value is not empty.
* @method LazyAssertion notEmptyKey(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object and its value is not empty.
* @method LazyAssertion notEq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using ==).
* @method LazyAssertion notInArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is not in array of choices.
* @method LazyAssertion notIsInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is not instance of given class-name.
* @method LazyAssertion notNull(string|callable $message = null, string $propertyPath = null) Assert that value is not null.
* @method LazyAssertion notRegex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value does not match a regex.
* @method LazyAssertion notSame(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using ===).
* @method LazyAssertion null(string|callable $message = null, string $propertyPath = null) Assert that value is null.
* @method LazyAssertion numeric(string|callable $message = null, string $propertyPath = null) Assert that value is numeric.
* @method LazyAssertion objectOrClass(string|callable $message = null, string $propertyPath = null) Assert that the value is an object, or a class that exists.
* @method LazyAssertion phpVersion(mixed $version, string|callable $message = null, string $propertyPath = null) Assert on PHP version.
* @method LazyAssertion propertiesExist(array $properties, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the properties all exist.
* @method LazyAssertion propertyExists(string $property, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the property exists.
* @method LazyAssertion range(mixed $minValue, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that value is in range of numbers.
* @method LazyAssertion readable(string|callable $message = null, string $propertyPath = null) Assert that the value is something readable.
* @method LazyAssertion regex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value matches a regex.
* @method LazyAssertion same(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are the same (using ===).
* @method LazyAssertion satisfy(callable $callback, string|callable $message = null, string $propertyPath = null) Assert that the provided value is valid according to a callback.
* @method LazyAssertion scalar(string|callable $message = null, string $propertyPath = null) Assert that value is a PHP scalar.
* @method LazyAssertion startsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string starts with a sequence of chars.
* @method LazyAssertion string(string|callable $message = null, string $propertyPath = null) Assert that value is a string.
* @method LazyAssertion subclassOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is subclass of given class-name.
* @method LazyAssertion true(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean True.
* @method LazyAssertion uniqueValues(string|callable $message = null, string $propertyPath = null) Assert that values in array are unique (using strict equality).
* @method LazyAssertion url(string|callable $message = null, string $propertyPath = null) Assert that value is an URL.
* @method LazyAssertion uuid(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid UUID.
* @method LazyAssertion version(string $operator, string $version2, string|callable $message = null, string $propertyPath = null) Assert comparison of two versions.
* @method LazyAssertion writeable(string|callable $message = null, string $propertyPath = null) Assert that the value is something writeable.
* @method LazyAssertion all() Switch chain into validation mode for an array of values.
* @method LazyAssertion nullOr() Switch chain into mode allowing nulls, ignoring further assertions.
*/
class LazyAssertion
{
private $currentChainFailed = false;
private $alwaysTryAll = false;
private $thisChainTryAll = false;
private $currentChain;
private $errors = [];
/** @var string The class to use as AssertionChain factory */
private $assertClass = Assert::class;
/** @var string|LazyAssertionException The class to use for exceptions */
private $exceptionClass = LazyAssertionException::class;
/**
* @param mixed $value
* @param string|callable|null $defaultMessage
*
* @return static
*/
public function that($value, string $propertyPath = null, $defaultMessage = null)
{
$this->currentChainFailed = false;
$this->thisChainTryAll = false;
$assertClass = $this->assertClass;
$this->currentChain = $assertClass::that($value, $defaultMessage, $propertyPath);
return $this;
}
/**
* @return static
*/
public function tryAll()
{
if (!$this->currentChain) {
$this->alwaysTryAll = true;
}
$this->thisChainTryAll = true;
return $this;
}
/**
* @param string $method
* @param array $args
*
* @return static
*/
public function __call($method, $args)
{
if (false === $this->alwaysTryAll
&& false === $this->thisChainTryAll
&& true === $this->currentChainFailed
) {
return $this;
}
try {
\call_user_func_array([$this->currentChain, $method], $args);
} catch (AssertionFailedException $e) {
$this->errors[] = $e;
$this->currentChainFailed = true;
}
return $this;
}
/**
* @throws LazyAssertionException
*/
public function verifyNow(): bool
{
if ($this->errors) {
throw \call_user_func([$this->exceptionClass, 'fromErrors'], $this->errors);
}
return true;
}
/**
* @param string $className
*
* @return static
*/
public function setAssertClass(string $className): LazyAssertion
{
if (Assert::class !== $className && !\is_subclass_of($className, Assert::class)) {
throw new LogicException($className.' is not (a subclass of) '.Assert::class);
}
$this->assertClass = $className;
return $this;
}
/**
* @param string $className
*
* @return static
*/
public function setExceptionClass(string $className): LazyAssertion
{
if (LazyAssertionException::class !== $className && !\is_subclass_of($className, LazyAssertionException::class)) {
throw new LogicException($className.' is not (a subclass of) '.LazyAssertionException::class);
}
$this->exceptionClass = $className;
return $this;
}
}

View file

@ -0,0 +1,53 @@
<?php
/**
* Assert
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
namespace ncc\Assert;
class LazyAssertionException extends InvalidArgumentException
{
/**
* @var InvalidArgumentException[]
*/
private $errors = [];
/**
* @param InvalidArgumentException[] $errors
*/
public static function fromErrors(array $errors): self
{
$message = \sprintf('The following %d assertions failed:', \count($errors))."\n";
$i = 1;
foreach ($errors as $error) {
$message .= \sprintf("%d) %s: %s\n", $i++, $error->getPropertyPath(), $error->getMessage());
}
return new static($message, $errors);
}
public function __construct($message, array $errors)
{
parent::__construct($message, 0, null, null);
$this->errors = $errors;
}
/**
* @return InvalidArgumentException[]
*/
public function getErrorExceptions(): array
{
return $this->errors;
}
}

View file

@ -0,0 +1,346 @@
# Assert
[![Build Status](https://img.shields.io/travis/beberlei/assert.svg?style=for-the-badge&logo=travis)](https://travis-ci.org/beberlei/assert)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/beberlei/assert.svg?style=for-the-badge&logo=scrutinizer)](https://scrutinizer-ci.com/g/beberlei/assert/)
[![GitHub issues](https://img.shields.io/github/issues/beberlei/assert.svg?style=for-the-badge&logo=github)](https://github.com/beberlei/assert/issues)
[![PHP Version](https://img.shields.io/packagist/php-v/beberlei/assert.svg?style=for-the-badge)](https://github.com/beberlei/assert)
[![Stable Version](https://img.shields.io/packagist/v/beberlei/assert.svg?style=for-the-badge&label=Latest)](https://packagist.org/packages/beberlei/assert)
[![Total Downloads](https://img.shields.io/packagist/dt/beberlei/assert.svg?style=for-the-badge&label=Total+downloads)](https://packagist.org/packages/beberlei/assert)
[![Monthly Downloads](https://img.shields.io/packagist/dm/beberlei/assert.svg?style=for-the-badge&label=Monthly+downloads)](https://packagist.org/packages/beberlei/assert)
[![Daily Downloads](https://img.shields.io/packagist/dd/beberlei/assert.svg?style=for-the-badge&label=Daily+downloads)](https://packagist.org/packages/beberlei/assert)
A simple php library which contains assertions and guard methods for input validation (not filtering!) in business-model, libraries and application low-level code.
The library can be used to implement pre-/post-conditions on input data.
Idea is to reduce the amount of code for implementing assertions in your model and also simplify the code paths to implement assertions. When assertions fail, an exception is thrown, removing the
necessity for if-clauses in your code.
The library is not using Symfony or Zend Validators for a reason: The checks have to be low-level, fast, non-object-oriented code to be used everywhere necessary. Using any of the two libraries
requires instantiation of several objects, using a locale component, translations, you name it. Its too much bloat.
## Installation
Using Composer:
```sh
composer require beberlei/assert
```
## Example usages
```php
<?php
use Assert\Assertion;
function duplicateFile($file, $times)
{
Assertion::file($file);
Assertion::digit($times);
for ($i = 0; $i < $times; $i++) {
copy($file, $file . $i);
}
}
```
Real time usage with [Azure Blob Storage](https://github.com/beberlei/azure-blob-storage/blob/master/lib/Beberlei/AzureBlobStorage/BlobClient.php#L571):
```php
<?php
public function putBlob($containerName = '', $blobName = '', $localFileName = '', $metadata = array(), $leaseId = null, $additionalHeaders = array())
{
Assertion::notEmpty($containerName, 'Container name is not specified');
self::assertValidContainerName($containerName);
Assertion::notEmpty($blobName, 'Blob name is not specified.');
Assertion::notEmpty($localFileName, 'Local file name is not specified.');
Assertion::file($localFileName, 'Local file name is not specified.');
self::assertValidRootContainerBlobName($containerName, $blobName);
// Check file size
if (filesize($localFileName) >= self::MAX_BLOB_SIZE) {
return $this->putLargeBlob($containerName, $blobName, $localFileName, $metadata, $leaseId, $additionalHeaders);
}
// Put the data to Windows Azure Storage
return $this->putBlobData($containerName, $blobName, file_get_contents($localFileName), $metadata, $leaseId, $additionalHeaders);
}
```
### NullOr helper
A helper method (`Assertion::nullOr*`) is provided to check if a value is null OR holds for the assertion:
```php
<?php
Assertion::nullOrMax(null, 42); // success
Assertion::nullOrMax(1, 42); // success
Assertion::nullOrMax(1337, 42); // exception
```
### All helper
The `Assertion::all*` method checks if all provided values hold for the
assertion. It will throw an exception of the assertion does not hold for one of
the values:
```php
<?php
Assertion::allIsInstanceOf(array(new \stdClass, new \stdClass), 'stdClass'); // success
Assertion::allIsInstanceOf(array(new \stdClass, new \stdClass), 'PDO'); // exception
```
### Assert::that() Chaining
Using the static API on values is very verbose when checking values against multiple assertions.
Starting with 2.6.7 of Assert the `Assert` class provides a much nicer fluent API for assertions, starting
with `Assert::that($value)` and then receiving the assertions you want to call
on the fluent interface. You only have to specify the `$value` once.
```php
<?php
Assert::that($value)->notEmpty()->integer();
Assert::that($value)->nullOr()->string()->startsWith("Foo");
Assert::that($values)->all()->float();
```
There are also two shortcut function `Assert::thatNullOr()` and `Assert::thatAll()` enabling
the "nullOr" or "all" helper respectively.
### Lazy Assertions
There are many cases in web development, especially when involving forms, you want to collect several errors
instead of aborting directly on the first error. This is what lazy assertions are for. Their API
works exactly like the fluent ``Assert::that()`` API, but instead of throwing an Exception directly,
they collect all errors and only trigger the exception when the method
``verifyNow()`` is called on the ``Assert\SoftAssertion`` object.
```php
<?php
Assert::lazy()
->that(10, 'foo')->string()
->that(null, 'bar')->notEmpty()
->that('string', 'baz')->isArray()
->verifyNow();
```
The method ``that($value, $propertyPath)`` requires a property path (name), so that you know how to differentiate
the errors afterwards.
On failure ``verifyNow()`` will throw an exception
``Assert\\LazyAssertionException`` with a combined message:
The following 3 assertions failed:
1) foo: Value "10" expected to be string, type integer given.
2) bar: Value "<NULL>" is empty, but non empty value was expected.
3) baz: Value "string" is not an array.
You can also retrieve all the ``AssertionFailedException``s by calling ``getErrorExceptions()``.
This can be useful for example to build a failure response for the user.
For those looking to capture multiple errors on a single value when using a lazy assertion chain,
you may follow your call to ``that`` with ``tryAll`` to run all assertions against the value, and
capture all of the resulting failed assertion error messages. Here's an example:
```php
Assert::lazy()
->that(10, 'foo')->tryAll()->integer()->between(5, 15)
->that(null, 'foo')->tryAll()->notEmpty()->string()
->verifyNow();
```
The above shows how to use this functionality to finely tune the behavior of reporting failures, but to make
catching all failures even easier, you may also call ``tryAll`` before making any assertions like below. This
helps to reduce method calls, and has the same behavior as above.
```php
Assert::lazy()->tryAll()
->that(10, 'foo')->integer()->between(5, 15)
->that(null, 'foo')->notEmpty()->string()
->verifyNow();
```
### Functional Constructors
The following functions exist as aliases to `Assert` static constructors:
- `Assert\that()`
- `Assert\thatAll()`
- `Assert\thatNullOr()`
- `Assert\lazy()`
Using the functional or static constructors is entirely personal preference.
**Note:** The functional constructors will not work with an [`Assertion` extension](#your-own-assertion-class).
However it is trivial to recreate these functions in a way that point to the extended class.
## List of assertions
```php
<?php
use Assert\Assertion;
Assertion::alnum(mixed $value);
Assertion::base64(string $value);
Assertion::between(mixed $value, mixed $lowerLimit, mixed $upperLimit);
Assertion::betweenExclusive(mixed $value, mixed $lowerLimit, mixed $upperLimit);
Assertion::betweenLength(mixed $value, int $minLength, int $maxLength);
Assertion::boolean(mixed $value);
Assertion::choice(mixed $value, array $choices);
Assertion::choicesNotEmpty(array $values, array $choices);
Assertion::classExists(mixed $value);
Assertion::contains(mixed $string, string $needle);
Assertion::count(array|Countable|ResourceBundle|SimpleXMLElement $countable, int $count);
Assertion::date(string $value, string $format);
Assertion::defined(mixed $constant);
Assertion::digit(mixed $value);
Assertion::directory(string $value);
Assertion::e164(string $value);
Assertion::email(mixed $value);
Assertion::endsWith(mixed $string, string $needle);
Assertion::eq(mixed $value, mixed $value2);
Assertion::eqArraySubset(mixed $value, mixed $value2);
Assertion::extensionLoaded(mixed $value);
Assertion::extensionVersion(string $extension, string $operator, mixed $version);
Assertion::false(mixed $value);
Assertion::file(string $value);
Assertion::float(mixed $value);
Assertion::greaterOrEqualThan(mixed $value, mixed $limit);
Assertion::greaterThan(mixed $value, mixed $limit);
Assertion::implementsInterface(mixed $class, string $interfaceName);
Assertion::inArray(mixed $value, array $choices);
Assertion::integer(mixed $value);
Assertion::integerish(mixed $value);
Assertion::interfaceExists(mixed $value);
Assertion::ip(string $value, int $flag = null);
Assertion::ipv4(string $value, int $flag = null);
Assertion::ipv6(string $value, int $flag = null);
Assertion::isArray(mixed $value);
Assertion::isArrayAccessible(mixed $value);
Assertion::isCallable(mixed $value);
Assertion::isCountable(array|Countable|ResourceBundle|SimpleXMLElement $value);
Assertion::isInstanceOf(mixed $value, string $className);
Assertion::isJsonString(mixed $value);
Assertion::isObject(mixed $value);
Assertion::isResource(mixed $value);
Assertion::isTraversable(mixed $value);
Assertion::keyExists(mixed $value, string|int $key);
Assertion::keyIsset(mixed $value, string|int $key);
Assertion::keyNotExists(mixed $value, string|int $key);
Assertion::length(mixed $value, int $length);
Assertion::lessOrEqualThan(mixed $value, mixed $limit);
Assertion::lessThan(mixed $value, mixed $limit);
Assertion::max(mixed $value, mixed $maxValue);
Assertion::maxCount(array|Countable|ResourceBundle|SimpleXMLElement $countable, int $count);
Assertion::maxLength(mixed $value, int $maxLength);
Assertion::methodExists(string $value, mixed $object);
Assertion::min(mixed $value, mixed $minValue);
Assertion::minCount(array|Countable|ResourceBundle|SimpleXMLElement $countable, int $count);
Assertion::minLength(mixed $value, int $minLength);
Assertion::noContent(mixed $value);
Assertion::notBlank(mixed $value);
Assertion::notContains(mixed $string, string $needle);
Assertion::notEmpty(mixed $value);
Assertion::notEmptyKey(mixed $value, string|int $key);
Assertion::notEq(mixed $value1, mixed $value2);
Assertion::notInArray(mixed $value, array $choices);
Assertion::notIsInstanceOf(mixed $value, string $className);
Assertion::notNull(mixed $value);
Assertion::notRegex(mixed $value, string $pattern);
Assertion::notSame(mixed $value1, mixed $value2);
Assertion::null(mixed $value);
Assertion::numeric(mixed $value);
Assertion::objectOrClass(mixed $value);
Assertion::phpVersion(string $operator, mixed $version);
Assertion::propertiesExist(mixed $value, array $properties);
Assertion::propertyExists(mixed $value, string $property);
Assertion::range(mixed $value, mixed $minValue, mixed $maxValue);
Assertion::readable(string $value);
Assertion::regex(mixed $value, string $pattern);
Assertion::same(mixed $value, mixed $value2);
Assertion::satisfy(mixed $value, callable $callback);
Assertion::scalar(mixed $value);
Assertion::startsWith(mixed $string, string $needle);
Assertion::string(mixed $value);
Assertion::subclassOf(mixed $value, string $className);
Assertion::true(mixed $value);
Assertion::uniqueValues(array $values);
Assertion::url(mixed $value);
Assertion::uuid(string $value);
Assertion::version(string $version1, string $operator, string $version2);
Assertion::writeable(string $value);
```
Remember: When a configuration parameter is necessary, it is always passed AFTER the value. The value is always the first parameter.
## Exception & Error Handling
If any of the assertions fails a `Assert\AssertionFailedException` is thrown.
You can pass an argument called ```$message``` to any assertion to control the
exception message. Every exception contains a default message and unique message code
by default.
```php
<?php
use Assert\Assertion;
use Assert\AssertionFailedException;
try {
Assertion::integer($value, "The pressure of gas is measured in integers.");
} catch(AssertionFailedException $e) {
// error handling
$e->getValue(); // the value that caused the failure
$e->getConstraints(); // the additional constraints of the assertion.
}
```
``Assert\AssertionFailedException`` is just an interface and the default
implementation is ``Assert\InvalidArgumentException`` which extends the SPL
``InvalidArgumentException``. You can change the exception being used on a
package based level.
### Customised exception messages
You can pass a callback as the message parameter, allowing you to construct your own
message only if an assertion fails, rather than every time you run the test.
The callback will be supplied with an array of parameters that are for the assertion.
As some assertions call other assertions, your callback will need to example the array
to determine what assertion failed.
The array will contain a key called `::assertion` that indicates which assertion
failed.
The callback should return the string that will be used as the exception
message.
## Your own Assertion class
To shield your library from possible bugs, misinterpretations or BC breaks
inside Assert you should introduce a library/project based assertion subclass,
where you can override the exception thrown as well.
In addition, you can override the ``Assert\Assertion::stringify()`` method to
provide your own interpretations of the types during error handling.
```php
<?php
namespace MyProject;
use Assert\Assertion as BaseAssertion;
class Assertion extends BaseAssertion
{
protected static $exceptionClass = 'MyProject\AssertionFailedException';
}
```
As of V2.9.2, [Lazy Assertions](#lazy-assertions) now have access to any additional
assertions present in your own assertion classes.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for more details.

View file

@ -0,0 +1,10 @@
# TODO
- Refactor unit tests into sets of related assertions.
- Refactor all unit tests to use the new recommend exception testing pattern as the current `setExpectedException()` method is deprecated.
- Separate assertions into sets that deal with related themes:
- Variable type (isInt, isString isBoolean, isArray, etc.)
- Variable content (min, max, between, etc.)
- Scalar structures (keyExists, keyIsSet etc),
- Class/interface definition (classExists, subClassOf, etc).
- Class/interface content (methodExists, propertyExists, propertyIsSettable, etc.)

View file

@ -0,0 +1,72 @@
<?php
/**
* Assert
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
namespace ncc\Assert;
/**
* Start validation on a value, returns {@link AssertionChain}.
*
* The invocation of this method starts an assertion chain
* that is happening on the passed value.
*
* @param mixed $value
* @param string|callable|null $defaultMessage
* @param string $defaultPropertyPath
*
* @example
*
* \Assert\that($value)->notEmpty()->integer();
* \Assert\that($value)->nullOr()->string()->startsWith("Foo");
*
* The assertion chain can be stateful, that means be careful when you reuse
* it. You should never pass around the chain.
*/
function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
return Assert::that($value, $defaultMessage, $defaultPropertyPath);
}
/**
* Start validation on a set of values, returns {@link AssertionChain}.
*
* @param mixed $values
* @param string|callable|null $defaultMessage
* @param string $defaultPropertyPath
*/
function thatAll($values, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
return Assert::thatAll($values, $defaultMessage, $defaultPropertyPath);
}
/**
* Start validation and allow NULL, returns {@link AssertionChain}.
*
* @param mixed $value
* @param string|callable|null $defaultMessage
* @param string $defaultPropertyPath
*
* @deprecated In favour of Assert::thatNullOr($value, $defaultMessage = null, $defaultPropertyPath = null)
*/
function thatNullOr($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
return Assert::thatNullOr($value, $defaultMessage, $defaultPropertyPath);
}
/**
* Create a lazy assertion object.
*/
function lazy(): LazyAssertion
{
return Assert::lazy();
}

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Action; namespace ncc\PhpSchool\CliMenu\Action;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Action; namespace ncc\PhpSchool\CliMenu\Action;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,30 +1,30 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Builder; namespace ncc\PhpSchool\CliMenu\Builder;
use PhpSchool\CliMenu\Action\ExitAction; use ncc\PhpSchool\CliMenu\Action\ExitAction;
use PhpSchool\CliMenu\Action\GoBackAction; use ncc\PhpSchool\CliMenu\Action\GoBackAction;
use PhpSchool\CliMenu\Exception\InvalidShortcutException; use ncc\PhpSchool\CliMenu\Exception\InvalidShortcutException;
use PhpSchool\CliMenu\MenuItem\AsciiArtItem; use ncc\PhpSchool\CliMenu\MenuItem\AsciiArtItem;
use PhpSchool\CliMenu\MenuItem\CheckboxItem; use ncc\PhpSchool\CliMenu\MenuItem\CheckboxItem;
use PhpSchool\CliMenu\MenuItem\LineBreakItem; use ncc\PhpSchool\CliMenu\MenuItem\LineBreakItem;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
use PhpSchool\CliMenu\MenuItem\MenuMenuItem; use ncc\PhpSchool\CliMenu\MenuItem\MenuMenuItem;
use PhpSchool\CliMenu\MenuItem\RadioItem; use ncc\PhpSchool\CliMenu\MenuItem\RadioItem;
use PhpSchool\CliMenu\MenuItem\SelectableItem; use ncc\PhpSchool\CliMenu\MenuItem\SelectableItem;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuItem\SplitItem; use ncc\PhpSchool\CliMenu\MenuItem\SplitItem;
use PhpSchool\CliMenu\MenuItem\StaticItem; use ncc\PhpSchool\CliMenu\MenuItem\StaticItem;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\CheckboxStyle; use ncc\PhpSchool\CliMenu\Style\CheckboxStyle;
use PhpSchool\CliMenu\Style\DefaultStyle; use ncc\PhpSchool\CliMenu\Style\DefaultStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use PhpSchool\CliMenu\Style\RadioStyle; use ncc\PhpSchool\CliMenu\Style\RadioStyle;
use PhpSchool\CliMenu\Style\SelectableStyle; use ncc\PhpSchool\CliMenu\Style\SelectableStyle;
use PhpSchool\CliMenu\Terminal\TerminalFactory; use ncc\PhpSchool\CliMenu\Terminal\TerminalFactory;
use PhpSchool\Terminal\Terminal; use ncc\PhpSchool\Terminal\Terminal;
use function PhpSchool\CliMenu\Util\each; use function ncc\PhpSchool\CliMenu\Util\each;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,19 +1,19 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Builder; namespace ncc\PhpSchool\CliMenu\Builder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuItem\CheckboxItem; use ncc\PhpSchool\CliMenu\MenuItem\CheckboxItem;
use PhpSchool\CliMenu\MenuItem\LineBreakItem; use ncc\PhpSchool\CliMenu\MenuItem\LineBreakItem;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
use PhpSchool\CliMenu\MenuItem\MenuMenuItem; use ncc\PhpSchool\CliMenu\MenuItem\MenuMenuItem;
use PhpSchool\CliMenu\MenuItem\RadioItem; use ncc\PhpSchool\CliMenu\MenuItem\RadioItem;
use PhpSchool\CliMenu\MenuItem\SelectableItem; use ncc\PhpSchool\CliMenu\MenuItem\SelectableItem;
use PhpSchool\CliMenu\MenuItem\SplitItem; use ncc\PhpSchool\CliMenu\MenuItem\SplitItem;
use PhpSchool\CliMenu\MenuItem\StaticItem; use ncc\PhpSchool\CliMenu\MenuItem\StaticItem;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use function \PhpSchool\CliMenu\Util\each; use function \ncc\PhpSchool\CliMenu\Util\each;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -35,7 +35,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- CheckboxItem & RadioItem (#186, #189, #193, #194, #226) - CheckboxItem & RadioItem (#186, #189, #193, #194, #226)
- Ability to force display extra (#187) - Ability to force display extra (#187)
- Individual style objects for each item type (#211, #212, #213, #214, #216, #230) - Individual style objects for each item type (#211, #212, #213, #214, #216, #230)
- Method getStyle() to interface PhpSchool\CliMenu\MenuItem\MenuItemInterface - Method getStyle() to interface ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface
### Fixed ### Fixed
- Fixed item extra rendering outside of menu (#66, £184, #187) - Fixed item extra rendering outside of menu (#66, £184, #187)
@ -45,14 +45,14 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
### Removed ### Removed
- Remove rebinding $this in builder closures so we can access the real $this (#191, #192, #196) - Remove rebinding $this in builder closures so we can access the real $this (#191, #192, #196)
- Marker methods from PhpSchool\CliMenu\MenuStyle: - Marker methods from ncc\PhpSchool\CliMenu\MenuStyle:
#getSelectedMarker() #getSelectedMarker()
#setSelectedMarker() #setSelectedMarker()
#getUnselectedMarker() #getUnselectedMarker()
#setUnselectedMarker() #setUnselectedMarker()
#getMarker() #getMarker()
- PhpSchool\CliMenu\MenuItem\SelectableTrait - ncc\PhpSchool\CliMenu\MenuItem\SelectableTrait
- Marker methods from PhpSchool\CliMenu\Builder\CliMenuBuilder: - Marker methods from ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder:
#setUnselectedMarker() #setUnselectedMarker()
#setSelectedMarker() #setSelectedMarker()

View file

@ -1,31 +1,31 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu; namespace ncc\PhpSchool\CliMenu;
use PhpSchool\CliMenu\Dialogue\CancellableConfirm; use ncc\PhpSchool\CliMenu\Dialogue\CancellableConfirm;
use PhpSchool\CliMenu\Exception\InvalidTerminalException; use ncc\PhpSchool\CliMenu\Exception\InvalidTerminalException;
use PhpSchool\CliMenu\Exception\MenuNotOpenException; use ncc\PhpSchool\CliMenu\Exception\MenuNotOpenException;
use PhpSchool\CliMenu\Input\InputIO; use ncc\PhpSchool\CliMenu\Input\InputIO;
use PhpSchool\CliMenu\Input\Number; use ncc\PhpSchool\CliMenu\Input\Number;
use PhpSchool\CliMenu\Input\Password; use ncc\PhpSchool\CliMenu\Input\Password;
use PhpSchool\CliMenu\Input\Text; use ncc\PhpSchool\CliMenu\Input\Text;
use PhpSchool\CliMenu\MenuItem\LineBreakItem; use ncc\PhpSchool\CliMenu\MenuItem\LineBreakItem;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
use PhpSchool\CliMenu\MenuItem\PropagatesStyles; use ncc\PhpSchool\CliMenu\MenuItem\PropagatesStyles;
use PhpSchool\CliMenu\MenuItem\SplitItem; use ncc\PhpSchool\CliMenu\MenuItem\SplitItem;
use PhpSchool\CliMenu\MenuItem\StaticItem; use ncc\PhpSchool\CliMenu\MenuItem\StaticItem;
use PhpSchool\CliMenu\Dialogue\Confirm; use ncc\PhpSchool\CliMenu\Dialogue\Confirm;
use PhpSchool\CliMenu\Dialogue\Flash; use ncc\PhpSchool\CliMenu\Dialogue\Flash;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use PhpSchool\CliMenu\Style\Locator; use ncc\PhpSchool\CliMenu\Style\Locator;
use PhpSchool\CliMenu\Terminal\TerminalFactory; use ncc\PhpSchool\CliMenu\Terminal\TerminalFactory;
use PhpSchool\CliMenu\Util\StringUtil as s; use ncc\PhpSchool\CliMenu\Util\StringUtil as s;
use PhpSchool\Terminal\InputCharacter; use ncc\PhpSchool\Terminal\InputCharacter;
use PhpSchool\Terminal\NonCanonicalReader; use ncc\PhpSchool\Terminal\NonCanonicalReader;
use PhpSchool\Terminal\Terminal; use ncc\PhpSchool\Terminal\Terminal;
use function PhpSchool\CliMenu\Util\collect; use function ncc\PhpSchool\CliMenu\Util\collect;
use function PhpSchool\CliMenu\Util\each; use function ncc\PhpSchool\CliMenu\Util\each;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Dialogue; namespace ncc\PhpSchool\CliMenu\Dialogue;
use PhpSchool\Terminal\InputCharacter; use ncc\PhpSchool\Terminal\InputCharacter;
use PhpSchool\Terminal\NonCanonicalReader; use ncc\PhpSchool\Terminal\NonCanonicalReader;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Dialogue; namespace ncc\PhpSchool\CliMenu\Dialogue;
use PhpSchool\Terminal\InputCharacter; use ncc\PhpSchool\Terminal\InputCharacter;
use PhpSchool\Terminal\NonCanonicalReader; use ncc\PhpSchool\Terminal\NonCanonicalReader;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Dialogue; namespace ncc\PhpSchool\CliMenu\Dialogue;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Exception\MenuNotOpenException; use ncc\PhpSchool\CliMenu\Exception\MenuNotOpenException;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\Terminal\Terminal; use ncc\PhpSchool\Terminal\Terminal;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Dialogue; namespace ncc\PhpSchool\CliMenu\Dialogue;
use PhpSchool\Terminal\NonCanonicalReader; use ncc\PhpSchool\Terminal\NonCanonicalReader;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Exception; namespace ncc\PhpSchool\CliMenu\Exception;
use InvalidArgumentException; use InvalidArgumentException;

View file

@ -1,7 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Exception; namespace ncc\PhpSchool\CliMenu\Exception;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,7 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Exception; namespace ncc\PhpSchool\CliMenu\Exception;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,7 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Exception; namespace ncc\PhpSchool\CliMenu\Exception;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,7 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu; namespace ncc\PhpSchool\CliMenu;
/** /**
* Represents the current screen being displayed * Represents the current screen being displayed

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Input; namespace ncc\PhpSchool\CliMenu\Input;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,13 +1,13 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Input; namespace ncc\PhpSchool\CliMenu\Input;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Util\StringUtil; use ncc\PhpSchool\CliMenu\Util\StringUtil;
use PhpSchool\Terminal\InputCharacter; use ncc\PhpSchool\Terminal\InputCharacter;
use PhpSchool\Terminal\NonCanonicalReader; use ncc\PhpSchool\Terminal\NonCanonicalReader;
use PhpSchool\Terminal\Terminal; use ncc\PhpSchool\Terminal\Terminal;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,7 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Input; namespace ncc\PhpSchool\CliMenu\Input;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Input; namespace ncc\PhpSchool\CliMenu\Input;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\Terminal\InputCharacter; use ncc\PhpSchool\Terminal\InputCharacter;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Input; namespace ncc\PhpSchool\CliMenu\Input;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Input; namespace ncc\PhpSchool\CliMenu\Input;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use Assert\Assertion; use Assert\Assertion;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\DefaultStyle; use ncc\PhpSchool\CliMenu\Style\DefaultStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\CheckboxStyle; use ncc\PhpSchool\CliMenu\Style\CheckboxStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
class CheckboxItem implements MenuItemInterface class CheckboxItem implements MenuItemInterface
{ {

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use Assert\Assertion; use Assert\Assertion;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\DefaultStyle; use ncc\PhpSchool\CliMenu\Style\DefaultStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use PhpSchool\CliMenu\Style\SelectableStyle; use ncc\PhpSchool\CliMenu\Style\SelectableStyle;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
interface PropagatesStyles interface PropagatesStyles
{ {

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use PhpSchool\CliMenu\Style\RadioStyle; use ncc\PhpSchool\CliMenu\Style\RadioStyle;
class RadioItem implements MenuItemInterface class RadioItem implements MenuItemInterface
{ {

View file

@ -1,13 +1,13 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use PhpSchool\CliMenu\Util\StringUtil; use ncc\PhpSchool\CliMenu\Util\StringUtil;
use PhpSchool\CliMenu\Style\SelectableStyle; use ncc\PhpSchool\CliMenu\Style\SelectableStyle;
use function PhpSchool\CliMenu\Util\mapWithKeys; use function ncc\PhpSchool\CliMenu\Util\mapWithKeys;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -2,13 +2,13 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use PhpSchool\CliMenu\Style\Selectable; use ncc\PhpSchool\CliMenu\Style\Selectable;
use PhpSchool\CliMenu\Util\StringUtil as s; use ncc\PhpSchool\CliMenu\Util\StringUtil as s;
use function PhpSchool\CliMenu\Util\mapWithKeys; use function ncc\PhpSchool\CliMenu\Util\mapWithKeys;
class SelectableItemRenderer class SelectableItemRenderer
{ {

View file

@ -1,19 +1,19 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use Assert\Assertion; use Assert\Assertion;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\DefaultStyle; use ncc\PhpSchool\CliMenu\Style\DefaultStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use PhpSchool\CliMenu\Style\Selectable; use ncc\PhpSchool\CliMenu\Style\Selectable;
use PhpSchool\CliMenu\Util\StringUtil; use ncc\PhpSchool\CliMenu\Util\StringUtil;
use function PhpSchool\CliMenu\Util\collect; use function ncc\PhpSchool\CliMenu\Util\collect;
use function PhpSchool\CliMenu\Util\each; use function ncc\PhpSchool\CliMenu\Util\each;
use function PhpSchool\CliMenu\Util\mapWithKeys; use function ncc\PhpSchool\CliMenu\Util\mapWithKeys;
use function PhpSchool\CliMenu\Util\max; use function ncc\PhpSchool\CliMenu\Util\max;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>
@ -49,9 +49,9 @@ class SplitItem implements MenuItemInterface, PropagatesStyles
* @var array * @var array
*/ */
private static $blacklistedItems = [ private static $blacklistedItems = [
\PhpSchool\CliMenu\MenuItem\AsciiArtItem::class, \ncc\PhpSchool\CliMenu\MenuItem\AsciiArtItem::class,
\PhpSchool\CliMenu\MenuItem\LineBreakItem::class, \ncc\PhpSchool\CliMenu\MenuItem\LineBreakItem::class,
\PhpSchool\CliMenu\MenuItem\SplitItem::class, \ncc\PhpSchool\CliMenu\MenuItem\SplitItem::class,
]; ];
public function __construct(array $items = []) public function __construct(array $items = [])

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\MenuItem; namespace ncc\PhpSchool\CliMenu\MenuItem;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Style\DefaultStyle; use ncc\PhpSchool\CliMenu\Style\DefaultStyle;
use PhpSchool\CliMenu\Style\ItemStyle; use ncc\PhpSchool\CliMenu\Style\ItemStyle;
use PhpSchool\CliMenu\Util\StringUtil; use ncc\PhpSchool\CliMenu\Util\StringUtil;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,13 +1,13 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu; namespace ncc\PhpSchool\CliMenu;
use PhpSchool\CliMenu\Exception\CannotShrinkMenuException; use ncc\PhpSchool\CliMenu\Exception\CannotShrinkMenuException;
use PhpSchool\CliMenu\Terminal\TerminalFactory; use ncc\PhpSchool\CliMenu\Terminal\TerminalFactory;
use PhpSchool\CliMenu\Util\ColourUtil; use ncc\PhpSchool\CliMenu\Util\ColourUtil;
use PhpSchool\CliMenu\Util\StringUtil as s; use ncc\PhpSchool\CliMenu\Util\StringUtil as s;
use PhpSchool\Terminal\Terminal; use ncc\PhpSchool\Terminal\Terminal;
use Assert\Assertion; use Assert\Assertion;
//TODO: B/W fallback //TODO: B/W fallback

View file

@ -92,8 +92,8 @@ Here is a super basic example menu which will echo out the text of the selected
```php ```php
<?php <?php
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
require_once(__DIR__ . '/../vendor/autoload.php'); require_once(__DIR__ . '/../vendor/autoload.php');
@ -203,7 +203,7 @@ The `CliMenu` object is constructed via the Builder class
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
/** /**
@ -229,7 +229,7 @@ Whatever string you pass to `setTitleSeparator` will be repeated for the width o
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setTitle('One Menu to rule them all!') ->setTitle('One Menu to rule them all!')
@ -253,7 +253,7 @@ You can change the foreground and background colour of the menu to any of the fo
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setForegroundColour('green') ->setForegroundColour('green')
@ -271,7 +271,7 @@ In this example if no 256 colour support is found it will automatically fall bac
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setForegroundColour('40') ->setForegroundColour('40')
@ -284,7 +284,7 @@ In this example if no 256 colour support is found it will fall back to `yellow`
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setForegroundColour('40', 'yellow') ->setForegroundColour('40', 'yellow')
@ -301,7 +301,7 @@ and all around border of 5 and all around padding of 5 will leave for a content
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setWidth(1000) //if terminal is only 400, width will also be 400 ->setWidth(1000) //if terminal is only 400, width will also be 400
@ -313,7 +313,7 @@ If you want to use the full width of the terminal, you can grab the terminal obj
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = ($builder = new CliMenuBuilder) $menu = ($builder = new CliMenuBuilder)
->setWidth($builder->getTerminal()->getWidth()) ->setWidth($builder->getTerminal()->getWidth())
@ -326,7 +326,7 @@ automatically (shrink the width based on the margin).
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = ($builder = new CliMenuBuilder) $menu = ($builder = new CliMenuBuilder)
->setWidth($builder->getTerminal()->getWidth()) ->setWidth($builder->getTerminal()->getWidth())
@ -341,7 +341,7 @@ The padding can be set for all sides with one value or can be set individually f
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setPadding(10) //10 padding top/bottom/left/right ->setPadding(10) //10 padding top/bottom/left/right
@ -353,7 +353,7 @@ Different values can also be set for the top/bottom and the left/right padding:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setPaddingTopBottom(10) ->setPaddingTopBottom(10)
@ -366,7 +366,7 @@ Configure top/bottom and left/right padding using the shorthand method:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setPadding(10, 5) //top/bottom = 10, left/right = 5 ->setPadding(10, 5) //top/bottom = 10, left/right = 5
@ -383,7 +383,7 @@ Automatically center menu:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setWidth(200) ->setWidth(200)
@ -396,7 +396,7 @@ Arbitrary margin:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setWidth(200) ->setWidth(200)
@ -414,7 +414,7 @@ Set universal red border of 2:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setWidth(200) ->setWidth(200)
@ -427,7 +427,7 @@ Configure each border separately:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setWidth(200) ->setWidth(200)
@ -444,7 +444,7 @@ Configure each border separately using the shorthand method, like CSS:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setWidth(200) ->setWidth(200)
@ -461,7 +461,7 @@ Modify the exit button text:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setExitButtonText("Don't you want me baby?") ->setExitButtonText("Don't you want me baby?")
@ -475,7 +475,7 @@ You can remove the exit button altogether:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->disableDefaultItems() ->disableDefaultItems()
@ -489,9 +489,9 @@ You can manually add exit and go back buttons using the following:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\Action\ExitAction; use ncc\PhpSchool\CliMenu\Action\ExitAction;
use PhpSchool\CliMenu\Action\GoBackAction; use ncc\PhpSchool\CliMenu\Action\GoBackAction;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->disableDefaultItems() ->disableDefaultItems()
@ -522,8 +522,8 @@ There a few different types of items you can add to your menu
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->addItem('The Item Text', function (CliMenu $menu) { ->addItem('The Item Text', function (CliMenu $menu) {
@ -537,8 +537,8 @@ You can add multiple items at once like so:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$callable = function (CliMenu $menu) { $callable = function (CliMenu $menu) {
echo 'I am alive!'; echo 'I am alive!';
@ -561,8 +561,8 @@ and must be a valid PHP `callable`. Try using an `Invokable` class to keep your
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$callable = function (CliMenu $menu) { $callable = function (CliMenu $menu) {
echo $menu->getSelectedItem()->getText(); echo $menu->getSelectedItem()->getText();
@ -580,8 +580,8 @@ You can add multiple checkbox items at once like so:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$callable = function (CliMenu $menu) { $callable = function (CliMenu $menu) {
echo 'I am alive!'; echo 'I am alive!';
@ -604,8 +604,8 @@ checked.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$callable = function (CliMenu $menu) { $callable = function (CliMenu $menu) {
echo $menu->getSelectedItem()->getText(); echo $menu->getSelectedItem()->getText();
@ -623,8 +623,8 @@ You can add multiple radio items at once like so:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$callable = function (CliMenu $menu) { $callable = function (CliMenu $menu) {
echo 'I am alive!'; echo 'I am alive!';
@ -647,7 +647,7 @@ checked and all other `RadioItem` within the same level will be unchecked.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->addLineBreak('<3', 2) ->addLineBreak('<3', 2)
@ -664,7 +664,7 @@ If the text is longer than the width of the Menu, it will be continued on the ne
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->addStaticItem('AREA 1') ->addStaticItem('AREA 1')
@ -688,8 +688,8 @@ alignment:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\MenuItem\AsciiArtItem; use ncc\PhpSchool\CliMenu\MenuItem\AsciiArtItem;
$art = <<<ART $art = <<<ART
_ __ _ _ __ _
@ -718,8 +718,8 @@ can have different styles and colours!
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$callable = function (CliMenu $menu) { $callable = function (CliMenu $menu) {
echo "I'm just a boring selectable item"; echo "I'm just a boring selectable item";
@ -749,7 +749,7 @@ If you have already have a configured menu builder you can just pass that to `ad
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
$subMenuBuilder = (new CliMenuBuilder) $subMenuBuilder = (new CliMenuBuilder)
->setTitle('Behold the awesomeness') ->setTitle('Behold the awesomeness')
@ -760,7 +760,7 @@ $menu = (new CliMenuBuilder)
->build(); ->build();
``` ```
Note: The submenu menu item will be an instance of `\PhpSchool\CliMenu\MenuItem\MenuMenuItem`. If you need access to the submenu, Note: The submenu menu item will be an instance of `\ncc\PhpSchool\CliMenu\MenuItem\MenuMenuItem`. If you need access to the submenu,
you can get it via `$menuMenuItem->getSubMenu()`. you can get it via `$menuMenuItem->getSubMenu()`.
### Split Item ### Split Item
@ -774,9 +774,9 @@ Only Selectable, Checkbox, Radio, Static and SubMenu items are currently allowed
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\Builder\SplitItemBuilder; use ncc\PhpSchool\CliMenu\Builder\SplitItemBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
echo $menu->getSelectedItem()->getText(); echo $menu->getSelectedItem()->getText();
@ -812,8 +812,8 @@ In this example we are disabling certain items and a submenu but still having th
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
echo $menu->getSelectedItem()->getText(); echo $menu->getSelectedItem()->getText();
@ -845,13 +845,13 @@ The outcome is a full menu with dimmed rows to denote them being disabled. When
The marker displayed by the side of the currently active item can be modified, UTF-8 characters are supported. The marker displayed by the side of the currently active item can be modified, UTF-8 characters are supported.
The marker for un-selected items can also be modified. If you want to disable it, just set it to an empty string. Item The marker for un-selected items can also be modified. If you want to disable it, just set it to an empty string. Item
markers only display on *selectable* items, which are: `\PhpSchool\CliMenu\MenuItem\SelectableItem` & `\PhpSchool\CliMenu\MenuItem\MenuMenuItem`. markers only display on *selectable* items, which are: `\ncc\PhpSchool\CliMenu\MenuItem\SelectableItem` & `\ncc\PhpSchool\CliMenu\MenuItem\MenuMenuItem`.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\Style\SelectableStyle; use ncc\PhpSchool\CliMenu\Style\SelectableStyle;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->modifySelectableStyle(function (SelectableStyle $style) { ->modifySelectableStyle(function (SelectableStyle $style) {
@ -865,13 +865,13 @@ $menu = (new CliMenuBuilder)
->build(); ->build();
``` ```
You may also change the marker for `\PhpSchool\CliMenu\MenuItem\CheckboxItem`: You may also change the marker for `\ncc\PhpSchool\CliMenu\MenuItem\CheckboxItem`:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\Style\CheckboxStyle; use ncc\PhpSchool\CliMenu\Style\CheckboxStyle;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->modifyCheckboxStyle(function (CheckboxStyle $style) { ->modifyCheckboxStyle(function (CheckboxStyle $style) {
@ -883,13 +883,13 @@ $menu = (new CliMenuBuilder)
->build(); ->build();
``` ```
and for `\PhpSchool\CliMenu\MenuItem\RadioItem`: and for `\ncc\PhpSchool\CliMenu\MenuItem\RadioItem`:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\Style\RadioStyle; use ncc\PhpSchool\CliMenu\Style\RadioStyle;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->modifyRadioStyle(function (RadioStyle $style) { ->modifyRadioStyle(function (RadioStyle $style) {
@ -914,9 +914,9 @@ The third parameter to `addItem` is a boolean whether to show the item extra or
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Style\SelectableStyle; use ncc\PhpSchool\CliMenu\Style\SelectableStyle;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->modifySelectableStyle(function (SelectableStyle $style) { ->modifySelectableStyle(function (SelectableStyle $style) {
@ -935,8 +935,8 @@ menu like so:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->setItemExtra('✔') ->setItemExtra('✔')
@ -954,7 +954,7 @@ $menu = (new CliMenuBuilder)
## Menu Methods ## Menu Methods
The next set of documentation applies to methods available directly on the `\PhpSchool\CliMenu\CliMenu` instance. Typically The next set of documentation applies to methods available directly on the `\ncc\PhpSchool\CliMenu\CliMenu` instance. Typically
you will invoke these methods whilst your menu is open in you action callbacks. you will invoke these methods whilst your menu is open in you action callbacks.
### Redrawing the Menu ### Redrawing the Menu
@ -965,8 +965,8 @@ colour in an action.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
$menu->getStyle()->setBg($menu->getStyle()->getBg() === 'red' ? 'blue' : 'red'); $menu->getStyle()->setBg($menu->getStyle()->getBg() === 'red' ? 'blue' : 'red');
@ -991,8 +991,8 @@ the terminal before redrawing.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
$menu->getStyle()->setWidth($menu->getStyle()->getWidth() === 100 ? 80 : 100); $menu->getStyle()->setWidth($menu->getStyle()->getWidth() === 100 ? 80 : 100);
@ -1018,9 +1018,9 @@ will likely want to redraw the menu as well so the new list is rendered.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuItem\LineBreakItem; use ncc\PhpSchool\CliMenu\MenuItem\LineBreakItem;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
foreach ($menu->getItems() as $item) { foreach ($menu->getItems() as $item) {
@ -1057,8 +1057,8 @@ This functionality allows to map custom key presses to a callable. For example w
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$exit = function(CliMenu $menu) { $exit = function(CliMenu $menu) {
$menu->close(); $menu->close();
@ -1078,8 +1078,8 @@ Another example is mapping shortcuts to a list of items:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$myCallback = function(CliMenu $menu) { $myCallback = function(CliMenu $menu) {
echo "Client 1\nClient 2\nClient 3\n"; echo "Client 1\nClient 2\nClient 3\n";
@ -1110,8 +1110,8 @@ To enable this automatic keyboard shortcut mapping simply call `->enableAutoShor
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$myCallback = function(CliMenu $menu) { $myCallback = function(CliMenu $menu) {
echo "Client 1\nClient 2\nClient 3\n"; echo "Client 1\nClient 2\nClient 3\n";
@ -1141,8 +1141,8 @@ below we change the background color on the flash to green.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
require_once(__DIR__ . '/../vendor/autoload.php'); require_once(__DIR__ . '/../vendor/autoload.php');
@ -1171,8 +1171,8 @@ text can be customised.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
$menu->confirm('PHP School FTW!') $menu->confirm('PHP School FTW!')
@ -1209,8 +1209,8 @@ placeholder text (the default is empty) and the validation failed text (the defa
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
$result = $menu->askText() $result = $menu->askText()
@ -1243,8 +1243,8 @@ When entering a number you can use the up/down keys to increment and decrement t
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
$result = $menu->askNumber() $result = $menu->askNumber()
@ -1278,8 +1278,8 @@ Ask for a password with the default validation:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
$result = $menu->askPassword() $result = $menu->askPassword()
@ -1313,8 +1313,8 @@ password is longer than 20 characters.
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
$result = $menu->askPassword() $result = $menu->askPassword()
@ -1344,8 +1344,8 @@ Ask for a password with custom validation and set the validation failure message
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
$result = $menu->askPassword() $result = $menu->askPassword()
@ -1381,18 +1381,18 @@ $menu->open();
#### Custom Input #### Custom Input
If you need a new type of input which is not covered by the bundled selection then you can create your own by implementing If you need a new type of input which is not covered by the bundled selection then you can create your own by implementing
`\PhpSchool\CliMenu\Input\Input` - take a look at existing implementations to see how they are built. If all you need is some custom `\ncc\PhpSchool\CliMenu\Input\Input` - take a look at existing implementations to see how they are built. If all you need is some custom
validation - extend the `\PhpSchool\CliMenu\Input\Text` class and overwrite the `validate` method. You can then use it in validation - extend the `\ncc\PhpSchool\CliMenu\Input\Text` class and overwrite the `validate` method. You can then use it in
your menu item actions like so: your menu item actions like so:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
use PhpSchool\CliMenu\Input\Text; use ncc\PhpSchool\CliMenu\Input\Text;
use PhpSchool\CliMenu\Input\InputIO; use ncc\PhpSchool\CliMenu\Input\InputIO;
$itemCallable = function (CliMenu $menu) { $itemCallable = function (CliMenu $menu) {
@ -1432,9 +1432,9 @@ you can build up a `MenuStyle` object and pass it to the dialogue and input meth
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\MenuStyle; use ncc\PhpSchool\CliMenu\MenuStyle;
$popupStyle = (new MenuStyle) $popupStyle = (new MenuStyle)
->setBg('green') ->setBg('green')

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Style; namespace ncc\PhpSchool\CliMenu\Style;
use PhpSchool\CliMenu\MenuItem\CheckboxItem; use ncc\PhpSchool\CliMenu\MenuItem\CheckboxItem;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
class CheckboxStyle implements ItemStyle class CheckboxStyle implements ItemStyle
{ {

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Style; namespace ncc\PhpSchool\CliMenu\Style;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
class DefaultStyle implements ItemStyle class DefaultStyle implements ItemStyle
{ {

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Style\Exception; namespace ncc\PhpSchool\CliMenu\Style\Exception;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
class InvalidStyle extends \RuntimeException class InvalidStyle extends \RuntimeException
{ {

View file

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Style; namespace ncc\PhpSchool\CliMenu\Style;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
interface ItemStyle interface ItemStyle
{ {

View file

@ -2,19 +2,19 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Style; namespace ncc\PhpSchool\CliMenu\Style;
use PhpSchool\CliMenu\MenuItem\AsciiArtItem; use ncc\PhpSchool\CliMenu\MenuItem\AsciiArtItem;
use PhpSchool\CliMenu\MenuItem\CheckboxItem; use ncc\PhpSchool\CliMenu\MenuItem\CheckboxItem;
use PhpSchool\CliMenu\MenuItem\LineBreakItem; use ncc\PhpSchool\CliMenu\MenuItem\LineBreakItem;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
use PhpSchool\CliMenu\MenuItem\MenuMenuItem; use ncc\PhpSchool\CliMenu\MenuItem\MenuMenuItem;
use PhpSchool\CliMenu\MenuItem\RadioItem; use ncc\PhpSchool\CliMenu\MenuItem\RadioItem;
use PhpSchool\CliMenu\MenuItem\SelectableItem; use ncc\PhpSchool\CliMenu\MenuItem\SelectableItem;
use PhpSchool\CliMenu\MenuItem\SplitItem; use ncc\PhpSchool\CliMenu\MenuItem\SplitItem;
use PhpSchool\CliMenu\MenuItem\StaticItem; use ncc\PhpSchool\CliMenu\MenuItem\StaticItem;
use PhpSchool\CliMenu\Style\Exception\InvalidStyle; use ncc\PhpSchool\CliMenu\Style\Exception\InvalidStyle;
use function PhpSchool\CliMenu\Util\mapWithKeys; use function ncc\PhpSchool\CliMenu\Util\mapWithKeys;
class Locator class Locator
{ {

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Style; namespace ncc\PhpSchool\CliMenu\Style;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
use PhpSchool\CliMenu\MenuItem\RadioItem; use ncc\PhpSchool\CliMenu\MenuItem\RadioItem;
class RadioStyle implements ItemStyle class RadioStyle implements ItemStyle
{ {

View file

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Style; namespace ncc\PhpSchool\CliMenu\Style;
use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface;
class SelectableStyle implements ItemStyle class SelectableStyle implements ItemStyle
{ {

View file

@ -1,12 +1,12 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Terminal; namespace ncc\PhpSchool\CliMenu\Terminal;
use PhpSchool\Terminal\IO\ResourceInputStream; use ncc\PhpSchool\Terminal\IO\ResourceInputStream;
use PhpSchool\Terminal\IO\ResourceOutputStream; use ncc\PhpSchool\Terminal\IO\ResourceOutputStream;
use PhpSchool\Terminal\Terminal; use ncc\PhpSchool\Terminal\Terminal;
use PhpSchool\Terminal\UnixTerminal; use ncc\PhpSchool\Terminal\UnixTerminal;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -7,16 +7,16 @@ or backwards compatibility (BC) breakages occur.
### BC breaks ### BC breaks
* Trait `PhpSchool\CliMenu\MenuItem\SelectableTrait` was removed. Copy the old code into your menu item * Trait `ncc\PhpSchool\CliMenu\MenuItem\SelectableTrait` was removed. Copy the old code into your menu item
if you need it. if you need it.
* Methods `PhpSchool\CliMenu\Builder\CliMenuBuilder#setUnselectedMarker()` & `PhpSchool\CliMenu\Builder\CliMenuBuilder#setSelectedMarker()` were removed. * Methods `ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder#setUnselectedMarker()` & `ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder#setSelectedMarker()` were removed.
Customise markers on the individual item styles: Customise markers on the individual item styles:
```php ```php
<?php <?php
use PhpSchool\CliMenu\Builder\CliMenuBuilder; use ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\Style\SelectableStyle; use ncc\PhpSchool\CliMenu\Style\SelectableStyle;
$menu = (new CliMenuBuilder) $menu = (new CliMenuBuilder)
->modifySelectableStyle(function (SelectableStyle $style) { ->modifySelectableStyle(function (SelectableStyle $style) {
@ -29,25 +29,25 @@ or backwards compatibility (BC) breakages occur.
}) })
->build(); ->build();
``` ```
* Method getStyle() was added to interface PhpSchool\CliMenu\MenuItem\MenuItemInterface. Items must now implement this * Method getStyle() was added to interface ncc\PhpSchool\CliMenu\MenuItem\MenuItemInterface. Items must now implement this
method. For selectable items use `\PhpSchool\CliMenu\Style\SelectableStyle` or a subclass of. For static items use method. For selectable items use `\ncc\PhpSchool\CliMenu\Style\SelectableStyle` or a subclass of. For static items use
`\PhpSchool\CliMenu\Style\DefaultStyle` or a subclass of. `\ncc\PhpSchool\CliMenu\Style\DefaultStyle` or a subclass of.
* `PhpSchool\CliMenu\MenuStyle` marker methods have been removed. If you were using these directly. Operate on the item * `ncc\PhpSchool\CliMenu\MenuStyle` marker methods have been removed. If you were using these directly. Operate on the item
style object instead. style object instead.
## 3.0.0 ## 3.0.0
### BC breaks ### BC breaks
* Class `PhpSchool\CliMenu\CliMenuBuilder` has been moved, use * Class `ncc\PhpSchool\CliMenu\CliMenuBuilder` has been moved, use
`PhpSchool\CliMenu\Builder\CliMenuBuilder` instead. Please migrate to the new namespace. `ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder` instead. Please migrate to the new namespace.
* `PhpSchool\CliMenu\Builder\CliMenuBuilder#addSubMenu` now takes a text and a closure used to configure the submenu. The callback * `ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder#addSubMenu` now takes a text and a closure used to configure the submenu. The callback
invoked with a new instance of `PhpSchool\CliMenu\Builder\CliMenuBuilder` as a parameter. `addSubMenu` now returns itself instead of invoked with a new instance of `ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder` as a parameter. `addSubMenu` now returns itself instead of
the sub menu `PhpSchool\CliMenu\Builder\CliMenuBuilder`. See below for upgrade example. the sub menu `ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder`. See below for upgrade example.
* Removed `PhpSchool\CliMenu\Terminal` namespace, the code has been migrated to the `php-school/terminal` package and is * Removed `ncc\PhpSchool\CliMenu\Terminal` namespace, the code has been migrated to the `php-school/terminal` package and is
largely modified. largely modified.
* Removed methods `setTerminal`, `getSubMenu`, `getMenuStyle` and `end` from `PhpSchool\CliMenu\CliMenuBuilder`. * Removed methods `setTerminal`, `getSubMenu`, `getMenuStyle` and `end` from `ncc\PhpSchool\CliMenu\CliMenuBuilder`.
* Removed static method `getDefaultStyleValues` on `PhpSchool\CliMenu\MenuStyle`. * Removed static method `getDefaultStyleValues` on `ncc\PhpSchool\CliMenu\MenuStyle`.
#### Migrating to new `addSubMenu` method in `CliMenuBuilder` #### Migrating to new `addSubMenu` method in `CliMenuBuilder`
@ -57,8 +57,8 @@ Previous code:
```php ```php
<?php <?php
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\CliMenuBuilder; use ncc\PhpSchool\CliMenu\CliMenuBuilder;
require_once(__DIR__ . '/../vendor/autoload.php'); require_once(__DIR__ . '/../vendor/autoload.php');
@ -87,8 +87,8 @@ Would now become:
```php ```php
<?php <?php
use PhpSchool\CliMenu\CliMenu; use ncc\PhpSchool\CliMenu\CliMenu;
use \PhpSchool\CliMenu\Builder\CliMenuBuilder; use \ncc\PhpSchool\CliMenu\Builder\CliMenuBuilder;
require_once(__DIR__ . '/../vendor/autoload.php'); require_once(__DIR__ . '/../vendor/autoload.php');

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Util; namespace ncc\PhpSchool\CliMenu\Util;
function mapWithKeys(array $array, callable $callback) : array function mapWithKeys(array $array, callable $callback) : array
{ {

View file

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Util; namespace ncc\PhpSchool\CliMenu\Util;
class Collection class Collection
{ {

View file

@ -1,10 +1,10 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Util; namespace ncc\PhpSchool\CliMenu\Util;
use Assert\Assertion; use Assert\Assertion;
use PhpSchool\Terminal\Terminal; use ncc\PhpSchool\Terminal\Terminal;
class ColourUtil class ColourUtil
{ {

View file

@ -1,7 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace PhpSchool\CliMenu\Util; namespace ncc\PhpSchool\CliMenu\Util;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal\Exception; namespace ncc\PhpSchool\Terminal\Exception;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal\IO; namespace ncc\PhpSchool\Terminal\IO;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal\IO; namespace ncc\PhpSchool\Terminal\IO;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal\IO; namespace ncc\PhpSchool\Terminal\IO;
/** /**
* @author Aydin Hassan <aydin@hotmail.co.uk> * @author Aydin Hassan <aydin@hotmail.co.uk>

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal\IO; namespace ncc\PhpSchool\Terminal\IO;
use function is_resource; use function is_resource;
use function get_resource_type; use function get_resource_type;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal\IO; namespace ncc\PhpSchool\Terminal\IO;
use function is_resource; use function is_resource;
use function get_resource_type; use function get_resource_type;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal; namespace ncc\PhpSchool\Terminal;
use function in_array; use function in_array;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal; namespace ncc\PhpSchool\Terminal;
/** /**
* This class takes a terminal and disabled canonical mode. It reads the input * This class takes a terminal and disabled canonical mode. It reads the input

View file

@ -1,6 +1,6 @@
<?php <?php
namespace PhpSchool\Terminal; namespace ncc\PhpSchool\Terminal;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -1,10 +1,10 @@
<?php <?php
namespace PhpSchool\Terminal; namespace ncc\PhpSchool\Terminal;
use PhpSchool\Terminal\Exception\NotInteractiveTerminal; use ncc\PhpSchool\Terminal\Exception\NotInteractiveTerminal;
use PhpSchool\Terminal\IO\InputStream; use ncc\PhpSchool\Terminal\IO\InputStream;
use PhpSchool\Terminal\IO\OutputStream; use ncc\PhpSchool\Terminal\IO\OutputStream;
/** /**
* @author Michael Woodward <mikeymike.mw@gmail.com> * @author Michael Woodward <mikeymike.mw@gmail.com>

View file

@ -21,49 +21,49 @@ spl_autoload_register(
'ncc\\objects\\projectconfiguration\\project' => '/Objects/ProjectConfiguration/Project.php', 'ncc\\objects\\projectconfiguration\\project' => '/Objects/ProjectConfiguration/Project.php',
'ncc\\utilities\\functions' => '/Utilities/Functions.php', 'ncc\\utilities\\functions' => '/Utilities/Functions.php',
'ncc\\utilities\\validate' => '/Utilities/Validate.php', 'ncc\\utilities\\validate' => '/Utilities/Validate.php',
'phpschool\\climenu\\action\\exitaction' => '/ThirdParty/php-school/cli-menu/Action/ExitAction.php', 'ncc\PhpSchool\\climenu\\action\\exitaction' => '/ThirdParty/php-school/cli-menu/Action/ExitAction.php',
'phpschool\\climenu\\action\\gobackaction' => '/ThirdParty/php-school/cli-menu/Action/GoBackAction.php', 'ncc\PhpSchool\\climenu\\action\\gobackaction' => '/ThirdParty/php-school/cli-menu/Action/GoBackAction.php',
'phpschool\\climenu\\builder\\climenubuilder' => '/ThirdParty/php-school/cli-menu/Builder/CliMenuBuilder.php', 'ncc\PhpSchool\\climenu\\builder\\climenubuilder' => '/ThirdParty/php-school/cli-menu/Builder/CliMenuBuilder.php',
'phpschool\\climenu\\builder\\splititembuilder' => '/ThirdParty/php-school/cli-menu/Builder/SplitItemBuilder.php', 'ncc\PhpSchool\\climenu\\builder\\splititembuilder' => '/ThirdParty/php-school/cli-menu/Builder/SplitItemBuilder.php',
'phpschool\\climenu\\climenu' => '/ThirdParty/php-school/cli-menu/CliMenu.php', 'ncc\PhpSchool\\climenu\\climenu' => '/ThirdParty/php-school/cli-menu/CliMenu.php',
'phpschool\\climenu\\dialogue\\cancellableconfirm' => '/ThirdParty/php-school/cli-menu/Dialogue/CancellableConfirm.php', 'ncc\PhpSchool\\climenu\\dialogue\\cancellableconfirm' => '/ThirdParty/php-school/cli-menu/Dialogue/CancellableConfirm.php',
'phpschool\\climenu\\dialogue\\confirm' => '/ThirdParty/php-school/cli-menu/Dialogue/Confirm.php', 'ncc\PhpSchool\\climenu\\dialogue\\confirm' => '/ThirdParty/php-school/cli-menu/Dialogue/Confirm.php',
'phpschool\\climenu\\dialogue\\dialogue' => '/ThirdParty/php-school/cli-menu/Dialogue/Dialogue.php', 'ncc\PhpSchool\\climenu\\dialogue\\dialogue' => '/ThirdParty/php-school/cli-menu/Dialogue/Dialogue.php',
'phpschool\\climenu\\dialogue\\flash' => '/ThirdParty/php-school/cli-menu/Dialogue/Flash.php', 'ncc\PhpSchool\\climenu\\dialogue\\flash' => '/ThirdParty/php-school/cli-menu/Dialogue/Flash.php',
'phpschool\\climenu\\exception\\cannotshrinkmenuexception' => '/ThirdParty/php-school/cli-menu/Exception/CannotShrinkMenuException.php', 'ncc\PhpSchool\\climenu\\exception\\cannotshrinkmenuexception' => '/ThirdParty/php-school/cli-menu/Exception/CannotShrinkMenuException.php',
'phpschool\\climenu\\exception\\invalidshortcutexception' => '/ThirdParty/php-school/cli-menu/Exception/InvalidShortcutException.php', 'ncc\PhpSchool\\climenu\\exception\\invalidshortcutexception' => '/ThirdParty/php-school/cli-menu/Exception/InvalidShortcutException.php',
'phpschool\\climenu\\exception\\invalidterminalexception' => '/ThirdParty/php-school/cli-menu/Exception/InvalidTerminalException.php', 'ncc\PhpSchool\\climenu\\exception\\invalidterminalexception' => '/ThirdParty/php-school/cli-menu/Exception/InvalidTerminalException.php',
'phpschool\\climenu\\exception\\menunotopenexception' => '/ThirdParty/php-school/cli-menu/Exception/MenuNotOpenException.php', 'ncc\PhpSchool\\climenu\\exception\\menunotopenexception' => '/ThirdParty/php-school/cli-menu/Exception/MenuNotOpenException.php',
'phpschool\\climenu\\frame' => '/ThirdParty/php-school/cli-menu/Frame.php', 'ncc\PhpSchool\\climenu\\frame' => '/ThirdParty/php-school/cli-menu/Frame.php',
'phpschool\\climenu\\input\\input' => '/ThirdParty/php-school/cli-menu/Input/Input.php', 'ncc\PhpSchool\\climenu\\input\\input' => '/ThirdParty/php-school/cli-menu/Input/Input.php',
'phpschool\\climenu\\input\\inputio' => '/ThirdParty/php-school/cli-menu/Input/InputIO.php', 'ncc\PhpSchool\\climenu\\input\\inputio' => '/ThirdParty/php-school/cli-menu/Input/InputIO.php',
'phpschool\\climenu\\input\\inputresult' => '/ThirdParty/php-school/cli-menu/Input/InputResult.php', 'ncc\PhpSchool\\climenu\\input\\inputresult' => '/ThirdParty/php-school/cli-menu/Input/InputResult.php',
'phpschool\\climenu\\input\\number' => '/ThirdParty/php-school/cli-menu/Input/Number.php', 'ncc\PhpSchool\\climenu\\input\\number' => '/ThirdParty/php-school/cli-menu/Input/Number.php',
'phpschool\\climenu\\input\\password' => '/ThirdParty/php-school/cli-menu/Input/Password.php', 'ncc\PhpSchool\\climenu\\input\\password' => '/ThirdParty/php-school/cli-menu/Input/Password.php',
'phpschool\\climenu\\input\\text' => '/ThirdParty/php-school/cli-menu/Input/Text.php', 'ncc\PhpSchool\\climenu\\input\\text' => '/ThirdParty/php-school/cli-menu/Input/Text.php',
'phpschool\\climenu\\menuitem\\asciiartitem' => '/ThirdParty/php-school/cli-menu/MenuItem/AsciiArtItem.php', 'ncc\PhpSchool\\climenu\\menuitem\\asciiartitem' => '/ThirdParty/php-school/cli-menu/MenuItem/AsciiArtItem.php',
'phpschool\\climenu\\menuitem\\checkboxitem' => '/ThirdParty/php-school/cli-menu/MenuItem/CheckboxItem.php', 'ncc\PhpSchool\\climenu\\menuitem\\checkboxitem' => '/ThirdParty/php-school/cli-menu/MenuItem/CheckboxItem.php',
'phpschool\\climenu\\menuitem\\linebreakitem' => '/ThirdParty/php-school/cli-menu/MenuItem/LineBreakItem.php', 'ncc\PhpSchool\\climenu\\menuitem\\linebreakitem' => '/ThirdParty/php-school/cli-menu/MenuItem/LineBreakItem.php',
'phpschool\\climenu\\menuitem\\menuiteminterface' => '/ThirdParty/php-school/cli-menu/MenuItem/MenuItemInterface.php', 'ncc\PhpSchool\\climenu\\menuitem\\menuiteminterface' => '/ThirdParty/php-school/cli-menu/MenuItem/MenuItemInterface.php',
'phpschool\\climenu\\menuitem\\menumenuitem' => '/ThirdParty/php-school/cli-menu/MenuItem/MenuMenuItem.php', 'ncc\PhpSchool\\climenu\\menuitem\\menumenuitem' => '/ThirdParty/php-school/cli-menu/MenuItem/MenuMenuItem.php',
'phpschool\\climenu\\menuitem\\propagatesstyles' => '/ThirdParty/php-school/cli-menu/MenuItem/PropagatesStyles.php', 'ncc\PhpSchool\\climenu\\menuitem\\propagatesstyles' => '/ThirdParty/php-school/cli-menu/MenuItem/PropagatesStyles.php',
'phpschool\\climenu\\menuitem\\radioitem' => '/ThirdParty/php-school/cli-menu/MenuItem/RadioItem.php', 'ncc\PhpSchool\\climenu\\menuitem\\radioitem' => '/ThirdParty/php-school/cli-menu/MenuItem/RadioItem.php',
'phpschool\\climenu\\menuitem\\selectableitem' => '/ThirdParty/php-school/cli-menu/MenuItem/SelectableItem.php', 'ncc\PhpSchool\\climenu\\menuitem\\selectableitem' => '/ThirdParty/php-school/cli-menu/MenuItem/SelectableItem.php',
'phpschool\\climenu\\menuitem\\selectableitemrenderer' => '/ThirdParty/php-school/cli-menu/MenuItem/SelectableItemRenderer.php', 'ncc\PhpSchool\\climenu\\menuitem\\selectableitemrenderer' => '/ThirdParty/php-school/cli-menu/MenuItem/SelectableItemRenderer.php',
'phpschool\\climenu\\menuitem\\splititem' => '/ThirdParty/php-school/cli-menu/MenuItem/SplitItem.php', 'ncc\PhpSchool\\climenu\\menuitem\\splititem' => '/ThirdParty/php-school/cli-menu/MenuItem/SplitItem.php',
'phpschool\\climenu\\menuitem\\staticitem' => '/ThirdParty/php-school/cli-menu/MenuItem/StaticItem.php', 'ncc\PhpSchool\\climenu\\menuitem\\staticitem' => '/ThirdParty/php-school/cli-menu/MenuItem/StaticItem.php',
'phpschool\\climenu\\menustyle' => '/ThirdParty/php-school/cli-menu/MenuStyle.php', 'ncc\PhpSchool\\climenu\\menustyle' => '/ThirdParty/php-school/cli-menu/MenuStyle.php',
'phpschool\\climenu\\style\\checkboxstyle' => '/ThirdParty/php-school/cli-menu/Style/CheckboxStyle.php', 'ncc\PhpSchool\\climenu\\style\\checkboxstyle' => '/ThirdParty/php-school/cli-menu/Style/CheckboxStyle.php',
'phpschool\\climenu\\style\\defaultstyle' => '/ThirdParty/php-school/cli-menu/Style/DefaultStyle.php', 'ncc\PhpSchool\\climenu\\style\\defaultstyle' => '/ThirdParty/php-school/cli-menu/Style/DefaultStyle.php',
'phpschool\\climenu\\style\\exception\\invalidstyle' => '/ThirdParty/php-school/cli-menu/Style/Exception/InvalidStyle.php', 'ncc\PhpSchool\\climenu\\style\\exception\\invalidstyle' => '/ThirdParty/php-school/cli-menu/Style/Exception/InvalidStyle.php',
'phpschool\\climenu\\style\\itemstyle' => '/ThirdParty/php-school/cli-menu/Style/ItemStyle.php', 'ncc\PhpSchool\\climenu\\style\\itemstyle' => '/ThirdParty/php-school/cli-menu/Style/ItemStyle.php',
'phpschool\\climenu\\style\\locator' => '/ThirdParty/php-school/cli-menu/Style/Locator.php', 'ncc\PhpSchool\\climenu\\style\\locator' => '/ThirdParty/php-school/cli-menu/Style/Locator.php',
'phpschool\\climenu\\style\\radiostyle' => '/ThirdParty/php-school/cli-menu/Style/RadioStyle.php', 'ncc\PhpSchool\\climenu\\style\\radiostyle' => '/ThirdParty/php-school/cli-menu/Style/RadioStyle.php',
'phpschool\\climenu\\style\\selectablestyle' => '/ThirdParty/php-school/cli-menu/Style/SelectableStyle.php', 'ncc\PhpSchool\\climenu\\style\\selectablestyle' => '/ThirdParty/php-school/cli-menu/Style/SelectableStyle.php',
'phpschool\\climenu\\terminal\\terminalfactory' => '/ThirdParty/php-school/cli-menu/Terminal/TerminalFactory.php', 'ncc\PhpSchool\\climenu\\terminal\\terminalfactory' => '/ThirdParty/php-school/cli-menu/Terminal/TerminalFactory.php',
'phpschool\\climenu\\util\\collection' => '/ThirdParty/php-school/cli-menu/Util/Collection.php', 'ncc\PhpSchool\\climenu\\util\\collection' => '/ThirdParty/php-school/cli-menu/Util/Collection.php',
'phpschool\\climenu\\util\\colourutil' => '/ThirdParty/php-school/cli-menu/Util/ColourUtil.php', 'ncc\PhpSchool\\climenu\\util\\colourutil' => '/ThirdParty/php-school/cli-menu/Util/ColourUtil.php',
'phpschool\\climenu\\util\\stringutil' => '/ThirdParty/php-school/cli-menu/Util/StringUtil.php', 'ncc\PhpSchool\\climenu\\util\\stringutil' => '/ThirdParty/php-school/cli-menu/Util/StringUtil.php',
'ncc\Symfony\\component\\nccprocess\\exception\\exceptioninterface' => '/ThirdParty/Symfony/Process/Exception/ExceptionInterface.php', 'ncc\Symfony\\component\\nccprocess\\exception\\exceptioninterface' => '/ThirdParty/Symfony/Process/Exception/ExceptionInterface.php',
'ncc\Symfony\\component\\nccprocess\\exception\\invalidargumentexception' => '/ThirdParty/Symfony/Process/Exception/InvalidArgumentException.php', 'ncc\Symfony\\component\\nccprocess\\exception\\invalidargumentexception' => '/ThirdParty/Symfony/Process/Exception/InvalidArgumentException.php',
'ncc\Symfony\\component\\nccprocess\\exception\\logicexception' => '/ThirdParty/Symfony/Process/Exception/LogicException.php', 'ncc\Symfony\\component\\nccprocess\\exception\\logicexception' => '/ThirdParty/Symfony/Process/Exception/LogicException.php',