diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 011ba22..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-vendor-bin/**/composer.lock binary
diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml
new file mode 100644
index 0000000..a269994
--- /dev/null
+++ b/.github/workflows/cs.yml
@@ -0,0 +1,37 @@
+on:
+ pull_request:
+
+name: Coding Standards
+
+jobs:
+ phpstan:
+ name: PHP CS
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.4
+ tools: composer
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --prefer-dist
+
+ - name: PHP-CS-Fixer
+ run: vendor/bin/php-cs-fixer fix --dry-run -v
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
new file mode 100644
index 0000000..31f3146
--- /dev/null
+++ b/.github/workflows/static-analysis.yml
@@ -0,0 +1,37 @@
+on:
+ pull_request:
+
+name: Static Analysis
+
+jobs:
+ phpstan:
+ name: PHPStan
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.4
+ tools: composer
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --prefer-dist
+
+ - name: PHPStan
+ run: vendor/bin/phpstan
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..1e78057
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,90 @@
+name: Unit Tests
+
+on:
+ push:
+ branches:
+ - master
+ pull_request: ~
+
+jobs:
+ unit-test:
+ name: Unit ( PHP ${{ matrix.php }} )
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - php: 7.2
+ - php: 7.3
+ - php: 7.4
+ - php: 8.0
+ - php: 8.1
+ - php: 8.2
+ - php: 8.3
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: opcache
+ tools: composer
+
+ - name: Get composer cache directory
+ id: composercache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composercache.outputs.dir }}
+ key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json composer.lock') }}
+ restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-
+
+ - name: Install dependencies
+ run: composer update
+
+ - name: Run unit tests
+ run: vendor/bin/phpunit
+
+ lowest:
+ name: Unit ( PHP ${{ matrix.php }} + Lowest )
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - php: 7.2
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: :xdebug
+ tools: composer
+
+ - name: Get composer cache directory
+ id: composercache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composercache.outputs.dir }}
+ key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json composer.lock') }}
+ restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-
+
+ - name: Install dependencies
+ run: composer update --prefer-lowest --prefer-stable
+
+ - name: Run unit tests
+ run: vendor/bin/phpunit
diff --git a/.gitignore b/.gitignore
index ff8cba6..ff6836c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
/vendor/
/composer.lock
/vendor-bin/**/vendor
-/.php_cs.cache
\ No newline at end of file
+/.php_cs.cache
+/src/compiled.php
+.idea
+.phpunit.result.cache
diff --git a/.php-version b/.php-version
new file mode 100644
index 0000000..5904f7a
--- /dev/null
+++ b/.php-version
@@ -0,0 +1 @@
+7.2
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 1bbaa6f..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-language: php
-
-sudo: false
-
-env:
- - COMPOSER_OPTIONS="
-
-php:
- - 7.1
-
-matrix:
- fast_finish: true
- include:
- - php: 7.1
- env:
- - COMPOSER_OPTIONS="--prefer-lowest"
- - php: 7.1
- env:
- - COMPOSER_OPTIONS="--prefer-stable"
- - php: 7.2
- # - php: 7.3 # https://github.com/travis-ci/travis-ci/issues/9717
- - php: nightly
- allow_failures:
- - php: nightly
-
-cache:
- directories:
- - $HOME/.composer/cache/files
-
-before_install:
- - composer self-update
-
-install:
- - composer update -n "$COMPOSER_OPTIONS"
-
-script:
- - vendor/bin/php-cs-fixer fix --dry-run -v
- - vendor/bin/phpunit
- - vendor/bin/phpstan analyse ./src -c phpstan.neon --level=max
diff --git a/README.md b/README.md
index f4257df..3d9cc8a 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,10 @@ Lodash-PHP is a port of the [Lodash JS library](https://lodash.com/) to PHP. It
Lodash-PHP tries to mimick lodash.js as close as possible
+# Requirements
+
+Lodash-PHP requires minimum PHP 7.2+, but the latest version of PHP is always recommended.
+
# Installation
Install Lodash-PHP through composer:
@@ -45,6 +49,7 @@ _::each([1, 2, 3], function (int $item) {
- [Math](#math)
- [Number](#number)
- [Object](#object)
+- [Seq](#seq)
- [String](#string)
- [Util](#util)
@@ -53,10 +58,12 @@ _::each([1, 2, 3], function (int $item) {
### chunk
Creates an array of elements split into groups the length of `size`.
-
If `array` can't be split evenly, the final chunk will be the remaining
elements.
+
+
+
**Arguments:**
@param array $array array The array to process.
@@ -88,6 +95,7 @@ Creates an array with all falsey values removed. The values `false`, `null`,
+
**Arguments:**
@param array $array The array to compact.
@@ -114,11 +122,13 @@ and/or values.
+
+
**Arguments:**
@param array $array The array to concatenate.
-@param mixed $values The values to concatenate.
+@param array
fred, barney, & pebbles
' + +``` +## Lang + +### eq + +Performs a comparison between two values to determine if they are equivalent. + + + + +**Arguments:** + +@param mixed $value The value to compare. + +@param mixed $other The other value to compare. + + + +**Return:** + +@return boolean Returns `true` if the values are equivalent, else `false`. + +Example: +```php + 1]; +$other = (object) ['a' => 1]; + +eq($object, $object); // => true eq($object, $other); @@ -2698,6 +3420,10 @@ DateTime objects, exception objects, SPLObjectStorage, numbers, strings, typed arrays, resources, DOM Nodes. objects are compared by their own, not inherited, enumerable properties. + + + + **Arguments:** @param mixed $value The value to compare. @@ -2732,6 +3458,8 @@ Checks if `value` is an `\Exception`, `\ParseError`, \Error`, \Throwable`, \Soap + + **Arguments:** @param mixed $value The value to check. @@ -2740,7 +3468,7 @@ Checks if `value` is an `\Exception`, `\ParseError`, \Error`, \Throwable`, \Soap **Return:** -@return bool Returns `true` if `value` is an error object, else `false`. +@return boolean Returns `true` if `value` is an error object, else `false`. Example: ```php @@ -2752,6 +3480,7 @@ isError(new \Exception()) isError(\Exception::Class) // => false + ``` ## Math @@ -2761,17 +3490,19 @@ Adds two numbers. + + **Arguments:** -@param int|float|string $augend The first number in an addition. +@param (int | float | string) $augend The first number in an addition. -@param int|float|string $addend The second number in an addition. +@param (int | float | string) $addend The second number in an addition. **Return:** -@return int|float Returns the total. +@return (int | float) Returns the total. Example: ```php @@ -2788,15 +3519,16 @@ Computes the maximum value of `array`. If `array` is empty or falsey, null is re + **Arguments:** -@param array $ array The array to iterate over. +@param (array | null) $array The array to iterate over. **Return:** -@return int|null Returns the maximum value. +@return (int | null) Returns the maximum value. Example: ```php @@ -2818,11 +3550,12 @@ the value is ranked. The iteratee is invoked with one argument: (value). + **Arguments:** @param array $array The array to iterate over. -@param callable|string $iteratee The iteratee invoked per element. +@param (callable | string) $iteratee The iteratee invoked per element. @@ -2843,6 +3576,7 @@ maxBy($objects, function($o) { return $o['n']; }); // The `property` iteratee shorthand. maxBy($objects, 'n'); // => ['n' => 2] + ``` ## Number @@ -2852,13 +3586,15 @@ Clamps `number` within the inclusive `lower` and `upper` bounds. + + **Arguments:** -@param int $ number The number to clamp. +@param int $number The number to clamp. -@param int $ lower The lower bound. +@param int $lower The lower bound. -@param int $ upper The upper bound. +@param int $upper The upper bound. @@ -2882,13 +3618,16 @@ clamp(10, -5, 5) Checks if `number` is between `start` and up to, but not including, `end`. If `end` is not specified, it's set to `start` with `start` then set to `0`. - If `start` is greater than `end` the params are swapped to support negative ranges. + + + + **Arguments:** -@param float $ number The number to check. +@param float $number The number to check. @param float $start The start of the range. @@ -2898,7 +3637,7 @@ negative ranges. **Return:** -@return bool Returns `true` if `number` is in the range, else `false`. +@return boolean Returns `true` if `number` is in the range, else `false`. Example: ```php @@ -2930,29 +3669,33 @@ inRange(-3, -2, -6) ### random Produces a random number between the inclusive `lower` and `upper` bounds. - If only one argument is provided a number between `0` and the given number is returned. If `floating` is `true`, or either `lower` or `upper` are floats, a floating-point number is returned instead of an integer. + + + + **Arguments:** -@param int|float $lower The lower bound. +@param (int | float | bool) $lower The lower bound. -@param int|float $upper The upper bound. +@param (int | float | bool) $upper The upper bound. -@param bool $floating Specify returning a floating-point number. +@param (bool | null) $floating Specify returning a floating-point number. **Return:** -@return int|float Returns the random number. +@return (int | float) Returns the random number. Example: ```php an integer between 0 and 5 @@ -2964,20 +3707,61 @@ random(5, true) random(1.2, 5.2) // => a floating-point number between 1.2 and 5.2 + ``` ## Object +### get + +Gets the value at path of object. If the resolved value is null the defaultValue is returned in its place. + + + + + + +**Arguments:** + +@param mixed $object The associative array or object to fetch value from + +@param (array | string) $path Dot separated or array of string + +@param mixed $defaultValue (optional)The value returned for unresolved or null values. + + + +**Return:** + +@return mixed Returns the resolved value. + +Example: +```php + ["key2" => ["key3" => "val1", "key4" => ""]]]; +get($sampleArray, 'key1.key2.key3'); +// => "val1" + +get($sampleArray, 'key1.key2.key5', "default"); +// => "default" + +get($sampleArray, 'key1.key2.key4', "default"); +// => "" + +``` ### pick Creates an object composed of the picked `object` properties. + **Arguments:** @param object $object The source object. -@param string|string[] $paths The property paths to pick. +@param (string | string[]) $paths The property paths to pick. @@ -2989,10 +3773,12 @@ Example: ```php 1, 'b' => '2', 'c' => 3]; pick($object, ['a', 'c']); // => (object) ['a' => 1, 'c' => 3] + ``` ### pickBy @@ -3001,9 +3787,10 @@ truthy for. The predicate is invoked with two arguments: (value, key). + **Arguments:** -@param object $object The source object. +@param (object | null) $object The source object. @param callable $predicate The function invoked per property. @@ -3017,10 +3804,54 @@ Example: ```php 1, 'b' => 'abc', 'c' => 3]; pickBy(object, 'is_numeric'); // => (object) ['a' => 1, 'c' => 3] + +``` +## Seq + +### chain + +Creates a `lodash` wrapper instance that wraps `value` with explicit method +chain sequences enabled. The result of such sequences must be unwrapped +with `->value()`. + + + + +**Arguments:** + +@param mixed $value The value to wrap. + + + +**Return:** + +@return \_ Returns the new `lodash` wrapper instance. + +Example: +```php + 'barney', 'age' => 36], +['user' => 'fred', 'age' => 40], +['user' => 'pebbles', 'age' => 1 ], +]; + +$youngest = chain($users) +->sortBy('age') +->map(function($o) { +return $o['user'] . ' is ' . $o['age']; +}) +->head() +->value(); +// => 'pebbles is 1' + ``` ## String @@ -3030,6 +3861,8 @@ Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + + **Arguments:** @param string $string The string to convert. @@ -3062,6 +3895,7 @@ to lower case. + **Arguments:** @param string $string The string to capitalize. @@ -3091,6 +3925,8 @@ letters to basic Latin letters and removing + + **Arguments:** @param string $string The string to deburr. @@ -3105,8 +3941,10 @@ Example: ```php 'deja vu' + ``` ### endsWith @@ -3114,6 +3952,7 @@ Checks if `string` ends with the given target string. + **Arguments:** @param string $string The string to inspect. @@ -3126,7 +3965,7 @@ Checks if `string` ends with the given target string. **Return:** -@return bool Returns `true` if `string` ends with `target`, else `false`. +@return boolean Returns `true` if `string` ends with `target`, else `false`. Example: ```php @@ -3148,6 +3987,7 @@ endsWith('abc', 'b', 2) Converts the characters "&", "<", ">", '"', and "'" in `string` to their corresponding HTML entities. + Though the ">" character is escaped for symmetry, characters like ">" and "/" don't need escaping in HTML and have no special meaning unless they're part of a tag or unquoted attribute value. See @@ -3158,6 +3998,9 @@ When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) to reduce XSS vectors. + + + **Arguments:** @param string $string The string to escape. @@ -3184,6 +4027,7 @@ Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", + **Arguments:** @param string $string The string to escape. @@ -3210,6 +4054,7 @@ Converts `string` to + **Arguments:** @param string $string The string to convert. @@ -3241,6 +4086,7 @@ Converts `string`, as space separated words, to lower case. + **Arguments:** @param string $string The string to convert. @@ -3272,6 +4118,7 @@ Converts the first character of `string` to lower case. + **Arguments:** @param string $string The string to convert. @@ -3297,9 +4144,12 @@ lowerFirst('FRED') ### pad Pads `string` on the left and right sides if it's shorter than `length`. - Padding characters are truncated if they can't be evenly divided by `length`. + + + + **Arguments:** @param string $string The string to pad. @@ -3336,6 +4186,8 @@ characters are truncated if they exceed `length`. + + **Arguments:** @param string $string The string to pad. @@ -3372,6 +4224,7 @@ characters are truncated if they exceed `length`. +s **Arguments:** @param string $string ='' The string to pad. @@ -3399,7 +4252,7 @@ padStart('abc', 6, '_-') padStart('abc', 2) // => 'abc' -s + ``` ### parseInt @@ -3410,9 +4263,13 @@ hexadecimal, in which case a `radix` of `16` is used. **Note:** This method uses PHP's built-in integer casting, which does not necessarily align with the [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. + + + + **Arguments:** -@param int|float|string $string The string to convert. +@param (int | float | string) $string The string to convert. @param int $radix The radix to interpret `string` by. @@ -3437,6 +4294,8 @@ Repeats the given string `n` times. + + **Arguments:** @param string $string The string to repeat. @@ -3471,13 +4330,17 @@ Replaces matches for `pattern` in `string` with `replacement`. **Note:** This method is based on [`String#replace`](https://mdn.io/String/replace). + + + + **Arguments:** @param string $string The string to modify. @param string $pattern The pattern to replace. -@param callable|string $ replacement The match replacement. +@param (callable | string) $replacement The match replacement. @@ -3500,7 +4363,6 @@ Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). - **Arguments:** @param string $string The string to convert. @@ -3515,6 +4377,7 @@ Example: ```php 'foo_bar' @@ -3523,6 +4386,7 @@ snakeCase('fooBar') snakeCase('--FOO-BAR--') // => 'foo_bar' + ``` ### split @@ -3531,9 +4395,12 @@ Splits `string` by `separator`. **Note:** This method is based on [`String#split`](https://mdn.io/String/split). + + + **Arguments:** -@param string $ string The string to split. +@param string $string The string to split. @param string $separator The separator pattern to split by. @@ -3561,6 +4428,7 @@ Converts `string` to + **Arguments:** @param string $string The string to convert. @@ -3592,6 +4460,7 @@ Checks if `string` starts with the given target string. + **Arguments:** @param string $string The string to inspect. @@ -3604,7 +4473,7 @@ Checks if `string` starts with the given target string. **Return:** -@return bool Returns `true` if `string` starts with `target`, else `false`. +@return boolean Returns `true` if `string` starts with `target`, else `false`. Example: ```php @@ -3630,16 +4499,18 @@ properties may be accessed as free variables in the template. If a setting object is given, it takes precedence over `$templateSettings` values. +RegExp $options['escape'] = _::$templateSettings['escape'] The HTML "escape" delimiter. +RegExp $options['evaluate'] = _::$templateSettings['evaluate'] The "evaluate" delimiter. +array $options['imports'] = _::$templateSettings['imports'] An object to import into the template as free variables. +RegExp $options['interpolate'] = _::$templateSettings['interpolate'] The "interpolate" delimiter. + + **Arguments:** @param string $string The template string. @param array $options The options array. -RegExp $options['escape'] = _::$templateSettings['escape'] The HTML "escape" delimiter. -RegExp $options['evaluate'] = _::$templateSettings['evaluate'] The "evaluate" delimiter. -array $options['imports'] = _::$templateSettings['imports'] An object to import into the template as free variables. -RegExp $options['interpolate'] = _::$templateSettings['interpolate'] The "interpolate" delimiter. @@ -3699,6 +4570,7 @@ Converts `string`, as a whole, to lower case + **Arguments:** @param string $string The string to convert. @@ -3730,6 +4602,7 @@ Converts `string`, as a whole, to upper case + **Arguments:** @param string $string The string to convert. @@ -3753,6 +4626,7 @@ toUpper('fooBar') toUpper('__foo_bar__') // => '__FOO_BAR__' + ``` ### trim @@ -3760,6 +4634,7 @@ Removes leading and trailing whitespace or specified characters from `string`. + **Arguments:** @param string $string The string to trim. @@ -3790,6 +4665,7 @@ Removes trailing whitespace or specified characters from `string`. + **Arguments:** @param string $string The string to trim. @@ -3806,11 +4682,13 @@ Example: ```php ' abc' trimEnd('-_-abc-_-', '_-') // => '-_-abc' + ``` ### trimStart @@ -3818,6 +4696,7 @@ Removes leading whitespace or specified characters from `string`. + **Arguments:** @param string $string The string to trim. @@ -3845,18 +4724,21 @@ trimStart('-_-abc-_-', '_-') ### truncate Truncates `string` if it's longer than the given maximum string length. - The last characters of the truncated string are replaced with the omission string which defaults to "...". + +length = 30 The maximum string length. +omission = '...' The string to indicate text is omitted. +separator The separator pattern to truncate to. + + + **Arguments:** @param string $string The string to truncate. @param array $options The options object. -length = 30 The maximum string length. -omission = '...' The string to indicate text is omitted. -separator The separator pattern to truncate to. @@ -3873,19 +4755,19 @@ truncate('hi-diddly-ho there, neighborino') // => 'hi-diddly-ho there, neighbo...' truncate('hi-diddly-ho there, neighborino', [ - 'length' => 24, - 'separator' => ' ' +'length' => 24, +'separator' => ' ' ]) // => 'hi-diddly-ho there,...' truncate('hi-diddly-ho there, neighborino', [ - 'length' => 24, - 'separator' => '/,? +/' +'length' => 24, +'separator' => '/,? +/' ]) // => 'hi-diddly-ho there...' truncate('hi-diddly-ho there, neighborino', [ - 'omission' => ' [...]' +'omission' => ' [...]' ]) // => 'hi-diddly-ho there, neig [...]' @@ -3898,6 +4780,7 @@ their corresponding characters. + **Arguments:** @param string $string The string to unescape. @@ -3922,7 +4805,6 @@ unescape('fred, barney, & pebbles') Converts `string`, as space separated words, to upper case. - **Arguments:** @param string $string The string to convert. @@ -3954,6 +4836,7 @@ Converts the first character of `string` to upper case. + **Arguments:** @param string $string The string to convert. @@ -3982,6 +4865,8 @@ Splits `string` into an array of its words. + + **Arguments:** @param string $string The string to inspect. @@ -4015,17 +4900,19 @@ object. Any additional arguments are provided to `func` when it's invoked. + +s **Arguments:** @param callable $func The function to attempt. -@param array $args The arguments to invoke `func` with. +@param array((.|\n)*?)
#', $readme[$category][$function], $matches)) {
+
+ $readme[$category][$function] = str_replace($matches[0], '', $readme[$category][$function]);
- $example = str_replace(['', '
'], '', $docblock->getTagsByName('example')[0] ?? '');
+ $example = $matches[1];
- if ($example) {
- $readme[$category][$function] .= "Example:\n```php\n\\=\" between int\\<0, max\\> and 0 is always true\\.$#"
+ count: 1
+ path: src/String/startsWith.php
+
+ -
+ message: "#^Offset mixed on \\*NEVER\\* in isset\\(\\) always exists and is not nullable\\.$#"
+ count: 1
+ path: src/internal/baseIntersection.php
+
+ -
+ message: "#^Unreachable statement \\- code above always terminates\\.$#"
+ count: 1
+ path: src/internal/isIterateeCall.php
+
diff --git a/phpstan.neon b/phpstan.neon
index 4b49f37..08970a1 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,9 +1,15 @@
+includes:
+ - phpstan-baseline.neon
+
parameters:
- bootstrap: %rootDir%/../../../../../src/bootstrap.php
- excludes_analyse:
- - %rootDir%/../../../../../src/compiled.php
- - %rootDir%/../../../../../src/Lodash.php
- - %rootDir%/../../../../../src/internal/memoizeCapped.php # Exclude internal function due to dynamic class usage
+ paths:
+ - src
+ bootstrapFiles:
+ - src/bootstrap.php
+ level: 5
+ excludePaths:
+ - src/compiled.php
+ - src/Lodash.php
+ - src/internal/memoizeCapped.php # Exclude internal function due to dynamic class usage
ignoreErrors:
- - '#PHPDoc tag \@param references unknown parameter \$(comparator|iteratee)#'
- - "#Callable '.*internal.*' invoked with \\d+ parameters, [\\d-]+ required.#"
+ - "#^PHPDoc tag \\@param references unknown parameter\\: \\$[a-zA-Z]+$#"
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 3c500fe..192a663 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,8 +1,7 @@
* flatten([1, [2, [3, [4]], 5]])
* // => [1, 2, [3, [4]], 5]
+ *
*/
function flatten(array $array = null): array
{
diff --git a/src/Array/initial.php b/src/Array/initial.php
index 5f25bab..8368454 100644
--- a/src/Array/initial.php
+++ b/src/Array/initial.php
@@ -20,9 +20,10 @@
*
* @return array the slice of `array`.
* @example
- *
+ *
* initial([1, 2, 3])
* // => [1, 2]
+ *
*/
function initial(array $array): array
{
diff --git a/src/Array/nth.php b/src/Array/nth.php
index 32d142c..4b037fa 100644
--- a/src/Array/nth.php
+++ b/src/Array/nth.php
@@ -22,7 +22,7 @@
*
* @return mixed Returns the nth element of `array`.
* @example
- *
+ *
* $array = ['a', 'b', 'c', 'd']
*
* nth($array, 1)
@@ -30,6 +30,7 @@
*
* nth($array, -2)
* // => 'c'
+ *
*/
function nth(array $array, int $n)
{
diff --git a/src/Array/pullAllBy.php b/src/Array/pullAllBy.php
index b1e458f..5e50a76 100644
--- a/src/Array/pullAllBy.php
+++ b/src/Array/pullAllBy.php
@@ -29,12 +29,13 @@
*
* @return array `array`.
* @example
- *
+ *
* $array = [[ 'x' => 1 ], [ 'x' => 2 ], [ 'x' => 3 ], [ 'x' => 1 ]]
*
* pullAllBy($array, [[ 'x' => 1 ], [ 'x' => 3 ]], 'x')
* var_dump($array)
* // => [[ 'x' => 2 ]]
+ *
*/
function pullAllBy(array &$array, array $values, $iteratee): array
{
diff --git a/src/Array/remove.php b/src/Array/remove.php
index 70ff6cc..a939bf5 100644
--- a/src/Array/remove.php
+++ b/src/Array/remove.php
@@ -26,7 +26,7 @@
*
* @return array the new array of removed elements.
* @example
- *
+ *
* $array = [1, 2, 3, 4]
* $evens = remove($array, function ($n) { return $n % 2 === 0; })
*
@@ -35,6 +35,7 @@
*
* var_dump($evens)
* // => [2, 4]
+ *
*/
function remove(array &$array, callable $predicate): array
{
diff --git a/src/Array/without.php b/src/Array/without.php
index 1528bef..7976e97 100644
--- a/src/Array/without.php
+++ b/src/Array/without.php
@@ -34,5 +34,5 @@
*/
function without(array $array, ...$values): array
{
- return baseRest('\_\difference')($array, $values);
+ return baseRest('\_\difference')($array, ...$values);
}
diff --git a/src/Array/zip.php b/src/Array/zip.php
index b234e4c..24c8cbd 100644
--- a/src/Array/zip.php
+++ b/src/Array/zip.php
@@ -31,5 +31,5 @@
*/
function zip(array ...$arrays): array
{
- return baseRest('\_\unzip')($arrays);
+ return baseRest('\_\unzip')(...$arrays);
}
diff --git a/src/Collection/filter.php b/src/Collection/filter.php
index da32f12..3c3b9bf 100644
--- a/src/Collection/filter.php
+++ b/src/Collection/filter.php
@@ -62,7 +62,5 @@ function ($value, $key) use ($array, $iteratee) {
\ARRAY_FILTER_USE_BOTH
);
- \sort($result);
-
- return $result;
+ return \array_values($result);
}
diff --git a/src/Collection/findLast.php b/src/Collection/findLast.php
index 27c653e..2e7cb05 100644
--- a/src/Collection/findLast.php
+++ b/src/Collection/findLast.php
@@ -29,7 +29,7 @@
*
* findLast([1, 2, 3, 4], function ($n) { return $n % 2 == 1; })
* // => 3
- *
+ *
*/
function findLast(iterable $collection, $predicate = null, int $fromIndex = 0)
{
diff --git a/src/Collection/invokeMap.php b/src/Collection/invokeMap.php
index e4a413f..b5b4ddd 100644
--- a/src/Collection/invokeMap.php
+++ b/src/Collection/invokeMap.php
@@ -47,5 +47,5 @@ function invokeMap(iterable $collection, $path, array $args = []): array
});
return $result;
- })($collection, $path, $args);
+ })($collection, $path, ...$args);
}
diff --git a/src/Collection/partition.php b/src/Collection/partition.php
index 36b1353..ac4eae5 100644
--- a/src/Collection/partition.php
+++ b/src/Collection/partition.php
@@ -26,7 +26,7 @@
*
* @return array the array of grouped elements.
* @example
- *
+ *
* $users = [
* ['user' => 'barney', 'age' => 36, 'active' => false],
* ['user' => 'fred', 'age' => 40, 'active' => true],
@@ -35,6 +35,7 @@
*
* partition($users, function($user) { return $user['active']; })
* // => objects for [['fred'], ['barney', 'pebbles']]
+ *
*/
function partition(iterable $collection, $predicate = null): array
{
diff --git a/src/Collection/reduceRight.php b/src/Collection/reduceRight.php
index 9b3ff4b..8a51c16 100644
--- a/src/Collection/reduceRight.php
+++ b/src/Collection/reduceRight.php
@@ -32,6 +32,7 @@
*
* reduceRight(array, (flattened, other) => flattened.concat(other), [])
* // => [4, 5, 2, 3, 0, 1]
+ *
*/
function reduceRight(iterable $collection, $iteratee, $accumulator = null)
{
diff --git a/src/Collection/sampleSize.php b/src/Collection/sampleSize.php
index 684cf2e..199842a 100644
--- a/src/Collection/sampleSize.php
+++ b/src/Collection/sampleSize.php
@@ -22,12 +22,13 @@
*
* @return array the random elements.
* @example
- *
+ *
* sampleSize([1, 2, 3], 2)
* // => [3, 1]
*
* sampleSize([1, 2, 3], 4)
* // => [2, 3, 1]
+ *
*/
function sampleSize(array $array, int $n = 1): array
{
diff --git a/src/Collection/shuffle.php b/src/Collection/shuffle.php
index 353c16c..5dc4242 100644
--- a/src/Collection/shuffle.php
+++ b/src/Collection/shuffle.php
@@ -20,9 +20,10 @@
*
* @return array the new shuffled array.
* @example
- *
+ *
* shuffle([1, 2, 3, 4])
* // => [4, 1, 3, 2]
+ *
*/
function shuffle(array $array = []): array
{
diff --git a/src/Collection/size.php b/src/Collection/size.php
index 91aa57b..5116e9e 100644
--- a/src/Collection/size.php
+++ b/src/Collection/size.php
@@ -21,7 +21,7 @@
*
* @return int Returns the collection size.
* @example
- *
+ *
* size([1, 2, 3]);
* // => 3
*
@@ -30,6 +30,7 @@
*
* size('pebbles');
* // => 7
+ *
*/
function size($collection): int
{
diff --git a/src/Collection/sortBy.php b/src/Collection/sortBy.php
index 0bfc361..0e2e41c 100644
--- a/src/Collection/sortBy.php
+++ b/src/Collection/sortBy.php
@@ -47,7 +47,7 @@ function sortBy($collection, $iteratees): array
return [];
};
- if (\is_callable($iteratees)) {
+ if (\is_callable($iteratees) || !\is_iterable($iteratees)) {
$iteratees = [$iteratees];
}
diff --git a/src/Function/after.php b/src/Function/after.php
new file mode 100644
index 0000000..6a972c1
--- /dev/null
+++ b/src/Function/after.php
@@ -0,0 +1,46 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * The opposite of `before`; this method creates a function that invokes
+ * `func` once it's called `n` or more times.
+ *
+ * @category Function
+ *
+ * @param int $n The number of calls before `func` is invoked.
+ * @param Callable $func The function to restrict.
+ *
+ * @return Callable Returns the new restricted function.
+ *
+ * @example
+ *
+ * $saves = ['profile', 'settings'];
+ *
+ * $done = after(count($saves), function() {
+ * echo 'done saving!';
+ * });
+ *
+ * forEach($saves, function($type) use($done) {
+ * asyncSave([ 'type' => $type, 'complete' => $done ]);
+ * });
+ * // => Prints 'done saving!' after the two async saves have completed.
+ *
+ */
+function after(int $n, callable $func): callable
+{
+ return function (...$args) use (&$n, $func) {
+ if (--$n < 1) {
+ return $func(...$args);
+ }
+ };
+}
diff --git a/src/Function/ary.php b/src/Function/ary.php
new file mode 100644
index 0000000..47d5436
--- /dev/null
+++ b/src/Function/ary.php
@@ -0,0 +1,38 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a function that invokes `func`, with up to `n` arguments,
+ * ignoring any additional arguments.
+ *
+ * @category Function
+ *
+ * @param callable $func The function to cap arguments for.
+ * @param int $n The arity cap.
+ *
+ * @return Callable Returns the new capped function.
+ *
+ * @example
+ *
+ * map(['6', '8', '10'], ary('intval', 1));
+ * // => [6, 8, 10]
+ *
+ */
+function ary(callable $func, int $n): callable
+{
+ return function (...$args) use ($func, $n) {
+ \array_splice($args, $n);
+
+ return $func(...$args);
+ };
+}
diff --git a/src/Function/before.php b/src/Function/before.php
new file mode 100644
index 0000000..1dcacd4
--- /dev/null
+++ b/src/Function/before.php
@@ -0,0 +1,44 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a function that invokes `func`, with the arguments
+ * of the created function, while it's called less than `n` times. Subsequent
+ * calls to the created function return the result of the last `func` invocation.
+ *
+ * @category Function
+ *
+ * @param int $n The number of calls at which `func` is no longer invoked.
+ * @param callable $func The function to restrict.
+ *
+ * @return callable Returns the new restricted function.
+ *
+ * @example
+ *
+ * $users = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ * $result = uniqBy(map($users, before(5, [$repository, 'find'])), 'id')
+ * // => Fetch up to 4 results.
+ *
+ */
+function before(int $n, callable $func): callable
+{
+ $result = null;
+
+ return function (...$args) use (&$result, &$n, &$func) {
+ if (--$n > 0) {
+ $result = $func(...$args);
+ }
+
+ return $result;
+ };
+}
diff --git a/src/Function/bind.php b/src/Function/bind.php
new file mode 100644
index 0000000..e69e0bd
--- /dev/null
+++ b/src/Function/bind.php
@@ -0,0 +1,47 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a function that invokes `func` with the `this` binding of `object`
+ * and `partials` prepended to the arguments it receives.
+ *
+ * @category Function
+ *
+ * @param callable $function The function to bind.
+ * @param object|mixed $object The `object` binding of `func`.
+ * @param array
+ * function greet($greeting, $punctuation) {
+ * return $greeting . ' ' . $this->user . $punctuation;
+ * }
+ *
+ * $object = $object = new class {
+ * public $user = 'fred';
+ * };
+ *
+ * $bound = bind('greet', $object, 'hi');
+ * $bound('!');
+ * // => 'hi fred!'
+ *
+ */
+function bind(callable $function, $object, ...$partials): callable
+{
+ return function (...$args) use ($object, $function, $partials) {
+ $function = \Closure::fromCallable($function)->bindTo($object, $function instanceof \Closure ? $object : null);
+
+ return $function(...array_merge($partials, $args));
+ };
+}
diff --git a/src/Function/bindKey.php b/src/Function/bindKey.php
new file mode 100644
index 0000000..636cec6
--- /dev/null
+++ b/src/Function/bindKey.php
@@ -0,0 +1,49 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a function that invokes the method `$function` of `$object` with `$partials`
+ * prepended to the arguments it receives.
+ *
+ * This method differs from `bind` by allowing bound functions to reference
+ * methods that may be redefined or don't yet exist
+ *
+ * @category Function
+ *
+ * @param object $object The object to invoke the method on.
+ * @param string $function The name of the method.
+ * @param array
+ * $object = new class {
+ * private $user = 'fred';
+ * function greet($greeting, $punctuation) {
+ * return $greeting.' '.$this->user.$punctuation;
+ * }
+ * };
+ *
+ * $bound = bindKey($object, 'greet', 'hi');
+ * $bound('!');
+ * // => 'hi fred!'
+ *
+ */
+function bindKey($object, string $function, ...$partials): callable
+{
+ return function (...$args) use ($object, $function, $partials) {
+ $function = \Closure::fromCallable([$object, $function])->bindTo($object, get_class($object));
+
+ return $function(...array_merge($partials, $args));
+ };
+}
diff --git a/src/Function/curry.php b/src/Function/curry.php
new file mode 100644
index 0000000..d4cdd1c
--- /dev/null
+++ b/src/Function/curry.php
@@ -0,0 +1,85 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a function that accepts arguments of `func` and either invokes
+ * `func` returning its result, if at least `arity` number of arguments have
+ * been provided, or returns a function that accepts the remaining `func`
+ * arguments, and so on. The arity of `func` may be specified if `func.length`
+ * is not sufficient.
+ *
+ * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
+ * may be used as a placeholder for provided arguments.
+ *
+ * **Note:** This method doesn't set the "length" property of curried functions.
+ *
+ * @category Function
+ *
+ * @param callable $func The function to curry.
+ * @param int|null $arity The arity of `func`.
+ *
+ * @return callable Returns the new curried function.
+ * @example
+ *
+ * $abc = function($a, $b, $c) {
+ * return [$a, $b, $c];
+ * };
+ *
+ * $curried = curry($abc);
+ *
+ * $curried(1)(2)(3);
+ * // => [1, 2, 3]
+ *
+ * $curried(1, 2)(3);
+ * // => [1, 2, 3]
+ *
+ * $curried(1, 2, 3);
+ * // => [1, 2, 3]
+ *
+ * // Curried with placeholders.
+ * $curried(1)(_, 3)(2);
+ * // => [1, 2, 3]
+ *
+ */
+function curry(callable $func, ?int $arity = null)
+{
+ $curry = function ($arguments) use ($func, &$curry, $arity) {
+ $requiredArguments = (new \ReflectionFunction($func))->getNumberOfParameters();
+ $arity = $arity ?? $requiredArguments;
+
+ return function (...$args) use ($func, $arguments, $curry, $arity) {
+ if (false !== \array_search(_, $arguments)) {
+ foreach ($arguments as $i => $argument) {
+ if (_ !== $argument) {
+ continue;
+ }
+
+ $arguments[$i] = current($args);
+ next($args);
+ }
+ } else {
+ $arguments = \array_merge($arguments, $args);
+ }
+
+ if ($arity <= \count(\array_filter($arguments, function ($value) {
+ return _ !== $value;
+ }))) {
+ return $func(...$arguments);
+ }
+
+ return $curry($arguments);
+ };
+ };
+
+ return $curry([]);
+}
diff --git a/src/Function/delay.php b/src/Function/delay.php
new file mode 100644
index 0000000..53418fe
--- /dev/null
+++ b/src/Function/delay.php
@@ -0,0 +1,40 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Invokes `func` after `wait` milliseconds. Any additional arguments are
+ * provided to `func` when it's invoked.
+ *
+ * @category Function
+ *
+ * @param callable $func The function to delay.
+ * @param int $wait The number of milliseconds to delay invocation.
+ * @param array
+ * delay(function($text) {
+ * echo $text;
+ * }, 1000, 'later');
+ * // => Echo 'later' after one second.
+ *
+ */
+function delay(callable $func, int $wait = 1, ...$args): int
+{
+ usleep($wait * 1000);
+
+ $func(...$args);
+
+ return 1;
+}
diff --git a/src/Function/flip.php b/src/Function/flip.php
new file mode 100644
index 0000000..91c1e33
--- /dev/null
+++ b/src/Function/flip.php
@@ -0,0 +1,41 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+use function _\internal\baseRest;
+use function _\internal\castSlice;
+
+/**
+ * Creates a function that invokes `func` with arguments reversed.
+ *
+ * @category Function
+ *
+ * @param callable $func The function to flip arguments for.
+ *
+ * @return callable Returns the new flipped function.
+ *
+ * @example
+ *
+ * $flipped = flip(function() {
+ * return func_get_args();
+ * });
+ *
+ * flipped('a', 'b', 'c', 'd');
+ * // => ['d', 'c', 'b', 'a']
+ *
+ */
+function flip(callable $func): callable
+{
+ return function (...$values) use ($func) {
+ return \array_reverse($func(...$values), false);
+ };
+}
diff --git a/src/Function/negate.php b/src/Function/negate.php
index 934cb0b..4032304 100644
--- a/src/Function/negate.php
+++ b/src/Function/negate.php
@@ -28,6 +28,7 @@
*
* filter([1, 2, 3, 4, 5, 6], negate($isEven));
* // => [1, 3, 5]
+ *
*/
function negate(callable $predicate): callable
diff --git a/src/Function/once.php b/src/Function/once.php
new file mode 100644
index 0000000..2ff0909
--- /dev/null
+++ b/src/Function/once.php
@@ -0,0 +1,36 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
+ * to the function return the value of the first invocation. The `func` is
+ * invoked with the arguments of the created function.
+ *
+ * @category Function
+ *
+ * @param callable $func The function to restrict.
+ *
+ * @return callable the new restricted function.
+ *
+ * @example
+ *
+ * $initialize = once('createApplication');
+ * $initialize();
+ * $initialize();
+ * // => `createApplication` is invoked once
+ *
+ */
+function once(callable $func): callable
+{
+ return before(2, $func);
+}
diff --git a/src/Function/overArgs.php b/src/Function/overArgs.php
new file mode 100644
index 0000000..386c27e
--- /dev/null
+++ b/src/Function/overArgs.php
@@ -0,0 +1,72 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+use function _\internal\arrayMap;
+use function _\internal\baseFlatten;
+use function _\internal\baseRest;
+use function _\internal\baseUnary;
+
+/**
+ * Creates a function that invokes `func` with its arguments transformed.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ *
+ * @param callable $func The function to wrap.
+ * @param callable[] $transforms The argument transforms.
+ *
+ * @return callable the new function.
+ *
+ * @example
+ *
+ * function doubled($n) {
+ * return $n * 2;
+ * }
+ *
+ * function square($n) {
+ * return $n * $n;
+ * }
+ *
+ * $func = overArgs(function($x, $y) {
+ * return [$x, $y];
+ * }, ['square', 'doubled']);
+ *
+ * $func(9, 3);
+ * // => [81, 6]
+ *
+ * $func(10, 5);
+ * // => [100, 10]
+ *
+ */
+function overArgs(callable $func, array $transforms): callable
+{
+ return baseRest(function ($func, $transforms) {
+ $transforms = (\count($transforms) == 1 && \is_array($transforms[0]))
+ ? arrayMap($transforms[0], baseUnary('\_\internal\baseIteratee'))
+ : arrayMap(baseFlatten($transforms, 1), baseUnary('\_\internal\baseIteratee'));
+
+ $funcsLength = \count($transforms);
+
+ return baseRest(function ($args) use ($funcsLength, $transforms, $func) {
+ $index = -1;
+ $length = \min(\count($args), $funcsLength);
+
+ while (++$index < $length) {
+ $args[$index] = $transforms[$index]($args[$index]);
+ }
+
+ return $func(...$args);
+ });
+ })($func, $transforms);
+}
diff --git a/src/Function/partial.php b/src/Function/partial.php
new file mode 100644
index 0000000..8ada3d7
--- /dev/null
+++ b/src/Function/partial.php
@@ -0,0 +1,62 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+use function _\internal\baseRest;
+use function _\internal\shortOut;
+
+/**
+ * Creates a function that invokes `func` with `partials` prepended to the
+ * arguments it receives.
+ *
+ * @category Function
+ *
+ * @param callable $func The function to partially apply arguments to.
+ * @param array
+ * function greet($greeting, $name) {
+ * return $greeting . ' ' . $name;
+ * }
+ *
+ * $sayHelloTo = partial('greet', 'hello');
+ * $sayHelloTo('fred');
+ * // => 'hello fred'
+ *
+ */
+function partial(callable $func, ...$partials): callable
+{
+ return baseRest(function ($func, $partials) {
+ $wrapper = function () use ($func, $partials) {
+ $arguments = \func_get_args();
+ $argsIndex = -1;
+ $argsLength = \func_num_args();
+ $leftIndex = -1;
+ $leftLength = \count($partials);
+ $args = [];
+
+ while (++$leftIndex < $leftLength) {
+ $args[$leftIndex] = $partials[$leftIndex];
+ }
+ while ($argsLength--) {
+ $args[$leftIndex++] = $arguments[++$argsIndex];
+ }
+
+ return $func(...$args);
+ };
+
+ return shortOut($wrapper);
+ })($func, ...$partials);
+}
diff --git a/src/Function/rest.php b/src/Function/rest.php
new file mode 100644
index 0000000..1402941
--- /dev/null
+++ b/src/Function/rest.php
@@ -0,0 +1,42 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+use function _\internal\baseRest;
+
+/**
+ * Creates a function that invokes `func` with the `this` binding of the
+ * created function and arguments from `start` and beyond provided as
+ * an array.
+ *
+ * @category Function
+ *
+ * @param callable $func The function to apply a rest parameter to.
+ * @param int|null $start The start position of the rest parameter.
+ *
+ * @return callable Returns the new function.
+ *
+ * @example
+ *
+ * $say = rest(function($what, $names) {
+ * return $what . ' ' . implode(', ', initial($names)) .
+ * (size($names) > 1 ? ', & ' : '') . last($names);
+ * });
+ *
+ * $say('hello', 'fred', 'barney', 'pebbles');
+ * // => 'hello fred, barney, & pebbles'
+ *
+ */
+function rest(callable $func, ?int $start = null): callable
+{
+ return baseRest($func, $start);
+}
diff --git a/src/Function/spread.php b/src/Function/spread.php
new file mode 100644
index 0000000..7dfab5f
--- /dev/null
+++ b/src/Function/spread.php
@@ -0,0 +1,59 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+use function _\internal\baseRest;
+use function _\internal\castSlice;
+
+/**
+ * Creates a function that invokes `func` with the `this` binding of the
+ * create function and an array of arguments much like
+ * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
+ *
+ * **Note:** This method is based on the
+ * [spread operator](https://mdn.io/spread_operator).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.2.0
+ * @category Function
+ *
+ * @param callable $func The function to spread arguments over.
+ * @param int $start The start position of the spread.
+ *
+ * @return callable Returns the new function.
+ *
+ * @example
+ *
+ * $say = spread(function($who, $what) {
+ * return $who . ' says ' . $what;
+ * });
+ *
+ * $say(['fred', 'hello']);
+ * // => 'fred says hello'
+ *
+ */
+function spread(callable $func, ?int $start = null)
+{
+ $start = null === $start ? 0 : \max($start, 0);
+
+ return baseRest(function ($args) use ($start, $func) {
+ $array = $args[$start];
+ $otherArgs = castSlice($args, 0, $start);
+
+ if ($array) {
+ $otherArgs = \array_merge($otherArgs, $array);
+ }
+
+ return $func(...$otherArgs);
+ });
+}
diff --git a/src/Function/unary.php b/src/Function/unary.php
new file mode 100644
index 0000000..d179ba8
--- /dev/null
+++ b/src/Function/unary.php
@@ -0,0 +1,32 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a function that accepts up to one argument, ignoring any
+ * additional arguments.
+ *
+ * @category Function
+ *
+ * @param callable $func The function to cap arguments for.
+ *
+ * @return callable the new capped function.
+ * @example
+ *
+ * map(['6', '8', '10'], unary('intval'));
+ * // => [6, 8, 10]
+ *
+ */
+function unary(callable $func): callable
+{
+ return ary($func, 1);
+}
diff --git a/src/Function/wrap.php b/src/Function/wrap.php
new file mode 100644
index 0000000..84df495
--- /dev/null
+++ b/src/Function/wrap.php
@@ -0,0 +1,38 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a function that provides `value` to `wrapper` as its first
+ * argument. Any additional arguments provided to the function are appended
+ * to those provided to the `wrapper`.
+ *
+ * @category Function
+ *
+ * @param mixed $value The value to wrap.
+ * @param callable $wrapper The wrapper function.
+ *
+ * @return callable the new function.
+ * @example
+ *
+ * $p = wrap('_\escape', function($func, $text) {
+ * return '' . $func($text) . '
';
+ * });
+ *
+ * $p('fred, barney, & pebbles');
+ * // => 'fred, barney, & pebbles
'
+ *
+ */
+function wrap($value, callable $wrapper = null): callable
+{
+ return partial($wrapper ?? '\_\identity', $value);
+}
diff --git a/src/Lang/isError.php b/src/Lang/isError.php
index a31596c..0a9598f 100644
--- a/src/Lang/isError.php
+++ b/src/Lang/isError.php
@@ -27,6 +27,7 @@
*
* isError(\Exception::Class)
* // => false
+ *
*/
function isError($value): bool
{
diff --git a/src/Lodash.php b/src/Lodash.php
index 6ca5f40..08a6e01 100644
--- a/src/Lodash.php
+++ b/src/Lodash.php
@@ -11,6 +11,8 @@
final class _
{
+ public $__chain__ = false;
+
public const reInterpolate = '<%=([\s\S]+?)%>';
public const reEvaluate = "<%([\s\S]+?)%>";
public const reEscape = "<%-([\s\S]+?)%>";
@@ -44,6 +46,13 @@ final class _
],
];
+ private $value;
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+
/**
* @param string $method
* @param array $args
@@ -59,4 +68,34 @@ public static function __callStatic(string $method, array $args)
return ("_\\$method")(...$args);
}
+
+ public function __call($method, $arguments)
+ {
+ $this->value = self::__callStatic($method, \array_merge([$this->value], $arguments));
+
+ return $this;
+ }
+
+ public function value()
+ {
+ return $this->value;
+ }
+}
+
+function lodash($value): _
+{
+ return new _($value);
+}
+
+// We can't use "_" as a function name, since it collides with the "_" function in the gettext extension
+// Laravel uses a function __, so only register the alias if the function name is not in use
+if (!function_exists('__')) {
+ function __($value): _
+ {
+ return new _($value);
+ }
+}
+
+if (!defined('_')) {
+ define('_', _::class);
}
diff --git a/src/Math/maxBy.php b/src/Math/maxBy.php
index 091c5af..3127605 100644
--- a/src/Math/maxBy.php
+++ b/src/Math/maxBy.php
@@ -34,6 +34,7 @@
* // The `property` iteratee shorthand.
* maxBy($objects, 'n');
* // => ['n' => 2]
+ *
*/
function maxBy(?array $array, $iteratee)
{
diff --git a/src/Number/random.php b/src/Number/random.php
index 92b3600..8d322af 100644
--- a/src/Number/random.php
+++ b/src/Number/random.php
@@ -26,7 +26,7 @@
* @return int|float Returns the random number.
*
* @example
- *
+ *
* random(0, 5)
* // => an integer between 0 and 5
*
@@ -38,6 +38,7 @@
*
* random(1.2, 5.2)
* // => a floating-point number between 1.2 and 5.2
+ *
*/
function random($lower = null, $upper = null, $floating = null)
{
@@ -73,5 +74,5 @@ function random($lower = null, $upper = null, $floating = null)
return $lower + \abs($upper - $lower) * \mt_rand(0, $randMax) / $randMax;
}
- return \rand((int) $lower, (int) $upper);
+ return \random_int((int) $lower, (int) $upper);
}
diff --git a/src/Object/get.php b/src/Object/get.php
new file mode 100644
index 0000000..3a0c66d
--- /dev/null
+++ b/src/Object/get.php
@@ -0,0 +1,45 @@
+
+ * @copyright Copyright (c) 2019
+ */
+
+namespace _;
+
+use function _\internal\baseGet;
+
+/**
+ * Gets the value at path of object. If the resolved value is null the defaultValue is returned in its place.
+ *
+ * @category Object
+ *
+ * @param mixed $object The associative array or object to fetch value from
+ * @param array|string $path Dot separated or array of string
+ * @param mixed $defaultValue (optional)The value returned for unresolved or null values.
+ *
+ * @return mixed Returns the resolved value.
+ *
+ * @author punit-kulal
+ *
+ * @example
+ *
+ * $sampleArray = ["key1" => ["key2" => ["key3" => "val1", "key4" => ""]]];
+ * get($sampleArray, 'key1.key2.key3');
+ * // => "val1"
+ *
+ * get($sampleArray, 'key1.key2.key5', "default");
+ * // => "default"
+ *
+ * get($sampleArray, 'key1.key2.key4', "default");
+ * // => ""
+ *
+ */
+function get($object, $path, $defaultValue = null)
+{
+ return ($object !== null ? baseGet($object, $path) : null) ?? $defaultValue;
+}
diff --git a/src/Object/pick.php b/src/Object/pick.php
index 54d488c..9813514 100644
--- a/src/Object/pick.php
+++ b/src/Object/pick.php
@@ -24,15 +24,16 @@
*
* @return \stdClass Returns the new object.
* @example
- *
+ *
* $object = (object) ['a' => 1, 'b' => '2', 'c' => 3];
*
* pick($object, ['a', 'c']);
* // => (object) ['a' => 1, 'c' => 3]
+ *
*/
function pick($object, $paths): \stdClass
{
- return flatRest(function ($object, ...$paths) {
+ return flatRest(function ($object, $paths) {
return basePick($object, $paths);
})($object, $paths);
}
diff --git a/src/Object/pickBy.php b/src/Object/pickBy.php
index f0e11c9..7d85cc0 100644
--- a/src/Object/pickBy.php
+++ b/src/Object/pickBy.php
@@ -26,11 +26,12 @@
*
* @return \stdClass Returns the new object.
* @example
- *
+ *
* $object = (object) ['a' => 1, 'b' => 'abc', 'c' => 3];
*
* pickBy(object, 'is_numeric');
* // => (object) ['a' => 1, 'c' => 3]
+ *
*/
function pickBy($object, callable $predicate): \stdClass
{
diff --git a/src/Seq/chain.php b/src/Seq/chain.php
new file mode 100644
index 0000000..63e3149
--- /dev/null
+++ b/src/Seq/chain.php
@@ -0,0 +1,49 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+namespace _;
+
+/**
+ * Creates a `lodash` wrapper instance that wraps `value` with explicit method
+ * chain sequences enabled. The result of such sequences must be unwrapped
+ * with `->value()`.
+ *
+ * @category Seq
+ *
+ * @param mixed $value The value to wrap.
+ *
+ * @return \_ Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * $users = [
+ * ['user' => 'barney', 'age' => 36],
+ * ['user' => 'fred', 'age' => 40],
+ * ['user' => 'pebbles', 'age' => 1 ],
+ * ];
+ *
+ * $youngest = chain($users)
+ * ->sortBy('age')
+ * ->map(function($o) {
+ * return $o['user'] . ' is ' . $o['age'];
+ * })
+ * ->head()
+ * ->value();
+ * // => 'pebbles is 1'
+ *
+ */
+function chain($value): \_
+{
+ /** @var \_ $result */
+ $result = __($value);
+ $result->__chain__ = true;
+
+ return $result;
+}
diff --git a/src/String/deburr.php b/src/String/deburr.php
index 579ae6b..a850d78 100644
--- a/src/String/deburr.php
+++ b/src/String/deburr.php
@@ -96,9 +96,10 @@
* @return string Returns the deburred string.
*
* @example
- *
+ *
* deburr('déjà vu')
* // => 'deja vu'
+ *
*/
function deburr(string $string): string
{
diff --git a/src/String/snakeCase.php b/src/String/snakeCase.php
index fcb4a50..07c3d0f 100644
--- a/src/String/snakeCase.php
+++ b/src/String/snakeCase.php
@@ -19,7 +19,7 @@
* @param string $string The string to convert.
* @return string Returns the snake cased string.
* @example
- *
+ *
* snakeCase('Foo Bar')
* // => 'foo_bar'
*
@@ -28,6 +28,7 @@
*
* snakeCase('--FOO-BAR--')
* // => 'foo_bar'
+ *
*/
function snakeCase(string $string): string
{
diff --git a/src/String/split.php b/src/String/split.php
index 2ec929f..73916c3 100644
--- a/src/String/split.php
+++ b/src/String/split.php
@@ -33,7 +33,7 @@
function split(string $string, string $separator, int $limit = 0): array
{
if (\preg_match(reRegExpChar, $separator)) {
- return \preg_split($separator, $string, $limit ?? -1, PREG_SPLIT_DELIM_CAPTURE) ?: [];
+ return \preg_split($separator, $string, $limit ?: -1, PREG_SPLIT_DELIM_CAPTURE) ?: [];
}
/** @var array $result */
diff --git a/src/String/template.php b/src/String/template.php
index a035e74..8b76ef0 100644
--- a/src/String/template.php
+++ b/src/String/template.php
@@ -107,12 +107,12 @@ function template(string $string, array $options = []): callable
]);
$string = \preg_replace_callback('#'.$reDelimiters.'#u', function ($matches) {
- list(,
+ [,
$escapeValue,
$interpolateValue,
$esTemplateValue,
$evaluateValue,
- ) = \array_merge($matches, \array_fill(\count($matches), 5 - \count($matches), null));
+ ] = \array_merge($matches, \array_fill(\count($matches), 5 - \count($matches), null));
$interpolateValue = $interpolateValue ?: $esTemplateValue;
@@ -120,17 +120,17 @@ function template(string $string, array $options = []): callable
if ($escapeValue) {
$escapeValue = \trim($escapeValue);
- $source .= "=__e(\$${escapeValue});?>";
+ $source .= "=__e(\${$escapeValue});?>";
}
if ($evaluateValue) {
- $source .= "";
+ $source .= "";
}
if ($interpolateValue) {
- $interpolateValue = \trim($interpolateValue ?? $esTemplateValue);
+ $interpolateValue = \trim($interpolateValue);
$interpolateValue = \preg_replace('#^([\p{L}\p{N}_]+)$#u', '$$1', $interpolateValue);
- $source .= "=${interpolateValue};?>";
+ $source .= "={$interpolateValue};?>";
}
return $source;
@@ -145,8 +145,14 @@ function template(string $string, array $options = []): callable
return new class($string, $imports) {
public $source;
+ /**
+ * @var array
* trimEnd(' abc ')
* // => ' abc'
*
* trimEnd('-_-abc-_-', '_-')
* // => '-_-abc'
+ *
*/
function trimEnd(string $string, string $chars = ' '): string
{
diff --git a/src/String/truncate.php b/src/String/truncate.php
index cdca582..381c0df 100644
--- a/src/String/truncate.php
+++ b/src/String/truncate.php
@@ -101,11 +101,11 @@ function truncate($string, array $options = [])
$newEnd = \end($match[0])[1];
}
- $result = \substr($result, 0, null === $newEnd ? $end : $newEnd);
+ $result = \substr($result, 0, $newEnd ?? $end);
}
} elseif (\strpos($string, $separator) !== $end) {
$index = \strrpos($result, $separator);
- if (false !== $index && $index > -1) {
+ if (false !== $index) {
$result = \substr($result, 0, $index);
}
}
diff --git a/src/Util/defaultTo.php b/src/Util/defaultTo.php
new file mode 100644
index 0000000..79b8baf
--- /dev/null
+++ b/src/Util/defaultTo.php
@@ -0,0 +1,43 @@
+
+ * @copyright Copyright (c) 2019
+ */
+
+namespace _;
+
+/**
+ * Checks value to determine whether a default value should be returned in its place.
+ * The defaultValue is returned if value is NaN or null.
+ *
+ * @category Util
+ *
+ * @param mixed $value Any value.
+ * @param mixed $defaultValue Value to return when $value is null or NAN
+ *
+ * @return mixed Returns `value`.
+ *
+ * @author punit-kulal
+ *
+ * @example
+ *
+ * $a = null;
+ *
+ * defaultTo($a, "default");
+ * // => "default"
+ *
+ * $a = "x";
+ *
+ * defaultTo($a, "default");
+ * // => "x"
+ *
+ */
+function defaultTo($value, $defaultValue)
+{
+ return (null !== $value && (is_object($value) || !\is_nan(\floatval($value)))) ? $value : $defaultValue;
+}
diff --git a/src/Util/property.php b/src/Util/property.php
index 1bc0f40..17f75f0 100644
--- a/src/Util/property.php
+++ b/src/Util/property.php
@@ -11,6 +11,8 @@
namespace _;
+use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
+use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
use Symfony\Component\PropertyAccess\PropertyAccess;
/**
@@ -60,6 +62,10 @@ function property($path): callable
}
}
- return $propertyAccess->getValue($value, $path);
+ try {
+ return $propertyAccess->getValue($value, $path);
+ } catch (NoSuchPropertyException | NoSuchIndexException $e) {
+ return null;
+ }
};
}
diff --git a/src/bootstrap.php b/src/bootstrap.php
index 1e9b200..8bc7456 100644
--- a/src/bootstrap.php
+++ b/src/bootstrap.php
@@ -13,6 +13,7 @@
require_once $file;
} else {
require_once __DIR__.'/internal/Traits/CacheDataTrait.php';
+ require_once __DIR__.'/internal/unicode.php';
require_once __DIR__.'/CacheInterface.php';
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__, RecursiveDirectoryIterator::SKIP_DOTS)) as $file) {
diff --git a/src/compiled.php b/src/compiled.php
deleted file mode 100644
index e4730f2..0000000
--- a/src/compiled.php
+++ /dev/null
@@ -1,178 +0,0 @@
-'; public const reEvaluate = "<%([\s\S]+?)%>"; public const reEscape = "<%-([\s\S]+?)%>"; public static $templateSettings = [ 'escape' => self::reEscape, 'evaluate' => self::reEvaluate, 'interpolate' => self::reInterpolate, 'imports' => [ '_\escape' => '__e', ], ]; public static function __callStatic(string $method, array $args) { if (!\is_callable("_\\$method")) { throw new \InvalidArgumentException("Function _::$method is not valid"); } return ("_\\$method")(...$args); } } }
- namespace _ { use _\internal\Traits\CacheDataTrait; final class Hash implements CacheInterface { use CacheDataTrait; public function __construct() { $this->clear(); } public function set($key, $value): CacheInterface { $this->size += $this->has($key) ? 0 : 1; $this->__data__[$key] = $value; return $this; } public function get($key) { return $this->__data__[$key] ?? null; } public function has($key): bool { return \array_key_exists($key, $this->__data__); } public function clear() { $this->__data__ = []; $this->size = 0; } public function delete($key) { $result = $this->has($key); unset($this->__data__[$key]); $this->size -= $result ? 1 : 0; return $result; } } }
- namespace _ { use _\internal\Traits\CacheDataTrait; final class MapCache implements CacheInterface { use CacheDataTrait; public function __construct(iterable $entries = null) { $this->clear(); if (null !== $entries) { foreach ($entries as $key => $entry) { $this->set($key, $entry); } } } final public function set($key, $value): CacheInterface { $data = $this->getMapData($key); $size = $data->getSize(); $data->set($key, $value); $this->size += $data->getSize() === $size ? 0 : 1; return $this; } final public function get($key) { return $this->getMapData($key)->get($key); } final public function has($key): bool { return $this->getMapData($key)->has($key); } final public function clear() { $this->size = 0; $this->__data__ = [ 'hash' => new Hash, 'map' => new ListCache, 'string' => new Hash, ]; } final public function delete($key) { $result = $this->getMapData($key)->delete($key); $this->size -= $result ? 1 : 0; return $result; } private function isKey($key) { return \is_scalar($key); } private function getMapData($key): CacheInterface { if ($this->isKey($key)) { return $this->__data__[\is_string($key) ? 'string' : 'hash']; } return $this->__data__['map']; } } }
- namespace _ { use function _\internal\baseIteratee; function reduce(iterable $collection, $iteratee, $accumulator = null) { $func = function (iterable $array, $iteratee, $accumulator, $initAccum = null) { $length = \count(\is_array($array) ? $array : \iterator_to_array($array)); if ($initAccum && $length) { $accumulator = \current($array); } foreach ($array as $key => $value) { $accumulator = $iteratee($accumulator, $value, $key, $array); } return $accumulator; }; return $func($collection, baseIteratee($iteratee), $accumulator, null === $accumulator); } }
- namespace _ { function eachRight($collection, callable $iteratee) { $values = \is_object($collection) ? \get_object_vars($collection) : $collection; foreach (\array_reverse($values, true) as $index => $value) { if (false === $iteratee($value, $index, $collection)) { break; } } return $collection; } }
- namespace _ { use function _\internal\baseFlatten; function flatMapDeep(iterable $collection, callable $iteratee): array { return baseFlatten(map($collection, $iteratee), \PHP_INT_MAX); } }
- namespace _ { use function _\internal\baseOrderBy; function orderBy(?iterable $collection, array $iteratee, array $orders): array { if (null === $collection) { return []; } return baseOrderBy($collection, $iteratee, $orders); } }
- namespace _ { function size($collection): int { if (\is_string($collection)) { return \strlen($collection); } if (\is_array($collection) || $collection instanceof \Countable) { return \count($collection); } if ($collection instanceof \Traversable) { return \count(\iterator_to_array($collection)); } if (\is_object($collection)) { return \count(\get_object_vars($collection)); } return 0; } }
- namespace _ { function each($collection, callable $iteratee) { $values = \is_object($collection) ? \get_object_vars($collection) : $collection; foreach ($values as $index => $value) { if (false === $iteratee($value, $index, $collection)) { break; } } return $collection; } }
- namespace _ { use function _\internal\baseIteratee; use function _\internal\baseReduce; function reduceRight(iterable $collection, $iteratee, $accumulator = null) { return baseReduce(\array_reverse($collection instanceof \Traversable ? \iterator_to_array($collection, true) : $collection, true), baseIteratee($iteratee), $accumulator, null === $accumulator); } }
- namespace _ { use function _\internal\baseIteratee; function map($collection, $iteratee): array { $values = []; if (\is_array($collection)) { $values = $collection; } elseif ($collection instanceof \Traversable) { $values = \iterator_to_array($collection); } elseif (\is_object($collection)) { $values = \get_object_vars($collection); } $callable = baseIteratee($iteratee); return \array_map(function ($value, $index) use ($callable, $collection) { return $callable($value, $index, $collection); }, $values, \array_keys($values)); } }
- namespace _ { use function _\internal\createAggregator; function partition(iterable $collection, $predicate = null): array { return createAggregator(function ($result, $value, $key) { $result[$key ? 0 : 1][] = $value; return $result; }, function () { return [[], []]; })($collection, $predicate); } }
- namespace _ { use function _\internal\baseIteratee; function every(iterable $collection, $predicate): bool { $iteratee = baseIteratee($predicate); foreach ($collection as $key => $value) { if (!$iteratee($value, $key, $collection)) { return false; } } return true; } }
- namespace _ { use function _\internal\baseIteratee; function find(iterable $collection, $predicate = null, int $fromIndex = 0) { $iteratee = baseIteratee($predicate); foreach (\array_slice(\is_array($collection) ? $collection : \iterator_to_array($collection), $fromIndex) as $key => $value) { if ($iteratee($value, $key, $collection)) { return $value; } } return null; } }
- namespace _ { function shuffle(array $array = []): array { \shuffle($array); return $array; } }
- namespace _ { use function _\internal\baseFlatten; function flatMap(iterable $collection, callable $iteratee): array { return baseFlatten(map($collection, $iteratee), 1); } }
- namespace _ { use function _\internal\baseIteratee; function reject(iterable $collection, $predicate = null): array { return filter($collection, negate(baseIteratee($predicate))); } }
- namespace _ { use function _\internal\baseInvoke; use function _\internal\baseRest; function invokeMap(iterable $collection, $path, array $args = []): array { return baseRest(function ($collection, $path, $args) { $isFunc = \is_callable($path); $result = []; each($collection, function ($value) use (&$result, $isFunc, $path, $args) { $result[] = $isFunc ? $path($value, ...$args) : baseInvoke($value, $path, $args); }); return $result; })($collection, $path, $args); } }
- namespace _ { function sampleSize(array $array, int $n = 1): array { $result = []; $count = \count($array); foreach ((array) \array_rand($array, $n > $count ? $count : $n) as $index) { $result[] = $array[$index]; } return $result; } }
- namespace _ { use function _\internal\baseIteratee; function filter(iterable $array, $predicate = null): array { $iteratee = baseIteratee($predicate); $result = \array_filter( \is_array($array) ? $array : \iterator_to_array($array), function ($value, $key) use ($array, $iteratee) { return $iteratee($value, $key, $array); }, \ARRAY_FILTER_USE_BOTH ); \sort($result); return $result; } }
- namespace _ { function sample(array $array) { $key = \array_rand($array, 1); return $array[$key]; } }
- namespace _ { use function _\internal\baseIteratee; function some(iterable $collection, $predicate = null): bool { $iteratee = baseIteratee($predicate); foreach ($collection as $key => $value) { if ($iteratee($value, $key, $collection)) { return true; } } return false; } }
- namespace _ { use function _\internal\baseIteratee; function sortBy($collection, $iteratees): array { if (null === $collection) { return []; }; if (\is_callable($iteratees)) { $iteratees = [$iteratees]; } $result = \is_object($collection) ? \get_object_vars($collection) : $collection; foreach ($iteratees as $callable) { usort($result, function ($a, $b) use ($callable) { $iteratee = baseIteratee($callable); return $iteratee($a, $b) <=> $iteratee($b, $a); }); } return $result; } }
- namespace _ { use function _\internal\createAggregator; function keyBy(iterable $collection, $iteratee): array { return createAggregator(function ($result, $value, $key) { $result[$key] = $value; return $result; })($collection, $iteratee); } }
- namespace _ { use function _\internal\createAggregator; function groupBy(iterable $collection, $iteratee): array { return createAggregator(function ($result, $value, $key) { if (!isset($result[$key])) { $result[$key] = []; } $result[$key][] = $value; return $result; })($collection, $iteratee); } }
- namespace _ { use function _\internal\baseFlatten; function flatMapDepth(iterable $collection, callable $iteratee, int $depth = 1): array { return baseFlatten(map($collection, $iteratee), $depth); } }
- namespace _ { use function _\internal\createAggregator; function countBy(iterable $collection, callable $iteratee): array { return createAggregator(function ($result, $key, $value) { if (!isset($result[$value])) { $result[$value] = 0; } $result[$value]++; return $result; })($collection, $iteratee); } }
- namespace _ { use function _\internal\baseIteratee; function findLast(iterable $collection, $predicate = null, int $fromIndex = 0) { $iteratee = baseIteratee($predicate); foreach (\array_slice(\array_reverse(\is_array($collection) ? $collection : \iterator_to_array($collection), true), $fromIndex) as $key => $value) { if ($iteratee($value, $key, $collection)) { return $value; } } return null; } }
- namespace _ { use Symfony\Component\PropertyAccess\PropertyAccess; function property($path): callable { $propertyAccess = PropertyAccess::createPropertyAccessorBuilder() ->disableExceptionOnInvalidIndex() ->getPropertyAccessor(); return function ($value, $index = 0, $collection = []) use ($path, $propertyAccess) { $path = \implode('.', (array) $path); if (\is_array($value)) { if (false !== \strpos($path, '.')) { $paths = \explode('.', $path); foreach ($paths as $path) { $value = property($path)($value, $index, $collection); } return $value; } if (\is_string($path) && $path[0] !== '[' && $path[-1] !== ']') { $path = "[$path]"; } } return $propertyAccess->getValue($value, $path); }; } }
- namespace _ { function identity($value = null) { return $value; } }
- namespace _ { function attempt(callable $func, ...$args) { try { return $func(...$args); } catch (\ParseError | \Error | \Throwable | \SoapFault | \DOMException | \PDOException $e) { return $e; } } }
- namespace _ { use function _\internal\baseFlatten; function flattenDepth(array $array, int $depth = 1): array { return baseFlatten($array, $depth); } }
- namespace _ { function difference(array $array, array ...$values): array { return \array_values(\array_diff($array, ...$values)); } }
- namespace _ { use function _\internal\baseSet; function zipObjectDeep(array $props = [], array $values = []): \stdClass { $result = new \stdClass; $index = -1; $length = \count($props); $props = \array_values($props); $values = \array_values($values); while (++$index < $length) { $value = $values[$index] ?? null; baseSet($result, $props[$index], $value); } return $result; } }
- namespace _ { use function _\internal\baseIteratee; function findLastIndex(array $array, $predicate, int $fromIndex = null): int { $length = \count($array); $index = $fromIndex ?? $length - 1; if ($index < 0) { $index = \max($length + $index, 0); } $iteratee = baseIteratee($predicate); foreach (\array_reverse($array, true) as $key => $value) { if ($iteratee($value, $key, $array)) { return $index; } $index--; } return -1; } }
- namespace _ { function lastIndexOf(array $array, $value, int $fromIndex = null): int { $index = \count($array) - 1; if (null !== $fromIndex) { $index = $fromIndex > 0 ? $fromIndex : \count($array) - 1; $array = \array_slice($array, 0, -$fromIndex + 1); }; foreach (\array_reverse($array, false) as $v) { if (isEqual($value, $v)) { return $index; } $index--; } return -1; } }
- namespace _ { use function _\internal\baseIteratee; use function _\internal\basePullAll; function pullAllBy(array &$array, array $values, $iteratee): array { return basePullAll($array, $values, baseIteratee($iteratee)); } }
- namespace _ { use function _\internal\baseUniq; function uniqWith(array $array, callable $comparator): array { return baseUniq($array, null, $comparator); } }
- namespace _ { use function _\internal\basePullAll; function pullAllWith(array &$array, array $values, callable $comparator): array { return basePullAll($array, $values, null, $comparator); } }
- namespace _ { use function _\internal\baseRest; function zip(array ...$arrays): array { return baseRest('\_\unzip')($arrays); } }
- namespace _ { function compact(?array $array): array { return \array_values(\array_filter($array ?? [])); } }
- namespace _ { function zipWith(...$arrays): array { $iteratee = \is_callable(\end($arrays)) ? \array_pop($arrays) : null; return unzipWith($arrays, $iteratee); } }
- namespace _ { function uniq(array $array = []): array { return \array_unique($array); } }
- namespace _ { function zipObject(array $props = [], array $values = []) { $result = new \stdClass; $index = -1; $length = \count($props); $props = \array_values($props); $values = \array_values($values); while (++$index < $length) { $value = $values[$index] ?? null; $result->{$props[$index]} = $value; } return $result; } }
- namespace _ { use function _\internal\baseIteratee; use function _\internal\baseUniq; function uniqBy(array $array, $iteratee): array { return baseUniq($array, baseIteratee($iteratee)); } }
- namespace _ { use function _\internal\baseIteratee; function takeRightWhile(array $array, $predicate): array { $iteratee = baseIteratee($predicate); $result = []; foreach (array_reverse($array, true) as $index => $value) { if ($iteratee($value, $index, $array)) { $result[$index] = $value; } } return array_reverse($result); } }
- namespace _ { use function _\internal\baseIteratee; function takeWhile(array $array, $predicate): array { $result = []; $iteratee = baseIteratee($predicate); foreach ($array as $index => $value) { if ($iteratee($value, $index, $array)) { $result[$index] = $value; } } return $result; } }
- namespace _ { function takeRight(array $array, int $n = 1): array { if (1 > $n) { return []; } return array_slice($array, -$n); } }
- namespace _ { use function _\internal\baseFlatten; function differenceWith(array $array, ...$values): array { if (!$array) { return []; } if (!\is_callable(\end($values))) { return difference($array, ...$values); } $comparator = \array_pop($values); $values = baseFlatten($values, 1, 'is_array', true, null); $valuesLength = \count($values); $result = []; foreach ($array as $value) { $valuesIndex = $valuesLength; while ($valuesIndex--) { if ($comparator($value, $values[$valuesIndex])) { continue 2; } } $result[] = $value; } return $result; } }
- namespace _ { function initial(array $array): array { \array_pop($array); return $array; } }
- namespace _ { function dropRightWhile(array $array, callable $predicate): array { \end($array); $length = \count($array); $index = \key($array); while ($length && $predicate($array[$index], $index, $array)) { array_pop($array); $length--; \end($array); $index = \key($array); } return $array; } }
- namespace _ { function indexOf(array $array, $value, int $fromIndex = null): int { $inc = true; $index = 0; if (null !== $fromIndex) { $index = $fromIndex >= 0 ? $fromIndex : \count($array) - 1; if ($fromIndex < 0) { $array = \array_reverse($array, false); $inc = false; } }; foreach ($array as $v) { if (isEqual($value, $v)) { return $index; } $inc ? $index++ : $index--; } return -1; } }
- namespace _ { use function _\internal\arrayMap; use function _\internal\baseProperty; use function _\internal\baseTimes; function unzip(array $array): array { if (!\count($array)) { return []; } $length = 0; $array = \array_filter($array, function ($group) use (&$length) { if (\is_array($group)) { $length = \max(\count($group), $length); return true; } }); return baseTimes($length, function ($index) use ($array) { return arrayMap($array, baseProperty($index)); }); } }
- namespace _ { function slice(array $array, int $start, int $end = null): array { return \array_slice($array, $start, $end); } }
- namespace _ { function drop(array $array, int $n = 1): array { return \array_slice($array, $n); } }
- namespace _ { use function _\internal\baseRest; function without(array $array, ...$values): array { return baseRest('\_\difference')($array, $values); } }
- namespace _ { function dropWhile(array $array, callable $predicate): array { \reset($array); $count = \count($array); $length = 0; $index = \key($array); while ($length <= $count && $predicate($array[$index], $index, $array)) { array_shift($array); \reset($array); $length++; $index = \key($array); } return $array; } }
- namespace _ { use function _\internal\baseIntersection; function intersectionWith(...$arrays ): array { $copy = $arrays; $comparator = \array_pop($arrays); if (!\is_callable($comparator)) { $arrays = $copy; $comparator = null; } return baseIntersection($arrays, null, $comparator); } }
- namespace _ { function head(array $array) { reset($array); return current($array) ?: null; } function first(array $array) { return head($array); } }
- namespace _ { function dropRight(array $array, int $n = 1): array { $count = \count($array); if ($n > $count) { $n = $count; } return \array_slice($array, 0, $count - $n); } }
- namespace _ { function concat($array, ...$values): array { $check = function ($value): array { return \is_array($value) ? $value : [$value]; }; return \array_merge($check($array), ...\array_map($check, $values)); } }
- namespace _ { function remove(array &$array, callable $predicate): array { $resultArray = []; $array = \array_filter($array, function ($val, $key) use ($predicate, $array, &$resultArray) { $result = $predicate($val, $key, $array); if ($result) { $resultArray[] = $val; } return !$result; }, \ARRAY_FILTER_USE_BOTH); $array = \array_values($array); return $resultArray; } }
- namespace _ { function chunk(?array $array, int $number): array { if ($number < 1) { return []; } return \array_chunk($array ?? [], $number, false); } }
- namespace _ { function take(array $array, int $n = 1): array { if (1 > $n) { return []; } array_splice($array, $n); return $array; } }
- namespace _ { function last(array $array) { return \end($array) ?: null; } }
- namespace _ { function tail(array $array): array { array_shift($array); return $array; } }
- namespace _ { function pull(array &$array, ...$values): array { $array = \array_filter($array, function ($val) use ($values) { return !\in_array($val, $values, true); }); $array = \array_values($array); return $array; } }
- namespace _ { function fromPairs(array $pairs): \stdClass { if (!\count($pairs)) { return new \stdClass(); } $result = new \stdClass(); foreach ($pairs as $pair) { $result->{$pair[0]} = $pair[1]; } return $result; } }
- namespace _ { function intersection(array ...$arrays): array { return \array_intersect(...$arrays); } }
- namespace _ { function pullAt(array &$array, $indexes): array { $indexes = (array) $indexes; $pulled = []; $array = \array_filter($array, function ($val, $key) use ($indexes, &$pulled) { $inArray = \in_array($key, $indexes); if ($inArray) { $pulled[] = $val; } return !$inArray; }, \ARRAY_FILTER_USE_BOTH); $array = \array_values($array); return $pulled; } }
- namespace _ { function pullAll(array &$array, array $values): array { return pull($array, ...$values); } }
- namespace _ { function union(array ...$arrays): array { return array_unique(array_merge(...$arrays)); } }
- namespace _ { use function _\internal\baseFlatten; function flatten(array $array = null): array { return baseFlatten($array, 1); } }
- namespace _ { use function _\internal\baseFlatten; use function _\internal\baseUniq; function unionWith(... $arrays): array { $comparator = \array_pop($arrays); if (!\is_callable($comparator)) { throw new \InvalidArgumentException(__FUNCTION__.' expects the last value passed to be callable'); } return baseUniq(baseFlatten($arrays, 1, '\is_array', true), null, $comparator); } }
- namespace _ { use function _\internal\baseIteratee; function findIndex(array $array, $predicate, int $fromIndex = null): int { $length = \count($array); if (!$length) { return -1; } $index = $fromIndex ?? 0; if ($index < 0) { $index = \min($length + $index, 0); } $iteratee = baseIteratee($predicate); foreach ($array as $key => $value) { if ($iteratee($value, $key, $array)) { return $index; } $index++; } return -1; } }
- namespace _ { use function _\internal\baseFlatten; function flattenDeep(array $array): array { return baseFlatten($array, PHP_INT_MAX); } }
- namespace _ { use function _\internal\arrayMap; function unzipWith(array $array, ?callable $iteratee = null): array { if (!\count($array)) { return []; } $result = unzip($array); if (!is_callable($iteratee)) { return $result; } return arrayMap($result, function ($group) use ($iteratee) { return $iteratee(...$group); }); } }
- namespace _ { function nth(array $array, int $n) { return \array_values($array)[$n < 0 ? \count($array) + $n : $n] ?? null; } }
- namespace _ { use function _\internal\baseFlatten; function differenceBy(array $array, ...$values): array { if (!$array) { return []; } if (!\is_callable(\end($values))) { return difference($array, ...$values); } $iteratee = \array_pop($values); $values = \array_map($iteratee, baseFlatten($values, 1, 'is_array', true, null)); $valuesLength = \count($values); $result = []; foreach ($array as $value) { $computed = $iteratee($value); $valuesIndex = $valuesLength; while ($valuesIndex--) { if ($computed === $values[$valuesIndex]) { continue 2; } } $result[] = $value; } return $result; } }
- namespace _ { use function _\internal\baseFlatten; use function _\internal\baseIteratee; use function _\internal\baseUniq; function unionBy(...$arrays): array { return baseUniq(baseFlatten($arrays, 1, '\is_array', true), baseIteratee(\array_pop($arrays))); } }
- namespace _ { use function _\internal\baseIntersection; use function _\internal\baseIteratee; function intersectionBy(...$arrays): array { $iteratee = \array_pop($arrays); return baseIntersection($arrays, baseIteratee($iteratee)); } }
- namespace _ { function now(): int { return (int) (\microtime(true) * 1000); } }
- namespace _\internal { function baseUnary($func) { return function ($value) use ($func) { return $func($value); }; } }
- namespace _\internal { function stringToArray(string $string): array { return hasUnicode($string) ? unicodeToArray($string) : \str_split($string); } }
- namespace _\internal { function createMathOperation(callable $operator, $defaultValue) { return function ($value, $other) use ($defaultValue, $operator) { if (null === $value && null === $other) { return $defaultValue; } $result = null; if (null !== $value) { $result = $value; } if (null !== $other) { if (null === $result) { return $other; } $result = $operator($value, $other); } return $result; }; } }
- namespace _\internal { use function _\each; function createAggregator($setter, $initializer = null) { return function ($collection, $iteratee) use ($setter, $initializer) { $accumulator = null !== $initializer ? $initializer() : []; $func = function ($collection, $setter, &$accumulator, $iteratee) { each($collection, function ($value, $key, $collection) use ($setter, &$accumulator, $iteratee) { $accumulator = $setter($accumulator, $value, $iteratee($value), $collection); }); return $accumulator; }; return $func($collection, $setter, $accumulator, baseIteratee($iteratee)); }; } }
- namespace _\internal { use function _\isEqual; use function _\property; function baseMatches($source): callable { return function ($value, $index, $collection) use ($source): bool { if ($value === $source || isEqual($value, $source)) { return true; } if (\is_array($source) || $source instanceof \Traversable) { foreach ($source as $k => $v) { if (!isEqual(property($k)($value, $index, $collection), $v)) { return false; } } return true; } return false; }; } }
- namespace _\internal { function baseTimes(int $n, callable $iteratee) { $index = -1; $result = []; while (++$index < $n) { $result[$index] = $iteratee($index); } return $result; } }
- namespace _\internal { function arrayMap(?array $array, callable $iteratee) { $index = -1; $length = null === $array ? 0 : \count($array); $result = []; while (++$index < $length) { $result[$index] = $iteratee($array[$index], $index, $array); } return $result; } }
- namespace _\internal { const rsAstralRange = '\\x{e800}-\\x{efff}'; const rsComboMarksRange = '\\x{0300}-\\x{036f}'; const reComboHalfMarksRange = '\\x{fe20}-\\x{fe2f}'; const rsComboSymbolsRange = '\\x{20d0}-\\x{20ff}'; const rsComboRange = rsComboMarksRange.reComboHalfMarksRange.rsComboSymbolsRange; const rsDingbatRange = '\\x{2700}-\\x{27bf}'; const rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff'; const rsMathOpRange = '\\xac\\xb1\\xd7\\xf7'; const rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf'; const rsPunctuationRange = '\\x{2000}-\\x{206f}'; const rsSpaceRange = ' \\t\\x0b\\f\\xa0\\x{feff}\\n\\r\\x{2028}\\x{2029}\\x{1680}\\x{180e}\\x{2000}\\x{2001}\\x{2002}\\x{2003}\\x{2004}\\x{2005}\\x{2006}\\x{2007}\\x{2008}\\x{2009}\\x{200a}\\x{202f}\\x{205f}\\x{3000}'; const rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde'; const rsVarRange = '\\x{fe0e}\\x{fe0f}'; const rsBreakRange = rsMathOpRange.rsNonCharRange.rsPunctuationRange.rsSpaceRange; const rsApos = "[\\x{2019}]"; const rsBreak = '['.rsBreakRange.']'; const rsCombo = '['.rsComboRange.']'; const rsDigits = '\\d+'; const rsDingbat = '['.rsDingbatRange.']'; const rsLower = '['.rsLowerRange.']'; const rsMisc = '[^'.rsAstralRange.rsBreakRange.rsDigits.rsDingbatRange.rsLowerRange.rsUpperRange.']'; const rsFitz = '\\x{e83c}[\\x{effb}-\\x{efff}]'; const rsModifier = '(?:'.rsCombo.'|'.rsFitz.')'; const rsNonAstral = '[^'.rsAstralRange.']'; const rsRegional = '(?:\\x{e83c}[\\x{ede6}-\\x{edff}]){2}'; const rsSurrPair = '[\\x{e800}-\\x{ebff}][\\x{ec00}-\\x{efff}]'; const rsUpper = '['.rsUpperRange.']'; const rsZWJ = '\\x{200d}'; const rsMiscLower = '(?:'.rsLower.'|'.rsMisc.')'; const rsMiscUpper = '(?:'.rsUpper.'|'.rsMisc.')'; const rsOptContrLower = '(?:'.rsApos.'(?:d|ll|m|re|s|t|ve))?'; const rsOptContrUpper = '(?:'.rsApos.'(?:D|LL|M|RE|S|T|VE))?'; const reOptMod = rsModifier.'?'; const rsOptVar = '['.rsVarRange.']?'; define('rsOptJoin', '(?:'.rsZWJ.'(?:'.implode('|', [rsNonAstral, rsRegional, rsSurrPair]).')'.rsOptVar.reOptMod.')*'); const rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)'; const rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)'; const rsSeq = rsOptVar.reOptMod.rsOptJoin; define('rsEmoji', '(?:'.implode('|', [rsDingbat, rsRegional, rsSurrPair]).')'.rsSeq); const rsAstral = '['.rsAstralRange.']'; const rsNonAstralCombo = rsNonAstral.rsCombo.'?'; define('rsSymbol', '(?:'.implode('|', [rsNonAstralCombo, rsCombo, rsRegional, rsSurrPair, rsAstral]).')'); const reUnicode = rsFitz.'(?='.rsFitz.')|'.rsSymbol.rsSeq; }
- namespace _\internal { function toKey($value): string { if (\is_string($value)) { return $value; } $result = (string) $value; return ('0' === $result && (1 / $value) === -INF) ? '-0' : $result; } }
- namespace _\internal { function overRest(callable $func, $start, callable $transform): callable { $start = max($start ?? -1, 0); return function () use ($func, $start, $transform) { $args = \func_get_args(); $index = -1; $length = \max(\count($args) - $start, 0); $array = []; while (++$index < $length) { $array[$index] = $args[$start + $index]; } $index = -1; $otherArgs = []; while (++$index < $start) { $otherArgs[$index] = $args[$index]; } $otherArgs[$start] = $transform($array); return $func(...$otherArgs[$start]); }; } }
- namespace _\internal\Traits { trait CacheDataTrait { private $__data__ = []; private $size; public function getSize(): int { return $this->size; } } }
- namespace _\internal { function unicodeToArray(string $string): array { if (\preg_match_all('#'.reUnicode.'#u', $string, $matches)) { return $matches[0]; } return []; } }
- namespace _\internal { function flatRest(callable $func): callable { return shortOut(overRest($func, null, '\_\flatten')); } }
- namespace _\internal { function baseRest(callable $func, $start = null): callable { return overRest($func, $start, '\_\identity'); } }
- namespace _\internal { use function _\property; function isIterateeCall($value, $index = null, $object = null) { if (!\is_object($object) || !\is_array($object)) { return false; } $type = \gettype($index); if (null === $index || ('integer' !== $type && 'string' !== $type)) { return false; } if (\is_array($object)) { return isset($object[$index]) && property($index)($value) === $value; } if (\is_object($object)) { return \property_exists($object, $index) && property($index)($value) === $value; } return false; } }
- namespace _\internal { function unicodeSize(string $string): int { return \preg_match_all(reUnicode, $string) ?: 0; } }
- namespace _\internal { use function _\property; function baseGet($object, $path) { $path = castPath($path, $object); $index = 0; $length = \count($path); while ($object !== null && $index < $length) { $object = property(toKey($path[$index++]))($object); } return ($index && $index === $length) ? $object : null; } }
- namespace _\internal { function basePullAll(&$array, array $values, ?callable $iteratee, callable $comparator = null) { $indexOf = $comparator ? '_\\internal\\baseIndexOfWith' : '_\\indexOf'; $seen = $array; if ($iteratee) { $seen = \array_map($iteratee, $array); } foreach ($values as $value) { $fromIndex = 0; $computed = $iteratee ? $iteratee($value) : $value; while (($fromIndex = $indexOf($seen, $computed, $fromIndex, $comparator)) > -1) { \array_splice($array, $fromIndex, 1); if ($seen !== $array) { \array_splice($seen, $fromIndex, 1); } } } return $array; } }
- namespace _\internal { function baseFlatten(?array $array, int $depth, callable $predicate = null, bool $isStrict = null, array $result = null): array { $result = $result ?? []; if ($array === null) { return $result; } $predicate = $predicate ?? '_\internal\isFlattenable'; foreach ($array as $value) { if ($depth > 0 && $predicate($value)) { if ($depth > 1) { $result = baseFlatten($value, $depth - 1, $predicate, $isStrict, $result); } else { arrayPush($result, $value); } } elseif (!$isStrict) { $result[\count($result)] = $value; } } return $result; } }
- namespace _\internal { function castSlice(array $array, int $start, ?int $end = null): array { $length = \count($array); $end = null === $end ? $length : $end; return (!$start && $end >= $length) ? $array : \array_slice($array, $start, $end); } }
- namespace _\internal { function isFlattenable($value): bool { return \is_array($value) && \range(0, \count($value) - 1) === \array_keys($value); } }
- namespace _\internal { function arrayIncludesWith(?array $array, $value, callable $comparator) { $array = $array ?? []; foreach ($array as $v) { if ($comparator($value, $v)) { return true; } } return false; } }
- namespace _\internal { const reIsDeepProp = '#\.|\[(?:[^[\]]*|(["\'])(?:(?!\1)[^\\\\]|\\.)*?\1)\]#'; const reIsPlainProp = '/^\w*$/'; function isKey($value, $object = []): bool { if (\is_array($value)) { return false; } if (\is_numeric($value)) { return true; } return \preg_match(reIsPlainProp, $value) || !\preg_match(reIsDeepProp, $value) || (null !== $object && isset(((object) $object)->$value)); } }
- namespace _\internal { function baseProperty($key) { return function ($object) use ($key) { return null === $object ? null : $object[$key]; }; } }
- namespace _\internal { use function _\isEqual; use function _\property; function baseMatchesProperty($property, $source): callable { return function ($value, $index, $collection) use ($property, $source) { return isEqual(property($property)($value, $index, $collection), $source); }; } }
- namespace _\internal { function castPath($value, $object): array { if (\is_array($value)) { return $value; } return isKey($value, $object) ? [$value] : stringToPath((string) $value); } }
- namespace _\internal { use function _\map; use function _\sortBy; function baseOrderBy(iterable $collection, array $iteratees, array $orders): array { $index = -1; $iteratees = arrayMap($iteratees, baseUnary('\_\internal\baseIteratee')); $result = map($collection, function ($value) use ($iteratees, &$index) { $criteria = arrayMap($iteratees, function ($iteratee) use ($value) { return $iteratee($value); }); return ['criteria' => $criteria, 'index' => ++$index, 'value' => $value]; }); return map(sortBy($result, function ($object, $other) use ($orders) { return compareMultiple($object, $other, $orders); }), 'value'); } }
- namespace _\internal { const HOT_COUNT = 800; const HOT_SPAN = 16; function shortOut(callable $func): callable { $count = 0; $lastCalled = 0; return function () use ($func, &$count, &$lastCalled) { $stamp = microtime(true); $remaining = HOT_SPAN - ($stamp - $lastCalled); $lastCalled = $stamp; if ($remaining > 0) { if (++$count >= HOT_COUNT) { return func_get_arg(0); } } else { $count = 0; } return $func(...func_get_args()); }; } }
- namespace _\internal { use function _\property; function baseIteratee($value): callable { if (\is_callable($value)) { return $value; } if (null === $value) { return '_\identity'; } if (\is_array($value)) { return 2 === \count($value) && [0, 1] === \array_keys($value) ? baseMatchesProperty($value[0], $value[1]) : baseMatches($value); } return property($value); } }
- namespace _\internal { function compareMultiple($object, $other, $orders) { $index = -1; $objCriteria = $object['criteria']; $othCriteria = $other['criteria']; $length = \count($objCriteria); $ordersLength = \count($orders); while (++$index < $length) { $result = $objCriteria[$index] <=> $othCriteria[$index]; if ($result) { if ($index >= $ordersLength) { return $result; } $order = $orders[$index]; return $result * ('desc' === $order ? -1 : 1); } } return $object['index'] - $other['index']; } }
- namespace _\internal { use function _\eq; function assocIndexOf(array $array, $key): int { $length = \count($array); while ($length--) { if (eq($array[$length][0], $key)) { return $length; } } return -1; } }
- namespace _\internal { function parent($object, $path) { return count($path) < 2 ? $object : null; } }
- namespace _\internal { use function _\indexOf; function arrayIncludes(?array $array, $value) { return null !== $array && indexOf($array, $value, 0) > -1; } }
- namespace _\internal { const reLeadingDot = '/^\./'; const rePropName = '#[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["\'])((?:(?!\2)[^\\\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))#'; const reEscapeChar = '/\\(\\)?/g'; function stringToPath(...$args) { return memoizeCapped(function ($string) { $result = []; if (\preg_match(reLeadingDot, $string)) { $result[] = ''; } \preg_match_all(rePropName, $string, $matches, PREG_SPLIT_DELIM_CAPTURE); foreach ($matches as $match) { $result[] = $match[1] ?? $match[0]; } return $result; })(...$args); } }
- namespace _\internal { function baseUniq(array $array, callable $iteratee = null, callable $comparator = null) { $index = -1; $includes = '\_\internal\arrayIncludes'; $length = \count($array); $isCommon = true; $result = []; $seen = $result; if ($comparator) { $isCommon = false; $includes = '\_\internal\arrayIncludesWith'; } else { $seen = $iteratee ? [] : $result; } while (++$index < $length) { $value = $array[$index]; $computed = $iteratee ? $iteratee($value) : $value; $value = ($comparator || $value !== 0) ? $value : 0; if ($isCommon && $computed) { $seenIndex = \count($seen); while ($seenIndex--) { if ($seen[$seenIndex] === $computed) { continue 2; } } if ($iteratee) { $seen[] = $computed; } $result[] = $value; } elseif (!$includes($result, $computed, $comparator)) { if ($seen !== $result) { $seen[] = $computed; } $result[] = $value; } } return $result; } }
- namespace _\internal { function unicodeWords(string $string): array { $regex = '#'.\implode('|', [ rsUpper.'?'.rsLower.'+'.rsOptContrLower.'(?='.\implode('|', [rsBreak, rsUpper, '$']).')', rsMiscUpper.'+'.rsOptContrUpper.'(?='.\implode('|', [rsBreak, rsUpper.rsMiscLower, '$']).')', rsUpper.'?'.rsMiscLower.'+'.rsOptContrLower, rsUpper.'+'.rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji, ]).'#u'; if (\preg_match_all($regex, $string, $matches) > 0) { return $matches[0]; } return []; } }
- namespace _\internal { use function _\memoize; function memoizeCapped(callable $func) { $MaxMemoizeSize = 500; $result = memoize($func, function ($key) use ($MaxMemoizeSize) { if ($this->cache->getSize() === $MaxMemoizeSize) { $this->cache->clear(); } return $key; }); return $result; } }
- namespace _\internal { function baseIntersection($arrays, ?callable $iteratee, $comparator = null) { $includes = $comparator ? '_\internal\arrayIncludesWith' : '_\internal\arrayIncludes'; $length = \count($arrays[0]); $othLength = \count($arrays); $othIndex = $othLength; $caches = []; $maxLength = INF; $result = []; while ($othIndex--) { $array =& $arrays[$othIndex]; if ($othIndex && $iteratee) { $array = \array_map($iteratee, $array); } $maxLength = \min(\count($array), $maxLength); $caches[$othIndex] = !$comparator && $iteratee ? [] : null; } $array = $arrays[0]; $index = -1; $seen = $caches[0]; while (++$index < $length && \count($result) < $maxLength) { $value = $array[$index]; $computed = $iteratee ? $iteratee($value) : $value; $value = ($comparator ?: $value !== 0) ? $value : 0; if (!($seen ? \is_scalar($computed) && isset($seen[$computed]) : $includes($result, $computed, $comparator))) { $othIndex = $othLength; while (--$othIndex) { $cache = $caches[$othIndex]; if (!(!empty($cache) ? isset($cache[$computed]) : $includes($arrays[$othIndex], $computed, $comparator))) { continue 2; } } if (empty($seen)) { $seen[] = $computed; } $result[] = $value; } } return $result; } }
- namespace _\internal { function baseSet($object, $path, $value, callable $customizer = null) { if (!\is_object($object)) { return $object; } $path = castPath($path, $object); $index = -1; $length = \count($path); $lastIndex = $length - 1; $nested = $object; while ($nested !== null && ++$index < $length) { $key = toKey($path[$index]); if ($index !== $lastIndex) { $objValue = \is_array($nested) ? ($nested[$key] ?? null) : ($nested->$key ?? null); $newValue = $customizer ? $customizer($objValue, $key, $nested) : $objValue; if (null === $newValue) { $newValue = \is_object($objValue) ? $objValue : (\is_numeric($path[$index + 1]) ? [] : new \stdClass()); } if (\is_array($nested)) { $nested[$key] = $newValue; } else { $nested->{$key} = $newValue; } if (\is_array($nested)) { $nested = &$nested[$key]; } else { $nested = &$nested->$key; } continue; } $nested->{$key} = $value; } return $object; } }
- namespace _\internal { function stringSize(string $string): int { return hasUnicode($string) ? unicodeSize($string) : \strlen($string); } }
- namespace _\internal { use function _\last; function baseInvoke($object, $path, $args) { $path = castPath($path, $object); $object = parent($object, $path); $func = null === $object ? $object : [$object, toKey(last($path))]; return \is_callable($func) ? $func($object, ...$args) : null; } }
- namespace _\internal { function basePickBy($object, $paths, callable $predicate): \stdClass { $index = -1; $length = \is_array($paths) ? \count($paths) : \strlen($paths); $result = new \stdClass(); while (++$index < $length) { $path = $paths[$index]; $value = baseGet($object, $path); if ($predicate($value, $path)) { baseSet($result, castPath($path, $object), $value); } } return $result; } }
- namespace _\internal { function arrayPush(&$array, $values) { $index = -1; $length = \is_array($values) ? \count($values) : \strlen($values); $offset = \count($array); while (++$index < $length) { $array[$offset + $index] = $values[$index]; } return $array; } }
- namespace _\internal { function basePick($object, $paths): \stdClass { return basePickBy($object, $paths, function($value, $path) use ($object) { return property_exists($object, $path) || method_exists($object, 'get'.(ucfirst($path))); }); } }
- namespace _\internal { const reHasUnicode = '['.rsZWJ.rsAstralRange.rsComboRange.rsVarRange.']'; function hasUnicode(string $string): bool { return \preg_match('#'.reHasUnicode.'#u', $string) > 0; } }
- namespace _\internal { function baseIndexOfWith(array $array, $value, int $fromIndex, $comparator) { $index = $fromIndex - 1; foreach (\array_slice($array, $fromIndex, null, true) as $val) { ++$index; if ($comparator($val, $value)) { return $index; } } return -1; } }
- namespace _\internal { function baseReduce(iterable $array, $iteratee, $accumulator, $initAccum = null) { $length = \is_array($array) || $array instanceof \Countable ? \count($array) : 0; if ($initAccum && $length) { $accumulator = \current($array); } foreach ($array as $key => $value) { $accumulator = $iteratee($accumulator, $value, $key, $array); } return $accumulator; } }
- namespace _ { interface CacheInterface { public function set($key, $value): CacheInterface; public function get($key); public function has($key): bool; public function clear(); public function delete($key); public function getSize(); } }
- namespace _ { function negate(callable $predicate): callable { return function () use ($predicate) { return !$predicate(...\func_get_args()); }; } }
- namespace _ { function memoize(callable $func, callable $resolver = null) { $memoized = new class($func, $resolver ?? null) { public $cache; private $resolver; private $func; public function __construct(callable $func, ?callable $resolver) { $this->resolver = $resolver; $this->func = $func; } public function __invoke() { $args = \func_get_args(); if ($this->resolver) { $key = \Closure::fromCallable($this->resolver)->bindTo($this)(...$args); } else { $key = &$args[0]; } $cache = $this->cache; if ($cache->has($key)) { return $cache->get($key); } $result = ($this->func)(...$args); $this->cache = $this->cache->set($key, $result); return $result; } }; $memoized->cache = new MapCache; return $memoized; } }
- namespace _ { use function _\internal\createMathOperation; function add($augend, $addend) { return createMathOperation(function ($augend, $addend) { return $augend + $addend; }, 0)($augend, $addend); } }
- namespace _ { use function _\internal\baseIteratee; function maxBy(?array $array, $iteratee) { $iteratee = baseIteratee($iteratee); $result = null; $computed = null; foreach ($array as $key => $value) { $current = $iteratee($value); if (null !== $current && (null === $computed ? ($current === $current) : $current > $computed)) { $computed = $current; $result = $value; } } return $result; } }
- namespace _ { function max(?array $array): ?int { return $array ? \max($array) : null; } }
- namespace _ { function clamp(int $number, int $lower, int $upper): int { $number = $number <= $upper ? $number : $upper; $number = $number >= $lower ? $number : $lower; return $number; } }
- namespace _ { function inRange(float $number, float $start = 0, float $end = 0): bool { if (0.0 === $end) { $end = $start; $start = 0; } return $number >= \min($start, $end) && $number < \max($start, $end); } }
- namespace _ { function random($lower = null, $upper = null, $floating = null) { if (null === $floating) { if (\is_bool($upper)) { $floating = $upper; $upper = null; } elseif (\is_bool($lower)) { $floating = $lower; $lower = null; } } if (null === $lower && null === $upper) { $lower = 0; $upper = 1; } elseif (null === $upper) { $upper = $lower; $lower = 0; } if ($lower > $upper) { $temp = $lower; $lower = $upper; $upper = $temp; } $floating = $floating || (\is_float($lower) || \is_float($upper)); if ($floating || $lower % 1 || $upper % 1) { $randMax = \mt_getrandmax(); return $lower + \abs($upper - $lower) * \mt_rand(0, $randMax) / $randMax; } return \rand((int) $lower, (int) $upper); } }
- namespace _ { function isError($value): bool { if (!\is_object($value)) { return false; } return $value instanceof \ParseError || $value instanceof \Error || $value instanceof \Throwable || $value instanceof \SoapFault || $value instanceof \DOMException || $value instanceof \PDOException; } }
- namespace _ { use SebastianBergmann\Comparator\ComparisonFailure; use SebastianBergmann\Comparator\Factory; function isEqual($value, $other): bool { $factory = new Factory; $comparator = $factory->getComparatorFor($value, $other); try { $comparator->assertEquals($value, $other); return true; } catch (ComparisonFailure $failure) { return false; } } }
- namespace _ { function eq($value, $other): bool { return $value === $other; } }
- namespace _ { use function _\internal\arrayMap; use function _\internal\baseIteratee; use function _\internal\basePickBy; function pickBy($object, callable $predicate): \stdClass { if (null === $object) { return new \stdClass; } $props = arrayMap(\array_keys(\get_object_vars($object)), function ($prop) { return [$prop]; }); $predicate = baseIteratee($predicate); return basePickBy($object, $props, function ($value, $path) use ($predicate) { return $predicate($value, $path[0]); }); } }
- namespace _ { use function _\internal\basePick; use function _\internal\flatRest; function pick($object, $paths): \stdClass { return flatRest(function ($object, ...$paths) { return basePick($object, $paths); })($object, $paths); } }
- namespace _ { function lowerFirst(string $string): string { return \lcfirst($string); } }
- namespace _ { function camelCase(string $string): string { return \lcfirst(\array_reduce(words(\preg_replace("/['\\x{2019}]/u", '', $string)), function ($result, $word) { return $result.capitalize(\strtolower($word)); }, '')); } }
- namespace _ { function trimEnd(string $string, string $chars = ' '): string { return \rtrim($string, $chars); } }
- namespace _ { function upperFirst(string $string): string { return \ucfirst($string); } }
- namespace _ { const reQuotes = "/['\x{2019}]/u"; function lowerCase(string $string) { return \implode(' ', \array_map('\strtolower', words(\preg_replace(reQuotes, '', $string)))); } }
- namespace _ { const deburredLetters = [ '\xc0' => 'A', '\xc1' => 'A', '\xc2' => 'A', '\xc3' => 'A', '\xc4' => 'A', '\xc5' => 'A', '\xe0' => 'a', '\xe1' => 'a', '\xe2' => 'a', '\xe3' => 'a', '\xe4' => 'a', '\xe5' => 'a', '\xc7' => 'C', '\xe7' => 'c', '\xd0' => 'D', '\xf0' => 'd', '\xc8' => 'E', '\xc9' => 'E', '\xca' => 'E', '\xcb' => 'E', '\xe8' => 'e', '\xe9' => 'e', '\xea' => 'e', '\xeb' => 'e', '\xcc' => 'I', '\xcd' => 'I', '\xce' => 'I', '\xcf' => 'I', '\xec' => 'i', '\xed' => 'i', '\xee' => 'i', '\xef' => 'i', '\xd1' => 'N', '\xf1' => 'n', '\xd2' => 'O', '\xd3' => 'O', '\xd4' => 'O', '\xd5' => 'O', '\xd6' => 'O', '\xd8' => 'O', '\xf2' => 'o', '\xf3' => 'o', '\xf4' => 'o', '\xf5' => 'o', '\xf6' => 'o', '\xf8' => 'o', '\xd9' => 'U', '\xda' => 'U', '\xdb' => 'U', '\xdc' => 'U', '\xf9' => 'u', '\xfa' => 'u', '\xfb' => 'u', '\xfc' => 'u', '\xdd' => 'Y', '\xfd' => 'y', '\xff' => 'y', '\xc6' => 'Ae', '\xe6' => 'ae', '\xde' => 'Th', '\xfe' => 'th', '\xdf' => 'ss', '\x{0100}' => 'A', '\x{0102}' => 'A', '\x{0104}' => 'A', '\x{0101}' => 'a', '\x{0103}' => 'a', '\x{0105}' => 'a', '\x{0106}' => 'C', '\x{0108}' => 'C', '\x{010a}' => 'C', '\x{010c}' => 'C', '\x{0107}' => 'c', '\x{0109}' => 'c', '\x{010b}' => 'c', '\x{010d}' => 'c', '\x{010e}' => 'D', '\x{0110}' => 'D', '\x{010f}' => 'd', '\x{0111}' => 'd', '\x{0112}' => 'E', '\x{0114}' => 'E', '\x{0116}' => 'E', '\x{0118}' => 'E', '\x{011a}' => 'E', '\x{0113}' => 'e', '\x{0115}' => 'e', '\x{0117}' => 'e', '\x{0119}' => 'e', '\x{011b}' => 'e', '\x{011c}' => 'G', '\x{011e}' => 'G', '\x{0120}' => 'G', '\x{0122}' => 'G', '\x{011d}' => 'g', '\x{011f}' => 'g', '\x{0121}' => 'g', '\x{0123}' => 'g', '\x{0124}' => 'H', '\x{0126}' => 'H', '\x{0125}' => 'h', '\x{0127}' => 'h', '\x{0128}' => 'I', '\x{012a}' => 'I', '\x{012c}' => 'I', '\x{012e}' => 'I', '\x{0130}' => 'I', '\x{0129}' => 'i', '\x{012b}' => 'i', '\x{012d}' => 'i', '\x{012f}' => 'i', '\x{0131}' => 'i', '\x{0134}' => 'J', '\x{0135}' => 'j', '\x{0136}' => 'K', '\x{0137}' => 'k', '\x{0138}' => 'k', '\x{0139}' => 'L', '\x{013b}' => 'L', '\x{013d}' => 'L', '\x{013f}' => 'L', '\x{0141}' => 'L', '\x{013a}' => 'l', '\x{013c}' => 'l', '\x{013e}' => 'l', '\x{0140}' => 'l', '\x{0142}' => 'l', '\x{0143}' => 'N', '\x{0145}' => 'N', '\x{0147}' => 'N', '\x{014a}' => 'N', '\x{0144}' => 'n', '\x{0146}' => 'n', '\x{0148}' => 'n', '\x{014b}' => 'n', '\x{014c}' => 'O', '\x{014e}' => 'O', '\x{0150}' => 'O', '\x{014d}' => 'o', '\x{014f}' => 'o', '\x{0151}' => 'o', '\x{0154}' => 'R', '\x{0156}' => 'R', '\x{0158}' => 'R', '\x{0155}' => 'r', '\x{0157}' => 'r', '\x{0159}' => 'r', '\x{015a}' => 'S', '\x{015c}' => 'S', '\x{015e}' => 'S', '\x{0160}' => 'S', '\x{015b}' => 's', '\x{015d}' => 's', '\x{015f}' => 's', '\x{0161}' => 's', '\x{0162}' => 'T', '\x{0164}' => 'T', '\x{0166}' => 'T', '\x{0163}' => 't', '\x{0165}' => 't', '\x{0167}' => 't', '\x{0168}' => 'U', '\x{016a}' => 'U', '\x{016c}' => 'U', '\x{016e}' => 'U', '\x{0170}' => 'U', '\x{0172}' => 'U', '\x{0169}' => 'u', '\x{016b}' => 'u', '\x{016d}' => 'u', '\x{016f}' => 'u', '\x{0171}' => 'u', '\x{0173}' => 'u', '\x{0174}' => 'W', '\x{0175}' => 'w', '\x{0176}' => 'Y', '\x{0177}' => 'y', '\x{0178}' => 'Y', '\x{0179}' => 'Z', '\x{017b}' => 'Z', '\x{017d}' => 'Z', '\x{017a}' => 'z', '\x{017c}' => 'z', '\x{017e}' => 'z', '\x{0132}' => 'IJ', '\x{0133}' => 'ij', '\x{0152}' => 'Oe', '\x{0153}' => 'oe', '\x{0149}' => "'n", '\x{017f}' => 's', ]; const reLatin = '/[\xc0-\xd6\xd8-\xf6\xf8-\xff\x{0100}-\x{017f}]/u'; const rsComboMarksRange = '\\x{0300}-\\x{036f}'; const reComboHalfMarksRange = '\\x{fe20}-\\x{fe2f}'; const rsComboSymbolsRange = '\\x{20d0}-\\x{20ff}'; const rsComboRange = rsComboMarksRange.reComboHalfMarksRange.rsComboSymbolsRange; const rsCombo = '#['.rsComboRange.']#u'; function deburr(string $string): string { $patterns = \array_map( function ($pattern) { return "#$pattern#u"; }, \array_keys(deburredLetters) ); return \preg_replace(rsCombo, '', \preg_replace($patterns, \array_values(deburredLetters), $string)); } }
- namespace _ { function trimStart(string $string, string $chars = ' '): string { return \ltrim($string, $chars); } }
- namespace _ { function repeat(string $string, int $n = 1): string { return \str_repeat($string, $n); } }
- namespace _ { function padStart(string $string, int $length, string $chars = ' '): string { return \str_pad($string, $length, $chars, \STR_PAD_LEFT); } }
- namespace _ { function trim(string $string, string $chars = ' '): string { return \trim($string, $chars); } }
- namespace _ { function parseInt($string, int $radix = null): int { if (null === $radix) { $radix = 10; } elseif ($radix) { $radix = +$radix; } return \intval($string, $radix); } }
- namespace _ { function pad(string $string, int $length, string $chars = ' '): string { return \str_pad($string, $length, $chars, \STR_PAD_BOTH); } }
- namespace _ { use function _\internal\unicodeWords; const asciiWords = '/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/'; const hasUnicodeWord = '/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/'; function words(string $string, string $pattern = null): array { if (null === $pattern) { if (\preg_match(hasUnicodeWord, $string)) { return unicodeWords($string); } \preg_match_all(asciiWords, $string, $matches); return $matches[0] ?? []; } if (\preg_match_all($pattern, $string, $matches) > 0) { return $matches[0]; } return []; } }
- namespace _ { function unescape(string $string): string { return \html_entity_decode($string); } }
- namespace _ { function startCase(string $string) { return \implode(' ', \array_map('\ucfirst', words(\preg_replace("/['\x{2019}]/u", '', $string)))); } }
- namespace _ { function replace(string $string, string $pattern, $replacement = null): string { $callback = function (array $matches) use ($replacement): ?string { if (!\array_filter($matches)) { return null; } return \is_callable($replacement) ? $replacement(...$matches) : null; }; if (\preg_match(reRegExpChar, $pattern)) { if (!\is_callable($replacement)) { return \preg_replace($pattern, \is_string($replacement) || \is_array($replacement) ? $replacement : '', $string); } return \preg_replace_callback($pattern, $callback, $string); } return \str_replace($pattern, \is_string($replacement) || \is_array($replacement) ? $replacement : '', $string); } }
- namespace _ { function snakeCase(string $string): string { return \implode('_', \array_map('\strtolower', words(\preg_replace("/['\x{2019}]/u", '', $string)))); } }
- namespace _ { const reRegExpChar = '/([\\^$.*+?()[\]{}|])/'; function escapeRegExp(string $string): string { return \preg_replace(reRegExpChar, '\\\$0', $string); } }
- namespace _ { function toUpper(string $string): string { return \strtoupper($string); } }
- namespace _ { function startsWith(string $string, string $target, int $position = null): bool { $length = \strlen($string); $position = null === $position ? 0 : +$position; if ($position < 0) { $position = 0; } elseif ($position > $length) { $position = $length; } return $position >= 0 && \substr($string, $position, \strlen($target)) === $target; } }
- namespace _ { function capitalize(string $string): string { return \ucfirst(\mb_strtolower($string)); } }
- namespace _ { use function _\internal\castSlice; use function _\internal\hasUnicode; use function _\internal\stringSize; use function _\internal\stringToArray; const DEFAULT_TRUNC_LENGTH = 30; const DEFAULT_TRUNC_OMISSION = '...'; function truncate($string, array $options = []) { $separator = $options['separator'] ?? null; $length = $options['length'] ?? DEFAULT_TRUNC_LENGTH; $omission = $options['omission'] ?? DEFAULT_TRUNC_OMISSION; $strSymbols = null; $strLength = \strlen($string); if (hasUnicode($string)) { $strSymbols = stringToArray($string); $strLength = \count($strSymbols); } if ($length >= $strLength) { return $string; } $end = $length - stringSize($omission); if ($end < 1) { return $omission; } $result = $strSymbols ? \implode('', castSlice($strSymbols, 0, $end)) : \substr($string, 0, $end); if (null === $separator) { return $result.$omission; } if ($strSymbols) { $end += \strlen($result) - $end; } if (\preg_match(reRegExpChar, $separator)) { if (\preg_match($separator, \substr($string, 0, $end))) { $match = null; $newEnd = null; $substring = $result; if (\preg_match_all($separator, $substring, $match, PREG_OFFSET_CAPTURE)) { $newEnd = \end($match[0])[1]; } $result = \substr($result, 0, null === $newEnd ? $end : $newEnd); } } elseif (\strpos($string, $separator) !== $end) { $index = \strrpos($result, $separator); if (false !== $index && $index > -1) { $result = \substr($result, 0, $index); } } return $result.$omission; } }
- namespace _ { function upperCase(string $string) { return \implode(' ', \array_map('\strtoupper', words(\preg_replace(reQuotes, '', $string)))); } }
- namespace _ { function endsWith(string $string, string $target, int $position = null): bool { $length = \strlen($string); $position = null === $position ? $length : +$position; if ($position < 0) { $position = 0; } elseif ($position > $length) { $position = $length; } $position -= \strlen($target); return $position >= 0 && \substr($string, $position, \strlen($target)) === $target; } }
- namespace _ { const reEsTemplate = "\$\{([^\\}]*(?:\\.[^\\}]*)*)\}"; const reNoMatch = '($^)'; const reUnescapedString = "#([\'\n\r\x{2028}\x{2029}\\\])#u"; const stringEscapes = [ '\\' => '', '\n' => 'n', '\r' => 'r', '\u2028' => 'u2028', '\u2029' => 'u2029', ]; function template(string $string, array $options = []): callable { $options = \array_merge_recursive(\_::$templateSettings, $options); $interpolate = $options['interpolate'] ?? reNoMatch; $reDelimiters = \implode('|', [ ($options['escape'] ?? reNoMatch), ($interpolate === \_::reInterpolate ? reEsTemplate : reNoMatch), $interpolate, ($options['evaluate'] ?? reNoMatch), ]); $string = \preg_replace_callback('#'.$reDelimiters.'#u', function ($matches) { list(, $escapeValue, $interpolateValue, $esTemplateValue, $evaluateValue, ) = \array_merge($matches, \array_fill(\count($matches), 5 - \count($matches), null)); $interpolateValue = $interpolateValue ?: $esTemplateValue; $source = ''; if ($escapeValue) { $escapeValue = \trim($escapeValue); $source .= "=__e(\$${escapeValue});?>"; } if ($evaluateValue) { $source .= ""; } if ($interpolateValue) { $interpolateValue = \trim($interpolateValue ?? $esTemplateValue); $interpolateValue = \preg_replace('#^([\p{L}\p{N}_]+)$#u', '$$1', $interpolateValue); $source .= "=${interpolateValue};?>"; } return $source; }, $string); $string = \preg_replace_callback(reUnescapedString, function ($chr) { return stringEscapes[$chr[0]] ?? $chr[0]; }, $string); $imports = $options['imports'] ?? []; return new class($string, $imports) { public $source; private $imports; public function __construct(string $source, array $imports) { $this->source = $source; $this->imports = $imports; } public function __invoke(array $arguments = []) { $imports = ''; foreach ($this->imports as $import => $alias) { if (\class_exists($import)) { $imports .= "use $import as $alias;"; } elseif (\function_exists($import)) { $imports .= "use function $import as $alias;"; } } $file = \tempnam(\sys_get_temp_dir(), 'lodashphp'); if (!$file) { throw new \RuntimeException('Unable to create temporary file for template'); } \file_put_contents($file, "'.$this->source.''); $content = attempt(function () use ($file) { \ob_start(); require_once $file; return \ob_get_clean(); }); \unlink($file); return $content; } }; } }
- namespace _ { function padEnd(string $string, int $length, string $chars = ' '): string { return \str_pad($string, $length, $chars, \STR_PAD_RIGHT); } }
- namespace _ { function split(string $string, string $separator, int $limit = 0): array { if (\preg_match(reRegExpChar, $separator)) { return \preg_split($separator, $string, $limit ?? -1, PREG_SPLIT_DELIM_CAPTURE) ?: []; } $result = \explode($separator, $string); if ($limit > 0) { return \array_splice($result, 0, $limit); } return $result; } }
- namespace _ { function toLower(string $string): string { return \strtolower($string); } }
- namespace _ { function escape(string $string) { return \htmlentities($string); } }
- namespace _ { function kebabCase(string $string) { return \implode('-', \array_map('\strtolower', words(\preg_replace("/['\x{2019}]/u", '', $string)))); } }
- namespace _ { use _\internal\Traits\CacheDataTrait; use function _\internal\assocIndexOf; final class ListCache implements CacheInterface { use CacheDataTrait; public function __construct(iterable $entries = null) { $this->clear(); if (null !== $entries) { foreach ($entries as $key => $entry) { $this->set($key, $entry); } } } final public function set($key, $value): CacheInterface { $index = assocIndexOf($this->__data__, $key); if ($index < 0) { ++$this->size; $this->__data__[] = [$key, $value]; } else { $this->__data__[$index][1] = $value; } return $this; } final public function get($key) { $index = assocIndexOf($this->__data__, $key); return $index < 0 ? null : $this->__data__[$index][1]; } final public function has($key): bool { return assocIndexOf($this->__data__, $key) > -1; } final public function clear() { $this->__data__ = []; $this->size = 0; } final public function delete($key) { $index = assocIndexOf($this->__data__, $key); if ($index < 0) { return false; } $lastIndex = \count($this->__data__) - 1; if ($index === $lastIndex) { \array_pop($this->__data__); } else { \array_splice($this->__data__, $index, 1); } --$this->size; return true; } } }
\ No newline at end of file
diff --git a/src/internal/baseGet.php b/src/internal/baseGet.php
index c91a3d6..a9ff96a 100644
--- a/src/internal/baseGet.php
+++ b/src/internal/baseGet.php
@@ -20,9 +20,9 @@ function baseGet($object, $path)
$index = 0;
$length = \count($path);
- while ($object !== null && $index < $length) {
+ while ($object !== null && !is_scalar($object) && $index < $length) {
$object = property(toKey($path[$index++]))($object);
}
- return ($index > 0 && $index === $length) ? $object : null;
+ return ($index > 0 && $index === $length) ? $object : null;
}
diff --git a/src/internal/baseMatches.php b/src/internal/baseMatches.php
index d7c919b..3f39f4f 100644
--- a/src/internal/baseMatches.php
+++ b/src/internal/baseMatches.php
@@ -21,7 +21,7 @@ function baseMatches($source): callable
return true;
}
- if (\is_array($source) || $source instanceof \Traversable) {
+ if (\is_iterable($source)) {
foreach ($source as $k => $v) {
if (!isEqual(property($k)($value, $index, $collection), $v)) {
return false;
diff --git a/src/internal/castSlice.php b/src/internal/castSlice.php
index fcb027c..6d50495 100644
--- a/src/internal/castSlice.php
+++ b/src/internal/castSlice.php
@@ -25,7 +25,7 @@
function castSlice(array $array, int $start, ?int $end = null): array
{
$length = \count($array);
- $end = null === $end ? $length : $end;
+ $end = $end ?? $length;
return (!$start && $end >= $length) ? $array : \array_slice($array, $start, $end);
}
diff --git a/src/internal/isFlattenable.php b/src/internal/isFlattenable.php
index 266f59e..f14b5b4 100644
--- a/src/internal/isFlattenable.php
+++ b/src/internal/isFlattenable.php
@@ -22,5 +22,5 @@
*/
function isFlattenable($value): bool
{
- return \is_array($value) && \range(0, \count($value) - 1) === \array_keys($value);
+ return \is_array($value) && ([] === $value || \range(0, \count($value) - 1) === \array_keys($value));
}
diff --git a/src/internal/isIterateeCall.php b/src/internal/isIterateeCall.php
index 08b13b2..b9c3169 100644
--- a/src/internal/isIterateeCall.php
+++ b/src/internal/isIterateeCall.php
@@ -24,7 +24,7 @@
*/
function isIterateeCall($value, $index = null, $object = null)
{
- if (!\is_object($object) || !\is_array($object)) {
+ if (!\is_object($object) && !\is_array($object)) {
return false;
}
diff --git a/src/internal/overRest.php b/src/internal/overRest.php
index cfb46ce..a17be23 100644
--- a/src/internal/overRest.php
+++ b/src/internal/overRest.php
@@ -13,7 +13,8 @@
function overRest(callable $func, $start, callable $transform): callable
{
- $start = max($start ?? -1, 0);
+ $parameters = (new \ReflectionFunction($func))->getNumberOfParameters();
+ $start = max($start ?? $parameters - 1, 0);
return function () use ($func, $start, $transform) {
$args = \func_get_args();
@@ -31,6 +32,6 @@ function overRest(callable $func, $start, callable $transform): callable
}
$otherArgs[$start] = $transform($array);
- return $func(...$otherArgs[$start]);
+ return $func(...$otherArgs);
};
}
diff --git a/tests/Array/DropWhileTest.php b/tests/Array/DropWhileTest.php
index 997f761..50bef5a 100644
--- a/tests/Array/DropWhileTest.php
+++ b/tests/Array/DropWhileTest.php
@@ -25,5 +25,25 @@ public function testDropWhile()
$this->assertSame([['user' => 'pebbles', 'active' => false]], dropWhile($users, function ($user) {
return $user['active'];
}));
+
+ $lines = [
+ 'Processing report:',
+ 'Processed: 1',
+ 'Successful: 1',
+ '',
+ '',
+ ];
+
+ $lines = dropWhile($lines, static function ($x) {
+ return trim((string) $x) !== '';
+ });
+
+ self::assertEquals(['', ''], $lines);
+
+ $lines = dropWhile($lines, static function ($x) {
+ return trim((string) $x) === '';
+ });
+
+ self::assertEmpty($lines);
}
}
diff --git a/tests/Array/FlattenTest.php b/tests/Array/FlattenTest.php
index 6e93890..3c28d78 100644
--- a/tests/Array/FlattenTest.php
+++ b/tests/Array/FlattenTest.php
@@ -17,5 +17,7 @@ class FlattenTest extends TestCase
public function testFlatten()
{
$this->assertSame([1, 2, [3, [4]], 5], flatten([1, [2, [3, [4]], 5]]));
+
+ $this->assertSame([1, 2, 3, 4, 5, 6], flatten([[1, 2, 3], [], [4, 5, 6]]));
}
}
diff --git a/tests/Collection/SizeTest.php b/tests/Collection/SizeTest.php
index 490bf89..b750e29 100644
--- a/tests/Collection/SizeTest.php
+++ b/tests/Collection/SizeTest.php
@@ -26,6 +26,7 @@ public function testSize()
}));
$this->assertSame(12, size(new class implements \Countable {
+ #[\ReturnTypeWillChange]
public function count()
{
return 12;
diff --git a/tests/Function/AfterTest.php b/tests/Function/AfterTest.php
new file mode 100644
index 0000000..ed0c6bc
--- /dev/null
+++ b/tests/Function/AfterTest.php
@@ -0,0 +1,50 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use function _\after;
+use PHPUnit\Framework\TestCase;
+
+class AfterTest extends TestCase
+{
+ public function testAfter()
+ {
+ $counter = 0;
+
+ $after = after(12, function () use (&$counter) {
+ $counter++;
+
+ return $counter;
+ });
+
+ for ($i = 0; $i < 12; $i++) {
+ $after();
+ }
+
+ $this->assertSame(1, $counter);
+ }
+
+ public function testAfterNotCalled()
+ {
+ $counter = 0;
+
+ $after = after(12, function () use (&$counter) {
+ $counter++;
+
+ return $counter;
+ });
+
+ for ($i = 0; $i < 10; $i++) {
+ $after();
+ }
+
+ $this->assertSame(0, $counter);
+ }
+}
diff --git a/tests/Function/AryTest.php b/tests/Function/AryTest.php
new file mode 100644
index 0000000..ef9ca60
--- /dev/null
+++ b/tests/Function/AryTest.php
@@ -0,0 +1,22 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use function _\ary;
+use function _\map;
+use PHPUnit\Framework\TestCase;
+
+class AryTest extends TestCase
+{
+ public function testAry()
+ {
+ $this->assertSame([6, 8, 10], map(['6', '8', '10'], ary('intval', 1)));
+ }
+}
diff --git a/tests/Function/BeforeTest.php b/tests/Function/BeforeTest.php
new file mode 100644
index 0000000..f43a968
--- /dev/null
+++ b/tests/Function/BeforeTest.php
@@ -0,0 +1,47 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use function _\before;
+use function _\map;
+use function _\uniqBy;
+use PHPUnit\Framework\TestCase;
+
+class BeforeTest extends TestCase
+{
+ public function testBefore()
+ {
+ $counter = 0;
+ $func = before(5, function () use (&$counter) {
+ $counter++;
+
+ return $counter;
+ });
+
+ for ($i = 0; $i < 20; $i++) {
+ $func();
+ }
+
+ $this->assertSame(4, $counter);
+ $this->assertSame(4, $func());
+ }
+
+ public function testBeforeMap()
+ {
+ $users = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ $result = uniqBy(map($users, before(5, function (int $id) {
+ return [
+ 'id' => $id
+ ];
+ })), 'id');
+
+ $this->assertSame([['id' => 1],['id' => 2],['id' => 3],['id' => 4]], $result);
+ }
+}
diff --git a/tests/Function/BindKeyTest.php b/tests/Function/BindKeyTest.php
new file mode 100644
index 0000000..7cfcc50
--- /dev/null
+++ b/tests/Function/BindKeyTest.php
@@ -0,0 +1,32 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\bindKey;
+
+class BindKeyTest extends TestCase
+{
+ public function testBindKey()
+ {
+ $object = new class {
+ private $user = 'fred';
+
+ public function greet($greeting, $punctuation)
+ {
+ return $greeting.' '.$this->user.$punctuation;
+ }
+ };
+
+ $bound = bindKey($object, 'greet', 'hi');
+
+ $this->assertSame('hi fred!', $bound('!'));
+ }
+}
diff --git a/tests/Function/BindTest.php b/tests/Function/BindTest.php
new file mode 100644
index 0000000..a99a4f9
--- /dev/null
+++ b/tests/Function/BindTest.php
@@ -0,0 +1,39 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\bind;
+
+class BindTest extends TestCase
+{
+ public function testBind()
+ {
+ $object = new class {
+ public $user = 'fred';
+
+ private $age = 54;
+ };
+
+ $greet = function ($greeting, $punctuation) {
+ return $greeting.' '.$this->user.$punctuation;
+ };
+
+ $bound = bind($greet, $object, 'hi');
+
+ $this->assertSame('hi fred!', $bound('!'));
+
+ $bound = bind(function ($prefix, $suffix) {
+ return $prefix.' '.$this->age.' '.$suffix;
+ }, $object, 'I\'m');
+
+ $this->assertSame('I\'m 54 years', $bound('years'));
+ }
+}
diff --git a/tests/Function/CurryTest.php b/tests/Function/CurryTest.php
new file mode 100644
index 0000000..a267362
--- /dev/null
+++ b/tests/Function/CurryTest.php
@@ -0,0 +1,31 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\curry;
+
+class CurryTest extends TestCase
+{
+ public function testCurry()
+ {
+ $abc = function ($a, $b, $c = null) {
+ return [$a, $b, $c];
+ };
+
+ $curried = curry($abc);
+
+ $this->assertSame([1, 2, 3], $curried(1)(2)(3));
+ $this->assertSame([1, 2, 3], $curried(1, 2)(3));
+ $this->assertSame([1, 2, 3], $curried(1, 2, 3));
+ $this->assertSame([1, 2, null], curry($abc, 2)(1)(2));
+ $this->assertSame([1, 2, 3], $curried(1)(_, 3)(2));
+ }
+}
diff --git a/tests/Function/DelayTest.php b/tests/Function/DelayTest.php
new file mode 100644
index 0000000..65e1465
--- /dev/null
+++ b/tests/Function/DelayTest.php
@@ -0,0 +1,28 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use function _\delay;
+use PHPUnit\Framework\TestCase;
+
+class DelayTest extends TestCase
+{
+ public function testDelay()
+ {
+ $a = 1;
+ $time = microtime(true);
+ delay(function ($increment) use (&$a) {
+ $a += $increment;
+ }, 20, 2);
+
+ $this->assertSame(3, $a);
+ $this->assertTrue(((microtime(true) - $time) * 1000) > 20);
+ }
+}
diff --git a/tests/Function/FlipTest.php b/tests/Function/FlipTest.php
new file mode 100644
index 0000000..2e7ef83
--- /dev/null
+++ b/tests/Function/FlipTest.php
@@ -0,0 +1,25 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\flip;
+
+class FlipTest extends TestCase
+{
+ public function testFlip()
+ {
+ $flipped = flip(function () {
+ return func_get_args();
+ });
+
+ $this->assertSame(['d', 'c', 'b', 'a'], $flipped('a', 'b', 'c', 'd'));
+ }
+}
diff --git a/tests/Function/OnceTest.php b/tests/Function/OnceTest.php
new file mode 100644
index 0000000..96e057e
--- /dev/null
+++ b/tests/Function/OnceTest.php
@@ -0,0 +1,30 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\once;
+
+class OnceTest extends TestCase
+{
+ public function testOnce()
+ {
+ $counter = 0;
+
+ $func = once(function () use (&$counter) {
+ $counter++;
+ });
+
+ $func();
+ $func();
+
+ $this->assertSame(1, $counter);
+ }
+}
diff --git a/tests/Function/OverArgsTest.php b/tests/Function/OverArgsTest.php
new file mode 100644
index 0000000..197fea6
--- /dev/null
+++ b/tests/Function/OverArgsTest.php
@@ -0,0 +1,37 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\overArgs;
+
+class OverArgsTest extends TestCase
+{
+ public function testOverArgs()
+ {
+ function doubled($n)
+ {
+ return $n * 2;
+ }
+
+ function square($n)
+ {
+ return $n * $n;
+ }
+
+ $func = overArgs(function ($x, $y) {
+ return [$x, $y];
+ }, ['square', 'doubled']);
+
+ $this->assertSame([81, 6], $func(9, 3));
+
+ $this->assertSame([100, 10], $func(10, 5));
+ }
+}
diff --git a/tests/Function/PartialTest.php b/tests/Function/PartialTest.php
new file mode 100644
index 0000000..2a2c8c1
--- /dev/null
+++ b/tests/Function/PartialTest.php
@@ -0,0 +1,26 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\partial;
+
+class PartialTest extends TestCase
+{
+ public function testPartial()
+ {
+ $greet = function ($greeting, $name) {
+ return $greeting.' '.$name;
+ };
+
+ $sayHelloTo = partial($greet, 'hello');
+ $this->assertSame('hello fred', $sayHelloTo('fred'));
+ }
+}
diff --git a/tests/Function/RestTest.php b/tests/Function/RestTest.php
new file mode 100644
index 0000000..58ad8d0
--- /dev/null
+++ b/tests/Function/RestTest.php
@@ -0,0 +1,29 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\initial;
+use function _\last;
+use function _\rest;
+use function _\size;
+
+class RestTest extends TestCase
+{
+ public function testRest()
+ {
+ $say = rest(function ($what, $names) {
+ return $what.' '.implode(', ', initial($names)).
+ (size($names) > 1 ? ', & ' : '').last($names);
+ });
+
+ $this->assertSame('hello fred, barney, & pebbles', $say('hello', 'fred', 'barney', 'pebbles'));
+ }
+}
diff --git a/tests/Function/SpreadTest.php b/tests/Function/SpreadTest.php
new file mode 100644
index 0000000..b7b6cdb
--- /dev/null
+++ b/tests/Function/SpreadTest.php
@@ -0,0 +1,25 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use PHPUnit\Framework\TestCase;
+use function _\spread;
+
+class SpreadTest extends TestCase
+{
+ public function testSpread()
+ {
+ $say = spread(function ($who, $what) {
+ return $who.' says '.$what;
+ });
+
+ $this->assertSame('fred says hello', $say(['fred', 'hello']));
+ }
+}
diff --git a/tests/Function/UnaryTest.php b/tests/Function/UnaryTest.php
new file mode 100644
index 0000000..b68c439
--- /dev/null
+++ b/tests/Function/UnaryTest.php
@@ -0,0 +1,22 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use function _\map;
+use function _\unary;
+use PHPUnit\Framework\TestCase;
+
+class UnaryTest extends TestCase
+{
+ public function testUnary()
+ {
+ $this->assertSame([6, 8, 10], map(['6', '8', '10'], unary('intval')));
+ }
+}
diff --git a/tests/Function/WrapTest.php b/tests/Function/WrapTest.php
new file mode 100644
index 0000000..008485f
--- /dev/null
+++ b/tests/Function/WrapTest.php
@@ -0,0 +1,25 @@
+
+ * @copyright Copyright (c) 2017
+ */
+
+use function _\wrap;
+use PHPUnit\Framework\TestCase;
+
+class WrapTest extends TestCase
+{
+ public function testWrap()
+ {
+ $p = wrap('_\escape', function ($func, $text) {
+ return '' . $func($text) . '
'; + }); + + $this->assertSame('fred, barney, & pebbles
', $p('fred, barney, & pebbles')); + } +} diff --git a/tests/LodashTest.php b/tests/LodashTest.php new file mode 100644 index 0000000..fae6947 --- /dev/null +++ b/tests/LodashTest.php @@ -0,0 +1,25 @@ + 'barney', 'age' => 36], + ['user' => 'fred', 'age' => 40], + ['user' => 'pebbles', 'age' => 1], + ]; + + $youngest = __($users) + ->sortBy('age') + ->map(function ($o) { + return $o['user'] . ' is ' . $o['age']; + }) + ->head() + ->value(); + + $this->assertSame('pebbles is 1', $youngest); + } +} diff --git a/tests/Object/GetTest.php b/tests/Object/GetTest.php new file mode 100644 index 0000000..4fb02bb --- /dev/null +++ b/tests/Object/GetTest.php @@ -0,0 +1,49 @@ + + * @copyright Copyright (c) 2019 + */ + +use function _\get; +use PHPUnit\Framework\TestCase; + +class GetTest extends TestCase +{ + public function testGetArray() + { + $actualValue1 = "data"; + $sampleArray = ["key1" => ["key2" => ["key3" => $actualValue1, "key4" => ""]]]; + $defaultValue = "default"; + $this->assertSame($actualValue1, get($sampleArray, "key1.key2.key3", "default"), "Default To method 1 failed"); + $this->assertSame($defaultValue, get($sampleArray, "key2.key2.key3", $defaultValue), "Default To method 2 failed"); + $this->assertSame($actualValue1, get($sampleArray, ["key1","key2","key3"], $defaultValue), "Default To method 3 failed"); + $this->assertSame($defaultValue, get($sampleArray, "key1.key2.key3.key4", $defaultValue), "Default To method 4 failed"); + $this->assertSame($defaultValue, get($sampleArray, "key1.key2.key3.key4", $defaultValue), "Default To method 5 failed"); + $this->assertSame($defaultValue, get($sampleArray, ["key1","key2","key3","key4"], $defaultValue), "Default To method 6 failed"); + $this->assertSame("", get($sampleArray, "key1.key2.key4", $defaultValue), "Default To method 8 failed"); + + $this->assertSame($sampleArray["key1"]["key2"], _::get($sampleArray, "key1.key2", $defaultValue), "Default To method 9 failed"); + $this->assertSame($defaultValue, _::get($sampleArray, "key1.key3", $defaultValue), "Default To method 10 failed"); + } + + public function testDefaultToObject() + { + $actualValue1 = "data"; + $sampleArray = (object)["key1" => (object)["key2" => (object)["key3" => $actualValue1, "key4" => ""]]]; + $defaultValue = "default"; + $this->assertSame($actualValue1, get($sampleArray, "key1.key2.key3", $defaultValue), "Default To method object 1 failed"); + $this->assertSame($defaultValue, get($sampleArray, "key2.key2.key3", $defaultValue), "Default To method object 2 failed"); + $this->assertSame($actualValue1, get($sampleArray, ["key1","key2","key3"], $defaultValue), "Default To method object 3 failed"); + $this->assertSame($defaultValue, get($sampleArray, "key1.key2.key3.key4", $defaultValue), "Default To method object 4 failed"); + $this->assertSame($defaultValue, get($sampleArray, "key1.key2.key3.key4", $defaultValue), "Default To method object 5 failed"); + $this->assertSame($defaultValue, get($sampleArray, ["key1","key2","key3","key4"], $defaultValue), "Default To method object 6 failed"); + $this->assertSame("", get($sampleArray, "key1.key2.key4", $defaultValue), "Default To method object 8 failed"); + + $this->assertSame($sampleArray->key1->key2, _::get($sampleArray, "key1.key2", $defaultValue), "Default To method object 9 failed"); + $this->assertSame($defaultValue, _::get($sampleArray, "key1.key3", $defaultValue), "Default To method 10 failed"); + } +} diff --git a/tests/Seq/ChainTest.php b/tests/Seq/ChainTest.php new file mode 100644 index 0000000..f647cff --- /dev/null +++ b/tests/Seq/ChainTest.php @@ -0,0 +1,35 @@ + + * @copyright Copyright (c) 2017 + */ + +use function _\chain; +use PHPUnit\Framework\TestCase; + +class ChainTest extends TestCase +{ + public function testChain() + { + $users = [ + ['user' => 'barney', 'age' => 36], + ['user' => 'fred', 'age' => 40], + ['user' => 'pebbles', 'age' => 1], + ]; + + $youngest = chain($users) + ->sortBy('age') + ->map(function ($o) { + return $o['user'] . ' is ' . $o['age']; + }) + ->head() + ->value(); + + $this->assertSame('pebbles is 1', $youngest); + } +} diff --git a/tests/Util/DefaultToTest.php b/tests/Util/DefaultToTest.php new file mode 100644 index 0000000..f428473 --- /dev/null +++ b/tests/Util/DefaultToTest.php @@ -0,0 +1,26 @@ + + * @copyright Copyright (c) 2019 + */ + +use function _\defaultTo; +use PHPUnit\Framework\TestCase; + +class DefaultToTest extends TestCase +{ + public function testDefaultTo() + { + $null = null; + $default = "defaultValue"; + $realValue = "string"; + $this->assertSame($default, defaultTo($null, $default), "DefaultTo 1 failed"); + $this->assertSame($default, defaultTo(NAN, $default), "DefaultTo 2 failed"); + $this->assertSame($realValue, defaultTo($realValue, $default), "DefaultTo 3 failed"); + $this->assertSame("", defaultTo("", $default), "DefaultTo 4 failed"); + } +} diff --git a/vendor-bin/php-cs-fixer/composer.json b/vendor-bin/php-cs-fixer/composer.json deleted file mode 100644 index 4741827..0000000 --- a/vendor-bin/php-cs-fixer/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "friendsofphp/php-cs-fixer": "^2.12" - } -} diff --git a/vendor-bin/php-cs-fixer/composer.lock b/vendor-bin/php-cs-fixer/composer.lock deleted file mode 100644 index 47f9874..0000000 --- a/vendor-bin/php-cs-fixer/composer.lock +++ /dev/null @@ -1,1093 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "6164bfe4091cb1fe1c219656f116f002", - "packages": [ - { - "name": "composer/semver", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "time": "2016-08-30T16:08:34+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "e1809da56ce1bd1b547a752936817341ac244d8e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/e1809da56ce1bd1b547a752936817341ac244d8e", - "reference": "e1809da56ce1bd1b547a752936817341ac244d8e", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0", - "psr/log": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "time": "2018-08-16T10:54:23+00:00" - }, - { - "name": "doctrine/annotations", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", - "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": "^7.1" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2017-12-06T07:11:42+00:00" - }, - { - "name": "doctrine/lexer", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "lexer", - "parser" - ], - "time": "2014-09-09T13:34:57+00:00" - }, - { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.12.2", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "dcc87d5414e9d0bd316fce81a5bedb9ce720b183" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/dcc87d5414e9d0bd316fce81a5bedb9ce720b183", - "reference": "dcc87d5414e9d0bd316fce81a5bedb9ce720b183", - "shasum": "" - }, - "require": { - "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.0", - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "php": "^5.6 || >=7.0 <7.3", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.2 || ^4.0", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" - }, - "conflict": { - "hhvm": "*" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.1", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", - "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", - "phpunitgoodpractices/traits": "^1.5.1", - "symfony/phpunit-bridge": "^4.0" - }, - "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." - }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", - "autoload": { - "psr-4": { - "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationCaseFactory.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/Test/IntegrationCaseFactoryInterface.php", - "tests/Test/InternalIntegrationCaseFactory.php", - "tests/TestCase.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "A tool to automatically fix PHP code style", - "time": "2018-07-06T10:37:40+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.99", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "shasum": "" - }, - "require": { - "php": "^7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "time": "2018-07-02T15:55:56+00:00" - }, - { - "name": "php-cs-fixer/diff", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3", - "symfony/process": "^3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "SpacePossum" - } - ], - "description": "sebastian/diff v2 backport support for PHP5.6", - "homepage": "https://github.com/PHP-CS-Fixer", - "keywords": [ - "diff" - ], - "time": "2018-02-15T16:58:55+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "symfony/console", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" - }, - "suggest": { - "psr/log-implementation": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e", - "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/stopwatch": "~3.4|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T09:10:45+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "2e30335e0aafeaa86645555959572fe7cea22b43" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/2e30335e0aafeaa86645555959572fe7cea22b43", - "reference": "2e30335e0aafeaa86645555959572fe7cea22b43", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" - }, - { - "name": "symfony/options-resolver", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "1913f1962477cdbb13df951f8147d5da1fe2412c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/1913f1962477cdbb13df951f8147d5da1fe2412c", - "reference": "1913f1962477cdbb13df951f8147d5da1fe2412c", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony OptionsResolver Component", - "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ], - "time": "2018-07-26T08:55:25+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.9.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2018-08-06T14:22:27+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.9.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2018-08-06T14:22:27+00:00" - }, - { - "name": "symfony/polyfill-php70", - "version": "v1.9.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934", - "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2018-08-06T14:22:27+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.9.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae", - "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2018-08-06T14:22:27+00:00" - }, - { - "name": "symfony/process", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", - "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "966c982df3cca41324253dc0c7ffe76b6076b705" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/966c982df3cca41324253dc0c7ffe76b6076b705", - "reference": "966c982df3cca41324253dc0c7ffe76b6076b705", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T11:00:49+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json deleted file mode 100644 index d7c0420..0000000 --- a/vendor-bin/phpstan/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "phpstan/phpstan": "^0.10.3" - } -} diff --git a/vendor-bin/phpstan/composer.lock b/vendor-bin/phpstan/composer.lock deleted file mode 100644 index cc430f1..0000000 --- a/vendor-bin/phpstan/composer.lock +++ /dev/null @@ -1,1028 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "885b295492a97a537399d0d309928b59", - "packages": [ - { - "name": "composer/xdebug-handler", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/c919dc6c62e221fc6406f861ea13433c0aa24f08", - "reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0", - "psr/log": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "time": "2018-04-11T15:42:36+00:00" - }, - { - "name": "jean85/pretty-package-versions", - "version": "1.2", - "source": { - "type": "git", - "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/75c7effcf3f77501d0e0caa75111aff4daa0dd48", - "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48", - "shasum": "" - }, - "require": { - "ocramius/package-versions": "^1.2.0", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jean85\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alessandro Lai", - "email": "alessandro.lai85@gmail.com" - } - ], - "description": "A wrapper for ocramius/package-versions to get pretty versions strings", - "keywords": [ - "composer", - "package", - "release", - "versions" - ], - "time": "2018-06-13T13:22:40+00:00" - }, - { - "name": "nette/bootstrap", - "version": "v2.4.6", - "source": { - "type": "git", - "url": "https://github.com/nette/bootstrap.git", - "reference": "268816e3f1bb7426c3a4ceec2bd38a036b532543" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/bootstrap/zipball/268816e3f1bb7426c3a4ceec2bd38a036b532543", - "reference": "268816e3f1bb7426c3a4ceec2bd38a036b532543", - "shasum": "" - }, - "require": { - "nette/di": "~2.4.7", - "nette/utils": "~2.4", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "latte/latte": "~2.2", - "nette/application": "~2.3", - "nette/caching": "~2.3", - "nette/database": "~2.3", - "nette/forms": "~2.3", - "nette/http": "~2.4.0", - "nette/mail": "~2.3", - "nette/robot-loader": "^2.4.2 || ^3.0", - "nette/safe-stream": "~2.2", - "nette/security": "~2.3", - "nette/tester": "~2.0", - "tracy/tracy": "^2.4.1" - }, - "suggest": { - "nette/robot-loader": "to use Configurator::createRobotLoader()", - "tracy/tracy": "to use Configurator::enableTracy()" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", - "homepage": "https://nette.org", - "keywords": [ - "bootstrapping", - "configurator", - "nette" - ], - "time": "2018-05-17T12:52:20+00:00" - }, - { - "name": "nette/di", - "version": "v2.4.13", - "source": { - "type": "git", - "url": "https://github.com/nette/di.git", - "reference": "3f8f212b02d5c17feb97a7e0a39ab306f40c06ca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/di/zipball/3f8f212b02d5c17feb97a7e0a39ab306f40c06ca", - "reference": "3f8f212b02d5c17feb97a7e0a39ab306f40c06ca", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/neon": "^2.3.3 || ~3.0.0", - "nette/php-generator": "^2.6.1 || ~3.0.0", - "nette/utils": "^2.4.3 || ~3.0.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/bootstrap": "<2.4", - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", - "homepage": "https://nette.org", - "keywords": [ - "compiled", - "di", - "dic", - "factory", - "ioc", - "nette", - "static" - ], - "time": "2018-06-11T08:46:01+00:00" - }, - { - "name": "nette/finder", - "version": "v2.4.2", - "source": { - "type": "git", - "url": "https://github.com/nette/finder.git", - "reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/finder/zipball/ee951a656cb8ac622e5dd33474a01fd2470505a0", - "reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0", - "shasum": "" - }, - "require": { - "nette/utils": "~2.4", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🔍 Nette Finder: find files and directories with an intuitive API.", - "homepage": "https://nette.org", - "keywords": [ - "filesystem", - "glob", - "iterator", - "nette" - ], - "time": "2018-06-28T11:49:23+00:00" - }, - { - "name": "nette/neon", - "version": "v2.4.3", - "source": { - "type": "git", - "url": "https://github.com/nette/neon.git", - "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/neon/zipball/5e72b1dd3e2d34f0863c5561139a19df6a1ef398", - "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "ext-json": "*", - "php": ">=5.6.0" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🍸 Nette NEON: encodes and decodes NEON file format.", - "homepage": "http://ne-on.org", - "keywords": [ - "export", - "import", - "neon", - "nette", - "yaml" - ], - "time": "2018-03-21T12:12:21+00:00" - }, - { - "name": "nette/php-generator", - "version": "v3.0.5", - "source": { - "type": "git", - "url": "https://github.com/nette/php-generator.git", - "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/ea90209c2e8a7cd087b2742ca553c047a8df5eff", - "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4.2 || ~3.0.0", - "php": ">=7.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.2 features.", - "homepage": "https://nette.org", - "keywords": [ - "code", - "nette", - "php", - "scaffolding" - ], - "time": "2018-08-09T14:32:27+00:00" - }, - { - "name": "nette/robot-loader", - "version": "v3.0.4", - "source": { - "type": "git", - "url": "https://github.com/nette/robot-loader.git", - "reference": "3cf88781a05e0bf4618ae605361afcbaa4d5b392" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/robot-loader/zipball/3cf88781a05e0bf4618ae605361afcbaa4d5b392", - "reference": "3cf88781a05e0bf4618ae605361afcbaa4d5b392", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/finder": "^2.3 || ^3.0", - "nette/utils": "^2.4 || ^3.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", - "homepage": "https://nette.org", - "keywords": [ - "autoload", - "class", - "interface", - "nette", - "trait" - ], - "time": "2018-06-22T09:34:04+00:00" - }, - { - "name": "nette/utils", - "version": "v2.5.2", - "source": { - "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "183069866dc477fcfbac393ed486aaa6d93d19a5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/183069866dc477fcfbac393ed486aaa6d93d19a5", - "reference": "183069866dc477fcfbac393ed486aaa6d93d19a5", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize() and toAscii()", - "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ], - "files": [ - "src/loader.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", - "homepage": "https://nette.org", - "keywords": [ - "array", - "core", - "datetime", - "images", - "json", - "nette", - "paginator", - "password", - "slugify", - "string", - "unicode", - "utf-8", - "utility", - "validation" - ], - "time": "2018-05-02T17:16:08+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.0.3", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d", - "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5 || ^7.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2018-07-15T17:25:16+00:00" - }, - { - "name": "ocramius/package-versions", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "4489d5002c49d55576fa0ba786f42dbb009be46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/4489d5002c49d55576fa0ba786f42dbb009be46f", - "reference": "4489d5002c49d55576fa0ba786f42dbb009be46f", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0.0", - "php": "^7.1.0" - }, - "require-dev": { - "composer/composer": "^1.6.3", - "ext-zip": "*", - "infection/infection": "^0.7.1", - "phpunit/phpunit": "^7.0.0" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2018-02-05T13:05:30+00:00" - }, - { - "name": "phpstan/phpdoc-parser", - "version": "0.3", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "ed3223362174b8067729930439e139794e9e514a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ed3223362174b8067729930439e139794e9e514a", - "reference": "ed3223362174b8067729930439e139794e9e514a", - "shasum": "" - }, - "require": { - "php": "~7.1" - }, - "require-dev": { - "consistence/coding-standard": "^2.0.0", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", - "phpstan/phpstan": "^0.10@dev", - "phpunit/phpunit": "^6.3", - "slevomat/coding-standard": "^3.3.0", - "symfony/process": "^3.4 || ^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.3-dev" - } - }, - "autoload": { - "psr-4": { - "PHPStan\\PhpDocParser\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPDoc parser with support for nullable, intersection and generic types", - "time": "2018-06-20T17:48:01+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "0.10.3", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc62f78c9aa6e9f7c44e8d6518f1123cd1e1b1c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc62f78c9aa6e9f7c44e8d6518f1123cd1e1b1c0", - "reference": "dc62f78c9aa6e9f7c44e8d6518f1123cd1e1b1c0", - "shasum": "" - }, - "require": { - "composer/xdebug-handler": "^1.0", - "jean85/pretty-package-versions": "^1.0.3", - "nette/bootstrap": "^2.4 || ^3.0", - "nette/di": "^2.4.7 || ^3.0", - "nette/robot-loader": "^3.0.1", - "nette/utils": "^2.4.5 || ^3.0", - "nikic/php-parser": "^4.0.2", - "php": "~7.1", - "phpstan/phpdoc-parser": "^0.3", - "symfony/console": "~3.2 || ~4.0", - "symfony/finder": "~3.2 || ~4.0" - }, - "require-dev": { - "brianium/paratest": "^2.0", - "consistence/coding-standard": "^3.3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", - "ext-gd": "*", - "ext-intl": "*", - "ext-mysqli": "*", - "ext-zip": "*", - "jakub-onderka/php-parallel-lint": "^1.0", - "localheinz/composer-normalize": "~0.8.0", - "phing/phing": "^2.16.0", - "phpstan/phpstan-deprecation-rules": "^0.10.2", - "phpstan/phpstan-php-parser": "^0.10", - "phpstan/phpstan-phpunit": "^0.10", - "phpstan/phpstan-strict-rules": "^0.10", - "phpunit/phpunit": "^7.0", - "slevomat/coding-standard": "^4.6.2" - }, - "bin": [ - "bin/phpstan" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.10-dev" - } - }, - "autoload": { - "psr-4": { - "PHPStan\\": [ - "src/", - "build/PHPStan" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "time": "2018-08-12T15:14:21+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "symfony/console", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" - }, - "suggest": { - "psr/log-implementation": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.9.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2018-08-06T14:22:27+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json deleted file mode 100644 index 1d41d8f..0000000 --- a/vendor-bin/phpunit/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "phpunit/phpunit": "^7.3" - } -} diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock deleted file mode 100644 index b8ce301..0000000 --- a/vendor-bin/phpunit/composer.lock +++ /dev/null @@ -1,1423 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "c53e40477ad5fd9b453ca1e5ff4a2b95", - "packages": [ - { - "name": "doctrine/instantiator", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2017-07-22T11:58:36+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.8.1", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2018-06-11T23:09:50+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2017-09-11T18:02:19+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2017-07-14T14:27:02+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2018-08-05T17:53:17+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "6.0.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-xdebug": "^2.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2018-06-01T07:51:50+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2018-06-11T11:44:00+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2018-02-01T13:07:23+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2018-02-01T13:16:43+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "7.3.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f9b14c17860eccb440a0352a117a81eb754cff5a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f9b14c17860eccb440a0352a117a81eb754cff5a", - "reference": "f9b14c17860eccb440a0352a117a81eb754cff5a", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.0", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^3.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.3-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2018-08-07T06:44:28+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "shasum": "" - }, - "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-07-12T15:12:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "366541b989927187c4ca70490a35615d3fef2dce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", - "reference": "366541b989927187c4ca70490a35615d3fef2dce", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2018-06-10T07:54:39+00:00" - }, - { - "name": "sebastian/environment", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2017-07-01T08:51:00+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2017-04-03T13:19:02+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2018-01-29T19:49:41+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -}Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: