diff --git a/.gitignore b/.gitignore index 3a60e9ff..d005c20c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ public/conf public/WowOss.exe app/index/controller/Test.php composer.phar -app/test/ \ No newline at end of file +app/test/ +vendor \ No newline at end of file diff --git a/README.md b/README.md index df1b7521..eb8bf2ea 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,29 @@ 技术交流QQ群:[763822524](https://jq.qq.com/?_wv=1027&k=5IHJawE) `加群请备注来源:如gitee、github、官网等`。 +## 安装教程 +>EasyAdmin 使用 Composer 来管理项目依赖。因此,在使用 EasyAdmin 之前,请确保你的机器已经安装了 Composer。 + +#### 通过 Composer 创建项目`建议` +`composer create-project --prefer-dist zhongshaofa/easyadmin blog` + +#### 通过git下载安装包,composer安装依赖包 + +```bash +第一步,下载安装包 + +git clone https://github.com/zhongshaofa/easyadmin +或者 +git clone https://gitee.com/zhongshaofa/easyadmin + + +第二步,安装依赖包 +composer install + +``` + + + ## 站点地址 * 官方网站:[http://easyadmin.99php.cn](http://easyadmin.99php.cn) diff --git a/vendor/adbario/php-dot-notation/LICENSE.md b/vendor/adbario/php-dot-notation/LICENSE.md deleted file mode 100644 index fe013238..00000000 --- a/vendor/adbario/php-dot-notation/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -# The MIT License (MIT) - -Copyright (c) 2016-2019 Riku Särkinen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/adbario/php-dot-notation/composer.json b/vendor/adbario/php-dot-notation/composer.json deleted file mode 100644 index b7b82cb4..00000000 --- a/vendor/adbario/php-dot-notation/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "adbario/php-dot-notation", - "description": "PHP dot notation access to arrays", - "keywords": ["dotnotation", "arrayaccess"], - "homepage": "https://github.com/adbario/php-dot-notation", - "license": "MIT", - "authors": [ - { - "name": "Riku Särkinen", - "email": "riku@adbar.io" - } - ], - "require": { - "php": ">=5.5", - "ext-json": "*" - }, - "require-dev": { - "phpunit/phpunit": "^4.0|^5.0|^6.0", - "squizlabs/php_codesniffer": "^3.0" - }, - "autoload": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Adbar\\": "src" - } - } -} diff --git a/vendor/adbario/php-dot-notation/src/Dot.php b/vendor/adbario/php-dot-notation/src/Dot.php deleted file mode 100644 index 8d504d9e..00000000 --- a/vendor/adbario/php-dot-notation/src/Dot.php +++ /dev/null @@ -1,601 +0,0 @@ - - * @link https://github.com/adbario/php-dot-notation - * @license https://github.com/adbario/php-dot-notation/blob/2.x/LICENSE.md (MIT License) - */ -namespace Adbar; - -use Countable; -use ArrayAccess; -use ArrayIterator; -use JsonSerializable; -use IteratorAggregate; - -/** - * Dot - * - * This class provides a dot notation access and helper functions for - * working with arrays of data. Inspired by Laravel Collection. - */ -class Dot implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable -{ - /** - * The stored items - * - * @var array - */ - protected $items = []; - - /** - * Create a new Dot instance - * - * @param mixed $items - */ - public function __construct($items = []) - { - $this->items = $this->getArrayItems($items); - } - - /** - * Set a given key / value pair or pairs - * if the key doesn't exist already - * - * @param array|int|string $keys - * @param mixed $value - */ - public function add($keys, $value = null) - { - if (is_array($keys)) { - foreach ($keys as $key => $value) { - $this->add($key, $value); - } - } elseif (is_null($this->get($keys))) { - $this->set($keys, $value); - } - } - - /** - * Return all the stored items - * - * @return array - */ - public function all() - { - return $this->items; - } - - /** - * Delete the contents of a given key or keys - * - * @param array|int|string|null $keys - */ - public function clear($keys = null) - { - if (is_null($keys)) { - $this->items = []; - - return; - } - - $keys = (array) $keys; - - foreach ($keys as $key) { - $this->set($key, []); - } - } - - /** - * Delete the given key or keys - * - * @param array|int|string $keys - */ - public function delete($keys) - { - $keys = (array) $keys; - - foreach ($keys as $key) { - if ($this->exists($this->items, $key)) { - unset($this->items[$key]); - - continue; - } - - $items = &$this->items; - $segments = explode('.', $key); - $lastSegment = array_pop($segments); - - foreach ($segments as $segment) { - if (!isset($items[$segment]) || !is_array($items[$segment])) { - continue 2; - } - - $items = &$items[$segment]; - } - - unset($items[$lastSegment]); - } - } - - /** - * Checks if the given key exists in the provided array. - * - * @param array $array Array to validate - * @param int|string $key The key to look for - * - * @return bool - */ - protected function exists($array, $key) - { - return array_key_exists($key, $array); - } - - /** - * Flatten an array with the given character as a key delimiter - * - * @param string $delimiter - * @param array|null $items - * @param string $prepend - * @return array - */ - public function flatten($delimiter = '.', $items = null, $prepend = '') - { - $flatten = []; - - if (is_null($items)) { - $items = $this->items; - } - - foreach ($items as $key => $value) { - if (is_array($value) && !empty($value)) { - $flatten = array_merge( - $flatten, - $this->flatten($delimiter, $value, $prepend.$key.$delimiter) - ); - } else { - $flatten[$prepend.$key] = $value; - } - } - - return $flatten; - } - - /** - * Return the value of a given key - * - * @param int|string|null $key - * @param mixed $default - * @return mixed - */ - public function get($key = null, $default = null) - { - if (is_null($key)) { - return $this->items; - } - - if ($this->exists($this->items, $key)) { - return $this->items[$key]; - } - - if (strpos($key, '.') === false) { - return $default; - } - - $items = $this->items; - - foreach (explode('.', $key) as $segment) { - if (!is_array($items) || !$this->exists($items, $segment)) { - return $default; - } - - $items = &$items[$segment]; - } - - return $items; - } - - /** - * Return the given items as an array - * - * @param mixed $items - * @return array - */ - protected function getArrayItems($items) - { - if (is_array($items)) { - return $items; - } elseif ($items instanceof self) { - return $items->all(); - } - - return (array) $items; - } - - /** - * Check if a given key or keys exists - * - * @param array|int|string $keys - * @return bool - */ - public function has($keys) - { - $keys = (array) $keys; - - if (!$this->items || $keys === []) { - return false; - } - - foreach ($keys as $key) { - $items = $this->items; - - if ($this->exists($items, $key)) { - continue; - } - - foreach (explode('.', $key) as $segment) { - if (!is_array($items) || !$this->exists($items, $segment)) { - return false; - } - - $items = $items[$segment]; - } - } - - return true; - } - - /** - * Check if a given key or keys are empty - * - * @param array|int|string|null $keys - * @return bool - */ - public function isEmpty($keys = null) - { - if (is_null($keys)) { - return empty($this->items); - } - - $keys = (array) $keys; - - foreach ($keys as $key) { - if (!empty($this->get($key))) { - return false; - } - } - - return true; - } - - /** - * Merge a given array or a Dot object with the given key - * or with the whole Dot object - * - * @param array|string|self $key - * @param array|self $value - */ - public function merge($key, $value = []) - { - if (is_array($key)) { - $this->items = array_merge($this->items, $key); - } elseif (is_string($key)) { - $items = (array) $this->get($key); - $value = array_merge($items, $this->getArrayItems($value)); - - $this->set($key, $value); - } elseif ($key instanceof self) { - $this->items = array_merge($this->items, $key->all()); - } - } - - /** - * Recursively merge a given array or a Dot object with the given key - * or with the whole Dot object. - * - * Duplicate keys are converted to arrays. - * - * @param array|string|self $key - * @param array|self $value - */ - public function mergeRecursive($key, $value = []) - { - if (is_array($key)) { - $this->items = array_merge_recursive($this->items, $key); - } elseif (is_string($key)) { - $items = (array) $this->get($key); - $value = array_merge_recursive($items, $this->getArrayItems($value)); - - $this->set($key, $value); - } elseif ($key instanceof self) { - $this->items = array_merge_recursive($this->items, $key->all()); - } - } - - /** - * Recursively merge a given array or a Dot object with the given key - * or with the whole Dot object. - * - * Instead of converting duplicate keys to arrays, the value from - * given array will replace the value in Dot object. - * - * @param array|string|self $key - * @param array|self $value - */ - public function mergeRecursiveDistinct($key, $value = []) - { - if (is_array($key)) { - $this->items = $this->arrayMergeRecursiveDistinct($this->items, $key); - } elseif (is_string($key)) { - $items = (array) $this->get($key); - $value = $this->arrayMergeRecursiveDistinct($items, $this->getArrayItems($value)); - - $this->set($key, $value); - } elseif ($key instanceof self) { - $this->items = $this->arrayMergeRecursiveDistinct($this->items, $key->all()); - } - } - - /** - * Merges two arrays recursively. In contrast to array_merge_recursive, - * duplicate keys are not converted to arrays but rather overwrite the - * value in the first array with the duplicate value in the second array. - * - * @param array $array1 Initial array to merge - * @param array $array2 Array to recursively merge - * @return array - */ - protected function arrayMergeRecursiveDistinct(array $array1, array $array2) - { - $merged = &$array1; - - foreach ($array2 as $key => $value) { - if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { - $merged[$key] = $this->arrayMergeRecursiveDistinct($merged[$key], $value); - } else { - $merged[$key] = $value; - } - } - - return $merged; - } - - /** - * Return the value of a given key and - * delete the key - * - * @param int|string|null $key - * @param mixed $default - * @return mixed - */ - public function pull($key = null, $default = null) - { - if (is_null($key)) { - $value = $this->all(); - $this->clear(); - - return $value; - } - - $value = $this->get($key, $default); - $this->delete($key); - - return $value; - } - - /** - * Push a given value to the end of the array - * in a given key - * - * @param mixed $key - * @param mixed $value - */ - public function push($key, $value = null) - { - if (is_null($value)) { - $this->items[] = $key; - - return; - } - - $items = $this->get($key); - - if (is_array($items) || is_null($items)) { - $items[] = $value; - $this->set($key, $items); - } - } - - /** - * Replace all values or values within the given key - * with an array or Dot object - * - * @param array|string|self $key - * @param array|self $value - */ - public function replace($key, $value = []) - { - if (is_array($key)) { - $this->items = array_replace($this->items, $key); - } elseif (is_string($key)) { - $items = (array) $this->get($key); - $value = array_replace($items, $this->getArrayItems($value)); - - $this->set($key, $value); - } elseif ($key instanceof self) { - $this->items = array_replace($this->items, $key->all()); - } - } - - /** - * Set a given key / value pair or pairs - * - * @param array|int|string $keys - * @param mixed $value - */ - public function set($keys, $value = null) - { - if (is_array($keys)) { - foreach ($keys as $key => $value) { - $this->set($key, $value); - } - - return; - } - - $items = &$this->items; - - foreach (explode('.', $keys) as $key) { - if (!isset($items[$key]) || !is_array($items[$key])) { - $items[$key] = []; - } - - $items = &$items[$key]; - } - - $items = $value; - } - - /** - * Replace all items with a given array - * - * @param mixed $items - */ - public function setArray($items) - { - $this->items = $this->getArrayItems($items); - } - - /** - * Replace all items with a given array as a reference - * - * @param array $items - */ - public function setReference(array &$items) - { - $this->items = &$items; - } - - /** - * Return the value of a given key or all the values as JSON - * - * @param mixed $key - * @param int $options - * @return string - */ - public function toJson($key = null, $options = 0) - { - if (is_string($key)) { - return json_encode($this->get($key), $options); - } - - $options = $key === null ? 0 : $key; - - return json_encode($this->items, $options); - } - - /* - * -------------------------------------------------------------- - * ArrayAccess interface - * -------------------------------------------------------------- - */ - - /** - * Check if a given key exists - * - * @param int|string $key - * @return bool - */ - public function offsetExists($key) - { - return $this->has($key); - } - - /** - * Return the value of a given key - * - * @param int|string $key - * @return mixed - */ - public function offsetGet($key) - { - return $this->get($key); - } - - /** - * Set a given value to the given key - * - * @param int|string|null $key - * @param mixed $value - */ - public function offsetSet($key, $value) - { - if (is_null($key)) { - $this->items[] = $value; - - return; - } - - $this->set($key, $value); - } - - /** - * Delete the given key - * - * @param int|string $key - */ - public function offsetUnset($key) - { - $this->delete($key); - } - - /* - * -------------------------------------------------------------- - * Countable interface - * -------------------------------------------------------------- - */ - - /** - * Return the number of items in a given key - * - * @param int|string|null $key - * @return int - */ - public function count($key = null) - { - return count($this->get($key)); - } - - /* - * -------------------------------------------------------------- - * IteratorAggregate interface - * -------------------------------------------------------------- - */ - - /** - * Get an iterator for the stored items - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->items); - } - - /* - * -------------------------------------------------------------- - * JsonSerializable interface - * -------------------------------------------------------------- - */ - - /** - * Return items for JSON serialization - * - * @return array - */ - public function jsonSerialize() - { - return $this->items; - } -} diff --git a/vendor/adbario/php-dot-notation/src/helpers.php b/vendor/adbario/php-dot-notation/src/helpers.php deleted file mode 100644 index ffdc8268..00000000 --- a/vendor/adbario/php-dot-notation/src/helpers.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @link https://github.com/adbario/php-dot-notation - * @license https://github.com/adbario/php-dot-notation/blob/2.x/LICENSE.md (MIT License) - */ - -use Adbar\Dot; - -if (! function_exists('dot')) { - /** - * Create a new Dot object with the given items - * - * @param mixed $items - * @return \Adbar\Dot - */ - function dot($items) - { - return new Dot($items); - } -} diff --git a/vendor/alibabacloud/client/CHANGELOG.md b/vendor/alibabacloud/client/CHANGELOG.md deleted file mode 100644 index 09375ad8..00000000 --- a/vendor/alibabacloud/client/CHANGELOG.md +++ /dev/null @@ -1,264 +0,0 @@ -# CHANGELOG - -## 1.5.18 - 2019-10-11 -- Updated Request link. -- Updated Endpoints data. - -## 1.5.17 - 2019-09-15 -- Improved Host Finder. -- Updated Endpoints Data. - -## 1.5.16 - 2019-08-21 -- Updated Endpoints Data. - -## 1.5.15 - 2019-08-14 -- Improved Client. - - -## 1.5.14 - 2019-07-25 -- Improved Credential Filter. - - -## 1.5.13 - 2019-07-18 -- Improved API Resolver. - - -## 1.5.12 - 2019-06-20 -- Fixed Signature for ROA. - - -## 1.5.11 - 2019-06-14 -- Added endpoint rules. - - -## 1.5.10 - 2019-06-13 -- Improved `Resovler`. -- Updated `endpoints`. - - -## 1.5.9 - 2019-06-04 -- Improved `UUID`. - - -## 1.5.8 - 2019-05-30 -- Improved `Arrays`. - - -## 1.5.7 - 2019-05-29 -- Improved `uuid`. - - -## 1.5.6 - 2019-05-29 -- Fixed `uuid` version lock. - - -## 1.5.5 - 2019-05-23 -- Improved `Signature`. - - -## 1.5.4 - 2019-05-22 -- Updated `Endpoints`. -- Fixed `Content-Type` in header. - - -## 1.5.3 - 2019-05-13 -- Improved `Endpoint` tips. -- Improved `Endpoints` for `STS`. - - -## 1.5.2 - 2019-05-10 -- Improved `Result` object. - - -## 1.5.1 - 2019-05-09 -- Supported `Resolver` for Third-party dependencies. - - -## 1.5.0 - 2019-05-07 -- Improved `Resolver` for products. - - -## 1.4.0 - 2019-05-06 -- Support `Retry` and `Asynchronous` for Request. - - -## 1.3.1 - 2019-04-30 -- Allow timeouts to be set in microseconds. - - -## 1.3.0 - 2019-04-18 -- Improved parameters methods. -- Optimized the logic for body encode. - - -## 1.2.1 - 2019-04-11 -- Improve exception code and message for `Region ID`. - - -## 1.2.0 - 2019-04-11 -- Improve exception message for `Region ID`. - - -## 1.1.1 - 2019-04-02 -- Added endpoints for `batchcomputenew`, `privatelink`. -- Improve Region ID tips. - - -## 1.1.0 - 2019-04-01 -- Updated `composer.json`. - - -## 1.0.27 - 2019-03-31 -- Support `Policy` for `ramRoleArnClient`. - - -## 1.0.26 - 2019-03-27 -- Support `pid`, `cost`, `start_time` for Log. - - -## 1.0.25 - 2019-03-27 -- Updated default log format. -- Add endpoints for `dbs`. - - -## 1.0.24 - 2019-03-26 -- Support Log. - - -## 1.0.23 - 2019-03-23 -- Remove SVG. - - -## 1.0.22 - 2019-03-20 -- Add endpoint `cn-hangzhou` for `idaas` . - - -## 1.0.21 - 2019-03-19 -- Installing by Using the ZIP file. -- Update Docs. - - -## 1.0.20 - 2019-03-13 -- Improve Tests. -- Update Docs. - - -## 1.0.19 - 2019-03-12 -- Add SSL Verify Option `verify()`. - - -## 1.0.18 - 2019-03-11 -- Add endpoints for `acr`. -- Add endpoints for `faas`. -- Add endpoints for `ehs`. -- SSL certificates are not validated by default. - - -## 1.0.17 - 2019-03-08 -- Support Mock for Test. - - -## 1.0.16 - 2019-03-07 -- Support Credential Provider Chain. -- Support `CCC`. -- Add `ap-south-1` for `cas`. -- Add `ap-southeast-1` for `waf`. -- Update Docs. - - -## 1.0.15 - 2019-02-27 -- Add endpoints for `Chatbot`. -- Change endpoints for `drdspost` and `drdspre`. - - -## 1.0.14 - 2019-02-21 -- Enable debug mode by set environment variable `DEBUG=sdk`. - - -## 1.0.13 - 2019-02-18 -- Support Release Script `composer release`. -- Add endpoints for apigateway in `drdspre` in `cn-qingdao`. -- Add endpoints for apigateway in `drdspre` in `cn-beijing`. -- Add endpoints for apigateway in `drdspre` in `cn-hangzhou`. -- Add endpoints for apigateway in `drdspre` in `cn-shanghai`. -- Add endpoints for apigateway in `drdspre` in `cn-shenzhen`. -- Add endpoints for apigateway in `drdspre` in `cn-hongkong`. -- Add endpoints for apigateway in `drdspost` in `ap-southeast-1`. -- Add endpoints for apigateway in `drdspost` in `cn-shanghai`. -- Add endpoints for apigateway in `drdspost` in `cn-hongkong`. -- Add endpoints for apigateway in `vod` in `ap-southeast-1`. -- Add endpoints for apigateway in `vod` in `eu-central-1`. - - -## 1.0.12 - 2019-02-16 -- Support `open_basedir`. - - -## 1.0.11 - 2019-02-13 -- Improve User Agent. - - -## 1.0.10 - 2019-02-12 -- `userAgentAppend` is renamed to `appendUserAgent`. - - -## 1.0.9 - 2019-02-12 -- `userAgent` is renamed to `userAgentAppend`. - - -## 1.0.8 - 2019-02-11 -- `userAgent` - Support DIY User Agent. -- Add endpoints for apigateway in Zhangjiakou. -- Add endpoints for apigateway in Hu He Hao Te. -- Add endpoints for vod in Hu He Hao Te. -- Add endpoints for hsm in Zhangjiakou. -- Add endpoints for luban in Germany. -- Add endpoints for linkwan in Hangzhou. -- Add endpoints for drdspost in Singapore. - - -## 1.0.7 - 2019-01-28 -- Add endpoints for gpdb in Tokyo. -- Add endpoints for elasticsearch in Beijing. - - -## 1.0.6 - 2019-01-23 -- Add endpoints for dysmsapi in Singapore. -- Add endpoints for dybaseapi. -- Add endpoints for dyiotapi. -- Add endpoints for dycdpapi. -- Add endpoints for dyplsapi. -- Add endpoints for dypnsapi. -- Add endpoints for dyvmsapi. -- Add endpoints for snsuapi. - - -## 1.0.5 - 2019-01-21 -- Add endpoints for ApiGateway in Silicon Valley, Virginia. -- Add endpoints for Image Search in Shanghai. - - -## 1.0.4 - 2019-01-17 -- Support fixer all. -- Add Endpoints. - - -## 1.0.3 - 2019-01-15 -- Update Endpoints. -- Update README.md. -- Update Return Result Message. - - -## 1.0.2 - 2019-01-15 -- Optimize the documentation. -- Adjust the CI configuration. - - -## 1.0.1 - 2019-01-09 -- Distinguish credential error. -- Add endpoints for NLS. -- Add not found product tip. - - -## 1.0.0 - 2019-01-07 -- Initial release of the Alibaba Cloud Client for PHP Version 1.0.0 on Packagist See for more information. diff --git a/vendor/alibabacloud/client/CONTRIBUTING.md b/vendor/alibabacloud/client/CONTRIBUTING.md deleted file mode 100644 index a1c52a0b..00000000 --- a/vendor/alibabacloud/client/CONTRIBUTING.md +++ /dev/null @@ -1,30 +0,0 @@ -# Contributing to the Alibaba Cloud Client for PHP - -We work hard to provide a high-quality and useful SDK for Alibaba Cloud, and -we greatly value feedback and contributions from our community. Please submit -your [issues][issues] or [pull requests][pull-requests] through GitHub. - -## Tips - -- The SDK is released under the [Apache license][license]. Any code you submit - will be released under that license. For substantial contributions, we may - ask you to sign a [Alibaba Documentation Corporate Contributor License - Agreement (CLA)][cla]. -- We follow all of the relevant PSR recommendations from the [PHP Framework - Interop Group][php-fig]. Please submit code that follows these standards. - The [PHP CS Fixer][cs-fixer] tool can be helpful for formatting your code. - Your can use `composer fixer` to fix code. -- We maintain a high percentage of code coverage in our unit tests. If you make - changes to the code, please add, update, and/or remove tests as appropriate. -- If your code does not conform to the PSR standards, does not include adequate - tests, or does not contain a changelog document, we may ask you to update - your pull requests before we accept them. We also reserve the right to deny - any pull requests that do not align with our standards or goals. - -[issues]: https://github.com/aliyun/openapi-sdk-php-client/issues -[pull-requests]: https://github.com/aliyun/openapi-sdk-php-client/pulls -[license]: http://www.apache.org/licenses/LICENSE-2.0 -[cla]: https://alibaba-cla-2018.oss-cn-beijing.aliyuncs.com/Alibaba_Documentation_Open_Source_Corporate_CLA.pdf -[php-fig]: http://php-fig.org -[cs-fixer]: http://cs.sensiolabs.org/ -[docs-readme]: https://github.com/aliyun/openapi-sdk-php-client/blob/master/README.md diff --git a/vendor/alibabacloud/client/LICENSE.md b/vendor/alibabacloud/client/LICENSE.md deleted file mode 100644 index 47ee76d8..00000000 --- a/vendor/alibabacloud/client/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 1999-2019 Alibaba Group Holding Ltd. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/vendor/alibabacloud/client/NOTICE.md b/vendor/alibabacloud/client/NOTICE.md deleted file mode 100644 index c0622c92..00000000 --- a/vendor/alibabacloud/client/NOTICE.md +++ /dev/null @@ -1,88 +0,0 @@ -# Alibaba Cloud Client for PHP - - - -Copyright 1999-2019 Alibaba Group. or its affiliates. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"). -You may not use this file except in compliance with the License. -A copy of the License is located at - - - -or in the "license" file accompanying this file. This file is distributed -on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either -express or implied. See the License for the specific language governing -permissions and limitations under the License. - -# Guzzle - - - -Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -# jmespath.php - - - -Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -# Dot - - - -Copyright (c) 2016-2019 Riku Särkinen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/alibabacloud/client/README-zh-CN.md b/vendor/alibabacloud/client/README-zh-CN.md deleted file mode 100644 index 31de8aac..00000000 --- a/vendor/alibabacloud/client/README-zh-CN.md +++ /dev/null @@ -1,161 +0,0 @@ -[English](/README.md) | 简体中文 - - -# Alibaba Cloud Client for PHP -[![Latest Stable Version](https://poser.pugx.org/alibabacloud/client/v/stable)](https://packagist.org/packages/alibabacloud/client) -[![composer.lock](https://poser.pugx.org/alibabacloud/client/composerlock)](https://packagist.org/packages/alibabacloud/client) -[![Total Downloads](https://poser.pugx.org/alibabacloud/client/downloads)](https://packagist.org/packages/alibabacloud/client) -[![License](https://poser.pugx.org/alibabacloud/client/license)](https://packagist.org/packages/alibabacloud/client) -[![codecov](https://codecov.io/gh/aliyun/openapi-sdk-php-client/branch/master/graph/badge.svg)](https://codecov.io/gh/aliyun/openapi-sdk-php-client) -[![Travis Build Status](https://travis-ci.org/aliyun/openapi-sdk-php-client.svg?branch=master)](https://travis-ci.org/aliyun/openapi-sdk-php-client) -[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/qb8j3lhg8349k0hk/branch/master?svg=true)](https://ci.appveyor.com/project/aliyun/openapi-sdk-php-client/branch/master) - - -![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg) - - -Alibaba Cloud Client for PHP 是帮助 PHP 开发者管理凭据、发送请求的客户端工具,[Alibaba Cloud SDK for PHP][SDK] 由本工具提供底层支持。 - - -## 在线示例 -[API Explorer](https://api.aliyun.com) 提供在线调用阿里云产品,并动态生成 SDK 代码和快速检索接口等能力,能显著降低使用云 API 的难度。 - - -## 先决条件 -您的系统需要满足[先决条件](/docs/zh-CN/0-Prerequisites.md),包括 PHP> = 5.5。 我们强烈建议使用cURL扩展,并使用TLS后端编译cURL 7.16.2+。 - - -## 安装依赖 -如果已在系统上[全局安装 Composer](https://getcomposer.org/doc/00-intro.md#globally),请直接在项目目录中运行以下内容来安装 Alibaba Cloud Client for PHP 作为依赖项: -``` -composer require alibabacloud/client -``` -> 一些用户可能由于网络问题无法安装,可以使用[阿里云 Composer 全量镜像](https://developer.aliyun.com/composer)。 - -请看[安装](/docs/zh-CN/1-Installation.md)有关通过 Composer 和其他方式安装的详细信息。 - - -## 快速使用 -在您开始之前,您需要注册阿里云帐户并获取您的[凭证](https://usercenter.console.aliyun.com/#/manage/ak)。 - -```php -asDefaultClient(); -``` - -## ROA 请求 -```php -regionId('cn-hangzhou') // 指定请求的区域,不指定则使用客户端区域、默认区域 - ->product('CS') // 指定产品 - ->version('2015-12-15') // 指定产品版本 - ->action('DescribeClusterServices') // 指定产品接口 - ->serviceCode('cs') // 设置 ServiceCode 以备寻址,非必须 - ->endpointType('openAPI') // 设置类型,非必须 - ->method('GET') // 指定请求方式 - ->host('cs.aliyun.com') // 指定域名则不会寻址,如认证方式为 Bearer Token 的服务则需要指定 - ->pathPattern('/clusters/[ClusterId]/services') // 指定ROA风格路径规则 - ->withClusterId('123456') // 为路径中参数赋值,方法名:with + 参数 - ->request(); // 发起请求并返回结果对象,请求需要放在设置的最后面 - - print_r($result->toArray()); - -} catch (ClientException $exception) { - print_r($exception->getErrorMessage()); -} catch (ServerException $exception) { - print_r($exception->getErrorMessage()); -} -``` - -## RPC 请求 -```php -product('Cdn') - ->version('2014-11-11') - ->action('DescribeCdnService') - ->method('POST') - ->request(); - - print_r($result->toArray()); - -} catch (ClientException $exception) { - print_r($exception->getErrorMessage()); -} catch (ServerException $exception) { - print_r($exception->getErrorMessage()); -} -``` - - -## 文档 -* [先决条件](/docs/zh-CN/0-Prerequisites.md) -* [安装](/docs/zh-CN/1-Installation.md) -* [客户端](/docs/zh-CN/2-Client.md) -* [请求](/docs/zh-CN/3-Request.md) -* [结果](/docs/zh-CN/4-Result.md) -* [区域](/docs/zh-CN/5-Region.md) -* [域名](/docs/zh-CN/6-Host.md) -* [SSL 验证](/docs/zh-CN/7-Verify.md) -* [调试](/docs/zh-CN/8-Debug.md) -* [日志](/docs/zh-CN/9-Log.md) -* [测试](/docs/zh-CN/10-Test.md) - - -## 问题 -[提交 Issue](https://github.com/aliyun/openapi-sdk-php-client/issues/new/choose),不符合指南的问题可能会立即关闭。 - - -## 发行说明 -每个版本的详细更改记录在[发行说明](/CHANGELOG.md)中。 - - -## 贡献 -提交 Pull Request 之前请阅读[贡献指南](/CONTRIBUTING.md)。 - - -## 相关 -* [阿里云服务 Regions & Endpoints][endpoints] -* [OpenAPI Explorer][open-api] -* [Packagist][packagist] -* [Composer][composer] -* [Guzzle中文文档][guzzle-docs] -* [最新源码][latest-release] - - -## 许可证 -[Apache-2.0](/LICENSE.md) - -版权所有 1999-2019 阿里巴巴集团 - - -[SDK]: https://github.com/aliyun/openapi-sdk-php -[open-api]: https://api.aliyun.com -[latest-release]: https://github.com/aliyun/openapi-sdk-php-client -[guzzle-docs]: https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html -[composer]: https://getcomposer.org -[packagist]: https://packagist.org/packages/alibabacloud/sdk -[home]: https://home.console.aliyun.com -[aliyun]: https://www.aliyun.com -[regions]: https://help.aliyun.com/document_detail/40654.html -[endpoints]: https://developer.aliyun.com/endpoints -[cURL]: http://php.net/manual/zh/book.curl.php -[OPCache]: http://php.net/manual/zh/book.opcache.php -[xdebug]: http://xdebug.org -[OpenSSL]: http://php.net/manual/zh/book.openssl.php -[client]: https://github.com/aliyun/openapi-sdk-php-client diff --git a/vendor/alibabacloud/client/README.md b/vendor/alibabacloud/client/README.md deleted file mode 100644 index 00ff5728..00000000 --- a/vendor/alibabacloud/client/README.md +++ /dev/null @@ -1,162 +0,0 @@ -English | [简体中文](/README-zh-CN.md) - - -# Alibaba Cloud Client for PHP -[![Latest Stable Version](https://poser.pugx.org/alibabacloud/client/v/stable)](https://packagist.org/packages/alibabacloud/client) -[![composer.lock](https://poser.pugx.org/alibabacloud/client/composerlock)](https://packagist.org/packages/alibabacloud/client) -[![Total Downloads](https://poser.pugx.org/alibabacloud/client/downloads)](https://packagist.org/packages/alibabacloud/client) -[![License](https://poser.pugx.org/alibabacloud/client/license)](https://packagist.org/packages/alibabacloud/client) -[![codecov](https://codecov.io/gh/aliyun/openapi-sdk-php-client/branch/master/graph/badge.svg)](https://codecov.io/gh/aliyun/openapi-sdk-php-client) -[![Travis Build Status](https://travis-ci.org/aliyun/openapi-sdk-php-client.svg?branch=master)](https://travis-ci.org/aliyun/openapi-sdk-php-client) -[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/qb8j3lhg8349k0hk/branch/master?svg=true)](https://ci.appveyor.com/project/aliyun/openapi-sdk-php-client/branch/master) - - -![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg) - - -Alibaba Cloud Client for PHP is a client tool that helps PHP developers manage credentials and send requests, [Alibaba Cloud SDK for PHP][SDK] dependency on this tool. - - -## Online Demo -[API Explorer](https://api.aliyun.com) provides the ability to call the cloud product OpenAPI online, and dynamically generate SDK Example code and quick retrieval interface, which can significantly reduce the difficulty of using the cloud API. - - -## Prerequisites -Your system will need to meet the [Prerequisites](/docs/en-US/0-Prerequisites.md), including having PHP >= 5.5. We highly recommend having it compiled with the cURL extension and cURL 7.16.2+. - - -## Installation -If Composer is already [installed globally on your system](https://getcomposer.org/doc/00-intro.md#globally), run the following in the base directory of your project to install Alibaba Cloud Client for PHP as a dependency: -``` -composer require alibabacloud/client -``` -> Some users may not be able to install due to network problems, you can try to switch the Composer mirror. - -Please see the [Installation](/docs/en-US/1-Installation.md) for more detailed information about installing the Alibaba Cloud Client for PHP through Composer and other means. - - -## Quick Examples -Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your [Credentials](https://usercenter.console.aliyun.com/#/manage/ak). - -### Create Client -```php -asDefaultClient(); -``` - -### ROA Request -```php -regionId('cn-hangzhou') // Specify the requested regionId, if not specified, use the client regionId, then default regionId - ->product('CS') // Specify product - ->version('2015-12-15') // Specify product version - ->action('DescribeClusterServices') // Specify product interface - ->serviceCode('cs') // Set ServiceCode for addressing, optional - ->endpointType('openAPI') // Set type, optional - ->method('GET') // Set request method - ->host('cs.aliyun.com') // Location Service will not be enabled if the host is specified. For example, service with a Certification type-Bearer Token should be specified - ->pathPattern('/clusters/[ClusterId]/services') // Specify path rule with ROA-style - ->withClusterId('123456') // Assign values to parameters in the path. Method: with + Parameter - ->request(); // Make a request and return to result object. The request is to be placed at the end of the setting - - print_r($result->toArray()); - -} catch (ClientException $exception) { - print_r($exception->getErrorMessage()); -} catch (ServerException $exception) { - print_r($exception->getErrorMessage()); -} -``` - -### RPC Request -```php -product('Cdn') - ->version('2014-11-11') - ->action('DescribeCdnService') - ->method('POST') - ->request(); - - print_r($result->toArray()); - -} catch (ClientException $exception) { - print_r($exception->getErrorMessage()); -} catch (ServerException $exception) { - print_r($exception->getErrorMessage()); -} -``` - - -## Documentation -* [Prerequisites](/docs/en-US/0-Prerequisites.md) -* [Installation](/docs/en-US/1-Installation.md) -* [Client](/docs/en-US/2-Client.md) -* [Request](/docs/en-US/3-Request.md) -* [Result](/docs/en-US/4-Result.md) -* [Region](/docs/en-US/5-Region.md) -* [Host](/docs/en-US/6-Host.md) -* [SSL Verify](/docs/en-US/7-Verify.md) -* [Debug](/docs/en-US/8-Debug.md) -* [Log](/docs/en-US/9-Log.md) -* [Test](/docs/en-US/10-Test.md) - - -## Issues -[Opening an Issue](https://github.com/aliyun/openapi-sdk-php-client/issues/new/choose), Issues not conforming to the guidelines may be closed immediately. - - -## Changelog -Detailed changes for each release are documented in the [release notes](/CHANGELOG.md). - - -## Contribution -Please make sure to read the [Contributing Guide](/CONTRIBUTING.md) before making a pull request. - - -## References -* [Alibaba Cloud Regions & Endpoints][endpoints] -* [OpenAPI Explorer][open-api] -* [Packagist][packagist] -* [Composer][composer] -* [Guzzle Documentation][guzzle-docs] -* [Latest Release][latest-release] - - -## License -[Apache-2.0](/LICENSE.md) - -Copyright 1999-2019 Alibaba Group Holding Ltd. - - -[SDK]: https://github.com/aliyun/openapi-sdk-php -[open-api]: https://api.alibabacloud.com -[latest-release]: https://github.com/aliyun/openapi-sdk-php-client -[guzzle-docs]: http://docs.guzzlephp.org/en/stable/request-options.html -[composer]: https://getcomposer.org -[packagist]: https://packagist.org/packages/alibabacloud/sdk -[home]: https://home.console.aliyun.com -[alibabacloud]: https://www.alibabacloud.com -[regions]: https://www.alibabacloud.com/help/doc-detail/40654.html -[endpoints]: https://developer.aliyun.com/endpoints -[cURL]: http://php.net/manual/en/book.curl.php -[OPCache]: http://php.net/manual/en/book.opcache.php -[xdebug]: http://xdebug.org -[OpenSSL]: http://php.net/manual/en/book.openssl.php -[client]: https://github.com/aliyun/openapi-sdk-php-client diff --git a/vendor/alibabacloud/client/UPGRADING.md b/vendor/alibabacloud/client/UPGRADING.md deleted file mode 100644 index 08c1bb33..00000000 --- a/vendor/alibabacloud/client/UPGRADING.md +++ /dev/null @@ -1,6 +0,0 @@ -Upgrading Guide -=============== - -1.x ------------------------ -- This is the first version. See for more information. diff --git a/vendor/alibabacloud/client/composer.json b/vendor/alibabacloud/client/composer.json deleted file mode 100644 index 0f5eb3cf..00000000 --- a/vendor/alibabacloud/client/composer.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "name": "alibabacloud/client", - "homepage": "https://www.alibabacloud.com/", - "description": "Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project", - "keywords": [ - "sdk", - "tool", - "cloud", - "client", - "aliyun", - "library", - "alibaba", - "alibabacloud" - ], - "type": "library", - "license": "Apache-2.0", - "support": { - "source": "https://github.com/aliyun/openapi-sdk-php-client", - "issues": "https://github.com/aliyun/openapi-sdk-php-client/issues" - }, - "authors": [ - { - "name": "Alibaba Cloud SDK", - "email": "sdk-team@alibabacloud.com", - "homepage": "http://www.alibabacloud.com" - } - ], - "require": { - "php": ">=5.5", - "ext-curl": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-openssl": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-xmlwriter": "*", - "guzzlehttp/guzzle": "^6.3", - "danielstjules/stringy": "^3.1", - "mtdowling/jmespath.php": "^2.4", - "adbario/php-dot-notation": "^2.2", - "clagiordano/weblibs-configmanager": "^1.0" - }, - "require-dev": { - "ext-spl": "*", - "ext-dom": "*", - "ext-pcre": "*", - "psr/cache": "^1.0", - "ext-sockets": "*", - "drupal/coder": "^8.3", - "symfony/dotenv": "^3.4", - "league/climate": "^3.2.4", - "phpunit/phpunit": "^4.8.35|^5.4.3", - "monolog/monolog": "^1.24", - "composer/composer": "^1.8", - "mikey179/vfsstream": "^1.6", - "symfony/var-dumper": "^3.4" - }, - "suggest": { - "ext-sockets": "To use client-side monitoring" - }, - "autoload": { - "psr-4": { - "AlibabaCloud\\Client\\": "src" - }, - "files": [ - "src/Functions.php" - ] - }, - "autoload-dev": { - "psr-4": { - "AlibabaCloud\\Client\\Tests\\": "tests/" - } - }, - "config": { - "preferred-install": "dist", - "optimize-autoloader": true - }, - "minimum-stability": "dev", - "prefer-stable": true, - "scripts-descriptions": { - "cs": "Tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard.", - "cbf": "Automatically correct coding standard violations.", - "fixer": "Fixes code to follow standards.", - "test": "Run all tests.", - "unit": "Run Unit tests.", - "feature": "Run Feature tests.", - "clearCache": "Clear cache like coverage.", - "coverage": "Show Coverage html.", - "endpoints": "Update endpoints from OSS." - }, - "scripts": { - "cs": "phpcs --standard=PSR2 -n ./", - "cbf": "phpcbf --standard=PSR2 -n ./", - "fixer": "php-cs-fixer fix ./", - "test": [ - "phpunit --colors=always" - ], - "unit": [ - "@clearCache", - "phpunit --testsuite=Unit --colors=always" - ], - "feature": [ - "@clearCache", - "phpunit --testsuite=Feature --colors=always" - ], - "coverage": "open cache/coverage/index.html", - "clearCache": "rm -rf cache/*", - "endpoints": [ - "AlibabaCloud\\Client\\Regions\\LocationService::updateEndpoints", - "@fixer" - ], - "release": [ - "AlibabaCloud\\Client\\Release::release" - ] - } -} diff --git a/vendor/alibabacloud/client/src/Accept.php b/vendor/alibabacloud/client/src/Accept.php deleted file mode 100644 index e7c52613..00000000 --- a/vendor/alibabacloud/client/src/Accept.php +++ /dev/null @@ -1,53 +0,0 @@ -format = $format; - } - - /** - * @param $format - * - * @return Accept - */ - public static function create($format) - { - return new static($format); - } - - /** - * @return mixed|string - */ - public function toString() - { - $key = \strtoupper($this->format); - - $list = [ - 'JSON' => 'application/json', - 'XML' => 'application/xml', - 'RAW' => 'application/octet-stream', - 'FORM' => 'application/x-www-form-urlencoded' - ]; - - return isset($list[$key]) ? $list[$key] : $list['RAW']; - } -} diff --git a/vendor/alibabacloud/client/src/AlibabaCloud.php b/vendor/alibabacloud/client/src/AlibabaCloud.php deleted file mode 100644 index 08fb5586..00000000 --- a/vendor/alibabacloud/client/src/AlibabaCloud.php +++ /dev/null @@ -1,62 +0,0 @@ -credential = $credential; - $this->signature = $signature; - $this->options['connect_timeout'] = Request::CONNECT_TIMEOUT; - $this->options['timeout'] = Request::TIMEOUT; - $this->options['verify'] = false; - } - - /** - * @return AccessKeyCredential|BearerTokenCredential|CredentialsInterface|EcsRamRoleCredential|RamRoleArnCredential|RsaKeyPairCredential|StsCredential - */ - public function getCredential() - { - return $this->credential; - } - - /** - * @return SignatureInterface|BearerTokenSignature|ShaHmac1Signature|ShaHmac256Signature|ShaHmac256WithRsaSignature - */ - public function getSignature() - { - return $this->signature; - } -} diff --git a/vendor/alibabacloud/client/src/Clients/EcsRamRoleClient.php b/vendor/alibabacloud/client/src/Clients/EcsRamRoleClient.php deleted file mode 100644 index e97cd6cc..00000000 --- a/vendor/alibabacloud/client/src/Clients/EcsRamRoleClient.php +++ /dev/null @@ -1,26 +0,0 @@ -credential)) { - case EcsRamRoleCredential::class: - return (new EcsRamRoleProvider($this))->get(); - case RamRoleArnCredential::class: - return (new RamRoleArnProvider($this))->get($timeout, $connectTimeout); - case RsaKeyPairCredential::class: - return (new RsaKeyPairProvider($this))->get($timeout, $connectTimeout); - default: - return $this->credential; - } - } - - /** - * @return static - * @throws ClientException - * @deprecated - * @codeCoverageIgnore - */ - public function asGlobalClient() - { - return $this->asDefaultClient(); - } - - /** - * Set the current client as the default client. - * - * @return static - * @throws ClientException - */ - public function asDefaultClient() - { - return $this->name(CredentialsProvider::getDefaultName()); - } - - /** - * Naming clients. - * - * @param string $name - * - * @return static - * @throws ClientException - */ - public function name($name) - { - Filter::name($name); - - return AlibabaCloud::set($name, $this); - } - - /** - * @return bool - */ - public function isDebug() - { - if (isset($this->options['debug'])) { - return $this->options['debug'] === true && PHP_SAPI === 'cli'; - } - - return false; - } -} diff --git a/vendor/alibabacloud/client/src/Clients/RamRoleArnClient.php b/vendor/alibabacloud/client/src/Clients/RamRoleArnClient.php deleted file mode 100644 index b7d3087d..00000000 --- a/vendor/alibabacloud/client/src/Clients/RamRoleArnClient.php +++ /dev/null @@ -1,33 +0,0 @@ -getValue( - \strtolower($configPath), - $defaultValue - ); - } - - /** - * @return ConfigManager - */ - private static function getConfigManager() - { - if (!self::$configManager instanceof ConfigManager) { - self::$configManager = new ConfigManager(__DIR__ . DIRECTORY_SEPARATOR . 'Data.php'); - } - - return self::$configManager; - } - - /** - * @param string $configPath - * @param mixed $newValue - * - * @return ConfigManager - * @throws Exception - */ - public static function set($configPath, $newValue) - { - self::getConfigManager()->setValue(\strtolower($configPath), $newValue); - - return self::getConfigManager()->saveConfigFile(); - } -} diff --git a/vendor/alibabacloud/client/src/Config/Data.php b/vendor/alibabacloud/client/src/Config/Data.php deleted file mode 100644 index 439088c8..00000000 --- a/vendor/alibabacloud/client/src/Config/Data.php +++ /dev/null @@ -1,2653 +0,0 @@ - - [ - 'dysmsapi' => - [ - 'global' => 'dysmsapi.aliyuncs.com', - 'cn-hangzhou' => 'dysmsapi.aliyuncs.com', - 'ap-southeast-1' => 'dysmsapi.ap-southeast-1.aliyuncs.com', - ], - 'ccc' => - [ - 'global' => 'ccc.cn-shanghai.aliyuncs.com', - 'cn-shanghai' => 'ccc.cn-shanghai.aliyuncs.com', - ], - 'dbs' => - [ - 'cn-hangzhou' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'dbs-api.ap-southeast-1.aliyuncs.com', - 'ap-northeast-1' => 'dbs-api.ap-northeast-1.aliyuncs.com', - ], - 'dybaseapi' => - [ - 'global' => 'dybaseapi.aliyuncs.com', - 'cn-hangzhou' => 'dybaseapi.aliyuncs.com', - ], - 'dyiotapi' => - [ - 'global' => 'dyiotapi.aliyuncs.com', - 'cn-hangzhou' => 'dyiotapi.aliyuncs.com', - ], - 'dycdpapi' => - [ - 'global' => 'dycdpapi.aliyuncs.com', - 'cn-hangzhou' => 'dycdpapi.aliyuncs.com', - ], - 'dyplsapi' => - [ - 'global' => 'dyplsapi.aliyuncs.com', - 'cn-hangzhou' => 'dyplsapi.aliyuncs.com', - ], - 'dypnsapi' => - [ - 'global' => 'dypnsapi.aliyuncs.com', - 'cn-hangzhou' => 'dypnsapi.aliyuncs.com', - ], - 'dyvmsapi' => - [ - 'global' => 'dyvmsapi.aliyuncs.com', - 'cn-hangzhou' => 'dyvmsapi.aliyuncs.com', - ], - 'snsuapi' => - [ - 'global' => 'snsuapi.aliyuncs.com', - 'cn-hangzhou' => 'snsuapi.aliyuncs.com', - ], - 'ecs' => - [ - 'jp-fudao-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'me-east-1' => 'ecs.me-east-1.aliyuncs.com', - 'us-east-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'ap-northeast-1' => 'ecs.ap-northeast-1.aliyuncs.com', - 'cn-hangzhou-bj-b01' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-beijing-nu16-b01' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-beijing-am13-c01' => 'ecs-cn-hangzhou.aliyuncs.com', - 'in-west-antgroup-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-guizhou-gov' => 'ecs-cn-hangzhou.aliyuncs.com', - 'in-west-antgroup-2' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'ecs-cn-hangzhou.aliyuncs.com', - 'tw-snowcloud-kaohsiung' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-finance-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-guizhou' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-fujian' => 'ecs-cn-hangzhou.aliyuncs.com', - 'in-mumbai-alipay' => 'ecs-cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-anhui-gov-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-haidian-cm12-c01' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-anhui-gov' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'ecs-cn-hangzhou.aliyuncs.com', - 'ap-southeast-2' => 'ecs.ap-southeast-2.aliyuncs.com', - 'cn-qingdao' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-su18-b02' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-su18-b03' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-su18-b01' => 'ecs-cn-hangzhou.aliyuncs.com', - 'ap-southeast-antgroup-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-henan-am12001' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-gansu-am6' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-ningxiazhongwei' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-ningxia-am7-c01' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'ecs-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-st4-d01' => 'ecs-cn-hangzhou.aliyuncs.com', - 'eu-central-1' => 'ecs.eu-central-1.aliyuncs.com', - 'cn-zhangjiakou' => 'ecs.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'ecs.cn-huhehaote.aliyuncs.com', - 'ap-southeast-3' => 'ecs.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'ecs.ap-southeast-5.aliyuncs.com', - 'eu-west-1' => 'ecs.eu-west-1.aliyuncs.com', - 'ap-south-1' => 'ecs.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'ecs.cn-chengdu.aliyuncs.com', - 'cn-north-2-gov-1' => 'ecs.aliyuncs.com', - ], - 'rds' => - [ - 'me-east-1' => 'rds.me-east-1.aliyuncs.com', - 'us-east-1' => 'rds.aliyuncs.com', - 'ap-northeast-1' => 'rds.ap-northeast-1.aliyuncs.com', - 'cn-hongkong' => 'rds.aliyuncs.com', - 'cn-qingdao-cm9' => 'rds.aliyuncs.com', - 'cn-shanghai-finance-1' => 'rds.aliyuncs.com', - 'cn-beijing-gov-1' => 'rds.aliyuncs.com', - 'cn-shanghai' => 'rds.aliyuncs.com', - 'cn-shenzhen-inner' => 'rds.aliyuncs.com', - 'cn-fujian' => 'rds.aliyuncs.com', - 'us-west-1' => 'rds.aliyuncs.com', - 'cn-shanghai-inner' => 'rds.aliyuncs.com', - 'cn-hangzhou' => 'rds.aliyuncs.com', - 'cn-beijing-inner' => 'rds.aliyuncs.com', - 'cn-haidian-cm12-c01' => 'rds.aliyuncs.com', - 'cn-shenzhen' => 'rds.aliyuncs.com', - 'ap-southeast-2' => 'rds.ap-southeast-2.aliyuncs.com', - 'cn-qingdao' => 'rds.aliyuncs.com', - 'cn-beijing' => 'rds.aliyuncs.com', - 'cn-hangzhou-d' => 'rds.aliyuncs.com', - 'cn-gansu-am6' => 'rds.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'rds.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'rds.aliyuncs.com', - 'ap-southeast-1' => 'rds.aliyuncs.com', - 'eu-central-1' => 'rds.eu-central-1.aliyuncs.com', - 'cn-zhangjiakou' => 'rds.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'rds.cn-huhehaote.aliyuncs.com', - 'ap-southeast-3' => 'rds.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'rds.ap-southeast-5.aliyuncs.com', - 'eu-west-1' => 'rds.eu-west-1.aliyuncs.com', - 'ap-south-1' => 'rds.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'rds.cn-chengdu.aliyuncs.com', - 'cn-north-2-gov-1' => 'rds.aliyuncs.com', - ], - 'vpc' => - [ - 'me-east-1' => 'vpc.me-east-1.aliyuncs.com', - 'us-east-1' => 'vpc.aliyuncs.com', - 'ap-northeast-1' => 'vpc.ap-northeast-1.aliyuncs.com', - 'cn-hongkong' => 'vpc.aliyuncs.com', - 'cn-beijing-am13-c01' => 'vpc.aliyuncs.com', - 'cn-guizhou-gov' => 'vpc.aliyuncs.com', - 'cn-shanghai-finance-1' => 'vpc.aliyuncs.com', - 'cn-guizhou' => 'vpc.aliyuncs.com', - 'cn-shanghai' => 'vpc.aliyuncs.com', - 'us-west-1' => 'vpc.aliyuncs.com', - 'cn-hangzhou' => 'vpc.aliyuncs.com', - 'cn-haidian-cm12-c01' => 'vpc.aliyuncs.com', - 'cn-anhui-gov' => 'vpc.aliyuncs.com', - 'cn-shenzhen' => 'vpc.aliyuncs.com', - 'ap-southeast-2' => 'vpc.ap-southeast-2.aliyuncs.com', - 'cn-henan-am12001' => 'vpc.aliyuncs.com', - 'cn-beijing' => 'vpc.aliyuncs.com', - 'cn-gansu-am6' => 'vpc.aliyuncs.com', - 'cn-ningxiazhongwei' => 'vpc.aliyuncs.com', - 'cn-ningxia-am7-c01' => 'vpc.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'vpc.aliyuncs.com', - 'ap-southeast-1' => 'vpc.aliyuncs.com', - 'eu-central-1' => 'vpc.eu-central-1.aliyuncs.com', - 'cn-zhangjiakou' => 'vpc.cn-zhangjiakou.aliyuncs.com', - 'cn-qingdao' => 'vpc.aliyuncs.com', - 'cn-huhehaote' => 'vpc.cn-huhehaote.aliyuncs.com', - 'ap-southeast-3' => 'vpc.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'vpc.ap-southeast-5.aliyuncs.com', - 'eu-west-1' => 'vpc.eu-west-1.aliyuncs.com', - 'ap-south-1' => 'vpc.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'vpc.cn-chengdu.aliyuncs.com', - 'cn-north-2-gov-1' => 'vpc.aliyuncs.com', - ], - 'kms' => - [ - 'me-east-1' => 'kms.me-east-1.aliyuncs.com', - 'ap-northeast-1' => 'kms.ap-northeast-1.aliyuncs.com', - 'cn-hongkong' => 'kms.cn-hongkong.aliyuncs.com', - 'cn-shanghai-finance-1' => 'kms.cn-shanghai-finance-1.aliyuncs.com', - 'cn-shanghai' => 'kms.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'kms.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'kms.cn-shenzhen.aliyuncs.com', - 'ap-southeast-2' => 'kms.ap-southeast-2.aliyuncs.com', - 'cn-beijing' => 'kms.cn-beijing.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'kms.cn-shenzhen-finance-1.aliyuncs.com', - 'ap-southeast-1' => 'kms.ap-southeast-1.aliyuncs.com', - 'eu-central-1' => 'kms.eu-central-1.aliyuncs.com', - 'cn-qingdao' => 'kms.cn-qingdao.aliyuncs.com', - 'cn-zhangjiakou' => 'kms.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'kms.cn-huhehaote.aliyuncs.com', - 'ap-southeast-3' => 'kms.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'kms.ap-southeast-5.aliyuncs.com', - 'eu-west-1' => 'kms.eu-west-1.aliyuncs.com', - 'us-west-1' => 'kms.us-west-1.aliyuncs.com', - 'us-east-1' => 'kms.us-east-1.aliyuncs.com', - 'ap-south-1' => 'kms.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'kms.cn-chengdu.aliyuncs.com', - 'cn-hangzhou-finance' => 'kms.cn-hangzhou-finance.aliyuncs.com', - 'cn-north-2-gov-1' => 'kms.cn-north-2-gov-1.aliyuncs.com', - ], - 'cms' => - [ - 'me-east-1' => 'metrics.cn-hangzhou.aliyuncs.com', - 'us-east-1' => 'metrics.cn-hangzhou.aliyuncs.com', - 'ap-northeast-1' => 'metrics.ap-northeast-1.aliyuncs.com', - 'cn-hongkong' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'metrics.aliyuncs.com', - 'cn-shanghai' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'metrics.aliyuncs.com', - 'us-west-1' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'metrics.aliyuncs.com', - 'cn-hangzhou' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'metrics.aliyuncs.com', - 'cn-shenzhen' => 'metrics.cn-hangzhou.aliyuncs.com', - 'ap-southeast-2' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'metrics.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'metrics.aliyuncs.com', - 'ap-southeast-1' => 'metrics.cn-hangzhou.aliyuncs.com', - 'eu-central-1' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-zhangjiakou' => 'metrics.cn-hangzhou.aliyuncs.com', - 'cn-huhehaote' => 'metrics.cn-huhehaote.aliyuncs.com', - 'ap-southeast-3' => 'metrics.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'metrics.ap-southeast-5.aliyuncs.com', - 'eu-west-1' => 'metrics.eu-west-1.aliyuncs.com', - 'ap-south-1' => 'metrics.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'metrics.cn-chengdu.aliyuncs.com', - 'cn-shanghai-finance-1' => 'metrics.cn-shanghai-finance-1.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'metrics.cn-shenzhen-finance-1.aliyuncs.com', - 'cn-north-2-gov-1' => 'metrics.aliyuncs.com', - ], - 'slb' => - [ - 'me-east-1' => 'slb.me-east-1.aliyuncs.com', - 'us-east-1' => 'slb.aliyuncs.com', - 'ap-northeast-1' => 'slb.ap-northeast-1.aliyuncs.com', - 'cn-hongkong' => 'slb.aliyuncs.com', - 'cn-qingdao-cm9' => 'slb.aliyuncs.com', - 'cn-shanghai' => 'slb.aliyuncs.com', - 'cn-shenzhen-inner' => 'slb.aliyuncs.com', - 'us-west-1' => 'slb.aliyuncs.com', - 'cn-shanghai-inner' => 'slb.aliyuncs.com', - 'cn-hangzhou' => 'slb.aliyuncs.com', - 'cn-beijing-inner' => 'slb.aliyuncs.com', - 'cn-shenzhen' => 'slb.aliyuncs.com', - 'ap-southeast-2' => 'slb.ap-southeast-2.aliyuncs.com', - 'cn-qingdao' => 'slb.aliyuncs.com', - 'cn-beijing' => 'slb.aliyuncs.com', - 'cn-hangzhou-d' => 'slb.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'slb.aliyuncs.com', - 'ap-southeast-1' => 'slb.aliyuncs.com', - 'eu-central-1' => 'slb.eu-central-1.aliyuncs.com', - 'cn-zhangjiakou' => 'slb.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'slb.cn-huhehaote.aliyuncs.com', - 'ap-southeast-3' => 'slb.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'slb.ap-southeast-5.aliyuncs.com', - 'eu-west-1' => 'slb.eu-west-1.aliyuncs.com', - 'ap-south-1' => 'slb.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'slb.cn-chengdu.aliyuncs.com', - 'cn-shanghai-finance-1' => 'slb.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'slb.aliyuncs.com', - 'cn-north-2-gov-1' => 'slb.aliyuncs.com', - ], - 'cs' => - [ - 'us-east-1' => 'cs.aliyuncs.com', - 'cn-hongkong' => 'cs.aliyuncs.com', - 'cn-qingdao-cm9' => 'cs.aliyuncs.com', - 'cn-shanghai' => 'cs.aliyuncs.com', - 'cn-shenzhen-inner' => 'cs.aliyuncs.com', - 'us-west-1' => 'cs.aliyuncs.com', - 'cn-shanghai-inner' => 'cs.aliyuncs.com', - 'cn-hangzhou' => 'cs.aliyuncs.com', - 'cn-beijing-inner' => 'cs.aliyuncs.com', - 'cn-shenzhen' => 'cs.aliyuncs.com', - 'cn-qingdao' => 'cs.aliyuncs.com', - 'cn-beijing' => 'cs.aliyuncs.com', - 'cn-hangzhou-d' => 'cs.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'cs.aliyuncs.com', - 'ap-southeast-1' => 'cs.aliyuncs.com', - ], - 'push' => - [ - 'us-east-1' => 'cloudpush.aliyuncs.com', - 'cn-hongkong' => 'cloudpush.aliyuncs.com', - 'cn-qingdao-cm9' => 'cloudpush.aliyuncs.com', - 'cn-shanghai' => 'cloudpush.aliyuncs.com', - 'cn-shenzhen-inner' => 'cloudpush.aliyuncs.com', - 'us-west-1' => 'cloudpush.aliyuncs.com', - 'cn-shanghai-inner' => 'cloudpush.aliyuncs.com', - 'cn-hangzhou' => 'cloudpush.aliyuncs.com', - 'cn-beijing-inner' => 'cloudpush.aliyuncs.com', - 'cn-shenzhen' => 'cloudpush.aliyuncs.com', - 'cn-qingdao' => 'cloudpush.aliyuncs.com', - 'cn-beijing' => 'cloudpush.aliyuncs.com', - 'cn-hangzhou-d' => 'cloudpush.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'cloudpush.aliyuncs.com', - 'ap-southeast-1' => 'cloudpush.aliyuncs.com', - ], - 'cos' => - [ - 'us-east-1' => 'cos.aliyuncs.com', - 'cn-hongkong' => 'cos.aliyuncs.com', - 'cn-qingdao-cm9' => 'cos.aliyuncs.com', - 'cn-shanghai' => 'cos.aliyuncs.com', - 'cn-shenzhen-inner' => 'cos.aliyuncs.com', - 'us-west-1' => 'cos.aliyuncs.com', - 'cn-shanghai-inner' => 'cos.aliyuncs.com', - 'cn-hangzhou' => 'cos.aliyuncs.com', - 'cn-beijing-inner' => 'cos.aliyuncs.com', - 'cn-shenzhen' => 'cos.aliyuncs.com', - 'cn-qingdao' => 'cos.aliyuncs.com', - 'cn-beijing' => 'cos.aliyuncs.com', - 'cn-hangzhou-d' => 'cos.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'cos.aliyuncs.com', - 'ap-southeast-1' => 'cos.aliyuncs.com', - ], - 'ess' => - [ - 'us-east-1' => 'ess.aliyuncs.com', - 'cn-hongkong' => 'ess.aliyuncs.com', - 'cn-qingdao-cm9' => 'ess.aliyuncs.com', - 'cn-shanghai' => 'ess.aliyuncs.com', - 'cn-shenzhen-inner' => 'ess.aliyuncs.com', - 'us-west-1' => 'ess.aliyuncs.com', - 'cn-shanghai-inner' => 'ess.aliyuncs.com', - 'cn-hangzhou' => 'ess.aliyuncs.com', - 'cn-beijing-inner' => 'ess.aliyuncs.com', - 'cn-shenzhen' => 'ess.aliyuncs.com', - 'cn-qingdao' => 'ess.aliyuncs.com', - 'cn-beijing' => 'ess.aliyuncs.com', - 'cn-hangzhou-d' => 'ess.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ess.aliyuncs.com', - 'ap-southeast-1' => 'ess.aliyuncs.com', - 'cn-zhangjiakou' => 'ess.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'ess.cn-huhehaote.aliyuncs.com', - 'ap-southeast-2' => 'ess.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'ess.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'ess.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'ess.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'ess.eu-west-1.aliyuncs.com', - 'eu-central-1' => 'ess.eu-central-1.aliyuncs.com', - 'me-east-1' => 'ess.me-east-1.aliyuncs.com', - 'ap-south-1' => 'ess.ap-south-1.aliyuncs.com', - 'cn-shanghai-finance-1' => 'ess.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'ess.aliyuncs.com', - 'cn-north-2-gov-1' => 'ess.aliyuncs.com', - ], - 'ace-ops' => - [ - 'us-east-1' => 'ace-ops.cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'ace-ops.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'ace-ops.cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'ace-ops.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'ace-ops.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'ace-ops.cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'ace-ops.cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'ace-ops.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ace-ops.cn-hangzhou.aliyuncs.com', - ], - 'billing' => - [ - 'us-east-1' => 'billing.aliyuncs.com', - 'cn-hongkong' => 'billing.aliyuncs.com', - 'cn-qingdao-cm9' => 'billing.aliyuncs.com', - 'cn-shanghai' => 'billing.aliyuncs.com', - 'cn-shenzhen-inner' => 'billing.aliyuncs.com', - 'us-west-1' => 'billing.aliyuncs.com', - 'cn-shanghai-inner' => 'billing.aliyuncs.com', - 'cn-hangzhou' => 'billing.aliyuncs.com', - 'cn-beijing-inner' => 'billing.aliyuncs.com', - 'cn-beijing' => 'billing.aliyuncs.com', - 'cn-hangzhou-d' => 'billing.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'billing.aliyuncs.com', - 'ap-southeast-1' => 'billing.aliyuncs.com', - ], - 'dqs' => - [ - 'us-east-1' => 'dqs.aliyuncs.com', - 'cn-hongkong' => 'dqs.aliyuncs.com', - 'cn-qingdao-cm9' => 'dqs.aliyuncs.com', - 'cn-shanghai' => 'dqs.aliyuncs.com', - 'cn-shenzhen-inner' => 'dqs.aliyuncs.com', - 'us-west-1' => 'dqs.aliyuncs.com', - 'cn-shanghai-inner' => 'dqs.aliyuncs.com', - 'cn-hangzhou' => 'dqs.aliyuncs.com', - 'cn-beijing-inner' => 'dqs.aliyuncs.com', - 'cn-shenzhen' => 'dqs.aliyuncs.com', - 'cn-qingdao' => 'dqs.aliyuncs.com', - 'cn-beijing' => 'dqs.aliyuncs.com', - 'cn-hangzhou-d' => 'dqs.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'dqs.aliyuncs.com', - 'ap-southeast-1' => 'dqs.aliyuncs.com', - ], - 'dds' => - [ - 'us-east-1' => 'mongodb.aliyuncs.com', - 'cn-hongkong' => 'mongodb.aliyuncs.com', - 'cn-qingdao-cm9' => 'mongodb.aliyuncs.com', - 'cn-shanghai' => 'mongodb.aliyuncs.com', - 'cn-shenzhen-inner' => 'mongodb.aliyuncs.com', - 'us-west-1' => 'mongodb.aliyuncs.com', - 'cn-shanghai-inner' => 'mongodb.aliyuncs.com', - 'cn-hangzhou' => 'mongodb.aliyuncs.com', - 'cn-beijing-inner' => 'mongodb.aliyuncs.com', - 'cn-shenzhen' => 'mongodb.aliyuncs.com', - 'cn-qingdao' => 'mongodb.aliyuncs.com', - 'cn-beijing' => 'mongodb.aliyuncs.com', - 'cn-hangzhou-d' => 'mongodb.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'mongodb.aliyuncs.com', - 'ap-southeast-1' => 'mongodb.aliyuncs.com', - 'cn-zhangjiakou' => 'mongodb.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'mongodb.cn-huhehaote.aliyuncs.com', - 'ap-southeast-2' => 'mongodb.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'mongodb.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'mongodb.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'mongodb.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'mongodb.eu-west-1.aliyuncs.com', - 'eu-central-1' => 'mongodb.eu-central-1.aliyuncs.com', - 'me-east-1' => 'mongodb.me-east-1.aliyuncs.com', - 'ap-south-1' => 'mongodb.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'mongodb.cn-chengdu.aliyuncs.com', - 'cn-hangzhou-finance' => 'mongodb.aliyuncs.com', - 'cn-shanghai-finance-1' => 'mongodb.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'mongodb.aliyuncs.com', - 'cn-north-2-gov-1' => 'mongodb.aliyuncs.com', - ], - 'emr' => - [ - 'us-east-1' => 'emr.us-east-1.aliyuncs.com', - 'cn-hongkong' => 'emr.cn-hongkong.aliyuncs.com', - 'cn-qingdao-cm9' => 'emr.aliyuncs.com', - 'cn-shanghai' => 'emr.aliyuncs.com', - 'cn-shenzhen-inner' => 'emr.aliyuncs.com', - 'us-west-1' => 'emr.aliyuncs.com', - 'cn-shanghai-inner' => 'emr.aliyuncs.com', - 'cn-hangzhou' => 'emr.aliyuncs.com', - 'cn-beijing-inner' => 'emr.aliyuncs.com', - 'cn-shenzhen' => 'emr.aliyuncs.com', - 'cn-qingdao' => 'emr.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'emr.aliyuncs.com', - 'cn-hangzhou-d' => 'emr.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'emr.aliyuncs.com', - 'ap-southeast-1' => 'emr.aliyuncs.com', - 'cn-zhangjiakou' => 'emr.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'emr.cn-huhehaote.aliyuncs.com', - 'ap-southeast-2' => 'emr.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'emr.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'emr.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'emr.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'emr.eu-west-1.aliyuncs.com', - 'eu-central-1' => 'emr.eu-central-1.aliyuncs.com', - 'me-east-1' => 'emr.me-east-1.aliyuncs.com', - 'ap-south-1' => 'emr.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'emr.cn-chengdu.aliyuncs.com', - ], - 'sms' => - [ - 'us-east-1' => 'sms.aliyuncs.com', - 'cn-hongkong' => 'sms.aliyuncs.com', - 'cn-qingdao-cm9' => 'sms.aliyuncs.com', - 'cn-shanghai' => 'sms.aliyuncs.com', - 'cn-shenzhen-inner' => 'sms.aliyuncs.com', - 'us-west-1' => 'sms.aliyuncs.com', - 'cn-shanghai-inner' => 'sms.aliyuncs.com', - 'cn-hangzhou' => 'sms.aliyuncs.com', - 'cn-beijing-inner' => 'sms.aliyuncs.com', - 'cn-shenzhen' => 'sms.aliyuncs.com', - 'cn-qingdao' => 'sms.aliyuncs.com', - 'cn-beijing' => 'sms.aliyuncs.com', - 'cn-hangzhou-d' => 'sms.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'sms.aliyuncs.com', - 'ap-southeast-1' => 'sms.aliyuncs.com', - ], - 'jaq' => - [ - 'us-east-1' => 'jaq.aliyuncs.com', - 'cn-hongkong' => 'jaq.aliyuncs.com', - 'cn-qingdao-cm9' => 'jaq.aliyuncs.com', - 'cn-shanghai' => 'jaq.aliyuncs.com', - 'cn-shenzhen-inner' => 'jaq.aliyuncs.com', - 'us-west-1' => 'jaq.aliyuncs.com', - 'cn-shanghai-inner' => 'jaq.aliyuncs.com', - 'cn-hangzhou' => 'jaq.aliyuncs.com', - 'cn-beijing-inner' => 'jaq.aliyuncs.com', - 'cn-shenzhen' => 'jaq.aliyuncs.com', - 'cn-qingdao' => 'jaq.aliyuncs.com', - 'cn-beijing' => 'jaq.aliyuncs.com', - 'cn-hangzhou-d' => 'jaq.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'jaq.aliyuncs.com', - 'ap-southeast-1' => 'jaq.aliyuncs.com', - ], - 'hpc' => - [ - 'us-east-1' => 'hpc.aliyuncs.com', - 'cn-hongkong' => 'hpc.aliyuncs.com', - 'cn-qingdao-cm9' => 'hpc.aliyuncs.com', - 'cn-shanghai' => 'hpc.aliyuncs.com', - 'cn-shenzhen-inner' => 'hpc.aliyuncs.com', - 'us-west-1' => 'hpc.aliyuncs.com', - 'cn-shanghai-inner' => 'hpc.aliyuncs.com', - 'cn-hangzhou' => 'hpc.aliyuncs.com', - 'cn-beijing-inner' => 'hpc.aliyuncs.com', - 'cn-shenzhen' => 'hpc.aliyuncs.com', - 'cn-qingdao' => 'hpc.aliyuncs.com', - 'cn-beijing' => 'hpc.aliyuncs.com', - 'cn-hangzhou-d' => 'hpc.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'hpc.aliyuncs.com', - 'ap-southeast-1' => 'hpc.aliyuncs.com', - ], - 'location' => - [ - 'us-east-1' => 'location.aliyuncs.com', - 'cn-hongkong' => 'location.aliyuncs.com', - 'cn-qingdao-cm9' => 'location.aliyuncs.com', - 'cn-shanghai' => 'location.aliyuncs.com', - 'cn-shenzhen-inner' => 'location.aliyuncs.com', - 'us-west-1' => 'location.aliyuncs.com', - 'cn-shanghai-inner' => 'location.aliyuncs.com', - 'cn-hangzhou' => 'location.aliyuncs.com', - 'cn-beijing-inner' => 'location.aliyuncs.com', - 'cn-shenzhen' => 'location.aliyuncs.com', - 'cn-qingdao' => 'location.aliyuncs.com', - 'cn-beijing' => 'location.aliyuncs.com', - 'cn-hangzhou-d' => 'location.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'location.aliyuncs.com', - 'ap-southeast-1' => 'location.aliyuncs.com', - ], - 'chargingservice' => - [ - 'us-east-1' => 'chargingservice.aliyuncs.com', - 'cn-hongkong' => 'chargingservice.aliyuncs.com', - 'cn-qingdao-cm9' => 'chargingservice.aliyuncs.com', - 'cn-shanghai' => 'chargingservice.aliyuncs.com', - 'cn-shenzhen-inner' => 'chargingservice.aliyuncs.com', - 'us-west-1' => 'chargingservice.aliyuncs.com', - 'cn-shanghai-inner' => 'chargingservice.aliyuncs.com', - 'cn-hangzhou' => 'chargingservice.aliyuncs.com', - 'cn-beijing-inner' => 'chargingservice.aliyuncs.com', - 'cn-beijing' => 'chargingservice.aliyuncs.com', - 'cn-hangzhou-d' => 'chargingservice.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'chargingservice.aliyuncs.com', - 'ap-southeast-1' => 'chargingservice.aliyuncs.com', - ], - 'msg' => - [ - 'us-east-1' => 'msg-inner.aliyuncs.com', - 'cn-hongkong' => 'msg-inner.aliyuncs.com', - 'cn-qingdao-cm9' => 'msg-inner.aliyuncs.com', - 'cn-shanghai' => 'msg-inner.aliyuncs.com', - 'cn-shenzhen-inner' => 'msg-inner.aliyuncs.com', - 'us-west-1' => 'msg-inner.aliyuncs.com', - 'cn-shanghai-inner' => 'msg-inner.aliyuncs.com', - 'cn-hangzhou' => 'msg-inner.aliyuncs.com', - 'cn-beijing-inner' => 'msg-inner.aliyuncs.com', - 'cn-beijing' => 'msg-inner.aliyuncs.com', - 'cn-hangzhou-d' => 'msg-inner.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'msg-inner.aliyuncs.com', - 'ap-southeast-1' => 'msg-inner.aliyuncs.com', - ], - 'commondriver' => - [ - 'us-east-1' => 'common.driver.aliyuncs.com', - 'cn-hongkong' => 'common.driver.aliyuncs.com', - 'cn-qingdao-cm9' => 'common.driver.aliyuncs.com', - 'cn-shanghai' => 'common.driver.aliyuncs.com', - 'cn-shenzhen-inner' => 'common.driver.aliyuncs.com', - 'us-west-1' => 'common.driver.aliyuncs.com', - 'cn-shanghai-inner' => 'common.driver.aliyuncs.com', - 'cn-hangzhou' => 'common.driver.aliyuncs.com', - 'cn-beijing-inner' => 'common.driver.aliyuncs.com', - 'cn-shenzhen' => 'common.driver.aliyuncs.com', - 'cn-qingdao' => 'common.driver.aliyuncs.com', - 'cn-beijing' => 'common.driver.aliyuncs.com', - 'cn-hangzhou-d' => 'common.driver.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'common.driver.aliyuncs.com', - 'ap-southeast-1' => 'common.driver.aliyuncs.com', - ], - 'r-kvstore' => - [ - 'us-east-1' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'r-kvstore-cn-hangzhou.aliyuncs.com', - ], - 'bss' => - [ - 'us-east-1' => 'bss.aliyuncs.com', - 'cn-hongkong' => 'bss.aliyuncs.com', - 'cn-qingdao-cm9' => 'bss.aliyuncs.com', - 'cn-shanghai' => 'bss.aliyuncs.com', - 'cn-shenzhen-inner' => 'bss.aliyuncs.com', - 'us-west-1' => 'bss.aliyuncs.com', - 'cn-shanghai-inner' => 'bss.aliyuncs.com', - 'cn-hangzhou' => 'bss.aliyuncs.com', - 'cn-beijing-inner' => 'bss.aliyuncs.com', - 'cn-shenzhen' => 'bss.aliyuncs.com', - 'cn-qingdao' => 'bss.aliyuncs.com', - 'cn-beijing' => 'bss.aliyuncs.com', - 'cn-hangzhou-d' => 'bss.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'bss.aliyuncs.com', - 'ap-southeast-1' => 'bss.aliyuncs.com', - ], - 'workorder' => - [ - 'us-east-1' => 'workorder.aliyuncs.com', - 'cn-hongkong' => 'workorder.aliyuncs.com', - 'cn-qingdao-cm9' => 'workorder.aliyuncs.com', - 'cn-shanghai' => 'workorder.aliyuncs.com', - 'cn-shenzhen-inner' => 'workorder.aliyuncs.com', - 'us-west-1' => 'workorder.aliyuncs.com', - 'cn-shanghai-inner' => 'workorder.aliyuncs.com', - 'cn-hangzhou' => 'workorder.aliyuncs.com', - 'cn-beijing-inner' => 'workorder.aliyuncs.com', - 'cn-beijing' => 'workorder.aliyuncs.com', - 'cn-hangzhou-d' => 'workorder.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'workorder.aliyuncs.com', - 'ap-southeast-1' => 'workorder.aliyuncs.com', - ], - 'ocs' => - [ - 'us-east-1' => 'm-kvstore.aliyuncs.com', - 'cn-hongkong' => 'm-kvstore.aliyuncs.com', - 'cn-qingdao-cm9' => 'm-kvstore.aliyuncs.com', - 'cn-shanghai' => 'm-kvstore.aliyuncs.com', - 'cn-shenzhen-inner' => 'm-kvstore.aliyuncs.com', - 'us-west-1' => 'm-kvstore.aliyuncs.com', - 'cn-shanghai-inner' => 'm-kvstore.aliyuncs.com', - 'cn-hangzhou' => 'm-kvstore.aliyuncs.com', - 'cn-beijing-inner' => 'm-kvstore.aliyuncs.com', - 'cn-shenzhen' => 'm-kvstore.aliyuncs.com', - 'cn-qingdao' => 'm-kvstore.aliyuncs.com', - 'cn-beijing' => 'm-kvstore.aliyuncs.com', - 'cn-hangzhou-d' => 'm-kvstore.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'm-kvstore.aliyuncs.com', - 'ap-southeast-1' => 'm-kvstore.aliyuncs.com', - ], - 'yundun' => - [ - 'us-east-1' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'yundun-cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'yundun-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'yundun-cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'yundun-cn-hangzhou.aliyuncs.com', - ], - 'ubsms-inner' => - [ - 'us-east-1' => 'ubsms-inner.aliyuncs.com', - 'cn-hongkong' => 'ubsms-inner.aliyuncs.com', - 'cn-qingdao-cm9' => 'ubsms-inner.aliyuncs.com', - 'cn-shanghai' => 'ubsms-inner.aliyuncs.com', - 'cn-shenzhen-inner' => 'ubsms-inner.aliyuncs.com', - 'us-west-1' => 'ubsms-inner.aliyuncs.com', - 'cn-shanghai-inner' => 'ubsms-inner.aliyuncs.com', - 'cn-hangzhou' => 'ubsms-inner.aliyuncs.com', - 'cn-beijing-inner' => 'ubsms-inner.aliyuncs.com', - 'cn-shenzhen' => 'ubsms-inner.aliyuncs.com', - 'cn-qingdao' => 'ubsms-inner.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'ubsms-inner.aliyuncs.com', - 'cn-hangzhou-d' => 'ubsms-inner.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ubsms-inner.aliyuncs.com', - 'ap-southeast-1' => 'ubsms-inner.aliyuncs.com', - ], - 'dm' => - [ - 'us-east-1' => 'dm.aliyuncs.com', - 'cn-hongkong' => 'dm.aliyuncs.com', - 'cn-qingdao-cm9' => 'dm.aliyuncs.com', - 'cn-shanghai' => 'dm.aliyuncs.com', - 'cn-shenzhen-inner' => 'dm.aliyuncs.com', - 'us-west-1' => 'dm.aliyuncs.com', - 'cn-shanghai-inner' => 'dm.aliyuncs.com', - 'cn-hangzhou' => 'dm.aliyuncs.com', - 'cn-beijing-inner' => 'dm.aliyuncs.com', - 'cn-shenzhen' => 'dm.aliyuncs.com', - 'cn-qingdao' => 'dm.aliyuncs.com', - 'cn-beijing' => 'dm.aliyuncs.com', - 'cn-hangzhou-d' => 'dm.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'dm.aliyuncs.com', - 'ap-southeast-1' => 'dm.aliyuncs.com', - ], - 'green' => - [ - 'us-east-1' => 'green.aliyuncs.com', - 'cn-hongkong' => 'green.aliyuncs.com', - 'cn-qingdao-cm9' => 'green.aliyuncs.com', - 'cn-shanghai' => 'green.cn-shanghai.aliyuncs.com', - 'cn-shenzhen-inner' => 'green.aliyuncs.com', - 'us-west-1' => 'green.us-west-1.aliyuncs.com', - 'cn-shanghai-inner' => 'green.aliyuncs.com', - 'cn-hangzhou' => 'green.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'green.aliyuncs.com', - 'cn-shenzhen' => 'green.cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'green.aliyuncs.com', - 'cn-beijing' => 'green.cn-beijing.aliyuncs.com', - 'cn-hangzhou-d' => 'green.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'green.aliyuncs.com', - 'ap-southeast-1' => 'green.ap-southeast-1.aliyuncs.com', - ], - 'risk' => - [ - 'us-east-1' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'risk-cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'risk-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'risk-cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'risk-cn-hangzhou.aliyuncs.com', - ], - 'oceanbase' => - [ - 'us-east-1' => 'oceanbase.aliyuncs.com', - 'cn-hongkong' => 'oceanbase.aliyuncs.com', - 'cn-qingdao-cm9' => 'oceanbase.aliyuncs.com', - 'cn-shanghai' => 'oceanbasepro-share.cn-shanghai.aliyuncs.com', - 'cn-shenzhen-inner' => 'oceanbase.aliyuncs.com', - 'us-west-1' => 'oceanbase.aliyuncs.com', - 'cn-shanghai-inner' => 'oceanbase.aliyuncs.com', - 'cn-hangzhou' => 'ob.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'oceanbase.aliyuncs.com', - 'cn-shenzhen' => 'oceanbase.aliyuncs.com', - 'cn-qingdao' => 'oceanbase.aliyuncs.com', - 'cn-beijing' => 'oceanbase.aliyuncs.com', - 'cn-hangzhou-d' => 'oceanbase.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'oceanbase.aliyuncs.com', - 'ap-southeast-1' => 'oceanbase.aliyuncs.com', - ], - 'msc' => - [ - 'us-east-1' => 'msc-inner.aliyuncs.com', - 'cn-hongkong' => 'msc-inner.aliyuncs.com', - 'cn-qingdao-cm9' => 'msc-inner.aliyuncs.com', - 'cn-shanghai' => 'msc-inner.aliyuncs.com', - 'cn-shenzhen-inner' => 'msc-inner.aliyuncs.com', - 'us-west-1' => 'msc-inner.aliyuncs.com', - 'cn-shanghai-inner' => 'msc-inner.aliyuncs.com', - 'cn-hangzhou' => 'msc-inner.aliyuncs.com', - 'cn-beijing-inner' => 'msc-inner.aliyuncs.com', - 'cn-beijing' => 'msc-inner.aliyuncs.com', - 'cn-hangzhou-d' => 'msc-inner.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'msc-inner.aliyuncs.com', - 'ap-southeast-1' => 'msc-inner.aliyuncs.com', - ], - 'yundunhsm' => - [ - 'us-east-1' => 'yundunhsm.aliyuncs.com', - 'cn-hongkong' => 'yundunhsm.aliyuncs.com', - 'cn-qingdao-cm9' => 'yundunhsm.aliyuncs.com', - 'cn-shanghai' => 'yundunhsm.aliyuncs.com', - 'cn-shenzhen-inner' => 'yundunhsm.aliyuncs.com', - 'us-west-1' => 'yundunhsm.aliyuncs.com', - 'cn-shanghai-inner' => 'yundunhsm.aliyuncs.com', - 'cn-hangzhou' => 'yundunhsm.aliyuncs.com', - 'cn-beijing-inner' => 'yundunhsm.aliyuncs.com', - 'cn-beijing' => 'yundunhsm.aliyuncs.com', - 'cn-hangzhou-d' => 'yundunhsm.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'yundunhsm.aliyuncs.com', - 'ap-southeast-1' => 'yundunhsm.aliyuncs.com', - ], - 'iot' => - [ - 'cn-hongkong' => 'iot.aliyuncs.com', - 'cn-qingdao-cm9' => 'iot.aliyuncs.com', - 'cn-shanghai' => 'iot.cn-shanghai.aliyuncs.com', - 'cn-shenzhen-inner' => 'iot.aliyuncs.com', - 'us-west-1' => 'iot.us-west-1.aliyuncs.com', - 'cn-shanghai-inner' => 'iot.aliyuncs.com', - 'cn-hangzhou' => 'iot.aliyuncs.com', - 'cn-beijing-inner' => 'iot.aliyuncs.com', - 'cn-shenzhen' => 'iot.aliyuncs.com', - 'cn-qingdao' => 'iot.aliyuncs.com', - 'cn-beijing' => 'iot.aliyuncs.com', - 'cn-hangzhou-d' => 'iot.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'iot.aliyuncs.com', - 'ap-southeast-1' => 'iot.ap-southeast-1.aliyuncs.com', - 'ap-northeast-1' => 'iot.ap-northeast-1.aliyuncs.com', - 'us-east-1' => 'iot.us-east-1.aliyuncs.com', - 'eu-central-1' => 'iot.eu-central-1.aliyuncs.com', - ], - 'oms' => - [ - 'us-east-1' => 'oms.aliyuncs.com', - 'cn-hongkong' => 'oms.aliyuncs.com', - 'cn-qingdao-cm9' => 'oms.aliyuncs.com', - 'cn-shanghai' => 'oms.aliyuncs.com', - 'cn-shenzhen-inner' => 'oms.aliyuncs.com', - 'us-west-1' => 'oms.aliyuncs.com', - 'cn-shanghai-inner' => 'oms.aliyuncs.com', - 'cn-hangzhou' => 'oms.aliyuncs.com', - 'cn-beijing-inner' => 'oms.aliyuncs.com', - 'cn-shenzhen' => 'oms.aliyuncs.com', - 'cn-qingdao' => 'oms.aliyuncs.com', - 'cn-beijing' => 'oms.aliyuncs.com', - 'cn-hangzhou-d' => 'oms.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'oms.aliyuncs.com', - 'ap-southeast-1' => 'oms.aliyuncs.com', - ], - 'live' => - [ - 'us-east-1' => 'live.aliyuncs.com', - 'cn-hongkong' => 'live.aliyuncs.com', - 'cn-qingdao-cm9' => 'live.aliyuncs.com', - 'cn-shanghai' => 'live.aliyuncs.com', - 'cn-shenzhen-inner' => 'live.aliyuncs.com', - 'us-west-1' => 'live.aliyuncs.com', - 'cn-shanghai-inner' => 'live.aliyuncs.com', - 'cn-hangzhou' => 'live.aliyuncs.com', - 'cn-beijing-inner' => 'live.aliyuncs.com', - 'cn-shenzhen' => 'live.aliyuncs.com', - 'cn-qingdao' => 'live.aliyuncs.com', - 'cn-beijing' => 'live.aliyuncs.com', - 'cn-hangzhou-d' => 'live.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'live.aliyuncs.com', - 'ap-southeast-1' => 'live.aliyuncs.com', - 'ap-northeast-1' => 'live.aliyuncs.com', - 'eu-central-1' => 'live.aliyuncs.com', - 'ap-southeast-5' => 'live.aliyuncs.com', - 'ap-south-1' => 'live.aliyuncs.com', - ], - 'ubsms' => - [ - 'us-east-1' => 'ubsms.aliyuncs.com', - 'cn-hongkong' => 'ubsms.aliyuncs.com', - 'cn-qingdao-cm9' => 'ubsms.aliyuncs.com', - 'cn-shanghai' => 'ubsms.aliyuncs.com', - 'cn-shenzhen-inner' => 'ubsms.aliyuncs.com', - 'us-west-1' => 'ubsms.aliyuncs.com', - 'cn-shanghai-inner' => 'ubsms.aliyuncs.com', - 'cn-hangzhou' => 'ubsms.aliyuncs.com', - 'cn-beijing-inner' => 'ubsms.aliyuncs.com', - 'cn-shenzhen' => 'ubsms.aliyuncs.com', - 'cn-qingdao' => 'ubsms.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'ubsms.aliyuncs.com', - 'cn-hangzhou-d' => 'ubsms.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ubsms.aliyuncs.com', - 'ap-southeast-1' => 'ubsms.aliyuncs.com', - ], - 'alert' => - [ - 'us-east-1' => 'alert.aliyuncs.com', - 'cn-hongkong' => 'alert.aliyuncs.com', - 'cn-qingdao-cm9' => 'alert.aliyuncs.com', - 'cn-shanghai' => 'alert.aliyuncs.com', - 'cn-shenzhen-inner' => 'alert.aliyuncs.com', - 'us-west-1' => 'alert.aliyuncs.com', - 'cn-shanghai-inner' => 'alert.aliyuncs.com', - 'cn-hangzhou' => 'alert.aliyuncs.com', - 'cn-beijing-inner' => 'alert.aliyuncs.com', - 'cn-shenzhen' => 'alert.aliyuncs.com', - 'cn-qingdao' => 'alert.aliyuncs.com', - 'cn-beijing' => 'alert.aliyuncs.com', - 'cn-hangzhou-d' => 'alert.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'alert.aliyuncs.com', - 'ap-southeast-1' => 'alert.aliyuncs.com', - ], - 'ace' => - [ - 'us-east-1' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'ace.cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'ace.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ace.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'ace.cn-hangzhou.aliyuncs.com', - ], - 'ams' => - [ - 'us-east-1' => 'ams.aliyuncs.com', - 'cn-hongkong' => 'ams.aliyuncs.com', - 'cn-qingdao-cm9' => 'ams.aliyuncs.com', - 'cn-shanghai' => 'ams.aliyuncs.com', - 'cn-shenzhen-inner' => 'ams.aliyuncs.com', - 'us-west-1' => 'ams.aliyuncs.com', - 'cn-shanghai-inner' => 'ams.aliyuncs.com', - 'cn-hangzhou' => 'ams.aliyuncs.com', - 'cn-beijing-inner' => 'ams.aliyuncs.com', - 'cn-beijing' => 'ams.aliyuncs.com', - 'cn-hangzhou-d' => 'ams.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ams.aliyuncs.com', - 'ap-southeast-1' => 'ams.aliyuncs.com', - ], - 'ros' => - [ - 'us-east-1' => 'ros.aliyuncs.com', - 'cn-hongkong' => 'ros.aliyuncs.com', - 'cn-qingdao-cm9' => 'ros.aliyuncs.com', - 'cn-shanghai' => 'ros.aliyuncs.com', - 'cn-shenzhen-inner' => 'ros.aliyuncs.com', - 'us-west-1' => 'ros.aliyuncs.com', - 'cn-shanghai-inner' => 'ros.aliyuncs.com', - 'cn-hangzhou' => 'ros.aliyuncs.com', - 'cn-beijing-inner' => 'ros.aliyuncs.com', - 'cn-shenzhen' => 'ros.aliyuncs.com', - 'cn-qingdao' => 'ros.aliyuncs.com', - 'cn-beijing' => 'ros.aliyuncs.com', - 'cn-hangzhou-d' => 'ros.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ros.aliyuncs.com', - 'ap-southeast-1' => 'ros.aliyuncs.com', - ], - 'pts' => - [ - 'us-east-1' => 'pts.aliyuncs.com', - 'cn-hongkong' => 'pts.aliyuncs.com', - 'cn-qingdao-cm9' => 'pts.aliyuncs.com', - 'cn-shanghai' => 'pts.aliyuncs.com', - 'cn-shenzhen-inner' => 'pts.aliyuncs.com', - 'us-west-1' => 'pts.aliyuncs.com', - 'cn-shanghai-inner' => 'pts.aliyuncs.com', - 'cn-hangzhou' => 'pts.aliyuncs.com', - 'cn-beijing-inner' => 'pts.aliyuncs.com', - 'cn-shenzhen' => 'pts.aliyuncs.com', - 'cn-qingdao' => 'pts.aliyuncs.com', - 'cn-beijing' => 'pts.aliyuncs.com', - 'cn-hangzhou-d' => 'pts.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'pts.aliyuncs.com', - 'ap-southeast-1' => 'pts.aliyuncs.com', - ], - 'qualitycheck' => - [ - 'us-east-1' => 'qualitycheck.aliyuncs.com', - 'cn-hongkong' => 'qualitycheck.aliyuncs.com', - 'cn-qingdao-cm9' => 'qualitycheck.aliyuncs.com', - 'cn-shanghai' => 'qualitycheck.aliyuncs.com', - 'cn-shenzhen-inner' => 'qualitycheck.aliyuncs.com', - 'us-west-1' => 'qualitycheck.aliyuncs.com', - 'cn-shanghai-inner' => 'qualitycheck.aliyuncs.com', - 'cn-hangzhou' => 'qualitycheck.aliyuncs.com', - 'cn-beijing-inner' => 'qualitycheck.aliyuncs.com', - 'cn-hangzhou-d' => 'qualitycheck.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'qualitycheck.aliyuncs.com', - 'ap-southeast-1' => 'qualitycheck.aliyuncs.com', - ], - 'm-kvstore' => - [ - 'us-east-1' => 'm-kvstore.aliyuncs.com', - 'cn-hongkong' => 'm-kvstore.aliyuncs.com', - 'cn-qingdao-cm9' => 'm-kvstore.aliyuncs.com', - 'cn-shanghai' => 'm-kvstore.aliyuncs.com', - 'cn-shenzhen-inner' => 'm-kvstore.aliyuncs.com', - 'us-west-1' => 'm-kvstore.aliyuncs.com', - 'cn-shanghai-inner' => 'm-kvstore.aliyuncs.com', - 'cn-hangzhou' => 'm-kvstore.aliyuncs.com', - 'cn-beijing-inner' => 'm-kvstore.aliyuncs.com', - 'cn-shenzhen' => 'm-kvstore.aliyuncs.com', - 'cn-qingdao' => 'm-kvstore.aliyuncs.com', - 'cn-beijing' => 'm-kvstore.aliyuncs.com', - 'cn-hangzhou-d' => 'm-kvstore.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'm-kvstore.aliyuncs.com', - 'ap-southeast-1' => 'm-kvstore.aliyuncs.com', - ], - 'highddos' => - [ - 'us-east-1' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'yd-highddos-cn-hangzhou.aliyuncs.com', - ], - 'cmssitemonitor' => - [ - 'us-east-1' => 'sitemonitor.aliyuncs.com', - 'cn-hongkong' => 'sitemonitor.aliyuncs.com', - 'cn-qingdao-cm9' => 'sitemonitor.aliyuncs.com', - 'cn-shanghai' => 'sitemonitor.aliyuncs.com', - 'cn-shenzhen-inner' => 'sitemonitor.aliyuncs.com', - 'us-west-1' => 'sitemonitor.aliyuncs.com', - 'cn-shanghai-inner' => 'sitemonitor.aliyuncs.com', - 'cn-hangzhou' => 'sitemonitor.aliyuncs.com', - 'cn-beijing-inner' => 'sitemonitor.aliyuncs.com', - 'cn-shenzhen' => 'sitemonitor.aliyuncs.com', - 'cn-qingdao' => 'sitemonitor.aliyuncs.com', - 'cn-beijing' => 'sitemonitor.aliyuncs.com', - 'cn-hangzhou-d' => 'sitemonitor.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'sitemonitor.aliyuncs.com', - 'ap-southeast-1' => 'sitemonitor.aliyuncs.com', - ], - 'batchcompute' => - [ - 'us-east-1' => 'batchCompute.us-east-1.aliyuncs.com', - 'cn-hongkong' => 'batchCompute.cn-hongkong.aliyuncs.com', - 'cn-shanghai' => 'batchCompute.cn-shanghai.aliyuncs.com', - 'us-west-1' => 'batchCompute.us-west-1.aliyuncs.com', - 'cn-hangzhou' => 'batchCompute.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'batchcompute.cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'batchcompute.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'batchCompute.cn-beijing.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'batchCompute.cn-shanghai-et2-b01.aliyuncs.com', - 'ap-southeast-1' => 'batchCompute.ap-southeast-1.aliyuncs.com', - ], - 'cf' => - [ - 'us-east-1' => 'cf.aliyuncs.com', - 'cn-hongkong' => 'cf.aliyuncs.com', - 'cn-qingdao-cm9' => 'cf.aliyuncs.com', - 'cn-shanghai' => 'cf.aliyuncs.com', - 'cn-shenzhen-inner' => 'cf.aliyuncs.com', - 'us-west-1' => 'cf.aliyuncs.com', - 'cn-shanghai-inner' => 'cf.aliyuncs.com', - 'cn-hangzhou' => 'cf.aliyuncs.com', - 'cn-beijing-inner' => 'cf.aliyuncs.com', - 'cn-shenzhen' => 'cf.aliyuncs.com', - 'cn-qingdao' => 'cf.aliyuncs.com', - 'cn-beijing' => 'cf.aliyuncs.com', - 'cn-hangzhou-d' => 'cf.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'cf.aliyuncs.com', - 'ap-southeast-1' => 'cf.aliyuncs.com', - ], - 'drds' => - [ - 'us-east-1' => 'drds.aliyuncs.com', - 'cn-hongkong' => 'drds.aliyuncs.com', - 'cn-qingdao-cm9' => 'drds.aliyuncs.com', - 'cn-shanghai' => 'drds.aliyuncs.com', - 'cn-shenzhen-inner' => 'drds.aliyuncs.com', - 'us-west-1' => 'drds.aliyuncs.com', - 'cn-shanghai-inner' => 'drds.aliyuncs.com', - 'cn-hangzhou' => 'drds.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'drds.aliyuncs.com', - 'cn-shenzhen' => 'drds.aliyuncs.com', - 'cn-qingdao' => 'drds.aliyuncs.com', - 'cn-beijing' => 'drds.aliyuncs.com', - 'cn-hangzhou-d' => 'drds.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'drds.aliyuncs.com', - 'ap-southeast-1' => 'drds.aliyuncs.com', - ], - 'acs' => - [ - 'us-east-1' => 'acs.aliyun-inc.com', - 'cn-hongkong' => 'acs.aliyun-inc.com', - 'cn-shanghai' => 'acs.aliyun-inc.com', - 'us-west-1' => 'acs.aliyun-inc.com', - 'cn-hangzhou' => 'acs.aliyun-inc.com', - 'cn-shenzhen' => 'acs.aliyun-inc.com', - 'cn-qingdao' => 'acs.aliyun-inc.com', - 'cn-beijing' => 'acs.aliyun-inc.com', - 'cn-shanghai-et2-b01' => 'acs.aliyun-inc.com', - ], - 'httpdns' => - [ - 'us-east-1' => 'httpdns-api.aliyuncs.com', - 'cn-hongkong' => 'httpdns-api.aliyuncs.com', - 'cn-qingdao-cm9' => 'httpdns-api.aliyuncs.com', - 'cn-shanghai' => 'httpdns-api.aliyuncs.com', - 'cn-shenzhen-inner' => 'httpdns-api.aliyuncs.com', - 'us-west-1' => 'httpdns-api.aliyuncs.com', - 'cn-shanghai-inner' => 'httpdns-api.aliyuncs.com', - 'cn-hangzhou' => 'httpdns-api.aliyuncs.com', - 'cn-beijing-inner' => 'httpdns-api.aliyuncs.com', - 'cn-shenzhen' => 'httpdns-api.aliyuncs.com', - 'cn-qingdao' => 'httpdns-api.aliyuncs.com', - 'cn-beijing' => 'httpdns-api.aliyuncs.com', - 'cn-hangzhou-d' => 'httpdns-api.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'httpdns-api.aliyuncs.com', - 'ap-southeast-1' => 'httpdns-api.aliyuncs.com', - ], - 'location-inner' => - [ - 'us-east-1' => 'location-inner.aliyuncs.com', - 'cn-hongkong' => 'location-inner.aliyuncs.com', - 'cn-qingdao-cm9' => 'location-inner.aliyuncs.com', - 'cn-shanghai' => 'location-inner.aliyuncs.com', - 'cn-shenzhen-inner' => 'location-inner.aliyuncs.com', - 'us-west-1' => 'location-inner.aliyuncs.com', - 'cn-shanghai-inner' => 'location-inner.aliyuncs.com', - 'cn-hangzhou' => 'location-inner.aliyuncs.com', - 'cn-beijing-inner' => 'location-inner.aliyuncs.com', - 'cn-shenzhen' => 'location-inner.aliyuncs.com', - 'cn-qingdao' => 'location-inner.aliyuncs.com', - 'cn-beijing' => 'location-inner.aliyuncs.com', - 'cn-hangzhou-d' => 'location-inner.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'location-inner.aliyuncs.com', - 'ap-southeast-1' => 'location-inner.aliyuncs.com', - ], - 'aas' => - [ - 'us-east-1' => 'aas.aliyuncs.com', - 'cn-hongkong' => 'aas.aliyuncs.com', - 'cn-qingdao-cm9' => 'aas.aliyuncs.com', - 'cn-shanghai' => 'aas.aliyuncs.com', - 'cn-shenzhen-inner' => 'aas.aliyuncs.com', - 'us-west-1' => 'aas.aliyuncs.com', - 'cn-shanghai-inner' => 'aas.aliyuncs.com', - 'cn-hangzhou' => 'aas.aliyuncs.com', - 'cn-beijing-inner' => 'aas.aliyuncs.com', - 'cn-shenzhen' => 'aas.aliyuncs.com', - 'cn-qingdao' => 'aas.aliyuncs.com', - 'cn-beijing' => 'aas.aliyuncs.com', - 'cn-hangzhou-d' => 'aas.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'aas.aliyuncs.com', - 'ap-southeast-1' => 'aas.aliyuncs.com', - ], - 'sts' => - [ - 'cn-hangzhou' => 'sts.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'sts.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'sts.cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'sts.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'sts.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'sts.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'sts.cn-huhehaote.aliyuncs.com', - 'cn-hongkong' => 'sts.cn-hongkong.aliyuncs.com', - 'cn-chengdu' => 'sts.cn-chengdu.aliyuncs.com', - 'ap-southeast-1' => 'sts.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'sts.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'sts.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'sts.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'sts.ap-northeast-1.aliyuncs.com', - 'ap-south-1' => 'sts.ap-south-1.aliyuncs.com', - 'us-west-1' => 'sts.us-west-1.aliyuncs.com', - 'us-east-1' => 'sts.us-east-1.aliyuncs.com', - 'eu-central-1' => 'sts.eu-central-1.aliyuncs.com', - 'me-east-1' => 'sts.me-east-1.aliyuncs.com', - 'eu-west-1' => 'sts.eu-west-1.aliyuncs.com', - ], - 'dts' => - [ - 'us-east-1' => 'dts.aliyuncs.com', - 'cn-hongkong' => 'dts.aliyuncs.com', - 'cn-qingdao-cm9' => 'dts.aliyuncs.com', - 'cn-shanghai' => 'dts.aliyuncs.com', - 'cn-shenzhen-inner' => 'dts.aliyuncs.com', - 'us-west-1' => 'dts.aliyuncs.com', - 'cn-shanghai-inner' => 'dts.aliyuncs.com', - 'cn-hangzhou' => 'dts.aliyuncs.com', - 'cn-beijing-inner' => 'dts.aliyuncs.com', - 'cn-shenzhen' => 'dts.aliyuncs.com', - 'cn-qingdao' => 'dts.aliyuncs.com', - 'cn-beijing' => 'dts.aliyuncs.com', - 'cn-hangzhou-d' => 'dts.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'dts.aliyuncs.com', - 'ap-southeast-1' => 'dts.aliyuncs.com', - ], - 'drc' => - [ - 'us-east-1' => 'drc.aliyuncs.com', - 'cn-hongkong' => 'drc.aliyuncs.com', - 'cn-qingdao-cm9' => 'drc.aliyuncs.com', - 'cn-shanghai' => 'drc.aliyuncs.com', - 'cn-shenzhen-inner' => 'drc.aliyuncs.com', - 'us-west-1' => 'drc.aliyuncs.com', - 'cn-shanghai-inner' => 'drc.aliyuncs.com', - 'cn-hangzhou' => 'drc.aliyuncs.com', - 'cn-beijing-inner' => 'drc.aliyuncs.com', - 'cn-shenzhen' => 'drc.aliyuncs.com', - 'cn-qingdao' => 'drc.aliyuncs.com', - 'cn-beijing' => 'drc.aliyuncs.com', - 'cn-hangzhou-d' => 'drc.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'drc.aliyuncs.com', - 'ap-southeast-1' => 'drc.aliyuncs.com', - ], - 'vpc-inner' => - [ - 'us-east-1' => 'vpc-inner.aliyuncs.com', - 'cn-hongkong' => 'vpc-inner.aliyuncs.com', - 'cn-shanghai' => 'vpc-inner.aliyuncs.com', - 'us-west-1' => 'vpc-inner.aliyuncs.com', - 'cn-hangzhou' => 'vpc-inner.aliyuncs.com', - 'cn-shenzhen' => 'vpc-inner.aliyuncs.com', - 'cn-qingdao' => 'vpc-inner.aliyuncs.com', - 'cn-beijing' => 'vpc-inner.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'vpc-inner.aliyuncs.com', - ], - 'crm' => - [ - 'us-east-1' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'crm-cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-qingdao' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'crm-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'crm-cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'crm-cn-hangzhou.aliyuncs.com', - ], - 'domain' => - [ - 'us-east-1' => 'domain.aliyuncs.com', - 'cn-hongkong' => 'domain.aliyuncs.com', - 'cn-qingdao-cm9' => 'domain.aliyuncs.com', - 'cn-shanghai' => 'domain.aliyuncs.com', - 'cn-shenzhen-inner' => 'domain.aliyuncs.com', - 'us-west-1' => 'domain.aliyuncs.com', - 'cn-shanghai-inner' => 'domain.aliyuncs.com', - 'cn-hangzhou' => 'domain.aliyuncs.com', - 'cn-beijing-inner' => 'domain.aliyuncs.com', - 'cn-shenzhen' => 'domain.aliyuncs.com', - 'cn-qingdao' => 'domain.aliyuncs.com', - 'cn-beijing' => 'domain.aliyuncs.com', - 'cn-hangzhou-d' => 'domain.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'domain.aliyuncs.com', - 'ap-southeast-1' => 'domain.aliyuncs.com', - ], - 'ots' => - [ - 'us-east-1' => 'ots.us-east-1.aliyuncs.com', - 'cn-hongkong' => 'ots-pop.aliyuncs.com', - 'cn-qingdao-cm9' => 'ots-pop.aliyuncs.com', - 'cn-shanghai' => 'ots.cn-shanghai.aliyuncs.com', - 'cn-shenzhen-inner' => 'ots-pop.aliyuncs.com', - 'us-west-1' => 'ots.us-west-1.aliyuncs.com', - 'cn-shanghai-inner' => 'ots-pop.aliyuncs.com', - 'cn-hangzhou' => 'ots.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'ots-pop.aliyuncs.com', - 'cn-shenzhen' => 'ots.cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'ots-pop.aliyuncs.com', - 'cn-beijing' => 'ots.cn-beijing.aliyuncs.com', - 'cn-hangzhou-d' => 'ots-pop.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ots-pop.aliyuncs.com', - 'ap-southeast-1' => 'ots.ap-southeast-1.aliyuncs.com', - 'cn-zhangjiakou' => 'ots.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'ots.cn-huhehaote.aliyuncs.com', - 'ap-southeast-2' => 'ots.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'ots.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'ots.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'ots.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'ots.eu-west-1.aliyuncs.com', - 'eu-central-1' => 'ots.eu-central-1.aliyuncs.com', - 'me-east-1' => 'ots.me-east-1.aliyuncs.com', - 'ap-south-1' => 'ots.ap-south-1.aliyuncs.com', - ], - 'oss' => - [ - 'us-east-1' => 'oss-cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'oss-cn-hongkong.aliyuncs.com', - 'cn-qingdao-cm9' => 'oss-cn-hangzhou.aliyuncs.com', - 'cn-qingdao-finance' => 'oss-cn-qdjbp-a.aliyuncs.com', - 'cn-beijing-gov-1' => 'oss-cn-haidian-a.aliyuncs.com', - 'cn-shanghai' => 'oss-cn-shanghai.aliyuncs.com', - 'cn-shenzhen-inner' => 'oss-cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'oss-us-west-1.aliyuncs.com', - 'cn-shanghai-inner' => 'oss-cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-finance' => 'oss-cn-hzjbp-b-console.aliyuncs.com', - 'cn-hangzhou' => 'oss-cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'oss-cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'oss-cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'oss-cn-qingdao.aliyuncs.com', - 'oss-cn-bjzwy' => 'oss-cn-bjzwy.aliyuncs.com', - 'cn-beijing' => 'oss-cn-beijing.aliyuncs.com', - 'cn-hangzhou-d' => 'oss-cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'oss-cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'oss-ap-southeast-1.aliyuncs.com', - ], - 'ram' => - [ - 'global' => 'ram.aliyuncs.com', - 'us-east-1' => 'ram.aliyuncs.com', - 'cn-hongkong' => 'ram.aliyuncs.com', - 'cn-qingdao-cm9' => 'ram.aliyuncs.com', - 'cn-shanghai' => 'ram.aliyuncs.com', - 'cn-shenzhen-inner' => 'ram.aliyuncs.com', - 'us-west-1' => 'ram.aliyuncs.com', - 'cn-shanghai-inner' => 'ram.aliyuncs.com', - 'cn-hangzhou' => 'ram.aliyuncs.com', - 'cn-beijing-inner' => 'ram.aliyuncs.com', - 'cn-shenzhen' => 'ram.aliyuncs.com', - 'cn-qingdao' => 'ram.aliyuncs.com', - 'cn-beijing' => 'ram.aliyuncs.com', - 'cn-hangzhou-d' => 'ram.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ram.aliyuncs.com', - 'ap-southeast-1' => 'ram.aliyuncs.com', - ], - 'sales' => - [ - 'us-east-1' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'sales.cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'sales.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'sales.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'sales.cn-hangzhou.aliyuncs.com', - ], - 'ossadmin' => - [ - 'us-east-1' => 'oss-admin.aliyuncs.com', - 'cn-hongkong' => 'oss-admin.aliyuncs.com', - 'cn-qingdao-cm9' => 'oss-admin.aliyuncs.com', - 'cn-shanghai' => 'oss-admin.aliyuncs.com', - 'cn-shenzhen-inner' => 'oss-admin.aliyuncs.com', - 'us-west-1' => 'oss-admin.aliyuncs.com', - 'cn-shanghai-inner' => 'oss-admin.aliyuncs.com', - 'cn-hangzhou' => 'oss-admin.aliyuncs.com', - 'cn-beijing-inner' => 'oss-admin.aliyuncs.com', - 'cn-shenzhen' => 'oss-admin.aliyuncs.com', - 'cn-qingdao' => 'oss-admin.aliyuncs.com', - 'cn-beijing' => 'oss-admin.aliyuncs.com', - 'cn-hangzhou-d' => 'oss-admin.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'oss-admin.aliyuncs.com', - 'ap-southeast-1' => 'oss-admin.aliyuncs.com', - ], - 'alidns' => - [ - 'us-east-1' => 'alidns.aliyuncs.com', - 'cn-hongkong' => 'alidns.aliyuncs.com', - 'cn-qingdao-cm9' => 'alidns.aliyuncs.com', - 'cn-shanghai' => 'alidns.aliyuncs.com', - 'cn-shenzhen-inner' => 'alidns.aliyuncs.com', - 'us-west-1' => 'alidns.aliyuncs.com', - 'cn-shanghai-inner' => 'alidns.aliyuncs.com', - 'cn-hangzhou' => 'alidns.aliyuncs.com', - 'cn-beijing-inner' => 'alidns.aliyuncs.com', - 'cn-shenzhen' => 'alidns.aliyuncs.com', - 'cn-qingdao' => 'alidns.aliyuncs.com', - 'cn-beijing' => 'alidns.aliyuncs.com', - 'cn-hangzhou-d' => 'alidns.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'alidns.aliyuncs.com', - 'ap-southeast-1' => 'alidns.aliyuncs.com', - ], - 'ons' => - [ - 'us-east-1' => 'ons.us-east-1.aliyuncs.com', - 'cn-hongkong' => 'ons.cn-hongkong.aliyuncs.com', - 'cn-qingdao-cm9' => 'ons.aliyuncs.com', - 'cn-shanghai' => 'ons.cn-shanghai.aliyuncs.com', - 'cn-shenzhen-inner' => 'ons.aliyuncs.com', - 'us-west-1' => 'ons.us-west-1.aliyuncs.com', - 'cn-shanghai-inner' => 'ons.aliyuncs.com', - 'cn-hangzhou' => 'ons.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'ons.aliyuncs.com', - 'cn-shenzhen' => 'ons.cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'ons.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'ons.cn-beijing.aliyuncs.com', - 'cn-hangzhou-d' => 'ons.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'ons.aliyuncs.com', - 'ap-southeast-1' => 'ons.ap-southeast-1.aliyuncs.com', - 'cn-zhangjiakou' => 'ons.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'ons.cn-huhehaote.aliyuncs.com', - 'ap-southeast-2' => 'ons.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'ons.ap-southeast-3.aliyuncs.com', - 'ap-northeast-1' => 'ons.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'ons.eu-west-1.aliyuncs.com', - 'eu-central-1' => 'ons.eu-central-1.aliyuncs.com', - 'me-east-1' => 'ons.me-east-1.aliyuncs.com', - 'ap-south-1' => 'ons.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'ons.cn-chengdu.aliyuncs.com', - 'cn-hangzhou-finance' => 'ons.cn-hangzhou-finance.aliyuncs.com', - 'cn-shanghai-finance-1' => 'ons.cn-shanghai-finance-1.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'ons.cn-shenzhen-finance-1.aliyuncs.com', - 'cn-north-2-gov-1' => 'ons.cn-north-2-gov-1.aliyuncs.com', - ], - 'cdn' => - [ - 'global' => 'cdn.aliyuncs.com', - 'us-east-1' => 'cdn.aliyuncs.com', - 'cn-hongkong' => 'cdn.aliyuncs.com', - 'cn-qingdao-cm9' => 'cdn.aliyuncs.com', - 'cn-shanghai' => 'cdn.aliyuncs.com', - 'cn-shenzhen-inner' => 'cdn.aliyuncs.com', - 'us-west-1' => 'cdn.aliyuncs.com', - 'cn-shanghai-inner' => 'cdn.aliyuncs.com', - 'cn-hangzhou' => 'cdn.aliyuncs.com', - 'cn-beijing-inner' => 'cdn.aliyuncs.com', - 'cn-shenzhen' => 'cdn.aliyuncs.com', - 'cn-qingdao' => 'cdn.aliyuncs.com', - 'cn-beijing' => 'cdn.aliyuncs.com', - 'cn-hangzhou-d' => 'cdn.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'cdn.aliyuncs.com', - 'ap-southeast-1' => 'cdn.aliyuncs.com', - ], - 'yundunddos' => - [ - 'us-east-1' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-qingdao-cm9' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-inner' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'us-west-1' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-inner' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou-d' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'inner-yundun-ddos.cn-hangzhou.aliyuncs.com', - ], - 'kvstore' => - [ - 'ap-northeast-1' => 'r-kvstore.ap-northeast-1.aliyuncs.com', - ], - 'cloudapi' => - [ - 'cn-hongkong' => 'apigateway.cn-hongkong.aliyuncs.com', - 'cn-shanghai' => 'apigateway.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'apigateway.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'apigateway.cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'apigateway.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'apigateway.cn-beijing.aliyuncs.com', - 'ap-southeast-1' => 'apigateway.ap-southeast-1.aliyuncs.com', - ], - 'mts' => - [ - 'cn-hongkong' => 'mts.cn-hongkong.aliyuncs.com', - 'cn-qingdao-cm9' => 'mts.cn-qingdao.aliyuncs.com', - 'cn-shanghai' => 'mts.cn-shanghai.aliyuncs.com', - 'cn-shenzhen-inner' => 'mts.cn-shenzhen.aliyuncs.com', - 'us-west-1' => 'mts.us-west-1.aliyuncs.com', - 'cn-shanghai-inner' => 'mts.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'mts.cn-hangzhou.aliyuncs.com', - 'cn-beijing-inner' => 'mts.cn-beijing.aliyuncs.com', - 'cn-shenzhen' => 'mts.cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'mts.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'mts.cn-beijing.aliyuncs.com', - 'cn-hangzhou-d' => 'mts.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-et2-b01' => 'mts.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'mts.ap-southeast-1.aliyuncs.com', - 'cn-zhangjiakou' => 'mts.cn-zhangjiakou.aliyuncs.com', - 'ap-northeast-1' => 'mts.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'mts.eu-west-1.aliyuncs.com', - 'eu-central-1' => 'mts.eu-central-1.aliyuncs.com', - 'ap-south-1' => 'mts.ap-south-1.aliyuncs.com', - 'ap-southeast-5' => 'mts.ap-southeast-5.aliyuncs.com', - ], - 'saf' => - [ - 'cn-shanghai' => 'saf.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'saf.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'saf.cn-shenzhen.aliyuncs.com', - 'ap-southeast-1' => 'riskcontrol-share.aliyuncs.com', - 'cn-north-2-gov-1' => 'saf.cn-north-2-gov-1.aliyuncs.com', - ], - 'arms' => - [ - 'cn-shanghai' => 'arms.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'arms.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'arms.cn-shenzhen.aliyuncs.com', - 'cn-beijing' => 'arms.cn-beijing.aliyuncs.com', - 'cn-qingdao' => 'arms.cn-qingdao.aliyuncs.com', - 'cn-zhangjiakou' => 'arms.cn-zhangjiakou.aliyuncs.com', - 'cn-hongkong' => 'arms.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'arms.ap-southeast-1.aliyuncs.com', - 'ap-south-1' => 'arms.ap-south-1.aliyuncs.com', - ], - 'apigateway' => - [ - 'cn-shanghai' => 'apigateway.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'apigateway.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'apigateway.cn-shenzhen.aliyuncs.com', - 'cn-qingdao' => 'apigateway.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'apigateway.cn-beijing.aliyuncs.com', - 'ap-southeast-1' => 'apigateway.ap-southeast-1.aliyuncs.com', - 'cn-hongkong' => 'apigateway.cn-hongkong.aliyuncs.com', - 'ap-southeast-2' => 'apigateway.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'apigateway.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'apigateway.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'apigateway.ap-northeast-1.aliyuncs.com', - 'eu-central-1' => 'apigateway.eu-central-1.aliyuncs.com', - 'ap-south-1' => 'apigateway.ap-south-1.aliyuncs.com', - 'eu-west-1' => 'apigateway.eu-west-1.aliyuncs.com', - 'me-east-1' => 'apigateway.me-east-1.aliyuncs.com', - 'us-east-1' => 'apigateway.us-east-1.aliyuncs.com', - 'us-west-1' => 'apigateway.us-west-1.aliyuncs.com', - 'cn-zhangjiakou' => 'apigateway.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'apigateway.cn-huhehaote.aliyuncs.com', - 'cn-chengdu' => 'apigateway.cn-chengdu.aliyuncs.com', - 'cn-north-2-gov-1' => 'apigateway.cn-north-2-gov-1.aliyuncs.com', - ], - 'vod' => - [ - 'cn-shanghai' => 'vod.cn-shanghai.aliyuncs.com', - 'cn-beijing' => 'vod.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'vod.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'vod.cn-shanghai.aliyuncs.com', - 'ap-southeast-1' => 'vod.ap-southeast-1.aliyuncs.com', - 'eu-central-1' => 'vod.eu-central-1.aliyuncs.com', - 'cn-zhangjiakou' => 'vod.cn-zhangjiakou.aliyuncs.com', - 'cn-hongkong' => 'vod.cn-hongkong.aliyuncs.com', - 'ap-southeast-5' => 'vod.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'vod.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'vod.eu-west-1.aliyuncs.com', - 'us-west-1' => 'vod.us-west-1.aliyuncs.com', - 'ap-south-1' => 'vod.ap-south-1.aliyuncs.com', - 'cn-north-2-gov-1' => 'vod.cn-north-2-gov-1.aliyuncs.com', - ], - 'afs' => - [ - 'cn-hangzhou' => 'afs.aliyuncs.com', - ], - 'oas' => - [ - 'cn-hangzhou' => 'cn-hangzhou.oas.aliyuncs.com', - 'cn-shenzhen' => 'cn-shenzhen.oas.aliyuncs.com', - 'cn-beijing' => 'cn-beijing.oas.aliyuncs.com', - ], - 'alikafka' => - [ - 'cn-qingdao' => 'alikafka.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'alikafka.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'alikafka.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'alikafka.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'alikafka.cn-shenzhen.aliyuncs.com', - 'cn-zhangjiakou' => 'alikafka.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'alikafka.cn-huhehaote.aliyuncs.com', - 'cn-hongkong' => 'alikafka.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'alikafka.ap-southeast-1.aliyuncs.com', - 'ap-southeast-5' => 'alikafka.ap-southeast-5.aliyuncs.com', - 'ap-south-1' => 'alikafka.ap-south-1.aliyuncs.com', - 'cn-hangzhou-finance' => 'alikafka.cn-hangzhou-finance.aliyuncs.com', - 'cn-shanghai-finance-1' => 'alikafka.cn-shanghai-finance-1.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'alikafka.cn-shenzhen-finance-1.aliyuncs.com', - ], - 'cbn' => - [ - 'cn-qingdao' => 'cbn.aliyuncs.com', - 'cn-beijing' => 'cbn.aliyuncs.com', - 'cn-zhangjiakou' => 'cbn.aliyuncs.com', - 'cn-huhehaote' => 'cbn.aliyuncs.com', - 'cn-hangzhou' => 'cbn.aliyuncs.com', - 'cn-shanghai' => 'cbn.aliyuncs.com', - 'cn-shenzhen' => 'cbn.aliyuncs.com', - 'cn-hongkong' => 'cbn.aliyuncs.com', - 'ap-southeast-1' => 'cbn.aliyuncs.com', - 'ap-southeast-2' => 'cbn.aliyuncs.com', - 'ap-southeast-3' => 'cbn.aliyuncs.com', - 'ap-southeast-5' => 'cbn.aliyuncs.com', - 'ap-northeast-1' => 'cbn.aliyuncs.com', - 'eu-west-1' => 'cbn.aliyuncs.com', - 'us-west-1' => 'cbn.aliyuncs.com', - 'us-east-1' => 'cbn.aliyuncs.com', - 'eu-central-1' => 'cbn.aliyuncs.com', - 'me-east-1' => 'cbn.aliyuncs.com', - 'ap-south-1' => 'cbn.aliyuncs.com', - 'cn-chengdu' => 'cbn.aliyuncs.com', - 'cn-shanghai-finance-1' => 'cbn.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'cbn.aliyuncs.com', - ], - 'onsvip' => - [ - 'cn-qingdao' => 'ons.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'ons.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'ons.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'ons.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'ons.cn-shenzhen.aliyuncs.com', - 'ap-southeast-1' => 'ons.ap-southeast-1.aliyuncs.com', - 'cn-hangzhou-finance' => 'ons.cn-hangzhou-finance.aliyuncs.com', - 'cn-shanghai-finance-1' => 'ons.cn-shanghai-finance.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'ons.cn-shenzhen-finance.aliyuncs.com', - ], - 'ddosbgp' => - [ - 'cn-qingdao' => 'ddosbgp.aliyuncs.com', - 'cn-beijing' => 'ddosbgp.aliyuncs.com', - 'cn-zhangjiakou' => 'ddosbgp.aliyuncs.com', - 'cn-huhehaote' => 'ddosbgp.aliyuncs.com', - 'cn-hangzhou' => 'ddosbgp.aliyuncs.com', - 'cn-shanghai' => 'ddosbgp.aliyuncs.com', - 'cn-shenzhen' => 'ddosbgp.aliyuncs.com', - 'cn-hongkong' => 'ddosbgp.cn-hongkong.aliyuncs.com', - 'us-west-1' => 'ddosbgp.us-west-1.aliyuncs.com', - 'ap-southeast-1' => 'ddosbgp.ap-southeast-1.aliyuncs.com', - 'us-east-1' => 'ddosbgp.us-east-1.aliyuncs.com', - ], - 'ehs' => - [ - 'cn-qingdao' => 'ehpc.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'ehpc.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'ehpc.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'ehpc.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'ehpc.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'ehpc.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'ehpc.cn-shenzhen.aliyuncs.com', - 'cn-hongkong' => 'ehpc.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'ehpc.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'ehpc.ap-southeast-2.aliyuncs.com', - 'eu-central-1' => 'ehpc.eu-central-1.aliyuncs.com', - 'ap-northeast-1' => 'ehpc.ap-northeast-1.aliyuncs.com', - ], - 'redisa' => - [ - 'cn-qingdao' => 'r-kvstore.aliyuncs.com', - 'cn-beijing' => 'r-kvstore.aliyuncs.com', - 'cn-zhangjiakou' => 'r-kvstore.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'r-kvstore.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'r-kvstore.aliyuncs.com', - 'cn-shanghai' => 'r-kvstore.aliyuncs.com', - 'cn-shenzhen' => 'r-kvstore.aliyuncs.com', - 'cn-hongkong' => 'r-kvstore.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'r-kvstore.aliyuncs.com', - 'ap-southeast-2' => 'r-kvstore.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'r-kvstore.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'r-kvstore.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'r-kvstore.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'r-kvstore.eu-west-1.aliyuncs.com', - 'us-west-1' => 'r-kvstore.aliyuncs.com', - 'us-east-1' => 'r-kvstore.aliyuncs.com', - 'eu-central-1' => 'r-kvstore.eu-central-1.aliyuncs.com', - 'me-east-1' => 'r-kvstore.me-east-1.aliyuncs.com', - 'ap-south-1' => 'r-kvstore.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'r-kvstore.cn-chengdu.aliyuncs.com', - 'cn-hangzhou-finance' => 'r-kvstore.aliyuncs.com', - 'cn-shanghai-finance-1' => 'r-kvstore.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'r-kvstore.aliyuncs.com', - 'cn-north-2-gov-1' => 'r-kvstore.aliyuncs.com', - ], - 'nas' => - [ - 'cn-qingdao' => 'nas.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'nas.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'nas.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'nas.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'nas.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'nas.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'nas.cn-shenzhen.aliyuncs.com', - 'cn-hongkong' => 'nas.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'nas.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'nas.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'nas.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'nas.ap-southeast-5.aliyuncs.com', - 'us-east-1' => 'nas.us-east-1.aliyuncs.com', - 'eu-central-1' => 'nas.eu-central-1.aliyuncs.com', - 'ap-south-1' => 'nas.ap-south-1.aliyuncs.com', - 'ap-northeast-1' => 'nas.ap-northeast-1.aliyuncs.com', - 'us-west-1' => 'nas.us-west-1.aliyuncs.com', - 'cn-shanghai-finance-1' => 'nas.cn-shanghai-finance-1.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'nas.cn-shenzhen-finance-1.aliyuncs.com', - 'cn-north-2-gov-1' => 'nas.cn-north-2-gov-1.aliyuncs.com', - ], - 'hbase' => - [ - 'cn-qingdao' => 'hbase.aliyuncs.com', - 'cn-beijing' => 'hbase.aliyuncs.com', - 'cn-huhehaote' => 'hbase.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'hbase.aliyuncs.com', - 'cn-shanghai' => 'hbase.aliyuncs.com', - 'cn-shenzhen' => 'hbase.aliyuncs.com', - 'ap-southeast-1' => 'hbase.aliyuncs.com', - 'ap-southeast-2' => 'hbase.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'hbase.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'hbase.ap-southeast-5.aliyuncs.com', - 'us-west-1' => 'hbase.aliyuncs.com', - 'us-east-1' => 'hbase.aliyuncs.com', - 'eu-central-1' => 'hbase.eu-central-1.aliyuncs.com', - 'me-east-1' => 'hbase.me-east-1.aliyuncs.com', - 'ap-south-1' => 'hbase.ap-south-1.aliyuncs.com', - 'eu-west-1' => 'hbase.eu-west-1.aliyuncs.com', - 'cn-hangzhou-finance' => 'hbase.aliyuncs.com', - 'cn-shanghai-finance-1' => 'hbase.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'hbase.aliyuncs.com', - 'cn-north-2-gov-1' => 'hbase.aliyuncs.com', - ], - 'ddosbasic' => - [ - 'cn-qingdao' => 'antiddos.aliyuncs.com', - 'cn-beijing' => 'antiddos.aliyuncs.com', - 'cn-zhangjiakou' => 'antiddos-openapi.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'antiddos-openapi.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'antiddos.aliyuncs.com', - 'cn-shanghai' => 'antiddos.aliyuncs.com', - 'cn-shenzhen' => 'antiddos.aliyuncs.com', - 'cn-hongkong' => 'antiddos.aliyuncs.com', - 'ap-southeast-1' => 'antiddos.aliyuncs.com', - 'ap-southeast-2' => 'antiddos-openapi.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'antiddos-openapi.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'antiddos-openapi.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'antiddos-openapi.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'antiddos-openapi.eu-west-1.aliyuncs.com', - 'us-west-1' => 'antiddos.aliyuncs.com', - 'us-east-1' => 'antiddos.aliyuncs.com', - 'eu-central-1' => 'antiddos-openapi.eu-central-1.aliyuncs.com', - 'me-east-1' => 'antiddos-openapi.me-east-1.aliyuncs.com', - 'ap-south-1' => 'antiddos-openapi.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'antiddos-openapi.cn-chengdu.aliyuncs.com', - 'cn-shanghai-finance-1' => 'antiddos.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'antiddos.aliyuncs.com', - 'cn-north-2-gov-1' => 'antiddos.aliyuncs.com', - ], - 'polardb' => - [ - 'cn-qingdao' => 'polardb.aliyuncs.com', - 'cn-beijing' => 'polardb.aliyuncs.com', - 'cn-huhehaote' => 'polardb.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'polardb.aliyuncs.com', - 'cn-shanghai' => 'polardb.aliyuncs.com', - 'cn-shenzhen' => 'polardb.aliyuncs.com', - 'cn-hongkong' => 'polardb.aliyuncs.com', - 'cn-zhangjiakou' => 'polardb.cn-zhangjiakou.aliyuncs.com', - 'ap-southeast-1' => 'polardb.aliyuncs.com', - 'ap-southeast-3' => 'polardb.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'polardb.ap-southeast-5.aliyuncs.com', - 'us-west-1' => 'polardb.aliyuncs.com', - 'cn-hangzhou-finance' => 'polardb.aliyuncs.com', - 'cn-shanghai-finance-1' => 'polardb.aliyuncs.com', - ], - 'actiontrail' => - [ - 'cn-qingdao' => 'actiontrail.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'actiontrail.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'actiontrail.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'actiontrail.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'actiontrail.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'actiontrail.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'actiontrail.cn-shenzhen.aliyuncs.com', - 'cn-hongkong' => 'actiontrail.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'actiontrail.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'actiontrail.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'actiontrail.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'actiontrail.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'actiontrail.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'actiontrail.eu-west-1.aliyuncs.com', - 'us-west-1' => 'actiontrail.us-west-1.aliyuncs.com', - 'us-east-1' => 'actiontrail.us-east-1.aliyuncs.com', - 'eu-central-1' => 'actiontrail.eu-central-1.aliyuncs.com', - 'me-east-1' => 'actiontrail.me-east-1.aliyuncs.com', - 'ap-south-1' => 'actiontrail.ap-south-1.aliyuncs.com', - 'cn-chengdu' => 'actiontrail.cn-chengdu.aliyuncs.com', - 'cn-shanghai-finance-1' => 'actiontrail.cn-shanghai-finance-1.aliyuncs.com', - 'cn-north-2-gov-1' => 'actiontrail.cn-north-2-gov-1.aliyuncs.com', - ], - 'codepipeline' => - [ - 'cn-beijing' => 'cds.cn-beijing.aliyuncs.com', - ], - 'hcs_sgw' => - [ - 'cn-beijing' => 'sgw.cn-shanghai.aliyuncs.com', - 'cn-zhangjiakou' => 'sgw.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'sgw.cn-shanghai.aliyuncs.com', - 'cn-shanghai' => 'sgw.cn-shanghai.aliyuncs.com', - 'cn-hongkong' => 'sgw.cn-shanghai.aliyuncs.com', - 'ap-southeast-1' => 'sgw.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'sgw.ap-southeast-2.aliyuncs.com', - 'eu-central-1' => 'sgw.eu-central-1.aliyuncs.com', - 'cn-qingdao' => 'sgw.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'sgw.cn-shanghai.aliyuncs.com', - 'cn-huhehaote' => 'sgw.cn-shanghai.aliyuncs.com', - ], - 'openanalytics' => - [ - 'cn-beijing' => 'openanalytics.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'openanalytics.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou' => 'openanalytics.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'openanalytics.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'openanalytics.cn-shenzhen.aliyuncs.com', - 'ap-southeast-1' => 'openanalytics.ap-southeast-1.aliyuncs.com', - 'ap-southeast-3' => 'openanalytics.ap-southeast-3.aliyuncs.com', - 'eu-west-1' => 'openanalytics.eu-west-1.aliyuncs.com', - 'cn-hongkong' => 'openanalytics.cn-hongkong.aliyuncs.com', - 'us-west-1' => 'openanalytics.us-west-1.aliyuncs.com', - 'ap-southeast-2' => 'datalakeanalytics.ap-southeast-2.aliyuncs.com', - 'ap-northeast-1' => 'datalakeanalytics.ap-northeast-1.aliyuncs.com', - 'us-east-1' => 'datalakeanalytics.us-east-1.aliyuncs.com', - 'eu-central-1' => 'datalakeanalytics.eu-central-1.aliyuncs.com', - ], - 'clouddesktop' => - [ - 'cn-beijing' => 'clouddesktop.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'clouddesktop.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'clouddesktop.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'clouddesktop.cn-shenzhen.aliyuncs.com', - ], - 'ivision' => - [ - 'cn-beijing' => 'ivision.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'ivision.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'ivision.cn-shanghai.aliyuncs.com', - ], - 'fc' => - [ - 'cn-beijing' => 'cn-beijing.fc.aliyuncs.com', - 'cn-hangzhou' => 'cn-hangzhou.fc.aliyuncs.com', - 'cn-shanghai' => 'cn-shanghai.fc.aliyuncs.com', - 'cn-shenzhen' => 'cn-shenzhen.fc.aliyuncs.com', - 'ap-southeast-2' => 'ap-southeast-2.fc.aliyuncs.com', - 'cn-huhehaote' => 'cn-huhehaote.fc.aliyuncs.com', - ], - 'hsm' => - [ - 'cn-beijing' => 'hsm.aliyuncs.com', - 'cn-hangzhou' => 'hsm.aliyuncs.com', - 'cn-shanghai' => 'hsm.aliyuncs.com', - 'cn-shenzhen' => 'hsm.aliyuncs.com', - 'cn-hongkong' => 'hsm.aliyuncs.com', - 'ap-southeast-1' => 'hsm.aliyuncs.com', - 'cn-shanghai-finance-1' => 'hsm.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'hsm.aliyuncs.com', - ], - 'petadata' => - [ - 'cn-beijing' => 'petadata.aliyuncs.com', - 'cn-zhangjiakou' => 'petadata.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'petadata.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'petadata.aliyuncs.com', - 'cn-shanghai' => 'petadata.aliyuncs.com', - 'cn-shenzhen' => 'petadata.aliyuncs.com', - 'ap-southeast-1' => 'petadata.aliyuncs.com', - 'ap-southeast-2' => 'petadata.ap-southeast-2.aliyuncs.com', - 'ap-southeast-5' => 'petadata.ap-southeast-5.aliyuncs.com', - 'us-west-1' => 'petadata.aliyuncs.com', - 'us-east-1' => 'petadata.aliyuncs.com', - 'eu-central-1' => 'petadata.eu-central-1.aliyuncs.com', - 'me-east-1' => 'petadata.me-east-1.aliyuncs.com', - 'cn-hongkong' => 'petadata.aliyuncs.com', - 'cn-qingdao' => 'petadata.aliyuncs.com', - ], - 'gpdb' => - [ - 'cn-beijing' => 'gpdb.aliyuncs.com', - 'cn-zhangjiakou' => 'gpdb.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'gpdb.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'gpdb.aliyuncs.com', - 'cn-shanghai' => 'gpdb.aliyuncs.com', - 'cn-shenzhen' => 'gpdb.aliyuncs.com', - 'ap-southeast-1' => 'gpdb.aliyuncs.com', - 'ap-southeast-2' => 'gpdb.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'gpdb.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'gpdb.ap-southeast-5.aliyuncs.com', - 'eu-west-1' => 'gpdb.eu-west-1.aliyuncs.com', - 'us-west-1' => 'gpdb.aliyuncs.com', - 'us-east-1' => 'gpdb.aliyuncs.com', - 'eu-central-1' => 'gpdb.eu-central-1.aliyuncs.com', - 'ap-south-1' => 'gpdb.ap-south-1.aliyuncs.com', - 'ap-northeast-1' => 'gpdb.ap-northeast-1.aliyuncs.com', - 'cn-hongkong' => 'gpdb.aliyuncs.com', - 'cn-chengdu' => 'gpdb.cn-chengdu.aliyuncs.com', - 'cn-hangzhou-finance' => 'gpdb.aliyuncs.com', - 'cn-shanghai-finance-1' => 'gpdb.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'gpdb.aliyuncs.com', - ], - 'eci' => - [ - 'cn-beijing' => 'eci.aliyuncs.com', - 'cn-hangzhou' => 'eci.aliyuncs.com', - 'cn-shanghai' => 'eci.aliyuncs.com', - 'cn-shenzhen' => 'eci.aliyuncs.com', - 'ap-southeast-1' => 'eci.aliyuncs.com', - 'us-west-1' => 'eci.aliyuncs.com', - 'cn-hongkong' => 'eci.aliyuncs.com', - 'cn-zhangjiakou' => 'eci.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'eci.cn-huhehaote.aliyuncs.com', - 'ap-southeast-2' => 'eci.ap-southeast-2.aliyuncs.com', - 'eu-west-1' => 'eci.eu-west-1.aliyuncs.com', - 'us-east-1' => 'eci.aliyuncs.com', - 'eu-central-1' => 'eci.eu-central-1.aliyuncs.com', - 'cn-chengdu' => 'eci.cn-chengdu.aliyuncs.com', - ], - 'airec' => - [ - 'cn-beijing' => 'airec.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'airec.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'airec.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'airec.cn-shenzhen.aliyuncs.com', - ], - 'imm' => - [ - 'cn-beijing' => 'imm.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'imm.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou' => 'imm.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'imm.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'imm.cn-shenzhen.aliyuncs.com', - 'ap-southeast-1' => 'imm.ap-southeast-1.aliyuncs.com', - ], - 'gameshield' => - [ - 'cn-zhangjiakou' => 'gameshield.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou' => 'gameshield.aliyuncs.com', - ], - 'ims' => - [ - 'cn-hangzhou' => 'ims.aliyuncs.com', - ], - 'cloudfirewall' => - [ - 'cn-hangzhou' => 'cloudfw.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'cloudfw.ap-southeast-1.aliyuncs.com', - ], - 'ens' => - [ - 'cn-hangzhou' => 'ens.aliyuncs.com', - 'ap-southeast-1' => 'ens.ap-southeast-1.aliyuncs.com', - ], - 'hitsdb' => - [ - 'cn-hangzhou' => 'hitsdb.aliyuncs.com', - ], - 'ddos' => - [ - 'cn-hangzhou' => 'ddospro.cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'ddospro.cn-hongkong.aliyuncs.com', - ], - 'rtc' => - [ - 'cn-hangzhou' => 'rtc.aliyuncs.com', - ], - 'emas' => - [ - 'cn-hangzhou' => 'mhub.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'mhub.cn-shanghai.aliyuncs.com', - ], - 'vipaegis' => - [ - 'cn-hangzhou' => 'aegis.cn-hangzhou.aliyuncs.com', - 'ap-southeast-3' => 'aegis.ap-southeast-3.aliyuncs.com', - ], - 'ddosrewards' => - [ - 'cn-hangzhou' => 'ddosright.cn-hangzhou.aliyuncs.com', - ], - 'cloudap' => - [ - 'cn-hangzhou' => 'cloudwf.aliyuncs.com', - ], - 'ensdisk' => - [ - 'cn-hangzhou' => 'ens.aliyuncs.com', - ], - 'bastionhost' => - [ - 'cn-hangzhou' => 'yundun-bastionhost.aliyuncs.com', - ], - 'pvtz' => - [ - 'cn-hangzhou' => 'pvtz.aliyuncs.com', - ], - 'ccs' => - [ - 'cn-hangzhou' => 'ccs.aliyuncs.com', - ], - 'yunmarket' => - [ - 'cn-hangzhou' => 'market.aliyuncs.com', - ], - 'cas' => - [ - 'cn-hangzhou' => 'cas.aliyuncs.com', - 'ap-southeast-2' => 'cas.ap-southeast-2.aliyuncs.com', - 'ap-northeast-1' => 'cas.ap-northeast-1.aliyuncs.com', - 'eu-central-1' => 'cas.eu-central-1.aliyuncs.com', - 'me-east-1' => 'cas.me-east-1.aliyuncs.com', - 'ap-south-1' => 'cas.ap-south-1.aliyuncs.com', - ], - 'ddoscoo' => - [ - 'cn-hangzhou' => 'ddoscoo.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'ddoscoo.ap-southeast-1.aliyuncs.com', - ], - 'waf' => - [ - 'cn-hangzhou' => 'wafopenapi.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'wafopenapi.ap-southeast-1.aliyuncs.com', - ], - 'xianzhi' => - [ - 'cn-hangzhou' => 'xianzhi.aliyuncs.com', - ], - 'sas' => - [ - 'cn-hangzhou' => 'sas.aliyuncs.com', - ], - 'cloudauth' => - [ - 'cn-hangzhou' => 'cloudauth.aliyuncs.com', - ], - 'dmsenterprise' => - [ - 'cn-hangzhou' => 'dms-enterprise.aliyuncs.com', - 'cn-shanghai' => 'dms-enterprise.aliyuncs.com', - 'cn-shenzhen' => 'dms-enterprise.aliyuncs.com', - 'cn-beijing' => 'dms-enterprise.aliyuncs.com', - 'cn-qingdao' => 'dms-enterprise.aliyuncs.com', - 'ap-northeast-1' => 'dms-enterprise.aliyuncs.com', - ], - 'baas' => - [ - 'cn-hangzhou' => 'baas.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'baas.ap-southeast-1.aliyuncs.com', - 'ap-northeast-1' => 'baas.ap-northeast-1.aliyuncs.com', - 'cn-beijing' => 'baas.aliyuncs.com', - 'cn-shanghai' => 'baas.aliyuncs.com', - 'cn-shenzhen' => 'baas.aliyuncs.com', - 'cn-hongkong' => 'baas.cn-hongkong.aliyuncs.com', - 'ap-southeast-2' => 'baas.ap-southeast-2.aliyuncs.com', - 'us-east-1' => 'baas.us-east-1.aliyuncs.com', - 'eu-central-1' => 'baas.aliyuncs.com', - 'cn-qingdao' => 'baas.aliyuncs.com', - 'cn-zhangjiakou' => 'baas.aliyuncs.com', - 'cn-huhehaote' => 'baas.aliyuncs.com', - 'eu-west-1' => 'baas.eu-west-1.aliyuncs.com', - 'us-west-1' => 'baas.aliyuncs.com', - 'ap-south-1' => 'baas.aliyuncs.com', - 'cn-north-2-gov-1' => 'baas.cn-north-2-gov-1.aliyuncs.com', - ], - 'alimt' => - [ - 'cn-hangzhou' => 'mt.cn-hangzhou.aliyuncs.com', - ], - 'dcdn' => - [ - 'cn-hangzhou' => 'dcdn.aliyuncs.com', - ], - 'hcs_mgw' => - [ - 'cn-hangzhou' => 'mgw.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'mgw.cn-shanghai.aliyuncs.com', - 'ap-southeast-1' => 'mgw.ap-southeast-1.aliyuncs.com', - ], - 'linkedmall' => - [ - 'cn-hangzhou' => 'linkedmall.aliyuncs.com', - 'cn-shanghai' => 'linkedmall.aliyuncs.com', - ], - 'cps' => - [ - 'cn-hangzhou' => 'cloudpush.aliyuncs.com', - ], - 'scdn' => - [ - 'cn-hangzhou' => 'scdn.aliyuncs.com', - ], - 'trademark' => - [ - 'cn-hangzhou' => 'trademark.aliyuncs.com', - ], - 'elasticsearch' => - [ - 'cn-hangzhou' => 'elasticsearch.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'elasticsearch.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'elasticsearch.cn-shenzhen.aliyuncs.com', - 'cn-hongkong' => 'elasticsearch.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'elasticsearch.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'elasticsearch.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'elasticsearch.ap-southeast-3.aliyuncs.com', - 'ap-northeast-1' => 'elasticsearch.ap-northeast-1.aliyuncs.com', - 'us-west-1' => 'elasticsearch.us-west-1.aliyuncs.com', - 'eu-central-1' => 'elasticsearch.eu-central-1.aliyuncs.com', - 'ap-south-1' => 'elasticsearch.ap-south-1.aliyuncs.com', - 'cn-qingdao' => 'elasticsearch.cn-qingdao.aliyuncs.com', - 'ap-southeast-5' => 'elasticsearch.ap-southeast-5.aliyuncs.com', - 'cn-beijing' => 'elasticsearch.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'elasticsearch.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou-finance' => 'elasticsearch.cn-hangzhou-finance.aliyuncs.com', - 'cn-shanghai-finance-1' => 'elasticsearch.cn-shanghai-finance-1.aliyuncs.com', - ], - 'luban' => - [ - 'cn-hangzhou' => 'luban.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'luban.cn-shanghai.aliyuncs.com', - ], - 'pcdn' => - [ - 'cn-hangzhou' => 'pcdn.aliyuncs.com', - ], - 'uis' => - [ - 'cn-hangzhou' => 'uis.cn-hangzhou.aliyuncs.com', - 'cn-north-2-gov-1' => 'uis.cn-hangzhou.aliyuncs.com', - ], - 'beebot' => - [ - 'cn-hangzhou' => 'chatbot.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'chatbot.cn-shanghai.aliyuncs.com', - ], - 'chatbot' => - [ - 'global' => 'chatbot.cn-shanghai.aliyuncs.com', - 'cn-shanghai' => 'chatbot.cn-shanghai.aliyuncs.com', - ], - 'alidnsgtm' => - [ - 'cn-hangzhou' => 'alidns.aliyuncs.com', - ], - 'sca' => - [ - 'cn-hangzhou' => 'qualitycheck.cn-hangzhou.aliyuncs.com', - ], - 'cccvn' => - [ - 'cn-shanghai' => 'voicenavigator.cn-shanghai.aliyuncs.com', - ], - 'cloudphoto' => - [ - 'cn-shanghai' => 'cloudphoto.cn-shanghai.aliyuncs.com', - ], - 'smartag' => - [ - 'cn-shanghai' => 'smartag.cn-shanghai.aliyuncs.com', - 'cn-hongkong' => 'smartag.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'smartag.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'smartag.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'smartag.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'smartag.ap-southeast-5.aliyuncs.com', - 'eu-central-1' => 'smartag.eu-central-1.aliyuncs.com', - 'ap-northeast-1' => 'smartag.ap-northeast-1.aliyuncs.com', - 'cn-shanghai-finance-1' => 'smartag.cn-shanghai-finance-1.aliyuncs.com', - ], - 'nlp' => - [ - 'cn-shanghai' => 'nlp.cn-shanghai.aliyuncs.com', - ], - 'nls-cloud-meta' => - [ - 'cn-shanghai' => 'nls-meta.cn-shanghai.aliyuncs.com', - ], - 'nls-filetrans' => - [ - 'cn-shanghai' => 'filetrans.cn-shanghai.aliyuncs.com', - ], - 'linkwan' => - [ - 'cn-shanghai' => 'linkwan.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'linkwan.cn-hangzhou.aliyuncs.com', - ], - 'hdm' => - [ - 'cn-shanghai' => 'hdm-api.aliyuncs.com', - ], - 'iovcc' => - [ - 'cn-shanghai' => 'iovcc.cn-shanghai.aliyuncs.com', - ], - 'ddosdip' => - [ - 'ap-southeast-1' => 'ddosdip.ap-southeast-1.aliyuncs.com', - ], - 'imagesearch' => - [ - 'ap-southeast-1' => 'imagesearch.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'imagesearch.ap-southeast-2.aliyuncs.com', - 'ap-northeast-1' => 'imagesearch.ap-northeast-1.aliyuncs.com', - 'cn-shanghai' => 'imagesearch.cn-shanghai.aliyuncs.com', - ], - 'alidfs' => - [ - 'cn-beijing' => 'dfs.cn-beijing.aliyuncs.com', - 'cn-shanghai' => 'dfs.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'dfs.cn-hangzhou.aliyuncs.com', - 'cn-zhangjiakou' => 'dfs.cn-zhangjiakou.aliyuncs.com', - ], - 'vs' => - [ - 'cn-hangzhou' => 'vs.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'vs.cn-shanghai.aliyuncs.com', - 'cn-qingdao' => 'vs.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'vs.cn-beijing.aliyuncs.com', - 'cn-shenzhen' => 'vs.cn-shenzhen.aliyuncs.com', - ], - 'foas' => - [ - 'cn-qingdao' => 'foas.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'foas.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'foas.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou' => 'foas.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'foas.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'foas.cn-shenzhen.aliyuncs.com', - 'ap-northeast-1' => 'foas.ap-northeast-1.aliyuncs.com', - 'ap-southeast-1' => 'foas.ap-southeast-1.aliyuncs.com', - 'ap-southeast-3' => 'foas.ap-southeast-3.aliyuncs.com', - 'cn-hangzhou-finance' => 'foas.cn-hangzhou-finance.aliyuncs.com', - 'cn-shanghai-finance-1' => 'foas.cn-shanghai-finance-1.aliyuncs.com', - 'cn-north-2-gov-1' => 'foas.cn-north-2-gov-1.aliyuncs.com', - ], - 'iotid' => - [ - 'cn-hangzhou' => 'iotid.cn-hangzhou.aliyuncs.com', - ], - 'drdspost' => - [ - 'ap-southeast-1' => 'drds.ap-southeast-1.aliyuncs.com', - 'cn-shanghai' => 'drds.cn-shanghai.aliyuncs.com', - 'cn-hongkong' => 'drds.cn-hangzhou.aliyuncs.com', - 'cn-huhehaote' => 'drds.cn-huhehaote.aliyuncs.com', - 'us-east-1' => 'drds.us-east-1.aliyuncs.com', - ], - 'drdspre' => - [ - 'cn-qingdao' => 'drds.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'drds.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'drds.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'drds.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'drds.cn-shenzhen.aliyuncs.com', - 'cn-hongkong' => 'drds.cn-hangzhou.aliyuncs.com', - 'cn-huhehaote' => 'drds.cn-huhehaote.aliyuncs.com', - 'us-east-1' => 'drds.us-east-1.aliyuncs.com', - ], - 'acr' => - [ - 'cn-qingdao' => 'cr.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'cr.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'cr.cn-zhangjiakou.aliyuncs.com', - 'cn-huhehaote' => 'cr.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'cr.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'cr.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'cr.cn-shenzhen.aliyuncs.com', - 'cn-hongkong' => 'cr.cn-hongkong.aliyuncs.com', - 'ap-southeast-1' => 'cr.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'cr.ap-southeast-2.aliyuncs.com', - 'ap-southeast-3' => 'cr.ap-southeast-3.aliyuncs.com', - 'ap-southeast-5' => 'cr.ap-southeast-5.aliyuncs.com', - 'ap-northeast-1' => 'cr.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'cr.eu-west-1.aliyuncs.com', - 'us-west-1' => 'cr.us-west-1.aliyuncs.com', - 'us-east-1' => 'cr.us-east-1.aliyuncs.com', - 'eu-central-1' => 'cr.eu-central-1.aliyuncs.com', - 'me-east-1' => 'cr.me-east-1.aliyuncs.com', - 'ap-south-1' => 'cr.ap-south-1.aliyuncs.com', - 'cn-hangzhou-finance' => 'cr.cn-hangzhou-finance.aliyuncs.com', - 'cn-shanghai-finance-1' => 'cr.cn-shanghai-finance-1.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'cr.cn-shenzhen-finance-1.aliyuncs.com', - 'cn-north-2-gov-1' => 'cr.cn-north-2-gov-1.aliyuncs.com', - ], - 'faas' => - [ - 'cn-beijing' => 'faas.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'faas.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou' => 'faas.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'faas.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'faas.cn-shenzhen.aliyuncs.com', - 'ap-southeast-5' => 'faas.ap-southeast-5.aliyuncs.com', - ], - 'idaas' => - [ - 'cn-hangzhou' => 'idaas.aliyuncs.com', - 'cn-qingdao' => 'idaas.aliyuncs.com', - 'cn-beijing' => 'idaas.aliyuncs.com', - 'cn-chengdu' => 'idaas.aliyuncs.com', - 'cn-zhangjiakou' => 'idaas.aliyuncs.com', - 'cn-huhehaote' => 'idaas.aliyuncs.com', - 'cn-shanghai' => 'idaas.aliyuncs.com', - 'cn-shenzhen' => 'idaas.aliyuncs.com', - 'cn-hongkong' => 'idaas.aliyuncs.com', - ], - 'privatelink' => - [ - 'cn-hangzhou' => 'privatelink.cn-hangzhou.aliyuncs.com', - 'cn-huhehaote' => 'privatelink.cn-huhehaote.aliyuncs.com', - 'eu-west-1' => 'privatelink.eu-west-1.aliyuncs.com', - ], - 'batchcomputenew' => - [ - 'cn-hongkong' => 'batchcompute.cn-hongkong.aliyuncs.com', - ], - 'vcs' => - [ - 'cn-hangzhou' => 'vcs.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'vcs.cn-shanghai.aliyuncs.com', - ], - 'vds' => - [ - 'cn-hangzhou' => 'vds.aliyuncs.com', - 'cn-shanghai' => 'vds.cn-shanghai.aliyuncs.com', - ], - 'vcsbasic' => - [ - 'cn-hangzhou' => 'vcsbasic.aliyuncs.com', - 'cn-shanghai' => 'vcs.cn-shanghai.aliyuncs.com', - ], - 'hbr' => - [ - 'cn-qingdao' => 'hbr.cn-shanghai.aliyuncs.com', - 'cn-beijing' => 'hbr.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'hbr.cn-shanghai.aliyuncs.com', - 'cn-huhehaote' => 'hbr.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'hbr.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'hbr.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'hbr.cn-shenzhen.aliyuncs.com', - 'ap-southeast-1' => 'hbr.ap-southeast-1.aliyuncs.com', - 'ap-southeast-2' => 'hbr.ap-southeast-2.aliyuncs.com', - ], - 'image' => - [ - 'cn-shanghai' => 'image.cn-shanghai.aliyuncs.com', - ], - 'webx' => - [ - 'cn-shenzhen' => 'webplus.cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'webplus.cn-hangzhou.aliyuncs.com', - 'cn-zhangjiakou' => 'webplus.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'webplus.cn-hangzhou.aliyuncs.com', - 'cn-hangzhou' => 'webplus.cn-hangzhou.aliyuncs.com', - ], - 'sddp' => - [ - 'cn-zhangjiakou' => 'sddp.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou' => 'sddp.cn-hangzhou.aliyuncs.com', - ], - 'oos' => - [ - 'cn-hangzhou' => 'oos.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'oos.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'oos.cn-shenzhen.aliyuncs.com', - 'cn-hongkong' => 'oos.cn-hongkong.aliyuncs.com', - 'us-east-1' => 'oos.us-east-1.aliyuncs.com', - 'cn-beijing' => 'oos.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'oos.cn-zhangjakou.aliyuncs.com', - 'cn-huhehaote' => 'oos.cn-huhehaote.aliyuncs.com', - 'eu-west-1' => 'oos.eu-west-1.aliyuncs.com', - 'eu-central-1' => 'oos.eu-central-1.aliyuncs.com', - 'ap-south-1' => 'oos.ap-south-1.aliyuncs.com', - ], - 'fnf' => - [ - 'cn-hangzhou' => 'cn-hangzhou.fnf.aliyuncs.com', - 'cn-shanghai' => 'cn-shanghai.fnf.aliyuncs.com', - 'cn-shenzhen' => 'cn-shenzhen.fnf.aliyuncs.com', - ], - 'smc' => - [ - 'cn-huhehaote' => 'smc.aliyuncs.com', - 'cn-hangzhou' => 'smc.aliyuncs.com', - 'cn-qingdao' => 'smc.aliyuncs.com', - 'cn-beijing' => 'smc.aliyuncs.com', - 'cn-zhangjiakou' => 'smc.aliyuncs.com', - 'cn-shanghai' => 'smc.aliyuncs.com', - 'cn-shenzhen' => 'smc.aliyuncs.com', - 'cn-hongkong' => 'smc.aliyuncs.com', - 'ap-southeast-1' => 'smc.aliyuncs.com', - 'ap-southeast-2' => 'smc.aliyuncs.com', - 'ap-southeast-3' => 'smc.aliyuncs.com', - 'ap-southeast-5' => 'smc.aliyuncs.com', - 'ap-northeast-1' => 'smc.aliyuncs.com', - 'eu-west-1' => 'smc.aliyuncs.com', - 'us-west-1' => 'smc.aliyuncs.com', - 'us-east-1' => 'smc.aliyuncs.com', - 'eu-central-1' => 'smc.aliyuncs.com', - 'me-east-1' => 'smc.aliyuncs.com', - 'ap-south-1' => 'smc.aliyuncs.com', - 'cn-chengdu' => 'smc.aliyuncs.com', - ], - 'foasconsole' => - [ - 'cn-beijing' => 'foasconsole.aliyuncs.com', - 'cn-zhangjiakou' => 'foasconsole.aliyuncs.com', - 'cn-hangzhou' => 'foasconsole.aliyuncs.com', - 'cn-shanghai' => 'foasconsole.aliyuncs.com', - 'cn-shenzhen' => 'foasconsole.aliyuncs.com', - 'cn-hongkong' => 'foasconsole.aliyuncs.com', - 'ap-southeast-1' => 'foasconsole.aliyuncs.com', - 'ap-southeast-3' => 'foasconsole.aliyuncs.com', - 'ap-northeast-1' => 'foasconsole.aliyuncs.com', - 'cn-hangzhou-finance' => 'foasconsole.aliyuncs.com', - 'cn-shanghai-finance-1' => 'foasconsole.aliyuncs.com', - 'cn-north-2-gov-1' => 'foasconsole.aliyuncs.com', - ], - 'serverless' => - [ - 'cn-beijing' => 'sae.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'sae.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'sae.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'sae.cn-shenzhen.aliyuncs.com', - ], - 'ivpd' => - [ - 'cn-huhehaote' => 'ivpd.cn-huhehaote.aliyuncs.com', - 'cn-shanghai' => 'ivpd.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'ivpd.cn-hangzhou.aliyuncs.com', - ], - 'hivisengine' => - [ - 'cn-huhehaote' => 'hivisengine.aliyuncs.com', - 'cn-shanghai' => 'hivisengine.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'hivisengine.cn-hangzhou.aliyuncs.com', - ], - 'hiknoengine' => - [ - 'cn-huhehaote' => 'hiknoengine.aliyuncs.com', - 'cn-shanghai' => 'hiknoengine.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'hiknoengine.cn-hangzhou.aliyuncs.com', - ], - 'clouddev' => - [ - 'cn-hangzhou' => 'mpserverless.aliyuncs.com', - 'cn-shanghai' => 'mpserverless.aliyuncs.com', - ], - 'premiumpics' => - [ - 'cn-hangzhou' => 'premiumpics.aliyuncs.com', - ], - 'composer' => - [ - 'cn-hangzhou' => 'composer.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'composer.cn-shanghai.aliyuncs.com', - ], - 'cloudesl' => - [ - 'cn-hangzhou' => 'cloudesl.cn-hangzhou.aliyuncs.com', - ], - 'amscloudapp' => - [ - 'cn-hangzhou' => 'mpca.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'mpca.cn-shanghai.aliyuncs.com', - ], - 'mse' => - [ - 'cn-hangzhou' => 'mse.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'mse.cn-shanghai.aliyuncs.com', - ], - 'dg' => - [ - 'cn-hangzhou' => 'dg.cn-hangzhou.aliyuncs.com', - ], - 'graphcompute' => - [ - 'cn-shanghai' => 'gcs.cn-shanghai.aliyuncs.com', - ], - 'cds' => - [ - 'ap-southeast-1' => 'cassandra.aliyuncs.com', - 'cn-qingdao' => 'cassandra.aliyuncs.com', - 'cn-beijing' => 'cassandra.aliyuncs.com', - 'cn-hangzhou' => 'cassandra.aliyuncs.com', - 'cn-shanghai' => 'cassandra.aliyuncs.com', - 'cn-shenzhen' => 'cassandra.aliyuncs.com', - ], - 'ads' => - [ - 'cn-qingdao' => 'adb.aliyuncs.com', - 'cn-beijing' => 'adb.aliyuncs.com', - 'cn-zhangjiakou' => 'adb.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou' => 'adb.aliyuncs.com', - 'cn-shanghai' => 'adb.aliyuncs.com', - 'cn-shenzhen' => 'adb.aliyuncs.com', - 'cn-hongkong' => 'adb.aliyuncs.com', - 'ap-southeast-1' => 'adb.aliyuncs.com', - 'ap-northeast-1' => 'adb.ap-northeast-1.aliyuncs.com', - 'eu-west-1' => 'adb.eu-west-1.aliyuncs.com', - 'us-west-1' => 'adb.aliyuncs.com', - 'us-east-1' => 'adb.aliyuncs.com', - 'ap-southeast-2' => 'adb.ap-southeast-2.aliyuncs.com', - 'eu-central-1' => 'adb.eu-central-1.aliyuncs.com', - 'ap-south-1' => 'adb.ap-south-1.aliyuncs.com', - 'cn-north-2-gov-1' => 'adb.aliyuncs.com', - 'cn-chengdu' => 'adb.cn-chengdu.aliyuncs.com', - 'cn-huhehaote' => 'adb.cn-huhehaote.aliyuncs.com', - 'ap-southeast-3' => 'adb.ap-southeast-3.aliyuncs.com', - ], - 'csb' => - [ - 'cn-beijing' => 'csb.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'csb.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'csb.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'csb.cn-shenzhen.aliyuncs.com', - 'cn-hongkong' => 'csb.cn-hongkong.aliyuncs.com', - ], - 'cityvisual' => - [ - 'cn-hangzhou' => 'cityvisual.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'cityvisual.cn-shanghai.aliyuncs.com', - ], - 'dbaudit' => - [ - 'cn-hangzhou' => 'yundun-dbaudit.aliyuncs.com', - ], - 'bssopenapi' => - [ - 'cn-hangzhou' => 'business.aliyuncs.com', - 'cn-shanghai' => 'business.aliyuncs.com', - 'ap-southeast-1' => 'business.ap-southeast-1.aliyuncs.com', - ], - 'indvi' => - [ - 'cn-hangzhou' => 'indvi.cn-hangzhou.aliyuncs.com', - ], - 'swcopyright' => - [ - 'cn-hangzhou' => 'copyright.aliyuncs.com', - ], - 'multimediaai' => - [ - 'cn-beijing' => 'multimediaai.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'multimediaai.cn-hangzhou.aliyuncs.com', - ], - 'rsimganalys' => - [ - 'cn-hangzhou' => 'rsimganalys.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'rsimganalys.cn-shanghai.aliyuncs.com', - ], - 'tdsr' => - [ - 'cn-hangzhou' => 'lyj.cn-hangzhou.aliyuncs.com', - ], - 'eslogstash' => - [ - 'cn-qingdao' => 'elasticsearch.cn-qingdao.aliyuncs.com', - 'cn-beijing' => 'elasticsearch.cn-beijing.aliyuncs.com', - 'cn-zhangjiakou' => 'elasticsearch.cn-zhangjiakou.aliyuncs.com', - 'cn-hangzhou' => 'elasticsearch.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'elasticsearch.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'elasticsearch.cn-shenzhen.aliyuncs.com', - ], - 'vcoverimage' => - [ - 'cn-beijing' => 'vcoverimage.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'vcoverimage.cn-hangzhou.aliyuncs.com', - ], - 'ahas' => - [ - 'cn-beijing' => 'ahas.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'ahas.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'ahas.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'ahas.cn-shenzhen.aliyuncs.com', - ], - 'vstruction' => - [ - 'cn-beijing' => 'vstruction.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'vstruction.cn-hangzhou.aliyuncs.com', - ], - 'vcovergif' => - [ - 'cn-beijing' => 'vcovergif.cn-beijing.aliyuncs.com', - 'cn-hangzhou' => 'vcovergif.cn-hangzhou.aliyuncs.com', - ], - 'aiccs' => - [ - 'cn-hangzhou' => 'aiccs.aliyuncs.com', - ], - 'nls' => - [ - 'cn-shanghai' => 'nls-slp.cn-shanghai.aliyuncs.com', - ], - 'antcloudauth' => - [ - 'cn-shanghai' => 'antcloudauth.aliyuncs.com', - ], - 'prepaid_ads' => - [ - 'cn-hangzhou-finance' => 'ads.cn-hangzhou-finance.aliyuncs.com', - ], - 'hdr' => - [ - 'cn-qingdao' => 'hdr.cn-shanghai.aliyuncs.com', - 'cn-beijing' => 'hdr.cn-shanghai.aliyuncs.com', - 'cn-zhangjiakou' => 'hdr.cn-shanghai.aliyuncs.com', - 'cn-hangzhou' => 'hdr.cn-shanghai.aliyuncs.com', - 'cn-shanghai' => 'hdr.cn-shanghai.aliyuncs.com', - 'cn-shenzhen' => 'hdr.cn-shanghai.aliyuncs.com', - 'cn-hongkong' => 'hdr.cn-shanghai.aliyuncs.com', - ], - 'cbs' => - [ - 'cn-qingdao' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-beijing' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-zhangjiakou' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-huhehaote' => 'dbs-api.cn-huhehaote.aliyuncs.com', - 'cn-hangzhou' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-hongkong' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'ap-southeast-1' => 'dbs-api.ap-southeast-1.aliyuncs.com', - 'ap-northeast-1' => 'dbs-api.ap-northeast-1.aliyuncs.com', - 'cn-hangzhou-finance' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-shanghai-finance-1' => 'dbs-api.cn-hangzhou.aliyuncs.com', - 'cn-shenzhen-finance-1' => 'dbs-api.cn-hangzhou.aliyuncs.com', - ], - 'datag' => - [ - 'cn-beijing' => 'datag.cn-beijing.aliyuncs.com', - ], - 'retailir' => - [ - 'cn-hangzhou' => 'retailir.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'retailir.cn-shanghai.aliyuncs.com', - ], - 'mpaas' => - [ - 'cn-hangzhou' => 'mpaas.aliyuncs.com', - ], - 'iqa' => - [ - 'cn-hangzhou' => 'iqa.aliyuncs.com', - ], - 'sofa' => - [ - 'cn-hangzhou' => 'sofa.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'sofa.cn-shanghai.aliyuncs.com', - 'cn-hangzhou-finance' => 'sofa.cn-shanghai.aliyuncs.com', - ], - 'edas' => - [ - 'cn-hangzhou' => 'edas.cn-hangzhou.aliyuncs.com', - 'cn-shanghai' => 'edas.cn-shanghai.aliyuncs.com', - ], - 'gwsservice' => - [ - 'cn-shanghai' => 'gws.cn-shanghai.aliyuncs.com', - ], - 'gds' => - [ - 'ap-southeast-1' => 'gdb.aliyuncs.com', - ], - ], -]; diff --git a/vendor/alibabacloud/client/src/Credentials/AccessKeyCredential.php b/vendor/alibabacloud/client/src/Credentials/AccessKeyCredential.php deleted file mode 100644 index bacaecc4..00000000 --- a/vendor/alibabacloud/client/src/Credentials/AccessKeyCredential.php +++ /dev/null @@ -1,65 +0,0 @@ -accessKeyId = $accessKeyId; - $this->accessKeySecret = $accessKeySecret; - } - - /** - * @return string - */ - public function getAccessKeyId() - { - return $this->accessKeyId; - } - - /** - * @return string - */ - public function getAccessKeySecret() - { - return $this->accessKeySecret; - } - - /** - * @return string - */ - public function __toString() - { - return "$this->accessKeyId#$this->accessKeySecret"; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/BearerTokenCredential.php b/vendor/alibabacloud/client/src/Credentials/BearerTokenCredential.php deleted file mode 100644 index db69a7c2..00000000 --- a/vendor/alibabacloud/client/src/Credentials/BearerTokenCredential.php +++ /dev/null @@ -1,66 +0,0 @@ -bearerToken = $bearerToken; - } - - /** - * @return string - */ - public function getBearerToken() - { - return $this->bearerToken; - } - - /** - * @return string - */ - public function getAccessKeyId() - { - return ''; - } - - /** - * @return string - */ - public function getAccessKeySecret() - { - return ''; - } - - /** - * @return string - */ - public function __toString() - { - return "bearerToken#$this->bearerToken"; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/CredentialsInterface.php b/vendor/alibabacloud/client/src/Credentials/CredentialsInterface.php deleted file mode 100644 index 96ee50ab..00000000 --- a/vendor/alibabacloud/client/src/Credentials/CredentialsInterface.php +++ /dev/null @@ -1,18 +0,0 @@ -roleName = $roleName; - } - - /** - * @return string - */ - public function getRoleName() - { - return $this->roleName; - } - - /** - * @return string - */ - public function __toString() - { - return "roleName#$this->roleName"; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Ini/CreateTrait.php b/vendor/alibabacloud/client/src/Credentials/Ini/CreateTrait.php deleted file mode 100644 index 2ec7511c..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Ini/CreateTrait.php +++ /dev/null @@ -1,181 +0,0 @@ -missingRequired('type', $clientName); - } - - return $this->createClientByType($clientName, $credential)->name($clientName); - } - - /** - * @param string $clientName - * @param array $credential - * - * @return AccessKeyClient|BearerTokenClient|EcsRamRoleClient|RamRoleArnClient|RsaKeyPairClient - * @throws ClientException - */ - private function createClientByType($clientName, array $credential) - { - switch (\strtolower($credential['type'])) { - case 'access_key': - return $this->accessKeyClient($clientName, $credential); - case 'ecs_ram_role': - return $this->ecsRamRoleClient($clientName, $credential); - case 'ram_role_arn': - return $this->ramRoleArnClient($clientName, $credential); - case 'bearer_token': - return $this->bearerTokenClient($clientName, $credential); - case 'rsa_key_pair': - return $this->rsaKeyPairClient($clientName, $credential); - default: - throw new ClientException( - "Invalid type '{$credential['type']}' for '$clientName' in {$this->filename}", - SDK::INVALID_CREDENTIAL - ); - } - } - - /** - * @param array $credential - * @param string $clientName - * - * @return AccessKeyClient - * @throws ClientException - */ - private function accessKeyClient($clientName, array $credential) - { - if (!isset($credential['access_key_id'])) { - $this->missingRequired('access_key_id', $clientName); - } - - if (!isset($credential['access_key_secret'])) { - $this->missingRequired('access_key_secret', $clientName); - } - - return new AccessKeyClient( - $credential['access_key_id'], - $credential['access_key_secret'] - ); - } - - /** - * @param string $clientName - * @param array $credential - * - * @return EcsRamRoleClient - * @throws ClientException - */ - private function ecsRamRoleClient($clientName, array $credential) - { - if (!isset($credential['role_name'])) { - $this->missingRequired('role_name', $clientName); - } - - return new EcsRamRoleClient($credential['role_name']); - } - - /** - * @param string $clientName - * @param array $credential - * - * @return RamRoleArnClient - * @throws ClientException - */ - private function ramRoleArnClient($clientName, array $credential) - { - if (!isset($credential['access_key_id'])) { - $this->missingRequired('access_key_id', $clientName); - } - - if (!isset($credential['access_key_secret'])) { - $this->missingRequired('access_key_secret', $clientName); - } - - if (!isset($credential['role_arn'])) { - $this->missingRequired('role_arn', $clientName); - } - - if (!isset($credential['role_session_name'])) { - $this->missingRequired('role_session_name', $clientName); - } - - return new RamRoleArnClient( - $credential['access_key_id'], - $credential['access_key_secret'], - $credential['role_arn'], - $credential['role_session_name'] - ); - } - - /** - * @param string $clientName - * @param array $credential - * - * @return BearerTokenClient - * @throws ClientException - */ - private function bearerTokenClient($clientName, array $credential) - { - if (!isset($credential['bearer_token'])) { - $this->missingRequired('bearer_token', $clientName); - } - - return new BearerTokenClient($credential['bearer_token']); - } - - /** - * @param array $credential - * @param string $clientName - * - * @return RsaKeyPairClient - * @throws ClientException - */ - private function rsaKeyPairClient($clientName, array $credential) - { - if (!isset($credential['public_key_id'])) { - $this->missingRequired('public_key_id', $clientName); - } - - if (!isset($credential['private_key_file'])) { - $this->missingRequired('private_key_file', $clientName); - } - - return new RsaKeyPairClient( - $credential['public_key_id'], - $credential['private_key_file'] - ); - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Ini/IniCredential.php b/vendor/alibabacloud/client/src/Credentials/Ini/IniCredential.php deleted file mode 100644 index 94ec7fbd..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Ini/IniCredential.php +++ /dev/null @@ -1,209 +0,0 @@ -filename = $filename ?: $this->getDefaultFile(); - } - - /** - * Get the default credential file. - * - * @return string - */ - public function getDefaultFile() - { - return self::getHomeDirectory() . DIRECTORY_SEPARATOR . '.alibabacloud' . DIRECTORY_SEPARATOR . 'credentials'; - } - - /** - * Gets the environment's HOME directory. - * - * @return null|string - */ - private static function getHomeDirectory() - { - if (getenv('HOME')) { - return getenv('HOME'); - } - - return (getenv('HOMEDRIVE') && getenv('HOMEPATH')) - ? getenv('HOMEDRIVE') . getenv('HOMEPATH') - : null; - } - - /** - * Clear credential cache. - * - * @return void - */ - public static function forgetLoadedCredentialsFile() - { - self::$hasLoaded = []; - } - - /** - * Get the credential file. - * - * @return string - */ - public function getFilename() - { - return $this->filename; - } - - /** - * @param array $array - * @param string $key - * - * @return bool - */ - protected static function isNotEmpty(array $array, $key) - { - return isset($array[$key]) && !empty($array[$key]); - } - - /** - * @param string $key - * @param string $clientName - * - * @throws ClientException - */ - public function missingRequired($key, $clientName) - { - throw new ClientException( - "Missing required '$key' option for '$clientName' in " . $this->getFilename(), - SDK::INVALID_CREDENTIAL - ); - } - - /** - * @return array|mixed - * @throws ClientException - */ - public function load() - { - // If it has been loaded, assign the client directly. - if (isset(self::$hasLoaded[$this->filename])) { - /** - * @var $client Client - */ - foreach (self::$hasLoaded[$this->filename] as $projectName => $client) { - $client->name($projectName); - } - - return self::$hasLoaded[$this->filename]; - } - - return $this->loadFile(); - } - - /** - * Exceptions will be thrown if the file is unreadable and not the default file. - * - * @return array|mixed - * @throws ClientException - */ - private function loadFile() - { - if (!\AlibabaCloud\Client\inOpenBasedir($this->filename)) { - return []; - } - - if (!\is_readable($this->filename) || !\is_file($this->filename)) { - if ($this->filename === $this->getDefaultFile()) { - // @codeCoverageIgnoreStart - return []; - // @codeCoverageIgnoreEnd - } - throw new ClientException( - 'Credential file is not readable: ' . $this->getFilename(), - SDK::INVALID_CREDENTIAL - ); - } - - return $this->parseFile(); - } - - /** - * Decode the ini file into an array. - * - * @return array|mixed - * @throws ClientException - */ - private function parseFile() - { - try { - $file = \parse_ini_file($this->filename, true); - if (\is_array($file) && $file !== []) { - return $this->initClients($file); - } - throw new ClientException( - 'Format error: ' . $this->getFilename(), - SDK::INVALID_CREDENTIAL - ); - } catch (\Exception $e) { - throw new ClientException( - $e->getMessage(), - SDK::INVALID_CREDENTIAL, - $e - ); - } - } - - /** - * Initialize clients. - * - * @param array $array - * - * @return array|mixed - * @throws ClientException - */ - private function initClients($array) - { - foreach (\array_change_key_case($array) as $clientName => $configures) { - $configures = \array_change_key_case($configures); - $clientInstance = $this->createClient($clientName, $configures); - if ($clientInstance instanceof Client) { - self::$hasLoaded[$this->filename][$clientName] = $clientInstance; - self::setClientAttributes($configures, $clientInstance); - self::setCert($configures, $clientInstance); - self::setProxy($configures, $clientInstance); - } - } - - return isset(self::$hasLoaded[$this->filename]) - ? self::$hasLoaded[$this->filename] - : []; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Ini/OptionsTrait.php b/vendor/alibabacloud/client/src/Credentials/Ini/OptionsTrait.php deleted file mode 100644 index 192d4940..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Ini/OptionsTrait.php +++ /dev/null @@ -1,111 +0,0 @@ -regionId($configures['region_id']); - } - - if (isset($configures['debug'])) { - $client->options( - [ - 'debug' => (bool)$configures['debug'], - ] - ); - } - - if (self::isNotEmpty($configures, 'timeout')) { - $client->options( - [ - 'timeout' => $configures['timeout'], - ] - ); - } - - if (self::isNotEmpty($configures, 'connect_timeout')) { - $client->options( - [ - 'connect_timeout' => $configures['connect_timeout'], - ] - ); - } - } - - /** - * @param array $configures - * @param Client $client - */ - private static function setProxy($configures, Client $client) - { - if (self::isNotEmpty($configures, 'proxy')) { - $client->options( - [ - 'proxy' => $configures['proxy'], - ] - ); - } - $proxy = []; - if (self::isNotEmpty($configures, 'proxy_http')) { - $proxy['http'] = $configures['proxy_http']; - } - if (self::isNotEmpty($configures, 'proxy_https')) { - $proxy['https'] = $configures['proxy_https']; - } - if (self::isNotEmpty($configures, 'proxy_no')) { - $proxy['no'] = \explode(',', $configures['proxy_no']); - } - if ($proxy !== []) { - $client->options( - [ - 'proxy' => $proxy, - ] - ); - } - } - - /** - * @param array $configures - * @param Client $client - */ - private static function setCert($configures, Client $client) - { - if (self::isNotEmpty($configures, 'cert_file') && !self::isNotEmpty($configures, 'cert_password')) { - $client->options( - [ - 'cert' => $configures['cert_file'], - ] - ); - } - - if (self::isNotEmpty($configures, 'cert_file') && self::isNotEmpty($configures, 'cert_password')) { - $client->options( - [ - 'cert' => [ - $configures['cert_file'], - $configures['cert_password'], - ], - ] - ); - } - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Providers/CredentialsProvider.php b/vendor/alibabacloud/client/src/Credentials/Providers/CredentialsProvider.php deleted file mode 100644 index 21aec9bb..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Providers/CredentialsProvider.php +++ /dev/null @@ -1,170 +0,0 @@ -asDefaultClient(); - } - }; - } - - /** - * @return Closure - */ - public static function ini() - { - return static function () { - $ini = \AlibabaCloud\Client\envNotEmpty('ALIBABA_CLOUD_CREDENTIALS_FILE'); - - if ($ini) { - AlibabaCloud::load($ini); - } else { - // @codeCoverageIgnoreStart - AlibabaCloud::load(); - // @codeCoverageIgnoreEnd - } - - self::compatibleWithGlobal(); - }; - } - - /** - * @codeCoverageIgnore - * - * Compatible with global - * - * @throws ClientException - */ - private static function compatibleWithGlobal() - { - if (AlibabaCloud::has('global') && !AlibabaCloud::has(self::getDefaultName())) { - AlibabaCloud::get('global')->name(self::getDefaultName()); - } - } - - /** - * @return array|false|string - * @throws ClientException - */ - public static function getDefaultName() - { - $name = \AlibabaCloud\Client\envNotEmpty('ALIBABA_CLOUD_PROFILE'); - - if ($name) { - return $name; - } - - return 'default'; - } - - /** - * @return Closure - */ - public static function instance() - { - return static function () { - $instance = \AlibabaCloud\Client\envNotEmpty('ALIBABA_CLOUD_ECS_METADATA'); - if ($instance) { - AlibabaCloud::ecsRamRoleClient($instance)->asDefaultClient(); - } - }; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Providers/EcsRamRoleProvider.php b/vendor/alibabacloud/client/src/Credentials/Providers/EcsRamRoleProvider.php deleted file mode 100644 index 26bb6757..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Providers/EcsRamRoleProvider.php +++ /dev/null @@ -1,128 +0,0 @@ -getCredentialsInCache(); - - if ($result === null) { - $result = $this->request(); - - if (!isset($result['AccessKeyId'], $result['AccessKeySecret'], $result['SecurityToken'])) { - throw new ServerException($result, $this->error, SDK::INVALID_CREDENTIAL); - } - - $this->cache($result->toArray()); - } - - return new StsCredential( - $result['AccessKeyId'], - $result['AccessKeySecret'], - $result['SecurityToken'] - ); - } - - /** - * Get credentials by request. - * - * @return Result - * @throws ClientException - * @throws ServerException - */ - public function request() - { - $result = $this->getResponse(); - - if ($result->getStatusCode() === 404) { - $message = 'The role was not found in the instance'; - throw new ClientException($message, SDK::INVALID_CREDENTIAL); - } - - if (!$result->isSuccess()) { - $message = 'Error retrieving credentials from result'; - throw new ServerException($result, $message, SDK::INVALID_CREDENTIAL); - } - - return $result; - } - - /** - * Get data from meta. - * - * @return mixed|ResponseInterface - * @throws ClientException - * @throws Exception - */ - public function getResponse() - { - /** - * @var EcsRamRoleCredential $credential - */ - $credential = $this->client->getCredential(); - $url = $this->uri . $credential->getRoleName(); - - $options = [ - 'http_errors' => false, - 'timeout' => 1, - 'connect_timeout' => 1, - 'debug' => $this->client->isDebug(), - ]; - - try { - return RpcRequest::createClient()->request('GET', $url, $options); - } catch (GuzzleException $exception) { - if (Stringy::create($exception->getMessage())->contains('timed')) { - $message = 'Timeout or instance does not belong to Alibaba Cloud'; - } else { - $message = $exception->getMessage(); - } - - throw new ClientException( - $message, - SDK::SERVER_UNREACHABLE, - $exception - ); - } - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Providers/Provider.php b/vendor/alibabacloud/client/src/Credentials/Providers/Provider.php deleted file mode 100644 index b64dab87..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Providers/Provider.php +++ /dev/null @@ -1,88 +0,0 @@ -client = $client; - } - - /** - * Get the credentials from the cache in the validity period. - * - * @return array|null - */ - public function getCredentialsInCache() - { - if (isset(self::$credentialsCache[$this->key()])) { - $result = self::$credentialsCache[$this->key()]; - if (\strtotime($result['Expiration']) - \time() >= $this->expirationSlot) { - return $result; - } - unset(self::$credentialsCache[$this->key()]); - } - - return null; - } - - /** - * Get the toString of the credentials as the key. - * - * @return string - */ - protected function key() - { - return (string)$this->client->getCredential(); - } - - /** - * Cache credentials. - * - * @param array $credential - */ - protected function cache(array $credential) - { - self::$credentialsCache[$this->key()] = $credential; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Providers/RamRoleArnProvider.php b/vendor/alibabacloud/client/src/Credentials/Providers/RamRoleArnProvider.php deleted file mode 100644 index ce4de41c..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Providers/RamRoleArnProvider.php +++ /dev/null @@ -1,84 +0,0 @@ -getCredentialsInCache(); - - if (null === $credential) { - $result = $this->request($timeout, $connectTimeout); - - if (!isset($result['Credentials']['AccessKeyId'], - $result['Credentials']['AccessKeySecret'], - $result['Credentials']['SecurityToken'])) { - throw new ServerException($result, $this->error, SDK::INVALID_CREDENTIAL); - } - - $credential = $result['Credentials']; - $this->cache($credential); - } - - return new StsCredential( - $credential['AccessKeyId'], - $credential['AccessKeySecret'], - $credential['SecurityToken'] - ); - } - - /** - * Get credentials by request. - * - * @param $timeout - * @param $connectTimeout - * - * @return Result - * @throws ClientException - * @throws ServerException - */ - private function request($timeout, $connectTimeout) - { - $clientName = __CLASS__ . \uniqid('ak', true); - $credential = $this->client->getCredential(); - - AlibabaCloud::accessKeyClient( - $credential->getAccessKeyId(), - $credential->getAccessKeySecret() - )->name($clientName); - - return (new AssumeRole($credential)) - ->client($clientName) - ->timeout($timeout) - ->connectTimeout($connectTimeout) - ->debug($this->client->isDebug()) - ->request(); - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Providers/RsaKeyPairProvider.php b/vendor/alibabacloud/client/src/Credentials/Providers/RsaKeyPairProvider.php deleted file mode 100644 index e78fc1c1..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Providers/RsaKeyPairProvider.php +++ /dev/null @@ -1,86 +0,0 @@ -getCredentialsInCache(); - - if ($credential === null) { - $result = $this->request($timeout, $connectTimeout); - - if (!isset($result['SessionAccessKey']['SessionAccessKeyId'], - $result['SessionAccessKey']['SessionAccessKeySecret'])) { - throw new ServerException($result, $this->error, SDK::INVALID_CREDENTIAL); - } - - $credential = $result['SessionAccessKey']; - $this->cache($credential); - } - - return new StsCredential( - $credential['SessionAccessKeyId'], - $credential['SessionAccessKeySecret'] - ); - } - - /** - * Get credentials by request. - * - * @param $timeout - * @param $connectTimeout - * - * @return Result - * @throws ClientException - * @throws ServerException - */ - private function request($timeout, $connectTimeout) - { - $clientName = __CLASS__ . \uniqid('rsa', true); - $credential = $this->client->getCredential(); - - AlibabaCloud::client( - new AccessKeyCredential( - $credential->getPublicKeyId(), - $credential->getPrivateKey() - ), - new ShaHmac256WithRsaSignature() - )->name($clientName); - - return (new GenerateSessionAccessKey($credential->getPublicKeyId())) - ->client($clientName) - ->timeout($timeout) - ->connectTimeout($connectTimeout) - ->debug($this->client->isDebug()) - ->request(); - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/RamRoleArnCredential.php b/vendor/alibabacloud/client/src/Credentials/RamRoleArnCredential.php deleted file mode 100644 index 6bdf5be9..00000000 --- a/vendor/alibabacloud/client/src/Credentials/RamRoleArnCredential.php +++ /dev/null @@ -1,110 +0,0 @@ -accessKeyId = $accessKeyId; - $this->accessKeySecret = $accessKeySecret; - $this->roleArn = $roleArn; - $this->roleSessionName = $roleSessionName; - $this->policy = $policy; - } - - /** - * @return string - */ - public function getAccessKeyId() - { - return $this->accessKeyId; - } - - /** - * @return string - */ - public function getAccessKeySecret() - { - return $this->accessKeySecret; - } - - /** - * @return string - */ - public function getRoleArn() - { - return $this->roleArn; - } - - /** - * @return string - */ - public function getRoleSessionName() - { - return $this->roleSessionName; - } - - /** - * @return string - */ - public function getPolicy() - { - return $this->policy; - } - - /** - * @return string - */ - public function __toString() - { - return "$this->accessKeyId#$this->accessKeySecret#$this->roleArn#$this->roleSessionName"; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Requests/AssumeRole.php b/vendor/alibabacloud/client/src/Credentials/Requests/AssumeRole.php deleted file mode 100644 index a3935aaf..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Requests/AssumeRole.php +++ /dev/null @@ -1,47 +0,0 @@ -product('Sts'); - $this->version('2015-04-01'); - $this->action('AssumeRole'); - $this->host('sts.aliyuncs.com'); - $this->scheme('https'); - $this->regionId('cn-hangzhou'); - $this->options['verify'] = false; - $this->options['query']['RoleArn'] = $arnCredential->getRoleArn(); - $this->options['query']['RoleSessionName'] = $arnCredential->getRoleSessionName(); - $this->options['query']['DurationSeconds'] = Provider::DURATION_SECONDS; - if ($arnCredential->getPolicy()) { - if (is_array($arnCredential->getPolicy())) { - $this->options['query']['Policy'] = json_encode($arnCredential->getPolicy()); - } - if (is_string($arnCredential->getPolicy())) { - $this->options['query']['Policy'] = $arnCredential->getPolicy(); - } - } - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/Requests/GenerateSessionAccessKey.php b/vendor/alibabacloud/client/src/Credentials/Requests/GenerateSessionAccessKey.php deleted file mode 100644 index 4ac1ee1a..00000000 --- a/vendor/alibabacloud/client/src/Credentials/Requests/GenerateSessionAccessKey.php +++ /dev/null @@ -1,37 +0,0 @@ -product('Sts'); - $this->version('2015-04-01'); - $this->action('GenerateSessionAccessKey'); - $this->host('sts.ap-northeast-1.aliyuncs.com'); - $this->scheme('https'); - $this->regionId('cn-hangzhou'); - $this->options['verify'] = false; - $this->options['query']['PublicKeyId'] = $publicKeyId; - $this->options['query']['DurationSeconds'] = Provider::DURATION_SECONDS; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/RsaKeyPairCredential.php b/vendor/alibabacloud/client/src/Credentials/RsaKeyPairCredential.php deleted file mode 100644 index 876909e2..00000000 --- a/vendor/alibabacloud/client/src/Credentials/RsaKeyPairCredential.php +++ /dev/null @@ -1,75 +0,0 @@ -publicKeyId = $publicKeyId; - try { - $this->privateKey = file_get_contents($privateKeyFile); - } catch (Exception $exception) { - throw new ClientException( - $exception->getMessage(), - SDK::INVALID_CREDENTIAL - ); - } - } - - /** - * @return mixed - */ - public function getPrivateKey() - { - return $this->privateKey; - } - - /** - * @return string - */ - public function getPublicKeyId() - { - return $this->publicKeyId; - } - - /** - * @return string - */ - public function __toString() - { - return "publicKeyId#$this->publicKeyId"; - } -} diff --git a/vendor/alibabacloud/client/src/Credentials/StsCredential.php b/vendor/alibabacloud/client/src/Credentials/StsCredential.php deleted file mode 100644 index d333fa82..00000000 --- a/vendor/alibabacloud/client/src/Credentials/StsCredential.php +++ /dev/null @@ -1,80 +0,0 @@ -accessKeyId = $accessKeyId; - $this->accessKeySecret = $accessKeySecret; - $this->securityToken = $securityToken; - } - - /** - * @return string - */ - public function getAccessKeyId() - { - return $this->accessKeyId; - } - - /** - * @return string - */ - public function getAccessKeySecret() - { - return $this->accessKeySecret; - } - - /** - * @return string - */ - public function getSecurityToken() - { - return $this->securityToken; - } - - /** - * @return string - */ - public function __toString() - { - return "$this->accessKeyId#$this->accessKeySecret#$this->securityToken"; - } -} diff --git a/vendor/alibabacloud/client/src/DefaultAcsClient.php b/vendor/alibabacloud/client/src/DefaultAcsClient.php deleted file mode 100644 index ff5ecd73..00000000 --- a/vendor/alibabacloud/client/src/DefaultAcsClient.php +++ /dev/null @@ -1,55 +0,0 @@ -randClientName = \uniqid('', true); - $client->name($this->randClientName); - } - - /** - * @param Request|Result $request - * - * @return Result|string - * @throws ClientException - * @throws ServerException - */ - public function getAcsResponse($request) - { - if ($request instanceof Result) { - return $request; - } - - return $request->client($this->randClientName)->request(); - } -} diff --git a/vendor/alibabacloud/client/src/Encode.php b/vendor/alibabacloud/client/src/Encode.php deleted file mode 100644 index ef589d20..00000000 --- a/vendor/alibabacloud/client/src/Encode.php +++ /dev/null @@ -1,64 +0,0 @@ -data = $data; - } - - /** - * @return bool|string - */ - public function toString() - { - $string = ''; - foreach ($this->data as $key => $value) { - $encode = rawurlencode($value); - $string .= "$key=$encode&"; - } - - if (0 < count($this->data)) { - $string = substr($string, 0, -1); - } - - return $string; - } - - /** - * @return $this - */ - public function ksort() - { - ksort($this->data); - - return $this; - } -} diff --git a/vendor/alibabacloud/client/src/Exception/AlibabaCloudException.php b/vendor/alibabacloud/client/src/Exception/AlibabaCloudException.php deleted file mode 100644 index cee21d8a..00000000 --- a/vendor/alibabacloud/client/src/Exception/AlibabaCloudException.php +++ /dev/null @@ -1,70 +0,0 @@ -errorCode; - } - - /** - * @codeCoverageIgnore - * @deprecated - */ - public function setErrorCode() - { - throw new RuntimeException('deprecated since 2.0.'); - } - - /** - * @return string - */ - public function getErrorMessage() - { - return $this->errorMessage; - } - - /** - * @codeCoverageIgnore - * - * @param $errorMessage - * - * @deprecated - */ - public function setErrorMessage($errorMessage) - { - $this->errorMessage = $errorMessage; - } - - /** - * @codeCoverageIgnore - * @deprecated - */ - public function setErrorType() - { - } -} diff --git a/vendor/alibabacloud/client/src/Exception/ClientException.php b/vendor/alibabacloud/client/src/Exception/ClientException.php deleted file mode 100644 index 0877e877..00000000 --- a/vendor/alibabacloud/client/src/Exception/ClientException.php +++ /dev/null @@ -1,38 +0,0 @@ -errorMessage = $errorMessage; - $this->errorCode = $errorCode; - } - - /** - * @codeCoverageIgnore - * @deprecated - */ - public function getErrorType() - { - return 'Client'; - } -} diff --git a/vendor/alibabacloud/client/src/Exception/ServerException.php b/vendor/alibabacloud/client/src/Exception/ServerException.php deleted file mode 100644 index 37db53e6..00000000 --- a/vendor/alibabacloud/client/src/Exception/ServerException.php +++ /dev/null @@ -1,158 +0,0 @@ -result = $result; - $this->errorMessage = $errorMessage; - $this->errorCode = $errorCode; - $this->resolvePropertiesByReturn(); - $this->distinguishSignatureErrors(); - $this->bodyAsErrorMessage(); - - parent::__construct( - $this->getMessageString(), - $this->result->getStatusCode() - ); - } - - /** - * Resolve the error message based on the return of the server. - * - * @return void - */ - private function resolvePropertiesByReturn() - { - if (isset($this->result['message'])) { - $this->errorMessage = $this->result['message']; - $this->errorCode = $this->result['code']; - } - if (isset($this->result['Message'])) { - $this->errorMessage = $this->result['Message']; - $this->errorCode = $this->result['Code']; - } - if (isset($this->result['errorMsg'])) { - $this->errorMessage = $this->result['errorMsg']; - $this->errorCode = $this->result['errorCode']; - } - if (isset($this->result['requestId'])) { - $this->requestId = $this->result['requestId']; - } - if (isset($this->result['RequestId'])) { - $this->requestId = $this->result['RequestId']; - } - } - - /** - * If the string to be signed are the same with server's, it is considered a credential error. - */ - private function distinguishSignatureErrors() - { - if ($this->result->getRequest() - && Stringy::create($this->errorMessage)->contains($this->result->getRequest()->stringToSign())) { - $this->errorCode = 'InvalidAccessKeySecret'; - $this->errorMessage = 'Specified Access Key Secret is not valid.'; - } - } - - /** - * If the error message matches the default message and - * the server has returned content, use the return content - */ - private function bodyAsErrorMessage() - { - $body = (string)$this->result->getBody(); - if ($this->errorMessage === SDK::RESPONSE_EMPTY && $body) { - $this->errorMessage = $body; - } - } - - /** - * Get standard exception message. - * - * @return string - */ - private function getMessageString() - { - $message = "$this->errorCode: $this->errorMessage RequestId: $this->requestId"; - - if ($this->getResult()->getRequest()) { - $method = $this->getResult()->getRequest()->method; - $uri = (string)$this->getResult()->getRequest()->uri; - $message .= " $method \"$uri\""; - if ($this->result) { - $message .= ' ' . $this->result->getStatusCode(); - } - } - - return $message; - } - - /** - * @return Result - */ - public function getResult() - { - return $this->result; - } - - /** - * @return string - */ - public function getRequestId() - { - return $this->requestId; - } - - /** - * @codeCoverageIgnore - * @deprecated - */ - public function getErrorType() - { - return 'Server'; - } - - /** - * @codeCoverageIgnore - * @deprecated - */ - public function getHttpStatus() - { - return $this->getResult()->getStatusCode(); - } -} diff --git a/vendor/alibabacloud/client/src/Filter/ApiFilter.php b/vendor/alibabacloud/client/src/Filter/ApiFilter.php deleted file mode 100644 index c12327fb..00000000 --- a/vendor/alibabacloud/client/src/Filter/ApiFilter.php +++ /dev/null @@ -1,245 +0,0 @@ -endsWith(DIRECTORY_SEPARATOR)) { - $dir .= DIRECTORY_SEPARATOR; - } - - if (0 === strpos($filename, $dir)) { - return true; - } - } - - return false; -} - -/** - * @return bool - */ -function isWindows() -{ - return PATH_SEPARATOR === ';'; -} - -/** - * @return CLImate - */ -function cliMate() -{ - return new CLImate(); -} - -/** - * @param string $string - * @param string|null $flank - * @param string|null $char - * @param int|null $length - * - * @return void - */ -function backgroundRed($string, $flank = null, $char = null, $length = null) -{ - cliMate()->br(); - if ($flank !== null) { - cliMate()->backgroundRed()->flank($flank, $char, $length); - cliMate()->br(); - } - cliMate()->backgroundRed($string); - cliMate()->br(); -} - -/** - * @param string $string - * @param string|null $flank - * @param string|null $char - * @param int|null $length - * - * @return void - */ -function backgroundGreen($string, $flank = null, $char = null, $length = null) -{ - cliMate()->br(); - if ($flank !== null) { - cliMate()->backgroundGreen()->flank($flank, $char, $length); - } - cliMate()->backgroundGreen($string); - cliMate()->br(); -} - -/** - * @param string $string - * @param string|null $flank - * @param string|null $char - * @param int|null $length - * - * @return void - */ -function backgroundBlue($string, $flank = null, $char = null, $length = null) -{ - cliMate()->br(); - if ($flank !== null) { - cliMate()->backgroundBlue()->flank($flank, $char, $length); - } - cliMate()->backgroundBlue($string); - cliMate()->br(); -} - -/** - * @param string $string - * @param string|null $flank - * @param string|null $char - * @param int|null $length - * - * @return void - */ -function backgroundMagenta($string, $flank = null, $char = null, $length = null) -{ - cliMate()->br(); - if ($flank !== null) { - cliMate()->backgroundMagenta()->flank($flank, $char, $length); - } - cliMate()->backgroundMagenta($string); - cliMate()->br(); -} - -/** - * @param array $array - */ -function json(array $array) -{ - cliMate()->br(); - cliMate()->backgroundGreen()->json($array); - cliMate()->br(); -} - -/** - * @param array $array - * - * @return void - */ -function redTable($array) -{ - /** - * @noinspection PhpUndefinedMethodInspection - */ - cliMate()->redTable($array); -} - -/** - * @param mixed $result - * @param string $title - * - * @return void - */ -function block($result, $title) -{ - cliMate()->backgroundGreen()->flank($title, '--', 20); - dump($result); -} - -/** - * Gets the value of an environment variable. - * - * @param string $key - * @param mixed $default - * - * @return mixed - */ -function env($key, $default = null) -{ - $value = getenv($key); - - if ($value === false) { - return value($default); - } - - if (envSubstr($value)) { - return substr($value, 1, -1); - } - - return envConversion($value); -} - -/** - * @param $value - * - * @return bool|string|null - */ -function envConversion($value) -{ - $key = strtolower($value); - - if ($key === 'null' || $key === '(null)') { - return null; - } - - $list = [ - 'true' => true, - '(true)' => true, - 'false' => false, - '(false)' => false, - 'empty' => '', - '(empty)' => '', - ]; - - return isset($list[$key]) ? $list[$key] : $value; -} - -/** - * @param $key - * - * @return bool|mixed - * @throws ClientException - */ -function envNotEmpty($key) -{ - $value = env($key, false); - if ($value !== false && !$value) { - throw new ClientException( - "Environment variable '$key' cannot be empty", - SDK::INVALID_ARGUMENT - ); - } - if ($value) { - return $value; - } - - return false; -} - -/** - * @param $value - * - * @return bool - */ -function envSubstr($value) -{ - return ($valueLength = strlen($value)) > 1 && strpos($value, '"') === 0 && $value[$valueLength - 1] === '"'; -} - -/** - * Return the default value of the given value. - * - * @param mixed $value - * - * @return mixed - */ -function value($value) -{ - return $value instanceof Closure ? $value() : $value; -} diff --git a/vendor/alibabacloud/client/src/Log/LogFormatter.php b/vendor/alibabacloud/client/src/Log/LogFormatter.php deleted file mode 100644 index a17a1b34..00000000 --- a/vendor/alibabacloud/client/src/Log/LogFormatter.php +++ /dev/null @@ -1,78 +0,0 @@ -template = $template; - $timezone = new DateTimeZone(date_default_timezone_get() ?: 'UTC'); - if (PHP_VERSION_ID < 70100) { - self::$ts = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), $timezone); - } else { - self::$ts = new DateTime(null, $timezone); - } - } - - /** - * Returns a formatted message string. - * - * @param RequestInterface $request Request that was sent - * @param ResponseInterface $response Response that was received - * @param Exception $error Exception that was received - * - * @return string - */ - public function format( - RequestInterface $request, - ResponseInterface $response = null, - Exception $error = null - ) { - $this->template = str_replace('{pid}', getmypid(), $this->template); - $this->template = str_replace('{cost}', self::getCost(), $this->template); - $this->template = str_replace('{start_time}', self::$ts->format('Y-m-d H:i:s.u'), $this->template); - - return (new MessageFormatter($this->template))->format($request, $response, $error); - } - - /** - * @return float|mixed - */ - private static function getCost() - { - return microtime(true) - self::$logStartTime; - } -} diff --git a/vendor/alibabacloud/client/src/Profile/DefaultProfile.php b/vendor/alibabacloud/client/src/Profile/DefaultProfile.php deleted file mode 100644 index b1b3707a..00000000 --- a/vendor/alibabacloud/client/src/Profile/DefaultProfile.php +++ /dev/null @@ -1,74 +0,0 @@ -regionId($regionId); - } - - /** - * @param string $regionId - * @param string $accessKeyId - * @param string $accessKeySecret - * @param string $roleArn - * @param string $roleSessionName - * - * @return Client - * @throws ClientException - */ - public static function getRamRoleArnProfile($regionId, $accessKeyId, $accessKeySecret, $roleArn, $roleSessionName) - { - return AlibabaCloud::ramRoleArnClient($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName) - ->regionId($regionId); - } - - /** - * @param string $regionId - * @param string $roleName - * - * @return Client - * @throws ClientException - */ - public static function getEcsRamRoleProfile($regionId, $roleName) - { - return AlibabaCloud::ecsRamRoleClient($roleName) - ->regionId($regionId); - } - - /** - * @param string $regionId - * @param string $bearerToken - * - * @return Client - * @throws ClientException - */ - public static function getBearerTokenProfile($regionId, $bearerToken) - { - return AlibabaCloud::bearerTokenClient($bearerToken) - ->regionId($regionId); - } -} diff --git a/vendor/alibabacloud/client/src/Regions/EndpointProvider.php b/vendor/alibabacloud/client/src/Regions/EndpointProvider.php deleted file mode 100644 index 5e8e555e..00000000 --- a/vendor/alibabacloud/client/src/Regions/EndpointProvider.php +++ /dev/null @@ -1,18 +0,0 @@ -request = $request; - } - - /** - * @param Request $request - * @param string $domain - * - * @return string - * @throws ClientException - * @throws ServerException - * @deprecated - * @codeCoverageIgnore - */ - public static function findProductDomain(Request $request, $domain = 'location.aliyuncs.com') - { - return self::resolveHost($request, $domain); - } - - /** - * @param $regionId - * @param $product - * @param $domain - * - * @throws ClientException - * @deprecated - * @codeCoverageIgnore - */ - public static function addEndPoint($regionId, $product, $domain) - { - self::addHost($product, $domain, $regionId); - } - - - /** - * @param Request $request - * @param string $domain - * - * @return string - * @throws ClientException - * @throws ServerException - */ - public static function resolveHost(Request $request, $domain = 'location.aliyuncs.com') - { - $locationService = new static($request); - $product = $locationService->request->product; - $regionId = $locationService->request->realRegionId(); - - if (!isset(self::$hosts[$product][$regionId])) { - self::$hosts[$product][$regionId] = self::getResult($locationService, $domain); - } - - return self::$hosts[$product][$regionId]; - } - - /** - * @param static $locationService - * @param string $domain - * - * @return string - * @throws ClientException - * @throws ServerException - */ - private static function getResult($locationService, $domain) - { - $locationRequest = new LocationServiceRequest($locationService->request, $domain); - - $result = $locationRequest->request(); - - if (!isset($result['Endpoints']['Endpoint'][0]['Endpoint'])) { - throw new ClientException( - 'Not found Region ID in ' . $domain, - SDK::INVALID_REGION_ID - ); - } - - return $result['Endpoints']['Endpoint'][0]['Endpoint']; - } - - /** - * @param string $product - * @param string $host - * @param string $regionId - * - * @throws ClientException - */ - public static function addHost($product, $host, $regionId = self::GLOBAL_REGION) - { - ApiFilter::product($product); - - HttpFilter::host($host); - - ClientFilter::regionId($regionId); - - self::$hosts[$product][$regionId] = $host; - } - - /** - * Update endpoints from OSS. - * - * @codeCoverageIgnore - * @throws Exception - */ - public static function updateEndpoints() - { - $ossUrl = 'https://openapi-endpoints.oss-cn-hangzhou.aliyuncs.com/endpoints.json'; - $json = \file_get_contents($ossUrl); - $list = \json_decode($json, true); - - foreach ($list['endpoints'] as $endpoint) { - Config::set( - "endpoints.{$endpoint['service']}.{$endpoint['regionid']}", - \strtolower($endpoint['endpoint']) - ); - } - } -} diff --git a/vendor/alibabacloud/client/src/Regions/LocationServiceRequest.php b/vendor/alibabacloud/client/src/Regions/LocationServiceRequest.php deleted file mode 100644 index 94a267d6..00000000 --- a/vendor/alibabacloud/client/src/Regions/LocationServiceRequest.php +++ /dev/null @@ -1,46 +0,0 @@ -product('Location'); - $this->version('2015-06-12'); - $this->action('DescribeEndpoints'); - $this->regionId('cn-hangzhou'); - $this->format('JSON'); - $this->options['query']['Id'] = $request->realRegionId(); - $this->options['query']['ServiceCode'] = $request->serviceCode; - $this->options['query']['Type'] = $request->endpointType; - $this->client($request->client); - $this->host($domain); - if (isset($request->options['timeout'])) { - $this->timeout($request->options['timeout']); - } - - if (isset($request->options['connect_timeout'])) { - $this->connectTimeout($request->options['connect_timeout']); - } - } -} diff --git a/vendor/alibabacloud/client/src/Release.php b/vendor/alibabacloud/client/src/Release.php deleted file mode 100644 index 0be9c1bc..00000000 --- a/vendor/alibabacloud/client/src/Release.php +++ /dev/null @@ -1,112 +0,0 @@ -getArguments(); - if (count($arguments) <= 1) { - echo 'Missing ChangeLog'; - - return; - } - self::updateChangelogFile($arguments[0], $arguments[1]); - self::changeVersionInCode($arguments[0]); - } - - /** - * @param $version - * @param $changeLog - */ - private static function updateChangelogFile($version, $changeLog) - { - $content = preg_replace( - '/# CHANGELOG/', - '# CHANGELOG' - . "\n" - . "\n" - . "## $version - " . date('Y-m-d') - . self::log($changeLog), - self::getChangeLogContent() - ); - - file_put_contents(self::getChangeLogFile(), $content); - } - - /** - * @param $changeLog - * - * @return string - */ - private static function log($changeLog) - { - $logs = explode('|', $changeLog); - $string = "\n"; - foreach ($logs as $log) { - if ($log) { - $string .= "- $log." . "\n"; - } - } - - return $string; - } - - /** - * @return string - */ - private static function getChangeLogContent() - { - return file_get_contents(self::getChangeLogFile()); - } - - /** - * @return string - */ - private static function getChangeLogFile() - { - return __DIR__ . '/../CHANGELOG.md'; - } - - /** - * @param $version - */ - private static function changeVersionInCode($version) - { - $content = preg_replace( - "/const VERSION = \'(.*)\';/", - "const VERSION = '" . $version . "';", - self::getCodeContent() - ); - - file_put_contents(self::getCodeFile(), $content); - } - - /** - * @return string - */ - private static function getCodeContent() - { - return file_get_contents(self::getCodeFile()); - } - - /** - * @return string - */ - private static function getCodeFile() - { - return __DIR__ . '/AlibabaCloud.php'; - } -} diff --git a/vendor/alibabacloud/client/src/Request/Request.php b/vendor/alibabacloud/client/src/Request/Request.php deleted file mode 100644 index 94ec12ce..00000000 --- a/vendor/alibabacloud/client/src/Request/Request.php +++ /dev/null @@ -1,445 +0,0 @@ -client = CredentialsProvider::getDefaultName(); - $this->uri = new Uri(); - $this->uri = $this->uri->withScheme($this->scheme); - $this->options['http_errors'] = false; - $this->options['connect_timeout'] = self::CONNECT_TIMEOUT; - $this->options['timeout'] = self::TIMEOUT; - - // Turn on debug mode based on environment variable. - if (strtolower(\AlibabaCloud\Client\env('DEBUG')) === 'sdk') { - $this->options['debug'] = true; - } - - // Rewrite configuration if the user has a configuration. - if ($options !== []) { - $this->options($options); - } - } - - /** - * @param string $name - * @param string $value - * - * @return $this - * @throws ClientException - */ - public function appendUserAgent($name, $value) - { - $filter_name = Filter::name($name); - - if (!UserAgent::isGuarded($filter_name)) { - $this->userAgent[$filter_name] = Filter::value($value); - } - - return $this; - } - - /** - * @param array $userAgent - * - * @return $this - */ - public function withUserAgent(array $userAgent) - { - $this->userAgent = UserAgent::clean($userAgent); - - return $this; - } - - /** - * Set Accept format. - * - * @param string $format - * - * @return $this - * @throws ClientException - */ - public function format($format) - { - $this->format = ApiFilter::format($format); - - return $this; - } - - /** - * @param $contentType - * - * @return $this - * @throws ClientException - */ - public function contentType($contentType) - { - $this->options['headers']['Content-Type'] = HttpFilter::contentType($contentType); - - return $this; - } - - /** - * @param string $accept - * - * @return $this - * @throws ClientException - */ - public function accept($accept) - { - $this->options['headers']['Accept'] = HttpFilter::accept($accept); - - return $this; - } - - /** - * Set the request body. - * - * @param string $body - * - * @return $this - * @throws ClientException - */ - public function body($body) - { - $this->options['body'] = HttpFilter::body($body); - - return $this; - } - - /** - * Set the json as body. - * - * @param array|object $content - * - * @return $this - * @throws ClientException - */ - public function jsonBody($content) - { - if (!\is_array($content) && !\is_object($content)) { - throw new ClientException( - 'jsonBody only accepts an array or object', - SDK::INVALID_ARGUMENT - ); - } - - return $this->body(\json_encode($content)); - } - - /** - * Set the request scheme. - * - * @param string $scheme - * - * @return $this - * @throws ClientException - */ - public function scheme($scheme) - { - $this->scheme = HttpFilter::scheme($scheme); - $this->uri = $this->uri->withScheme($scheme); - - return $this; - } - - /** - * Set the request host. - * - * @param string $host - * - * @return $this - * @throws ClientException - */ - public function host($host) - { - $this->uri = $this->uri->withHost(HttpFilter::host($host)); - - return $this; - } - - /** - * @param string $method - * - * @return $this - * @throws ClientException - */ - public function method($method) - { - $this->method = HttpFilter::method($method); - - return $this; - } - - /** - * @param string $clientName - * - * @return $this - * @throws ClientException - */ - public function client($clientName) - { - $this->client = ClientFilter::clientName($clientName); - - return $this; - } - - /** - * @return bool - * @throws ClientException - */ - public function isDebug() - { - if (isset($this->options['debug'])) { - return $this->options['debug'] === true; - } - - if (isset($this->httpClient()->options['debug'])) { - return $this->httpClient()->options['debug'] === true; - } - - return false; - } - - /** - * @throws ClientException - * @throws ServerException - */ - public function resolveOption() - { - $this->options['headers']['User-Agent'] = UserAgent::toString($this->userAgent); - - $this->cleanQuery(); - $this->cleanFormParams(); - $this->resolveHost(); - $this->resolveParameter(); - - if (isset($this->options['form_params'])) { - $this->options['form_params'] = \GuzzleHttp\Psr7\parse_query( - Encode::create($this->options['form_params'])->toString() - ); - } - - $this->mergeOptionsIntoClient(); - } - - /** - * @return Result - * @throws ClientException - * @throws ServerException - */ - public function request() - { - $this->resolveOption(); - $result = $this->response(); - - if ($this->shouldServerRetry($result)) { - return $this->request(); - } - - if (!$result->isSuccess()) { - throw new ServerException($result); - } - - return $result; - } - - /*** - * @return PromiseInterface - * @throws Exception - */ - public function requestAsync() - { - $this->resolveOption(); - - return self::createClient($this)->requestAsync( - $this->method, - (string)$this->uri, - $this->options - ); - } - - /** - * @param Request $request - * - * @return Client - * @throws Exception - */ - public static function createClient(Request $request = null) - { - if (AlibabaCloud::hasMock()) { - $stack = HandlerStack::create(AlibabaCloud::getMock()); - } else { - $stack = HandlerStack::create(); - } - - if (AlibabaCloud::isRememberHistory()) { - $stack->push(Middleware::history(AlibabaCloud::referenceHistory())); - } - - if (AlibabaCloud::getLogger()) { - $stack->push(Middleware::log( - AlibabaCloud::getLogger(), - new LogFormatter(AlibabaCloud::getLogFormat()) - )); - } - - $stack->push(Middleware::mapResponse(static function (ResponseInterface $response) use ($request) { - return new Result($response, $request); - })); - - self::$config['handler'] = $stack; - - return new Client(self::$config); - } - - /** - * @throws ClientException - * @throws Exception - */ - private function response() - { - try { - return self::createClient($this)->request( - $this->method, - (string)$this->uri, - $this->options - ); - } catch (GuzzleException $exception) { - if ($this->shouldClientRetry($exception)) { - return $this->response(); - } - throw new ClientException( - $exception->getMessage(), - SDK::SERVER_UNREACHABLE, - $exception - ); - } - } - - /** - * Remove redundant Query - * - * @codeCoverageIgnore - */ - private function cleanQuery() - { - if (isset($this->options['query']) && $this->options['query'] === []) { - unset($this->options['query']); - } - } - - /** - * Remove redundant Headers - * - * @codeCoverageIgnore - */ - private function cleanFormParams() - { - if (isset($this->options['form_params']) && $this->options['form_params'] === []) { - unset($this->options['form_params']); - } - } -} diff --git a/vendor/alibabacloud/client/src/Request/RoaRequest.php b/vendor/alibabacloud/client/src/Request/RoaRequest.php deleted file mode 100644 index a6af50ef..00000000 --- a/vendor/alibabacloud/client/src/Request/RoaRequest.php +++ /dev/null @@ -1,335 +0,0 @@ -resolveQuery(); - $this->resolveHeaders(); - $this->resolveBody(); - $this->resolveUri(); - $this->resolveSignature(); - } - - private function resolveQuery() - { - if (!isset($this->options['query']['Version'])) { - $this->options['query']['Version'] = $this->version; - } - } - - private function resolveBody() - { - // If the body has already been specified, it will not be resolved. - if (isset($this->options['body'])) { - return; - } - - if (!isset($this->options['form_params'])) { - return; - } - - // Merge data, compatible with parameters set from constructor. - $params = Arrays::merge( - [ - $this->data, - $this->options['form_params'] - ] - ); - - $this->encodeBody($params); - - unset($this->options['form_params']); - } - - /** - * Determine the body format based on the Content-Type and calculate the MD5 value. - * - * @param array $params - */ - private function encodeBody(array $params) - { - $stringy = Stringy::create($this->options['headers']['Content-Type']); - - if ($stringy->contains('application/json', false)) { - $this->options['body'] = json_encode($params); - $this->options['headers']['Content-MD5'] = base64_encode(md5($this->options['body'], true)); - - return; - } - - $this->options['body'] = Encode::create($params)->ksort()->toString(); - $this->options['headers']['Content-MD5'] = base64_encode(md5($this->options['body'], true)); - $this->options['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; - } - - /** - * @throws ClientException - * @throws ServerException - * @throws Exception - */ - private function resolveHeaders() - { - $this->options['headers']['x-acs-version'] = $this->version; - $this->options['headers']['x-acs-region-id'] = $this->realRegionId(); - $this->options['headers']['Date'] = gmdate($this->dateTimeFormat); - - $signature = $this->httpClient()->getSignature(); - $this->options['headers']['x-acs-signature-method'] = $signature->getMethod(); - $this->options['headers']['x-acs-signature-nonce'] = Sign::uuid($this->product . $this->realRegionId()); - $this->options['headers']['x-acs-signature-version'] = $signature->getVersion(); - if ($signature->getType()) { - $this->options['headers']['x-acs-signature-type'] = $signature->getType(); - } - - $this->resolveAccept(); - $this->resolveContentType(); - $this->resolveSecurityToken(); - $this->resolveBearerToken(); - } - - /** - * @throws ClientException - * @throws Exception - */ - private function resolveSignature() - { - $this->options['headers']['Authorization'] = $this->signature(); - } - - /** - * If accept is not specified, it is determined by format. - */ - private function resolveAccept() - { - if (!isset($this->options['headers']['Accept'])) { - $this->options['headers']['Accept'] = Accept::create($this->format)->toString(); - } - } - - /** - * If the Content-Type is not specified, it is determined according to accept. - */ - private function resolveContentType() - { - if (!isset($this->options['headers']['Content-Type'])) { - $this->options['headers']['Content-Type'] = "{$this->options['headers']['Accept']}; charset=utf-8"; - } - } - - /** - * @throws ClientException - * @throws ServerException - */ - private function resolveSecurityToken() - { - if (!$this->credential() instanceof StsCredential) { - return; - } - - if (!$this->credential()->getSecurityToken()) { - return; - } - - $this->options['headers']['x-acs-security-token'] = $this->credential()->getSecurityToken(); - } - - /** - * @throws ClientException - * @throws ServerException - */ - private function resolveBearerToken() - { - if ($this->credential() instanceof BearerTokenCredential) { - $this->options['headers']['x-acs-bearer-token'] = $this->credential()->getBearerToken(); - } - } - - /** - * Sign the request message. - * - * @return string - * @throws ClientException - * @throws ServerException - */ - private function signature() - { - /** - * @var AccessKeyCredential $credential - */ - $credential = $this->credential(); - $access_key_id = $credential->getAccessKeyId(); - $signature = $this->httpClient() - ->getSignature() - ->sign( - $this->stringToSign(), - $credential->getAccessKeySecret() - ); - - return "acs $access_key_id:$signature"; - } - - /** - * @return void - */ - private function resolveUri() - { - $path = Path::assign($this->pathPattern, $this->pathParameters); - - $this->uri = $this->uri->withPath($path) - ->withQuery( - $this->queryString() - ); - } - - /** - * @return string - */ - public function stringToSign() - { - $request = new \GuzzleHttp\Psr7\Request( - $this->method, - $this->uri, - $this->options['headers'] - ); - - return Sign::roaString($request); - } - - /** - * @return bool|string - */ - private function queryString() - { - $query = isset($this->options['query']) - ? $this->options['query'] - : []; - - return Encode::create($query)->ksort()->toString(); - } - - /** - * Set path parameter by name. - * - * @param string $name - * @param string $value - * - * @return RoaRequest - * @throws ClientException - */ - public function pathParameter($name, $value) - { - Filter::name($name); - - if ($value === '') { - throw new ClientException( - 'Value cannot be empty', - SDK::INVALID_ARGUMENT - ); - } - - $this->pathParameters[$name] = $value; - - return $this; - } - - /** - * Set path pattern. - * - * @param string $pattern - * - * @return self - * @throws ClientException - */ - public function pathPattern($pattern) - { - ApiFilter::pattern($pattern); - - $this->pathPattern = $pattern; - - return $this; - } - - /** - * Magic method for set or get request parameters. - * - * @param string $name - * @param mixed $arguments - * - * @return $this - */ - public function __call($name, $arguments) - { - if (strncmp($name, 'get', 3) === 0) { - $parameter_name = \mb_strcut($name, 3); - - return $this->__get($parameter_name); - } - - if (strncmp($name, 'with', 4) === 0) { - $parameter_name = \mb_strcut($name, 4); - $this->__set($parameter_name, $arguments[0]); - $this->pathParameters[$parameter_name] = $arguments[0]; - - return $this; - } - - if (strncmp($name, 'set', 3) === 0) { - $parameter_name = \mb_strcut($name, 3); - $with_method = "with$parameter_name"; - - throw new RuntimeException("Please use $with_method instead of $name"); - } - - throw new RuntimeException('Call to undefined method ' . __CLASS__ . '::' . $name . '()'); - } -} diff --git a/vendor/alibabacloud/client/src/Request/RpcRequest.php b/vendor/alibabacloud/client/src/Request/RpcRequest.php deleted file mode 100644 index b9d73694..00000000 --- a/vendor/alibabacloud/client/src/Request/RpcRequest.php +++ /dev/null @@ -1,203 +0,0 @@ -resolveBoolInParameters(); - $this->resolveCommonParameters(); - $this->repositionParameters(); - } - - /** - * Convert a Boolean value to a string - */ - private function resolveBoolInParameters() - { - if (isset($this->options['query'])) { - $this->options['query'] = array_map( - static function ($value) { - return self::boolToString($value); - }, - $this->options['query'] - ); - } - } - - /** - * Convert a Boolean value to a string. - * - * @param bool|string $value - * - * @return string - */ - public static function boolToString($value) - { - if (is_bool($value)) { - return $value ? 'true' : 'false'; - } - - return $value; - } - - /** - * Resolve Common Parameters. - * - * @throws ClientException - * @throws Exception - */ - private function resolveCommonParameters() - { - $signature = $this->httpClient()->getSignature(); - $this->options['query']['RegionId'] = $this->realRegionId(); - $this->options['query']['Format'] = $this->format; - $this->options['query']['SignatureMethod'] = $signature->getMethod(); - $this->options['query']['SignatureVersion'] = $signature->getVersion(); - $this->options['query']['SignatureNonce'] = Sign::uuid($this->product . $this->realRegionId()); - $this->options['query']['Timestamp'] = gmdate($this->dateTimeFormat); - $this->options['query']['Action'] = $this->action; - if ($this->credential()->getAccessKeyId()) { - $this->options['query']['AccessKeyId'] = $this->credential()->getAccessKeyId(); - } - if ($signature->getType()) { - $this->options['query']['SignatureType'] = $signature->getType(); - } - if (!isset($this->options['query']['Version'])) { - $this->options['query']['Version'] = $this->version; - } - $this->resolveSecurityToken(); - $this->resolveBearerToken(); - $this->options['query']['Signature'] = $this->signature(); - } - - /** - * @throws ClientException - * @throws ServerException - */ - private function resolveSecurityToken() - { - if (!$this->credential() instanceof StsCredential) { - return; - } - - if (!$this->credential()->getSecurityToken()) { - return; - } - - $this->options['query']['SecurityToken'] = $this->credential()->getSecurityToken(); - } - - /** - * @throws ClientException - * @throws ServerException - */ - private function resolveBearerToken() - { - if ($this->credential() instanceof BearerTokenCredential) { - $this->options['query']['BearerToken'] = $this->credential()->getBearerToken(); - } - } - - /** - * Sign the parameters. - * - * @return mixed - * @throws ClientException - * @throws ServerException - */ - private function signature() - { - return $this->httpClient() - ->getSignature() - ->sign( - $this->stringToSign(), - $this->credential()->getAccessKeySecret() . '&' - ); - } - - /** - * @return string - */ - public function stringToSign() - { - $query = isset($this->options['query']) ? $this->options['query'] : []; - $form_params = isset($this->options['form_params']) ? $this->options['form_params'] : []; - $parameters = Arrays::merge([$query, $form_params]); - - return Sign::rpcString($this->method, $parameters); - } - - /** - * Adjust parameter position - */ - private function repositionParameters() - { - if ($this->method === 'POST' || $this->method === 'PUT') { - foreach ($this->options['query'] as $api_key => $api_value) { - $this->options['form_params'][$api_key] = $api_value; - } - unset($this->options['query']); - } - } - - /** - * Magic method for set or get request parameters. - * - * @param string $name - * @param mixed $arguments - * - * @return $this - */ - public function __call($name, $arguments) - { - if (strncmp($name, 'get', 3) === 0) { - $parameter_name = \mb_strcut($name, 3); - - return $this->__get($parameter_name); - } - - if (strncmp($name, 'with', 4) === 0) { - $parameter_name = \mb_strcut($name, 4); - $this->__set($parameter_name, $arguments[0]); - $this->options['query'][$parameter_name] = $arguments[0]; - - return $this; - } - - if (strncmp($name, 'set', 3) === 0) { - $parameter_name = \mb_strcut($name, 3); - $with_method = "with$parameter_name"; - - throw new RuntimeException("Please use $with_method instead of $name"); - } - - throw new RuntimeException('Call to undefined method ' . __CLASS__ . '::' . $name . '()'); - } -} diff --git a/vendor/alibabacloud/client/src/Request/Traits/AcsTrait.php b/vendor/alibabacloud/client/src/Request/Traits/AcsTrait.php deleted file mode 100644 index 3b0aca04..00000000 --- a/vendor/alibabacloud/client/src/Request/Traits/AcsTrait.php +++ /dev/null @@ -1,239 +0,0 @@ -action = ApiFilter::action($action); - - return $this; - } - - /** - * @codeCoverageIgnore - * - * @param string $endpointSuffix - * - * @return AcsTrait - * @throws ClientException - */ - public function endpointSuffix($endpointSuffix) - { - $this->endpointSuffix = ApiFilter::endpointSuffix($endpointSuffix); - - return $this; - } - - /** - * @param string $network - */ - public function network($network) - { - $this->network = ApiFilter::network($network); - - return $this; - } - - /** - * @param string $version - * - * @return $this - * @throws ClientException - */ - public function version($version) - { - $this->version = ApiFilter::version($version); - - return $this; - } - - /** - * @param string $product - * - * @return $this - * @throws ClientException - */ - public function product($product) - { - $this->product = ApiFilter::product($product); - - return $this; - } - - /** - * @param string $endpointType - * - * @return $this - * @throws ClientException - */ - public function endpointType($endpointType) - { - $this->endpointType = ApiFilter::endpointType($endpointType); - - return $this; - } - - /** - * @param string $serviceCode - * - * @return $this - * @throws ClientException - */ - public function serviceCode($serviceCode) - { - $this->serviceCode = ApiFilter::serviceCode($serviceCode); - - return $this; - } - - /** - * Resolve Host. - * - * @throws ClientException - * @throws ServerException - */ - public function resolveHost() - { - // Return if specified - if ($this->uri->getHost() !== 'localhost') { - return; - } - - $region_id = $this->realRegionId(); - $host = ''; - - $this->resolveHostWays($host, $region_id); - - if (!$host) { - throw new ClientException( - "No host found for {$this->product} in the {$region_id}, you can specify host by host() method. " . - 'Like $request->host(\'xxx.xxx.aliyuncs.com\')', - SDK::HOST_NOT_FOUND - ); - } - - $this->uri = $this->uri->withHost($host); - } - - /** - * @param string $host - * @param string $region_id - * - * @throws ClientException - * @throws ServerException - */ - private function resolveHostWays(&$host, $region_id) - { - $host = AlibabaCloud::resolveHostByStatic($this->product, $region_id); - - // 1. Find host by map. - if (!$host && $this->network === 'public' && isset($this->endpointMap[$region_id])) { - $host = $this->endpointMap[$region_id]; - } - - // 2. Find host by rules. - if (!$host && $this->endpointRegional !== null) { - $host = AlibabaCloud::resolveHostByRule($this); - } - - // 3. Find in the local array file. - if (!$host) { - $host = AlibabaCloud::resolveHost($this->product, $region_id); - } - - // 4. Find in the Location service. - if (!$host && $this->serviceCode) { - $host = LocationService::resolveHost($this); - } - } - - /** - * @return string - * @throws ClientException - */ - public function realRegionId() - { - if ($this->regionId !== null) { - return $this->regionId; - } - - if ($this->httpClient()->regionId !== null) { - return $this->httpClient()->regionId; - } - - if (AlibabaCloud::getDefaultRegionId() !== null) { - return AlibabaCloud::getDefaultRegionId(); - } - - throw new ClientException("Missing required 'RegionId' for Request", SDK::INVALID_REGION_ID); - } -} diff --git a/vendor/alibabacloud/client/src/Request/Traits/ClientTrait.php b/vendor/alibabacloud/client/src/Request/Traits/ClientTrait.php deleted file mode 100644 index 37a2d22e..00000000 --- a/vendor/alibabacloud/client/src/Request/Traits/ClientTrait.php +++ /dev/null @@ -1,98 +0,0 @@ -httpClient()->getCredential(); - } - - $timeout = isset($this->options['timeout']) - ? $this->options['timeout'] - : Request::TIMEOUT; - - $connectTimeout = isset($this->options['connect_timeout']) - ? $this->options['connect_timeout'] - : Request::CONNECT_TIMEOUT; - - return $this->httpClient()->getSessionCredential($timeout, $connectTimeout); - } - - /** - * Get the client based on the request's settings. - * - * @return Client - * @throws ClientException - */ - public function httpClient() - { - if (!AlibabaCloud::all()) { - if (CredentialsProvider::hasCustomChain()) { - CredentialsProvider::customProvider($this->client); - } else { - CredentialsProvider::defaultProvider($this->client); - } - } - - return AlibabaCloud::get($this->client); - } - - /** - * Merged with the client's options, the same name will be overwritten. - * - * @throws ClientException - */ - public function mergeOptionsIntoClient() - { - $this->options = Arrays::merge( - [ - $this->httpClient()->options, - $this->options - ] - ); - } -} diff --git a/vendor/alibabacloud/client/src/Request/Traits/DeprecatedRoaTrait.php b/vendor/alibabacloud/client/src/Request/Traits/DeprecatedRoaTrait.php deleted file mode 100644 index ee64e52e..00000000 --- a/vendor/alibabacloud/client/src/Request/Traits/DeprecatedRoaTrait.php +++ /dev/null @@ -1,55 +0,0 @@ -pathParameter($name, $value); - } - - /** - * @param $pathPattern - * - * @return $this - * @deprecated - * @codeCoverageIgnore - */ - public function setUriPattern($pathPattern) - { - return $this->pathPattern($pathPattern); - } - - /** - * @return string - * @deprecated - * @codeCoverageIgnore - */ - public function getUriPattern() - { - return $this->pathPattern; - } - - /** - * @return array - * @deprecated - * @codeCoverageIgnore - */ - public function getPathParameters() - { - return $this->pathParameters; - } -} diff --git a/vendor/alibabacloud/client/src/Request/Traits/DeprecatedTrait.php b/vendor/alibabacloud/client/src/Request/Traits/DeprecatedTrait.php deleted file mode 100644 index 406e6ed0..00000000 --- a/vendor/alibabacloud/client/src/Request/Traits/DeprecatedTrait.php +++ /dev/null @@ -1,246 +0,0 @@ -body($content); - } - - /** - * @param $method - * - * @return $this - * @throws ClientException - * @deprecated - * @codeCoverageIgnore - */ - public function setMethod($method) - { - return $this->method($method); - } - - /** - * @param $scheme - * - * @return $this - * @throws ClientException - * @deprecated - * @codeCoverageIgnore - */ - public function setProtocol($scheme) - { - return $this->scheme($scheme); - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getProtocolType() - { - return $this->uri->getScheme(); - } - - /** - * @param $scheme - * - * @return $this - * @throws ClientException - * @deprecated - * @codeCoverageIgnore - */ - public function setProtocolType($scheme) - { - return $this->scheme($scheme); - } - - /** - * @param $actionName - * - * @return $this - * @throws ClientException - * @deprecated - * @codeCoverageIgnore - */ - public function setActionName($actionName) - { - return $this->action($actionName); - } - - /** - * @param $format - * - * @return $this - * @throws ClientException - * @deprecated - * @codeCoverageIgnore - */ - public function setAcceptFormat($format) - { - return $this->format($format); - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getProtocol() - { - return $this->uri->getScheme(); - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getContent() - { - return isset($this->options['body']) - ? $this->options['body'] - : null; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getMethod() - { - return $this->method; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getHeaders() - { - return isset($this->options['headers']) - ? $this->options['headers'] - : []; - } - - /** - * @param $headerKey - * @param $headerValue - * - * @return $this - * @deprecated - * @codeCoverageIgnore - */ - public function addHeader($headerKey, $headerValue) - { - $this->options['headers'][$headerKey] = $headerValue; - - return $this; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getQueryParameters() - { - return isset($this->options['query']) - ? $this->options['query'] - : []; - } - - /** - * @param $name - * @param $value - * - * @return $this - * @deprecated - * @codeCoverageIgnore - */ - public function setQueryParameters($name, $value) - { - $this->options['query'][$name] = $value; - - return $this; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getDomainParameter() - { - return isset($this->options['form_params']) - ? $this->options['form_params'] - : []; - } - - /** - * @param $name - * @param $value - * - * @return $this - * @deprecated - * @codeCoverageIgnore - */ - public function putDomainParameters($name, $value) - { - $this->options['form_params'][$name] = $value; - - return $this; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getActionName() - { - return $this->action; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getAcceptFormat() - { - return $this->format; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getLocationEndpointType() - { - return $this->endpointType; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getLocationServiceCode() - { - return $this->serviceCode; - } -} diff --git a/vendor/alibabacloud/client/src/Request/Traits/RetryTrait.php b/vendor/alibabacloud/client/src/Request/Traits/RetryTrait.php deleted file mode 100644 index ff35b647..00000000 --- a/vendor/alibabacloud/client/src/Request/Traits/RetryTrait.php +++ /dev/null @@ -1,149 +0,0 @@ -serverRetry = ClientFilter::retry($times); - $this->serverRetryStrings = $strings; - $this->serverRetryStatusCodes = $statusCodes; - - return $this; - } - - /** - * @param int $times - * @param array $strings - * @param array $codes - * - * @return $this - * @throws ClientException - */ - public function retryByClient($times, array $strings, array $codes = []) - { - $this->clientRetry = ClientFilter::retry($times); - $this->clientRetryStrings = $strings; - $this->clientRetryStatusCodes = $codes; - - return $this; - } - - /** - * @param Result $result - * - * @return bool - */ - private function shouldServerRetry(Result $result) - { - if ($this->serverRetry <= 0) { - return false; - } - - if (in_array($result->getStatusCode(), $this->serverRetryStatusCodes)) { - $this->serverRetry--; - - return true; - } - - foreach ($this->serverRetryStrings as $message) { - if (Stringy::create($result->getBody())->contains($message)) { - $this->serverRetry--; - - return true; - } - } - - return false; - } - - /** - * @param Exception $exception - * - * @return bool - */ - private function shouldClientRetry(Exception $exception) - { - if ($this->clientRetry <= 0) { - return false; - } - - if (in_array($exception->getCode(), $this->clientRetryStatusCodes, true)) { - $this->clientRetry--; - - return true; - } - - foreach ($this->clientRetryStrings as $message) { - if (Stringy::create($exception->getMessage())->contains($message)) { - $this->clientRetry--; - - return true; - } - } - - return false; - } -} diff --git a/vendor/alibabacloud/client/src/Request/UserAgent.php b/vendor/alibabacloud/client/src/Request/UserAgent.php deleted file mode 100644 index beb32834..00000000 --- a/vendor/alibabacloud/client/src/Request/UserAgent.php +++ /dev/null @@ -1,142 +0,0 @@ - $value) { - if ($value === null) { - $newUserAgent[] = $key; - continue; - } - $newUserAgent[] = "$key/$value"; - } - - return $userAgent . \implode(' ', $newUserAgent); - } - - /** - * UserAgent constructor. - */ - private static function defaultFields() - { - if (self::$userAgent === []) { - self::$userAgent = [ - 'Client' => AlibabaCloud::VERSION, - 'PHP' => \PHP_VERSION, - ]; - } - } - - /** - * @param array $append - * - * @return array - */ - public static function clean(array $append) - { - foreach ($append as $key => $value) { - if (self::isGuarded($key)) { - unset($append[$key]); - continue; - } - } - - return $append; - } - - /** - * @param $name - * - * @return bool - */ - public static function isGuarded($name) - { - return in_array(strtolower($name), self::$guard, true); - } - - /** - * set User Agent of Alibaba Cloud. - * - * @param string $name - * @param string $value - * - * @throws ClientException - */ - public static function append($name, $value) - { - Filter::name($name); - Filter::value($value); - - self::defaultFields(); - - if (!self::isGuarded($name)) { - self::$userAgent[$name] = $value; - } - } - - /** - * @param array $userAgent - */ - public static function with(array $userAgent) - { - self::$userAgent = self::clean($userAgent); - } - - /** - * Clear all of the User Agent. - */ - public static function clear() - { - self::$userAgent = []; - } -} diff --git a/vendor/alibabacloud/client/src/Resolver/ActionResolverTrait.php b/vendor/alibabacloud/client/src/Resolver/ActionResolverTrait.php deleted file mode 100644 index f375567a..00000000 --- a/vendor/alibabacloud/client/src/Resolver/ActionResolverTrait.php +++ /dev/null @@ -1,50 +0,0 @@ -action) { - $array = explode('\\', get_class($this)); - $this->action = array_pop($array); - } - } - - /** - * Append SDK version into User-Agent - * - * @throws ClientException - * @throws ReflectionException - */ - private function appendSdkUA() - { - if (!(new ReflectionClass(AlibabaCloud::class))->hasMethod('appendUserAgent')) { - return; - } - - if (!class_exists('AlibabaCloud\Release')) { - return; - } - - AlibabaCloud::appendUserAgent('SDK', \AlibabaCloud\Release::VERSION); - } -} diff --git a/vendor/alibabacloud/client/src/Resolver/ApiResolver.php b/vendor/alibabacloud/client/src/Resolver/ApiResolver.php deleted file mode 100644 index 7a2bc2b6..00000000 --- a/vendor/alibabacloud/client/src/Resolver/ApiResolver.php +++ /dev/null @@ -1,113 +0,0 @@ -__call($name, $arguments); - } - - /** - * @param $api - * @param $arguments - * - * @return mixed - * @throws ClientException - */ - public function __call($api, $arguments) - { - $product_name = $this->getProductName(); - $class = $this->getNamespace() . '\\' . \ucfirst($api); - - if (\class_exists($class)) { - if (isset($arguments[0])) { - return $this->warpEndpoint(new $class($arguments[0])); - } - - return $this->warpEndpoint(new $class()); - } - - throw new ClientException( - "{$product_name} contains no $api", - 'SDK.ApiNotFound' - ); - } - - /** - * @param Request $request - * - * @return Request - */ - public function warpEndpoint(Request $request) - { - $reflect = new ReflectionObject($request); - $product_dir = dirname(dirname($reflect->getFileName())); - $endpoints_json = "$product_dir/endpoints.json"; - if (file_exists($endpoints_json)) { - $endpoints = json_decode(file_get_contents($endpoints_json), true); - if (isset($endpoints['endpoint_map'])) { - $request->endpointMap = $endpoints['endpoint_map']; - } - if (isset($endpoints['endpoint_regional'])) { - $request->endpointRegional = $endpoints['endpoint_regional']; - } - } - - return $request; - } - - /** - * @return mixed - * @throws ClientException - */ - private function getProductName() - { - $array = \explode('\\', \get_class($this)); - if (isset($array[3])) { - return str_replace('ApiResolver', '', $array[3]); - } - throw new ClientException( - 'Service name not found.', - 'SDK.ServiceNotFound' - ); - } - - /** - * @return string - * @throws ClientException - */ - private function getNamespace() - { - $array = \explode('\\', \get_class($this)); - - if (!isset($array[3])) { - throw new ClientException( - 'Get namespace error.', - 'SDK.ParseError' - ); - } - - unset($array[3]); - - return \implode('\\', $array); - } -} diff --git a/vendor/alibabacloud/client/src/Resolver/CallTrait.php b/vendor/alibabacloud/client/src/Resolver/CallTrait.php deleted file mode 100644 index 33afdce5..00000000 --- a/vendor/alibabacloud/client/src/Resolver/CallTrait.php +++ /dev/null @@ -1,67 +0,0 @@ -__get($parameter); - } - - if (strncmp($name, 'with', 4) === 0) { - $parameter = \mb_strcut($name, 4); - - $value = $this->getCallArguments($name, $arguments); - $this->data[$parameter] = $value; - $this->parameterPosition()[$parameter] = $value; - - return $this; - } - - if (strncmp($name, 'set', 3) === 0) { - $parameter = \mb_strcut($name, 3); - $with_method = "with$parameter"; - - return $this->$with_method($this->getCallArguments($name, $arguments)); - } - - throw new RuntimeException('Call to undefined method ' . __CLASS__ . '::' . $name . '()'); - } - - /** - * @param string $name - * @param array $arguments - * @param int $index - * - * @return mixed - */ - private function getCallArguments($name, array $arguments, $index = 0) - { - if (!isset($arguments[$index])) { - throw new ArgumentCountError("Missing arguments to method $name"); - } - - return $arguments[$index]; - } -} diff --git a/vendor/alibabacloud/client/src/Resolver/Roa.php b/vendor/alibabacloud/client/src/Resolver/Roa.php deleted file mode 100644 index 719cb0a7..00000000 --- a/vendor/alibabacloud/client/src/Resolver/Roa.php +++ /dev/null @@ -1,43 +0,0 @@ -resolveActionName(); - $this->appendSdkUA(); - } - - /** - * @return mixed - */ - private function ¶meterPosition() - { - return $this->pathParameters; - } -} diff --git a/vendor/alibabacloud/client/src/Resolver/Rpc.php b/vendor/alibabacloud/client/src/Resolver/Rpc.php deleted file mode 100644 index 0926ca4c..00000000 --- a/vendor/alibabacloud/client/src/Resolver/Rpc.php +++ /dev/null @@ -1,41 +0,0 @@ -resolveActionName(); - $this->appendSdkUA(); - } - - /** - * @return mixed - */ - private function ¶meterPosition() - { - return $this->options['query']; - } -} diff --git a/vendor/alibabacloud/client/src/Resolver/VersionResolver.php b/vendor/alibabacloud/client/src/Resolver/VersionResolver.php deleted file mode 100644 index cc66c644..00000000 --- a/vendor/alibabacloud/client/src/Resolver/VersionResolver.php +++ /dev/null @@ -1,73 +0,0 @@ -__call($name, $arguments); - } - - /** - * @param string $version - * @param array $arguments - * - * @return mixed - * @throws ClientException - */ - public function __call($version, $arguments) - { - $version = \ucfirst($version); - $product = $this->getProductName(); - - $position = strpos($product, 'Version'); - if ($position !== false && $position !== 0) { - $product = \str_replace('Version', '', $product); - } - - $class = "AlibabaCloud\\{$product}\\$version\\{$product}ApiResolver"; - - if (\class_exists($class)) { - return new $class(); - } - - throw new ClientException( - "$product Versions contains no {$version}", - 'SDK.VersionNotFound' - ); - } - - /** - * @return mixed - * @throws ClientException - */ - private function getProductName() - { - $array = \explode('\\', \get_class($this)); - - if (isset($array[1])) { - return $array[1]; - } - - throw new ClientException( - 'Service name not found.', - 'SDK.ServiceNotFound' - ); - } -} diff --git a/vendor/alibabacloud/client/src/Result/Result.php b/vendor/alibabacloud/client/src/Result/Result.php deleted file mode 100644 index 7c2910e7..00000000 --- a/vendor/alibabacloud/client/src/Result/Result.php +++ /dev/null @@ -1,151 +0,0 @@ -getStatusCode(), - $response->getHeaders(), - $response->getBody(), - $response->getProtocolVersion(), - $response->getReasonPhrase() - ); - - $this->request = $request; - - $this->resolveData(); - } - - private function resolveData() - { - $content = $this->getBody()->getContents(); - - switch ($this->getRequestFormat()) { - case 'JSON': - $result_data = $this->jsonToArray($content); - break; - case 'XML': - $result_data = $this->xmlToArray($content); - break; - case 'RAW': - $result_data = $this->jsonToArray($content); - break; - default: - $result_data = $this->jsonToArray($content); - } - - if (!$result_data) { - $result_data = []; - } - - $this->dot($result_data); - } - - /** - * @return string - */ - private function getRequestFormat() - { - return ($this->request instanceof Request) - ? \strtoupper($this->request->format) - : 'JSON'; - } - - /** - * @param string $response - * - * @return array - */ - private function jsonToArray($response) - { - try { - return \GuzzleHttp\json_decode($response, true); - } catch (InvalidArgumentException $exception) { - return []; - } - } - - /** - * @param string $string - * - * @return array - */ - private function xmlToArray($string) - { - try { - return json_decode(json_encode(simplexml_load_string($string)), true); - } catch (Exception $exception) { - return []; - } - } - - /** - * @return string - */ - public function __toString() - { - return (string)$this->getBody(); - } - - /** - * @return Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * @codeCoverageIgnore - * @return Response - * @deprecated - */ - public function getResponse() - { - return $this; - } - - /** - * @return bool - */ - public function isSuccess() - { - return 200 <= $this->getStatusCode() - && 300 > $this->getStatusCode(); - } -} diff --git a/vendor/alibabacloud/client/src/SDK.php b/vendor/alibabacloud/client/src/SDK.php deleted file mode 100644 index 8976cd0f..00000000 --- a/vendor/alibabacloud/client/src/SDK.php +++ /dev/null @@ -1,57 +0,0 @@ -getMessage(), - SDK::INVALID_CREDENTIAL - ); - } - - return base64_encode($binarySignature); - } -} diff --git a/vendor/alibabacloud/client/src/Signature/Signature.php b/vendor/alibabacloud/client/src/Signature/Signature.php deleted file mode 100644 index 3b01e692..00000000 --- a/vendor/alibabacloud/client/src/Signature/Signature.php +++ /dev/null @@ -1,49 +0,0 @@ -sign($string, $accessKeySecret); - - return "acs $accessKeyId:$signature"; - } - - /** - * @codeCoverageIgnore - * - * @param string $accessKeySecret - * @param string $method - * @param array $parameters - * - * @return string - */ - public function rpc($accessKeySecret, $method, array $parameters) - { - $string = Sign::rpcString($method, $parameters); - - return $this->sign($string, $accessKeySecret . '&'); - } -} diff --git a/vendor/alibabacloud/client/src/Signature/SignatureInterface.php b/vendor/alibabacloud/client/src/Signature/SignatureInterface.php deleted file mode 100644 index afa82c8f..00000000 --- a/vendor/alibabacloud/client/src/Signature/SignatureInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - $value) { - if (is_int($key)) { - $result[] = $value; - continue; - } - - if (isset($result[$key]) && is_array($result[$key])) { - $result[$key] = self::merge( - [$result[$key], $value] - ); - continue; - } - - $result[$key] = $value; - } - } - - return $result; - } -} diff --git a/vendor/alibabacloud/client/src/Support/Path.php b/vendor/alibabacloud/client/src/Support/Path.php deleted file mode 100644 index e1a64647..00000000 --- a/vendor/alibabacloud/client/src/Support/Path.php +++ /dev/null @@ -1,28 +0,0 @@ - $value) { - $pattern = str_replace("[$key]", $value, $pattern); - } - - return $pattern; - } -} diff --git a/vendor/alibabacloud/client/src/Support/Sign.php b/vendor/alibabacloud/client/src/Support/Sign.php deleted file mode 100644 index 450929f0..00000000 --- a/vendor/alibabacloud/client/src/Support/Sign.php +++ /dev/null @@ -1,140 +0,0 @@ - $headerValue) { - $key = strtolower($headerKey); - if (strncmp($key, 'x-acs-', 6) === 0) { - $array[$key] = $headerValue; - } - } - ksort($array); - $string = ''; - foreach ($array as $sortMapKey => $sortMapValue) { - $string .= $sortMapKey . ':' . $sortMapValue[0] . self::$headerSeparator; - } - - return $string; - } - - /** - * @param UriInterface $uri - * - * @return string - */ - private static function resourceString(UriInterface $uri) - { - return $uri->getPath() . '?' . rawurldecode($uri->getQuery()); - } - - /** - * @param string $method - * @param array $headers - * - * @return string - */ - private static function headerString($method, array $headers) - { - $string = $method . self::$headerSeparator; - if (isset($headers['Accept'][0])) { - $string .= $headers['Accept'][0]; - } - $string .= self::$headerSeparator; - - if (isset($headers['Content-MD5'][0])) { - $string .= $headers['Content-MD5'][0]; - } - $string .= self::$headerSeparator; - - if (isset($headers['Content-Type'][0])) { - $string .= $headers['Content-Type'][0]; - } - $string .= self::$headerSeparator; - - if (isset($headers['Date'][0])) { - $string .= $headers['Date'][0]; - } - $string .= self::$headerSeparator; - - $string .= self::acsHeaderString($headers); - - return $string; - } - - /** - * @param string $string - * - * @return null|string|string[] - */ - private static function percentEncode($string) - { - $result = urlencode($string); - $result = str_replace(['+', '*'], ['%20', '%2A'], $result); - $result = preg_replace('/%7E/', '~', $result); - - return $result; - } - - /** - * @param string $method - * @param array $parameters - * - * @return string - */ - public static function rpcString($method, array $parameters) - { - ksort($parameters); - $canonicalized = ''; - foreach ($parameters as $key => $value) { - $canonicalized .= '&' . self::percentEncode($key) . '=' . self::percentEncode($value); - } - - return $method . '&%2F&' . self::percentEncode(substr($canonicalized, 1)); - } - - /** - * @param Request $request - * - * @return string - */ - public static function roaString(Request $request) - { - return self::headerString($request->getMethod(), $request->getHeaders()) . - self::resourceString($request->getUri()); - } - - /** - * @param string $salt - * - * @return string - */ - public static function uuid($salt) - { - return md5($salt . uniqid(md5(microtime(true)), true)); - } -} diff --git a/vendor/alibabacloud/client/src/Traits/ArrayAccessTrait.php b/vendor/alibabacloud/client/src/Traits/ArrayAccessTrait.php deleted file mode 100644 index d6f69084..00000000 --- a/vendor/alibabacloud/client/src/Traits/ArrayAccessTrait.php +++ /dev/null @@ -1,57 +0,0 @@ -data[$offset])) { - return $this->data[$offset]; - } - - $value = null; - - return $value; - } - - /** - * @param string $offset - * @param string|mixed $value - */ - public function offsetSet($offset, $value) - { - $this->data[$offset] = $value; - } - - /** - * @param string $offset - * - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->data[$offset]); - } - - /** - * @param string $offset - */ - public function offsetUnset($offset) - { - unset($this->data[$offset]); - } -} diff --git a/vendor/alibabacloud/client/src/Traits/ClientTrait.php b/vendor/alibabacloud/client/src/Traits/ClientTrait.php deleted file mode 100644 index 2336d177..00000000 --- a/vendor/alibabacloud/client/src/Traits/ClientTrait.php +++ /dev/null @@ -1,273 +0,0 @@ -load(); - } - $list = []; - foreach (\func_get_args() as $filename) { - $list[$filename] = (new IniCredential($filename))->load(); - } - - return $list; - } - - /** - * Custom Client. - * - * @param CredentialsInterface $credentials - * @param SignatureInterface $signature - * - * @return Client - */ - public static function client(CredentialsInterface $credentials, SignatureInterface $signature) - { - return new Client($credentials, $signature); - } - - /** - * Use the AccessKey to complete the authentication. - * - * @param string $accessKeyId - * @param string $accessKeySecret - * - * @return AccessKeyClient - * @throws ClientException - */ - public static function accessKeyClient($accessKeyId, $accessKeySecret) - { - if (strpos($accessKeyId, ' ') !== false) { - throw new ClientException( - 'AccessKey ID format is invalid', - SDK::INVALID_ARGUMENT - ); - } - - if (strpos($accessKeySecret, ' ') !== false) { - throw new ClientException( - 'AccessKey Secret format is invalid', - SDK::INVALID_ARGUMENT - ); - } - - return new AccessKeyClient($accessKeyId, $accessKeySecret); - } - - /** - * Use the AssumeRole of the RAM account to complete the authentication. - * - * @param string $accessKeyId - * @param string $accessKeySecret - * @param string $roleArn - * @param string $roleSessionName - * @param string|array $policy - * - * @return RamRoleArnClient - * @throws ClientException - */ - public static function ramRoleArnClient($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName, $policy = '') - { - return new RamRoleArnClient($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName, $policy); - } - - /** - * Use the RAM role of an ECS instance to complete the authentication. - * - * @param string $roleName - * - * @return EcsRamRoleClient - * @throws ClientException - */ - public static function ecsRamRoleClient($roleName) - { - return new EcsRamRoleClient($roleName); - } - - /** - * Use the Bearer Token to complete the authentication. - * - * @param string $bearerToken - * - * @return BearerTokenClient - * @throws ClientException - */ - public static function bearerTokenClient($bearerToken) - { - return new BearerTokenClient($bearerToken); - } - - /** - * Use the STS Token to complete the authentication. - * - * @param string $accessKeyId Access key ID - * @param string $accessKeySecret Access Key Secret - * @param string $securityToken Security Token - * - * @return StsClient - * @throws ClientException - */ - public static function stsClient($accessKeyId, $accessKeySecret, $securityToken = '') - { - return new StsClient($accessKeyId, $accessKeySecret, $securityToken); - } - - /** - * Use the RSA key pair to complete the authentication (supported only on Japanese site) - * - * @param string $publicKeyId - * @param string $privateKeyFile - * - * @return RsaKeyPairClient - * @throws ClientException - */ - public static function rsaKeyPairClient($publicKeyId, $privateKeyFile) - { - return new RsaKeyPairClient($publicKeyId, $privateKeyFile); - } -} diff --git a/vendor/alibabacloud/client/src/Traits/DefaultRegionTrait.php b/vendor/alibabacloud/client/src/Traits/DefaultRegionTrait.php deleted file mode 100644 index 5d5c75a9..00000000 --- a/vendor/alibabacloud/client/src/Traits/DefaultRegionTrait.php +++ /dev/null @@ -1,66 +0,0 @@ -realRegionId(); - $network = $request->network ?: 'public'; - $suffix = $request->endpointSuffix; - if ($network === 'public') { - $network = ''; - } - - if ($request->endpointRegional === 'regional') { - return "{$request->product}{$suffix}{$network}.{$regionId}.aliyuncs.com"; - } - - if ($request->endpointRegional === 'central') { - return "{$request->product}{$suffix}{$network}.aliyuncs.com"; - } - - throw new InvalidArgumentException('endpointRegional is invalid.'); - } -} diff --git a/vendor/alibabacloud/client/src/Traits/HasDataTrait.php b/vendor/alibabacloud/client/src/Traits/HasDataTrait.php deleted file mode 100644 index 81a03eaf..00000000 --- a/vendor/alibabacloud/client/src/Traits/HasDataTrait.php +++ /dev/null @@ -1,317 +0,0 @@ -dot->all()); - } - - /** - * Delete the contents of a given key or keys - * - * @param array|int|string|null $keys - */ - public function clear($keys = null) - { - $this->dot->clear($keys); - } - - /** - * Flatten an array with the given character as a key delimiter - * - * @param string $delimiter - * @param array|null $items - * @param string $prepend - * - * @return array - */ - public function flatten($delimiter = '.', $items = null, $prepend = '') - { - return $this->dot->flatten($delimiter, $items, $prepend); - } - - /** - * Return the value of a given key - * - * @param int|string|null $key - * @param mixed $default - * - * @return mixed - */ - public function get($key = null, $default = null) - { - return $this->dot->get($key, $default); - } - - /** - * Set a given key / value pair or pairs - * - * @param array|int|string $keys - * @param mixed $value - */ - public function set($keys, $value = null) - { - $this->dot->set($keys, $value); - } - - /** - * Check if a given key or keys are empty - * - * @param array|int|string|null $keys - * - * @return bool - */ - public function isEmpty($keys = null) - { - return $this->dot->isEmpty($keys); - } - - /** - * Replace all items with a given array as a reference - * - * @param array $items - */ - public function setReference(array &$items) - { - $this->dot->setReference($items); - } - - /** - * Return the value of a given key or all the values as JSON - * - * @param mixed $key - * @param int $options - * - * @return string - */ - public function toJson($key = null, $options = 0) - { - return $this->dot->toJson($key, $options); - } - - /** - * @return array - */ - public function toArray() - { - return $this->dot->all(); - } - - /** - * Check if a given key exists - * - * @param int|string $key - * - * @return bool - */ - public function offsetExists($key) - { - return $this->dot->has($key); - } - - /** - * Return the value of a given key - * - * @param int|string $key - * - * @return mixed - */ - public function offsetGet($key) - { - return $this->dot->offsetGet($key); - } - - /** - * Set a given value to the given key - * - * @param int|string|null $key - * @param mixed $value - */ - public function offsetSet($key, $value) - { - $this->dot->offsetSet($key, $value); - } - - /** - * Delete the given key - * - * @param int|string $key - */ - public function offsetUnset($key) - { - $this->delete($key); - } - - /** - * Delete the given key or keys - * - * @param array|int|string $keys - */ - public function delete($keys) - { - $this->dot->delete($keys); - } - - /* - * -------------------------------------------------------------- - * ArrayAccess interface - * -------------------------------------------------------------- - */ - - /** - * Return the number of items in a given key - * - * @param int|string|null $key - * - * @return int - */ - public function count($key = null) - { - return $this->dot->count($key); - } - - /** - * Get an iterator for the stored items - * - * @return ArrayIterator - */ - public function getIterator() - { - return $this->dot->getIterator(); - } - - /** - * Return items for JSON serialization - * - * @return array - */ - public function jsonSerialize() - { - return $this->dot->jsonSerialize(); - } - - /** - * @param string $name - * - * @return mixed|null - */ - public function __get($name) - { - if (!isset($this->all()[$name])) { - return null; - } - - return \json_decode(\json_encode($this->all()))->$name; - } - - /* - * -------------------------------------------------------------- - * Countable interface - * -------------------------------------------------------------- - */ - - /** - * Return all the stored items - * - * @return array - */ - public function all() - { - return $this->dot->all(); - } - - /** - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - $this->add($name, $value); - } - - /** - * Set a given key / value pair or pairs - * if the key doesn't exist already - * - * @param array|int|string $keys - * @param mixed $value - */ - public function add($keys, $value = null) - { - $this->dot->add($keys, $value); - } - - - /* - * -------------------------------------------------------------- - * ObjectAccess - * -------------------------------------------------------------- - */ - - /** - * @param string $name - * - * @return bool - */ - public function __isset($name) - { - return $this->has($name); - } - - /** - * Check if a given key or keys exists - * - * @param array|int|string $keys - * - * @return bool - */ - public function has($keys) - { - return $this->dot->has($keys); - } - - /** - * @param $name - * - * @return void - */ - public function __unset($name) - { - $this->delete($name); - } - - /** - * @param array $data - */ - protected function dot(array $data = []) - { - $this->dot = new Dot($data); - } -} diff --git a/vendor/alibabacloud/client/src/Traits/HistoryTrait.php b/vendor/alibabacloud/client/src/Traits/HistoryTrait.php deleted file mode 100644 index f70bb1d4..00000000 --- a/vendor/alibabacloud/client/src/Traits/HistoryTrait.php +++ /dev/null @@ -1,68 +0,0 @@ -options['timeout'] = ClientFilter::timeout($seconds); - - return $this; - } - - /** - * @param int $milliseconds - * - * @return $this - * @throws ClientException - */ - public function timeoutMilliseconds($milliseconds) - { - ClientFilter::milliseconds($milliseconds); - $seconds = $milliseconds / 1000; - - return $this->timeout($seconds); - } - - /** - * @param int|float $seconds - * - * @return $this - * @throws ClientException - */ - public function connectTimeout($seconds) - { - $this->options['connect_timeout'] = ClientFilter::connectTimeout($seconds); - - return $this; - } - - /** - * @param int $milliseconds - * - * @return $this - * @throws ClientException - */ - public function connectTimeoutMilliseconds($milliseconds) - { - ClientFilter::milliseconds($milliseconds); - $seconds = $milliseconds / 1000; - - return $this->connectTimeout($seconds); - } - - /** - * @param bool $debug - * - * @return $this - */ - public function debug($debug) - { - $this->options['debug'] = $debug; - - return $this; - } - - /** - * @codeCoverageIgnore - * - * @param array $cert - * - * @return $this - */ - public function cert($cert) - { - $this->options['cert'] = $cert; - - return $this; - } - - /** - * @codeCoverageIgnore - * - * @param array|string $proxy - * - * @return $this - */ - public function proxy($proxy) - { - $this->options['proxy'] = $proxy; - - return $this; - } - - /** - * @param mixed $verify - * - * @return $this - */ - public function verify($verify) - { - $this->options['verify'] = $verify; - - return $this; - } - - /** - * @param array $options - * - * @return $this - */ - public function options(array $options) - { - if ($options !== []) { - $this->options = Arrays::merge([$this->options, $options]); - } - - return $this; - } -} diff --git a/vendor/alibabacloud/client/src/Traits/LogTrait.php b/vendor/alibabacloud/client/src/Traits/LogTrait.php deleted file mode 100644 index c2b778fb..00000000 --- a/vendor/alibabacloud/client/src/Traits/LogTrait.php +++ /dev/null @@ -1,64 +0,0 @@ -data[$name])) { - return null; - } - - return \json_decode(\json_encode($this->data))->$name; - } - - /** - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - $this->data[$name] = $value; - } - - /** - * @param string $name - * - * @return bool - */ - public function __isset($name) - { - return isset($this->data[$name]); - } - - /** - * @param $name - * - * @return void - */ - public function __unset($name) - { - unset($this->data[$name]); - } -} diff --git a/vendor/alibabacloud/client/src/Traits/RegionTrait.php b/vendor/alibabacloud/client/src/Traits/RegionTrait.php deleted file mode 100644 index da6bee43..00000000 --- a/vendor/alibabacloud/client/src/Traits/RegionTrait.php +++ /dev/null @@ -1,33 +0,0 @@ -regionId = ClientFilter::regionId($regionId); - - return $this; - } -} diff --git a/vendor/alibabacloud/client/src/Traits/RequestTrait.php b/vendor/alibabacloud/client/src/Traits/RequestTrait.php deleted file mode 100644 index afcb9a4e..00000000 --- a/vendor/alibabacloud/client/src/Traits/RequestTrait.php +++ /dev/null @@ -1,90 +0,0 @@ -"; ; -$accessKeySecret = "<您从OSS获得的AccessKeySecret>"; -$endpoint = "<您选定的OSS数据中心访问域名,例如oss-cn-hangzhou.aliyuncs.com>"; -try { - $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint); -} catch (OssException $e) { - print $e->getMessage(); -} -``` - -### 文件操作 - -文件(又称对象,Object)是OSS中最基本的数据单元,您可以把它简单地理解为文件,用下面代码可以实现一个Object的上传: - -```php -"; -$object = "<您使用的Object名字,注意命名规范>"; -$content = "Hello, OSS!"; // 上传的文件内容 -try { - $ossClient->putObject($bucket, $object, $content); -} catch (OssException $e) { - print $e->getMessage(); -} -``` - -### 存储空间操作 - -存储空间(又称Bucket)是一个用户用来管理所存储Object的存储空间,对于用户来说是一个管理Object的单元,所有的Object都必须隶属于某个Bucket。您可以按照下面的代码新建一个Bucket: - -```php -"; -try { - $ossClient->createBucket($bucket); -} catch (OssException $e) { - print $e->getMessage(); -} -``` - -### 返回结果处理 - -OssClient提供的接口返回返回数据分为两种: - -* Put,Delete类接口,接口返回null,如果没有OssException,即可认为操作成功 -* Get,List类接口,接口返回对应的数据,如果没有OssException,即可认为操作成功,举个例子: - -```php -listBuckets(); -$bucketList = $bucketListInfo->getBucketList(); -foreach($bucketList as $bucket) { - print($bucket->getLocation() . "\t" . $bucket->getName() . "\t" . $bucket->getCreatedate() . "\n"); -} -``` -上面代码中的$bucketListInfo的数据类型是 `OSS\Model\BucketListInfo` - - -### 运行Sample程序 - -1. 修改 `samples/Config.php`, 补充配置信息 -2. 执行 `cd samples/ && php RunAll.php` - -### 运行单元测试 - -1. 执行`composer install`下载依赖的库 -2. 设置环境变量 - - export OSS_ACCESS_KEY_ID=access-key-id - export OSS_ACCESS_KEY_SECRET=access-key-secret - export OSS_ENDPOINT=endpoint - export OSS_BUCKET=bucket-name - -3. 执行 `php vendor/bin/phpunit` - -## License - -- MIT - -## 联系我们 - -- [阿里云OSS官方网站](http://oss.aliyun.com) -- [阿里云OSS官方论坛](http://bbs.aliyun.com) -- [阿里云OSS官方文档中心](http://www.aliyun.com/product/oss#Docs) -- 阿里云官方技术支持:[提交工单](https://workorder.console.aliyun.com/#/ticket/createIndex) - -[releases-page]: https://github.com/aliyun/aliyun-oss-php-sdk/releases -[phar-composer]: https://github.com/clue/phar-composer diff --git a/vendor/aliyuncs/oss-sdk-php/README.md b/vendor/aliyuncs/oss-sdk-php/README.md deleted file mode 100644 index 3c1da263..00000000 --- a/vendor/aliyuncs/oss-sdk-php/README.md +++ /dev/null @@ -1,150 +0,0 @@ -# Alibaba Cloud OSS SDK for PHP - -[![Latest Stable Version](https://poser.pugx.org/aliyuncs/oss-sdk-php/v/stable)](https://packagist.org/packages/aliyuncs/oss-sdk-php) -[![Build Status](https://travis-ci.org/aliyun/aliyun-oss-php-sdk.svg?branch=master)](https://travis-ci.org/aliyun/aliyun-oss-php-sdk) -[![Coverage Status](https://coveralls.io/repos/github/aliyun/aliyun-oss-php-sdk/badge.svg?branch=master)](https://coveralls.io/github/aliyun/aliyun-oss-php-sdk?branch=master) - -## [README of Chinese](https://github.com/aliyun/aliyun-oss-php-sdk/blob/master/README-CN.md) - -## Overview - -Alibaba Cloud Object Storage Service (OSS) is a cloud storage service provided by Alibaba Cloud, featuring a massive capacity, security, a low cost, and high reliability. You can upload and download data on any application anytime and anywhere by calling APIs, and perform simple management of data through the web console. The OSS can store any type of files and therefore applies to various websites, development enterprises and developers. - - -## Run environment -- PHP 5.3+. -- cURL extension. - -Tips: - -- In Ubuntu, you can use the ***apt-get*** package manager to install the *PHP cURL extension*: `sudo apt-get install php5-curl`. - -## Install OSS PHP SDK - -- If you use the ***composer*** to manage project dependencies, run the following command in your project's root directory: - - composer require aliyuncs/oss-sdk-php - - You can also declare the dependency on Alibaba Cloud OSS SDK for PHP in the `composer.json` file. - - "require": { - "aliyuncs/oss-sdk-php": "~2.0" - } - - Then run `composer install` to install the dependency. After the Composer Dependency Manager is installed, import the dependency in your PHP code: - - require_once __DIR__ . '/vendor/autoload.php'; - -- You can also directly download the packaged [PHAR File][releases-page], and - introduce the file to your code: - - require_once '/path/to/oss-sdk-php.phar'; - -- Download the SDK source code, and introduce the `autoload.php` file under the SDK directory to your code: - - require_once '/path/to/oss-sdk/autoload.php'; - -## Quick use - -### Common classes - -| Class | Explanation | -|:------------------|:------------------------------------| -|OSS\OSSClient | OSS client class. An OSSClient instance can be used to call the interface. | -|OSS\Core\OSSException |OSS Exception class . You only need to pay attention to this exception when you use the OSSClient. | - -### Initialize an OSSClient - -The SDK's operations for the OSS are performed through the OSSClient class. The code below creates an OSSClient object: - -```php -"; -$accessKeySecret = ""; -$endpoint = ""; -try { - $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint); -} catch (OssException $e) { - print $e->getMessage(); -} -``` - -### Operations on objects - -Objects are the most basic data units on the OSS. You can simply consider objects as files. The following code uploads an object: - -```php -"; -$object = ""; -$content = "Hello, OSS!"; // Content of the uploaded file -try { - $ossClient->putObject($bucket, $object, $content); -} catch (OssException $e) { - print $e->getMessage(); -} -``` - -### Operations on buckets - -Buckets are the space that you use to manage the stored objects. It is an object management unit for users. Each object must belong to a bucket. You can create a bucket with the following code: - -```php -"; -try { - $ossClient->createBucket($bucket); -} catch (OssException $e) { - print $e->getMessage(); -} -``` - -### Handle returned results - -The OSSClient provides the following two types of returned data from interfaces: - -- Put and Delete interfaces: The *PUT* and *DELETE* operations are deemed successful if *null* is returned by the interfaces without *OSSException*. -- Get and List interfaces: The *GET* and *LIST* operations are deemed successful if the desired data is returned by the interfaces without *OSSException*. For example, - - ```php - listBuckets(); - $bucketList = $bucketListInfo->getBucketList(); - foreach($bucketList as $bucket) { - print($bucket->getLocation() . "\t" . $bucket->getName() . "\t" . $bucket->getCreatedate() . "\n"); - } - ``` -In the above code, $bucketListInfo falls into the 'OSS\Model\BucketListInfo' data type. - - -### Run a sample project - -- Modify `samples/Config.php` to complete the configuration information. -- Run `cd samples/ && php RunAll.php`. - -### Run a unit test - -- Run `composer install` to download the dependent libraries. -- Set the environment variable. - - export OSS_ACCESS_KEY_ID=access-key-id - export OSS_ACCESS_KEY_SECRET=access-key-secret - export OSS_ENDPOINT=endpoint - export OSS_BUCKET=bucket-name - -- Run `php vendor/bin/phpunit` - -## License - -- MIT - -## Contact us - -- [Alibaba Cloud OSS official website](http://oss.aliyun.com). -- [Alibaba Cloud OSS official forum](http://bbs.aliyun.com). -- [Alibaba Cloud OSS official documentation center](http://www.aliyun.com/product/oss#Docs). -- Alibaba Cloud official technical support: [Submit a ticket](https://workorder.console.aliyun.com/#/ticket/createIndex). - -[releases-page]: https://github.com/aliyun/aliyun-oss-php-sdk/releases -[phar-composer]: https://github.com/clue/phar-composer - diff --git a/vendor/aliyuncs/oss-sdk-php/autoload.php b/vendor/aliyuncs/oss-sdk-php/autoload.php deleted file mode 100644 index ec132011..00000000 --- a/vendor/aliyuncs/oss-sdk-php/autoload.php +++ /dev/null @@ -1,11 +0,0 @@ -=5.3" - }, - "require-dev" : { - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "~1.0" - }, - "minimum-stability": "stable", - "autoload": { - "psr-4": {"OSS\\": "src/OSS"} - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/example.jpg b/vendor/aliyuncs/oss-sdk-php/example.jpg deleted file mode 100644 index ffd46a2f..00000000 Binary files a/vendor/aliyuncs/oss-sdk-php/example.jpg and /dev/null differ diff --git a/vendor/aliyuncs/oss-sdk-php/index.php b/vendor/aliyuncs/oss-sdk-php/index.php deleted file mode 100644 index cdc28bc1..00000000 --- a/vendor/aliyuncs/oss-sdk-php/index.php +++ /dev/null @@ -1,3 +0,0 @@ - - - - - - - ./src - - - - - - - - ./tests - ./tests/OSS/Tests/BucketCnameTest.php - - - diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Bucket.php b/vendor/aliyuncs/oss-sdk-php/samples/Bucket.php deleted file mode 100644 index bd16e655..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/Bucket.php +++ /dev/null @@ -1,167 +0,0 @@ -createBucket($bucket, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE); -Common::println("bucket $bucket created"); - -// 判断Bucket是否存在 -$doesExist = $ossClient->doesBucketExist($bucket); -Common::println("bucket $bucket exist? " . ($doesExist ? "yes" : "no")); - -// 获取Bucket列表 -$bucketListInfo = $ossClient->listBuckets(); - -// 设置bucket的ACL -$ossClient->putBucketAcl($bucket, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE); -Common::println("bucket $bucket acl put"); -// 获取bucket的ACL -$acl = $ossClient->getBucketAcl($bucket); -Common::println("bucket $bucket acl get: " . $acl); - - -//******************************* 完整用法参考下面函数 **************************************************** - -createBucket($ossClient, $bucket); -doesBucketExist($ossClient, $bucket); -deleteBucket($ossClient, $bucket); -putBucketAcl($ossClient, $bucket); -getBucketAcl($ossClient, $bucket); -listBuckets($ossClient); - -/** - * 创建一个存储空间 - * acl 指的是bucket的访问控制权限,有三种,私有读写,公共读私有写,公共读写。 - * 私有读写就是只有bucket的拥有者或授权用户才有权限操作 - * 三种权限分别对应 (OssClient::OSS_ACL_TYPE_PRIVATE,OssClient::OSS_ACL_TYPE_PUBLIC_READ, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE) - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 要创建的存储空间名称 - * @return null - */ -function createBucket($ossClient, $bucket) -{ - try { - $ossClient->createBucket($bucket, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 判断Bucket是否存在 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - */ -function doesBucketExist($ossClient, $bucket) -{ - try { - $res = $ossClient->doesBucketExist($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - if ($res === true) { - print(__FUNCTION__ . ": OK" . "\n"); - } else { - print(__FUNCTION__ . ": FAILED" . "\n"); - } -} - -/** - * 删除bucket,如果bucket不为空则bucket无法删除成功, 不为空表示bucket既没有object,也没有未完成的multipart上传时的parts - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 待删除的存储空间名称 - * @return null - */ -function deleteBucket($ossClient, $bucket) -{ - try { - $ossClient->deleteBucket($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 设置bucket的acl配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function putBucketAcl($ossClient, $bucket) -{ - $acl = OssClient::OSS_ACL_TYPE_PRIVATE; - try { - $ossClient->putBucketAcl($bucket, $acl); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - - -/** - * 获取bucket的acl配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getBucketAcl($ossClient, $bucket) -{ - try { - $res = $ossClient->getBucketAcl($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - print('acl: ' . $res); -} - - -/** - * 列出用户所有的Bucket - * - * @param OssClient $ossClient OssClient实例 - * @return null - */ -function listBuckets($ossClient) -{ - $bucketList = null; - try { - $bucketListInfo = $ossClient->listBuckets(); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - $bucketList = $bucketListInfo->getBucketList(); - foreach ($bucketList as $bucket) { - print($bucket->getLocation() . "\t" . $bucket->getName() . "\t" . $bucket->getCreatedate() . "\n"); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketCors.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketCors.php deleted file mode 100644 index cc5c0b9c..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketCors.php +++ /dev/null @@ -1,108 +0,0 @@ -addAllowedHeader("x-oss-header"); -$rule->addAllowedOrigin("http://www.b.com"); -$rule->addAllowedMethod("POST"); -$rule->setMaxAgeSeconds(10); -$corsConfig->addRule($rule); -$ossClient->putBucketCors($bucket, $corsConfig); -Common::println("bucket $bucket corsConfig created:" . $corsConfig->serializeToXml()); - -// 获取cors配置 -$corsConfig = $ossClient->getBucketCors($bucket); -Common::println("bucket $bucket corsConfig fetched:" . $corsConfig->serializeToXml()); - -// 删除cors配置 -$ossClient->deleteBucketCors($bucket); -Common::println("bucket $bucket corsConfig deleted"); - -//******************************* 完整用法参考下面函数 ***************************************************** - -putBucketCors($ossClient, $bucket); -getBucketCors($ossClient, $bucket); -deleteBucketCors($ossClient, $bucket); -getBucketCors($ossClient, $bucket); - -/** - * 设置bucket的cors配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function putBucketCors($ossClient, $bucket) -{ - $corsConfig = new CorsConfig(); - $rule = new CorsRule(); - $rule->addAllowedHeader("x-oss-header"); - $rule->addAllowedOrigin("http://www.b.com"); - $rule->addAllowedMethod("POST"); - $rule->setMaxAgeSeconds(10); - $corsConfig->addRule($rule); - - try { - $ossClient->putBucketCors($bucket, $corsConfig); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 获取并打印bucket的cors配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getBucketCors($ossClient, $bucket) -{ - $corsConfig = null; - try { - $corsConfig = $ossClient->getBucketCors($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - print($corsConfig->serializeToXml() . "\n"); -} - -/** - * 删除bucket的所有的cors配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function deleteBucketCors($ossClient, $bucket) -{ - try { - $ossClient->deleteBucketCors($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketLifecycle.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketLifecycle.php deleted file mode 100644 index ec0c37f8..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketLifecycle.php +++ /dev/null @@ -1,109 +0,0 @@ -addRule($lifecycleRule); -$ossClient->putBucketLifecycle($bucket, $lifecycleConfig); -Common::println("bucket $bucket lifecycleConfig created:" . $lifecycleConfig->serializeToXml()); - -//获取lifecycle规则 -$lifecycleConfig = $ossClient->getBucketLifecycle($bucket); -Common::println("bucket $bucket lifecycleConfig fetched:" . $lifecycleConfig->serializeToXml()); - -//删除bucket的lifecycle配置 -$ossClient->deleteBucketLifecycle($bucket); -Common::println("bucket $bucket lifecycleConfig deleted"); - - -//***************************** 完整用法参考下面函数 *********************************************** - -putBucketLifecycle($ossClient, $bucket); -getBucketLifecycle($ossClient, $bucket); -deleteBucketLifecycle($ossClient, $bucket); -getBucketLifecycle($ossClient, $bucket); - -/** - * 设置bucket的生命周期配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function putBucketLifecycle($ossClient, $bucket) -{ - $lifecycleConfig = new LifecycleConfig(); - $actions = array(); - $actions[] = new LifecycleAction(OssClient::OSS_LIFECYCLE_EXPIRATION, OssClient::OSS_LIFECYCLE_TIMING_DAYS, 3); - $lifecycleRule = new LifecycleRule("delete obsoleted files", "obsoleted/", "Enabled", $actions); - $lifecycleConfig->addRule($lifecycleRule); - $actions = array(); - $actions[] = new LifecycleAction(OssClient::OSS_LIFECYCLE_EXPIRATION, OssClient::OSS_LIFECYCLE_TIMING_DATE, '2022-10-12T00:00:00.000Z'); - $lifecycleRule = new LifecycleRule("delete temporary files", "temporary/", "Enabled", $actions); - $lifecycleConfig->addRule($lifecycleRule); - try { - $ossClient->putBucketLifecycle($bucket, $lifecycleConfig); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 获取bucket的生命周期配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getBucketLifecycle($ossClient, $bucket) -{ - $lifecycleConfig = null; - try { - $lifecycleConfig = $ossClient->getBucketLifecycle($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - print($lifecycleConfig->serializeToXml() . "\n"); -} - -/** - * 删除bucket的生命周期配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function deleteBucketLifecycle($ossClient, $bucket) -{ - try { - $ossClient->deleteBucketLifecycle($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - - diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketLogging.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketLogging.php deleted file mode 100644 index 406e1d47..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketLogging.php +++ /dev/null @@ -1,95 +0,0 @@ -putBucketLogging($bucket, $bucket, "access.log", array()); -Common::println("bucket $bucket lifecycleConfig created"); - -// 获取Bucket访问日志记录规则 -$loggingConfig = $ossClient->getBucketLogging($bucket, array()); -Common::println("bucket $bucket lifecycleConfig fetched:" . $loggingConfig->serializeToXml()); - -// 删除Bucket访问日志记录规则 -$loggingConfig = $ossClient->getBucketLogging($bucket, array()); -Common::println("bucket $bucket lifecycleConfig deleted"); - -//******************************* 完整用法参考下面函数 **************************************************** - -putBucketLogging($ossClient, $bucket); -getBucketLogging($ossClient, $bucket); -deleteBucketLogging($ossClient, $bucket); -getBucketLogging($ossClient, $bucket); - -/** - * 设置bucket的Logging配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function putBucketLogging($ossClient, $bucket) -{ - $option = array(); - //访问日志存放在本bucket下 - $targetBucket = $bucket; - $targetPrefix = "access.log"; - - try { - $ossClient->putBucketLogging($bucket, $targetBucket, $targetPrefix, $option); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 获取bucket的Logging配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getBucketLogging($ossClient, $bucket) -{ - $loggingConfig = null; - $options = array(); - try { - $loggingConfig = $ossClient->getBucketLogging($bucket, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - print($loggingConfig->serializeToXml() . "\n"); -} - -/** - * 删除bucket的Logging配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function deleteBucketLogging($ossClient, $bucket) -{ - try { - $ossClient->deleteBucketLogging($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketReferer.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketReferer.php deleted file mode 100644 index 3828df69..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketReferer.php +++ /dev/null @@ -1,101 +0,0 @@ -setAllowEmptyReferer(true); -$refererConfig->addReferer("www.aliiyun.com"); -$refererConfig->addReferer("www.aliiyuncs.com"); -$ossClient->putBucketReferer($bucket, $refererConfig); -Common::println("bucket $bucket refererConfig created:" . $refererConfig->serializeToXml()); -//获取Referer白名单 -$refererConfig = $ossClient->getBucketReferer($bucket); -Common::println("bucket $bucket refererConfig fetched:" . $refererConfig->serializeToXml()); - -//删除referer白名单 -$refererConfig = new RefererConfig(); -$ossClient->putBucketReferer($bucket, $refererConfig); -Common::println("bucket $bucket refererConfig deleted"); - - -//******************************* 完整用法参考下面函数 **************************************************** - -putBucketReferer($ossClient, $bucket); -getBucketReferer($ossClient, $bucket); -deleteBucketReferer($ossClient, $bucket); -getBucketReferer($ossClient, $bucket); - -/** - * 设置bucket的防盗链配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function putBucketReferer($ossClient, $bucket) -{ - $refererConfig = new RefererConfig(); - $refererConfig->setAllowEmptyReferer(true); - $refererConfig->addReferer("www.aliiyun.com"); - $refererConfig->addReferer("www.aliiyuncs.com"); - try { - $ossClient->putBucketReferer($bucket, $refererConfig); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 获取bucket的防盗链配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getBucketReferer($ossClient, $bucket) -{ - $refererConfig = null; - try { - $refererConfig = $ossClient->getBucketReferer($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - print($refererConfig->serializeToXml() . "\n"); -} - -/** - * 删除bucket的防盗链配置 - * Referer白名单不能直接清空,只能通过重新设置来覆盖之前的规则。 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function deleteBucketReferer($ossClient, $bucket) -{ - $refererConfig = new RefererConfig(); - try { - $ossClient->putBucketReferer($bucket, $refererConfig); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketWebsite.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketWebsite.php deleted file mode 100644 index 54706f83..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketWebsite.php +++ /dev/null @@ -1,92 +0,0 @@ -putBucketWebsite($bucket, $websiteConfig); -Common::println("bucket $bucket websiteConfig created:" . $websiteConfig->serializeToXml()); - -// 查看Bucket的静态网站托管状态 -$websiteConfig = $ossClient->getBucketWebsite($bucket); -Common::println("bucket $bucket websiteConfig fetched:" . $websiteConfig->serializeToXml()); - -// 删除Bucket的静态网站托管模式 -$ossClient->deleteBucketWebsite($bucket); -Common::println("bucket $bucket websiteConfig deleted"); - -//******************************* 完整用法参考下面函数 **************************************************** - -putBucketWebsite($ossClient, $bucket); -getBucketWebsite($ossClient, $bucket); -deleteBucketWebsite($ossClient, $bucket); -getBucketWebsite($ossClient, $bucket); - -/** - * 设置bucket的静态网站托管模式配置 - * - * @param $ossClient OssClient - * @param $bucket string 存储空间名称 - * @return null - */ -function putBucketWebsite($ossClient, $bucket) -{ - $websiteConfig = new WebsiteConfig("index.html", "error.html"); - try { - $ossClient->putBucketWebsite($bucket, $websiteConfig); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 获取bucket的静态网站托管状态 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getBucketWebsite($ossClient, $bucket) -{ - $websiteConfig = null; - try { - $websiteConfig = $ossClient->getBucketWebsite($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - print($websiteConfig->serializeToXml() . "\n"); -} - -/** - * 删除bucket的静态网站托管模式配置 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function deleteBucketWebsite($ossClient, $bucket) -{ - try { - $ossClient->deleteBucketWebsite($bucket); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Callback.php b/vendor/aliyuncs/oss-sdk-php/samples/Callback.php deleted file mode 100644 index 8612a1c5..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/Callback.php +++ /dev/null @@ -1,83 +0,0 @@ - $url, - OssClient::OSS_CALLBACK_VAR => $var - ); -$result = $ossClient->putObject($bucket, "b.file", "random content", $options); -Common::println($result['body']); -Common::println($result['info']['http_code']); - -/** - * completeMultipartUpload 使用callback上传内容到oss文件 - * callbackurl参数指定请求回调的服务器url - * callbackbodytype参数可为application/json或application/x-www-form-urlencoded, 可选参数,默认为application/x-www-form-urlencoded - * OSS_CALLBACK_VAR参数可以不设置 - */ -$object = "multipart-callback-test.txt"; -$copiedObject = "multipart-callback-test.txt.copied"; -$ossClient->putObject($bucket, $copiedObject, file_get_contents(__FILE__)); - -/** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id - */ -$upload_id = $ossClient->initiateMultipartUpload($bucket, $object); - -/** - * step 2. uploadPartCopy - */ -$copyId = 1; -$eTag = $ossClient->uploadPartCopy($bucket, $copiedObject, $bucket, $object, $copyId, $upload_id); -$upload_parts[] = array( - 'PartNumber' => $copyId, - 'ETag' => $eTag, - ); -$listPartsInfo = $ossClient->listParts($bucket, $object, $upload_id); - -/** - * step 3. - */ -$json = - '{ - "callbackUrl":"callback.oss-demo.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size},\"x:var1\":${x:var1},\"x:var2\":${x:var2}}", - "callbackBodyType":"application/json" - }'; -$var = - '{ - "x:var1":"value1", - "x:var2":"值2" - }'; -$options = array(OssClient::OSS_CALLBACK => $json, - OssClient::OSS_CALLBACK_VAR => $var); - -$result = $ossClient->completeMultipartUpload($bucket, $object, $upload_id, $upload_parts, $options); -Common::println($result['body']); -Common::println($result['info']['http_code']); diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Common.php b/vendor/aliyuncs/oss-sdk-php/samples/Common.php deleted file mode 100644 index f419d178..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/Common.php +++ /dev/null @@ -1,84 +0,0 @@ -getMessage() . "\n"); - return null; - } - return $ossClient; - } - - public static function getBucketName() - { - return self::bucket; - } - - /** - * 工具方法,创建一个存储空间,如果发生异常直接exit - */ - public static function createBucket() - { - $ossClient = self::getOssClient(); - if (is_null($ossClient)) exit(1); - $bucket = self::getBucketName(); - $acl = OssClient::OSS_ACL_TYPE_PUBLIC_READ; - try { - $ossClient->createBucket($bucket, $acl); - } catch (OssException $e) { - - $message = $e->getMessage(); - if (\OSS\Core\OssUtil::startsWith($message, 'http status: 403')) { - echo "Please Check your AccessKeyId and AccessKeySecret" . "\n"; - exit(0); - } elseif (strpos($message, "BucketAlreadyExists") !== false) { - echo "Bucket already exists. Please check whether the bucket belongs to you, or it was visited with correct endpoint. " . "\n"; - exit(0); - } - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - } - - public static function println($message) - { - if (!empty($message)) { - echo strval($message) . "\n"; - } - } -} - -Common::createBucket(); diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Config.php b/vendor/aliyuncs/oss-sdk-php/samples/Config.php deleted file mode 100644 index 35c0dc7c..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/Config.php +++ /dev/null @@ -1,15 +0,0 @@ -uploadFile($bucketName, $object, "example.jpg"); - -// 图片缩放 -$options = array( - OssClient::OSS_FILE_DOWNLOAD => $download_file, - OssClient::OSS_PROCESS => "image/resize,m_fixed,h_100,w_100", ); -$ossClient->getObject($bucketName, $object, $options); -printImage("imageResize",$download_file); - -// 图片裁剪 -$options = array( - OssClient::OSS_FILE_DOWNLOAD => $download_file, - OssClient::OSS_PROCESS => "image/crop,w_100,h_100,x_100,y_100,r_1", ); -$ossClient->getObject($bucketName, $object, $options); -printImage("iamgeCrop", $download_file); - -// 图片旋转 -$options = array( - OssClient::OSS_FILE_DOWNLOAD => $download_file, - OssClient::OSS_PROCESS => "image/rotate,90", ); -$ossClient->getObject($bucketName, $object, $options); -printImage("imageRotate", $download_file); - -// 图片锐化 -$options = array( - OssClient::OSS_FILE_DOWNLOAD => $download_file, - OssClient::OSS_PROCESS => "image/sharpen,100", ); -$ossClient->getObject($bucketName, $object, $options); -printImage("imageSharpen", $download_file); - -// 图片水印 -$options = array( - OssClient::OSS_FILE_DOWNLOAD => $download_file, - OssClient::OSS_PROCESS => "image/watermark,text_SGVsbG8g5Zu-54mH5pyN5YqhIQ", ); -$ossClient->getObject($bucketName, $object, $options); -printImage("imageWatermark", $download_file); - -// 图片格式转换 -$options = array( - OssClient::OSS_FILE_DOWNLOAD => $download_file, - OssClient::OSS_PROCESS => "image/format,png", ); -$ossClient->getObject($bucketName, $object, $options); -printImage("imageFormat", $download_file); - -// 获取图片信息 -$options = array( - OssClient::OSS_FILE_DOWNLOAD => $download_file, - OssClient::OSS_PROCESS => "image/info", ); -$ossClient->getObject($bucketName, $object, $options); -printImage("imageInfo", $download_file); - - -/** - * 生成一个带签名的可用于浏览器直接打开的url, URL的有效期是3600秒 - */ - $timeout = 3600; -$options = array( - OssClient::OSS_PROCESS => "image/resize,m_lfit,h_100,w_100", - ); -$signedUrl = $ossClient->signUrl($bucketName, $object, $timeout, "GET", $options); -Common::println("rtmp url: \n" . $signedUrl); - -//最后删除上传的$object -$ossClient->deleteObject($bucketName, $object); - -function printImage($func, $imageFile) -{ - $array = getimagesize($imageFile); - Common::println("$func, image width: " . $array[0]); - Common::println("$func, image height: " . $array[1]); - Common::println("$func, image type: " . ($array[2] === 2 ? 'jpg' : 'png')); - Common::println("$func, image size: " . ceil(filesize($imageFile))); -} diff --git a/vendor/aliyuncs/oss-sdk-php/samples/LiveChannel.php b/vendor/aliyuncs/oss-sdk-php/samples/LiveChannel.php deleted file mode 100644 index 2f7d3a8b..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/LiveChannel.php +++ /dev/null @@ -1,125 +0,0 @@ - 'live channel test', - 'type' => 'HLS', - 'fragDuration' => 10, - 'fragCount' => 5, - 'playListName' => 'hello.m3u8' - )); -$info = $ossClient->putBucketLiveChannel($bucket, 'test_rtmp_live', $config); -Common::println("bucket $bucket liveChannel created:\n" . -"live channel name: ". $info->getName() . "\n" . -"live channel description: ". $info->getDescription() . "\n" . -"publishurls: ". $info->getPublishUrls()[0] . "\n" . -"playurls: ". $info->getPlayUrls()[0] . "\n"); - -/** - 对创建好的频道,可以使用listBucketLiveChannels来进行列举已达到管理的目的。 - prefix可以按照前缀过滤list出来的频道。 - max_keys表示迭代器内部一次list出来的频道的最大数量,这个值最大不能超过1000,不填写的话默认为100。 - */ -$list = $ossClient->listBucketLiveChannels($bucket); -Common::println("bucket $bucket listLiveChannel:\n" . -"list live channel prefix: ". $list->getPrefix() . "\n" . -"list live channel marker: ". $list->getMarker() . "\n" . -"list live channel maxkey: ". $list->getMaxKeys() . "\n" . -"list live channel IsTruncated: ". $list->getIsTruncated() . "\n" . -"list live channel getNextMarker: ". $list->getNextMarker() . "\n"); - -foreach($list->getChannelList() as $list) -{ - Common::println("bucket $bucket listLiveChannel:\n" . - "list live channel IsTruncated: ". $list->getName() . "\n" . - "list live channel Description: ". $list->getDescription() . "\n" . - "list live channel Status: ". $list->getStatus() . "\n" . - "list live channel getNextMarker: ". $list->getLastModified() . "\n"); -} -/** - 创建直播频道之后拿到推流用的play_url(rtmp推流的url,如果Bucket不是公共读写权限那么还需要带上签名,见下文示例)和推流用的publish_url(推流产生的m3u8文件的url) - */ -$play_url = $ossClient->signRtmpUrl($bucket, "test_rtmp_live", 3600, array('params' => array('playlistName' => 'playlist.m3u8'))); -Common::println("bucket $bucket rtmp url: \n" . $play_url); -$play_url = $ossClient->signRtmpUrl($bucket, "test_rtmp_live", 3600); -Common::println("bucket $bucket rtmp url: \n" . $play_url); - -/** - 创建好直播频道,如果想把这个频道禁用掉(断掉正在推的流或者不再允许向一个地址推流),应该使用putLiveChannelStatus接口,将频道的status改成“Disabled”,如果要将一个禁用状态的频道启用,那么也是调用这个接口,将status改成“Enabled” - */ -$resp = $ossClient->putLiveChannelStatus($bucket, "test_rtmp_live", "enabled"); - -/** - 创建好直播频道之后调用getLiveChannelInfo可以得到频道相关的信息 - */ -$info = $ossClient->getLiveChannelInfo($bucket, 'test_rtmp_live'); -Common::println("bucket $bucket LiveChannelInfo:\n" . -"live channel info description: ". $info->getDescription() . "\n" . -"live channel info status: ". $info->getStatus() . "\n" . -"live channel info type: ". $info->getType() . "\n" . -"live channel info fragDuration: ". $info->getFragDuration() . "\n" . -"live channel info fragCount: ". $info->getFragCount() . "\n" . -"live channel info playListName: ". $info->getPlayListName() . "\n"); - -/** - 如果想查看一个频道历史推流记录,可以调用getLiveChannelHistory。目前最多可以看到10次推流的记录 - */ -$history = $ossClient->getLiveChannelHistory($bucket, "test_rtmp_live"); -if (count($history->getLiveRecordList()) != 0) -{ - foreach($history->getLiveRecordList() as $recordList) - { - Common::println("bucket $bucket liveChannelHistory:\n" . - "live channel history startTime: ". $recordList->getStartTime() . "\n" . - "live channel history endTime: ". $recordList->getEndTime() . "\n" . - "live channel history remoteAddr: ". $recordList->getRemoteAddr() . "\n"); - } -} - -/** - 对于正在推流的频道调用get_live_channel_stat可以获得流的状态信息。 - 如果频道正在推流,那么stat_result中的所有字段都有意义。 - 如果频道闲置或者处于“Disabled”状态,那么status为“Idle”或“Disabled”,其他字段无意义。 - */ -$status = $ossClient->getLiveChannelStatus($bucket, "test_rtmp_live"); -Common::println("bucket $bucket listLiveChannel:\n" . -"live channel status status: ". $status->getStatus() . "\n" . -"live channel status ConnectedTime: ". $status->getConnectedTime() . "\n" . -"live channel status VideoWidth: ". $status->getVideoWidth() . "\n" . -"live channel status VideoHeight: ". $status->getVideoHeight() . "\n" . -"live channel status VideoFrameRate: ". $status->getVideoFrameRate() . "\n" . -"live channel status VideoBandwidth: ". $status->getVideoBandwidth() . "\n" . -"live channel status VideoCodec: ". $status->getVideoCodec() . "\n" . -"live channel status AudioBandwidth: ". $status->getAudioBandwidth() . "\n" . -"live channel status AudioSampleRate: ". $status->getAudioSampleRate() . "\n" . -"live channel status AdioCodec: ". $status->getAudioCodec() . "\n"); - -/** - * 如果希望利用直播推流产生的ts文件生成一个点播列表,可以使用postVodPlaylist方法。 - * 指定起始时间为当前时间减去60秒,结束时间为当前时间,这意味着将生成一个长度为60秒的点播视频。 - * 播放列表指定为“vod_playlist.m3u8”,也就是说这个接口调用成功之后会在OSS上生成一个名叫“vod_playlist.m3u8”的播放列表文件。 - */ -$current_time = time(); -$ossClient->postVodPlaylist($bucket, - "test_rtmp_live", "vod_playlist.m3u8", - array('StartTime' => $current_time - 60, - 'EndTime' => $current_time) -); - -/** - * 如果一个直播频道已经不打算再使用了,那么可以调用delete_live_channel来删除频道。 - */ -$ossClient->deleteBucketLiveChannel($bucket, "test_rtmp_live"); diff --git a/vendor/aliyuncs/oss-sdk-php/samples/MultipartUpload.php b/vendor/aliyuncs/oss-sdk-php/samples/MultipartUpload.php deleted file mode 100644 index e8d69a3e..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/MultipartUpload.php +++ /dev/null @@ -1,182 +0,0 @@ -multiuploadFile($bucket, "file.php", __FILE__, array()); -Common::println("local file " . __FILE__ . " is uploaded to the bucket $bucket, file.php"); - - -// 上传本地目录到bucket内的targetdir子目录中 -$ossClient->uploadDir($bucket, "targetdir", __DIR__); -Common::println("local dir " . __DIR__ . " is uploaded to the bucket $bucket, targetdir/"); - - -// 列出当前未完成的分片上传 -$listMultipartUploadInfo = $ossClient->listMultipartUploads($bucket, array()); - - -//******************************* 完整用法参考下面函数 **************************************************** - -multiuploadFile($ossClient, $bucket); -putObjectByRawApis($ossClient, $bucket); -uploadDir($ossClient, $bucket); -listMultipartUploads($ossClient, $bucket); - -/** - * 通过multipart上传文件 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function multiuploadFile($ossClient, $bucket) -{ - $object = "test/multipart-test.txt"; - $file = __FILE__; - $options = array(); - - try { - $ossClient->multiuploadFile($bucket, $object, $file, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 使用基本的api分阶段进行分片上传 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @throws OssException - */ -function putObjectByRawApis($ossClient, $bucket) -{ - $object = "test/multipart-test.txt"; - /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id - */ - try { - $uploadId = $ossClient->initiateMultipartUpload($bucket, $object); - } catch (OssException $e) { - printf(__FUNCTION__ . ": initiateMultipartUpload FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": initiateMultipartUpload OK" . "\n"); - /* - * step 2. 上传分片 - */ - $partSize = 10 * 1024 * 1024; - $uploadFile = __FILE__; - $uploadFileSize = filesize($uploadFile); - $pieces = $ossClient->generateMultiuploadParts($uploadFileSize, $partSize); - $responseUploadPart = array(); - $uploadPosition = 0; - $isCheckMd5 = true; - foreach ($pieces as $i => $piece) { - $fromPos = $uploadPosition + (integer)$piece[$ossClient::OSS_SEEK_TO]; - $toPos = (integer)$piece[$ossClient::OSS_LENGTH] + $fromPos - 1; - $upOptions = array( - $ossClient::OSS_FILE_UPLOAD => $uploadFile, - $ossClient::OSS_PART_NUM => ($i + 1), - $ossClient::OSS_SEEK_TO => $fromPos, - $ossClient::OSS_LENGTH => $toPos - $fromPos + 1, - $ossClient::OSS_CHECK_MD5 => $isCheckMd5, - ); - if ($isCheckMd5) { - $contentMd5 = OssUtil::getMd5SumForFile($uploadFile, $fromPos, $toPos); - $upOptions[$ossClient::OSS_CONTENT_MD5] = $contentMd5; - } - //2. 将每一分片上传到OSS - try { - $responseUploadPart[] = $ossClient->uploadPart($bucket, $object, $uploadId, $upOptions); - } catch (OssException $e) { - printf(__FUNCTION__ . ": initiateMultipartUpload, uploadPart - part#{$i} FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - printf(__FUNCTION__ . ": initiateMultipartUpload, uploadPart - part#{$i} OK\n"); - } - $uploadParts = array(); - foreach ($responseUploadPart as $i => $eTag) { - $uploadParts[] = array( - 'PartNumber' => ($i + 1), - 'ETag' => $eTag, - ); - } - /** - * step 3. 完成上传 - */ - try { - $ossClient->completeMultipartUpload($bucket, $object, $uploadId, $uploadParts); - } catch (OssException $e) { - printf(__FUNCTION__ . ": completeMultipartUpload FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - printf(__FUNCTION__ . ": completeMultipartUpload OK\n"); -} - -/** - * 按照目录上传文件 - * - * @param OssClient $ossClient OssClient - * @param string $bucket 存储空间名称 - * - */ -function uploadDir($ossClient, $bucket) -{ - $localDirectory = "."; - $prefix = "samples/codes"; - try { - $ossClient->uploadDir($bucket, $prefix, $localDirectory); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - printf(__FUNCTION__ . ": completeMultipartUpload OK\n"); -} - -/** - * 获取当前未完成的分片上传列表 - * - * @param $ossClient OssClient - * @param $bucket string - */ -function listMultipartUploads($ossClient, $bucket) -{ - $options = array( - 'max-uploads' => 100, - 'key-marker' => '', - 'prefix' => '', - 'upload-id-marker' => '' - ); - try { - $listMultipartUploadInfo = $ossClient->listMultipartUploads($bucket, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": listMultipartUploads FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - printf(__FUNCTION__ . ": listMultipartUploads OK\n"); - $listUploadInfo = $listMultipartUploadInfo->getUploads(); - var_dump($listUploadInfo); -} diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Object.php b/vendor/aliyuncs/oss-sdk-php/samples/Object.php deleted file mode 100644 index 3bf024b0..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/Object.php +++ /dev/null @@ -1,517 +0,0 @@ -putObject($bucket, "b.file", "hi, oss"); -Common::println("b.file is created"); -Common::println($result['x-oss-request-id']); -Common::println($result['etag']); -Common::println($result['content-md5']); -Common::println($result['body']); - -// 上传本地文件 -$result = $ossClient->uploadFile($bucket, "c.file", __FILE__); -Common::println("c.file is created"); -Common::println("b.file is created"); -Common::println($result['x-oss-request-id']); -Common::println($result['etag']); -Common::println($result['content-md5']); -Common::println($result['body']); - -// 下载object到本地变量 -$content = $ossClient->getObject($bucket, "b.file"); -Common::println("b.file is fetched, the content is: " . $content); - -// 给object添加symlink -$content = $ossClient->putSymlink($bucket, "test-symlink", "b.file"); -Common::println("test-symlink is created"); -Common::println($result['x-oss-request-id']); -Common::println($result['etag']); - -// 获取symlink -$content = $ossClient->getSymlink($bucket, "test-symlink"); -Common::println("test-symlink refer to : " . $content[OssClient::OSS_SYMLINK_TARGET]); - -// 下载object到本地文件 -$options = array( - OssClient::OSS_FILE_DOWNLOAD => "./c.file.localcopy", -); -$ossClient->getObject($bucket, "c.file", $options); -Common::println("b.file is fetched to the local file: c.file.localcopy"); -Common::println("b.file is created"); - -// 拷贝object -$result = $ossClient->copyObject($bucket, "c.file", $bucket, "c.file.copy"); -Common::println("lastModifiedTime: " . $result[0]); -Common::println("ETag: " . $result[1]); - -// 判断object是否存在 -$doesExist = $ossClient->doesObjectExist($bucket, "c.file.copy"); -Common::println("file c.file.copy exist? " . ($doesExist ? "yes" : "no")); - -// 删除object -$result = $ossClient->deleteObject($bucket, "c.file.copy"); -Common::println("c.file.copy is deleted"); -Common::println("b.file is created"); -Common::println($result['x-oss-request-id']); - -// 判断object是否存在 -$doesExist = $ossClient->doesObjectExist($bucket, "c.file.copy"); -Common::println("file c.file.copy exist? " . ($doesExist ? "yes" : "no")); - -// 批量删除object -$result = $ossClient->deleteObjects($bucket, array("b.file", "c.file")); -foreach($result as $object) - Common::println($object); - -sleep(2); -unlink("c.file.localcopy"); - -//******************************* 完整用法参考下面函数 **************************************************** - -listObjects($ossClient, $bucket); -listAllObjects($ossClient, $bucket); -createObjectDir($ossClient, $bucket); -putObject($ossClient, $bucket); -uploadFile($ossClient, $bucket); -getObject($ossClient, $bucket); -getObjectToLocalFile($ossClient, $bucket); -copyObject($ossClient, $bucket); -modifyMetaForObject($ossClient, $bucket); -getObjectMeta($ossClient, $bucket); -deleteObject($ossClient, $bucket); -deleteObjects($ossClient, $bucket); -doesObjectExist($ossClient, $bucket); -getSymlink($ossClient, $bucket); -putSymlink($ossClient, $bucket); -/** - * 创建虚拟目录 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function createObjectDir($ossClient, $bucket) -{ - try { - $ossClient->createObjectDir($bucket, "dir"); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 把本地变量的内容到文件 - * - * 简单上传,上传指定变量的内存值作为object的内容 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function putObject($ossClient, $bucket) -{ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - $content = file_get_contents(__FILE__); - $options = array(); - try { - $ossClient->putObject($bucket, $object, $content, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - - -/** - * 上传指定的本地文件内容 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function uploadFile($ossClient, $bucket) -{ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - $filePath = __FILE__; - $options = array(); - - try { - $ossClient->uploadFile($bucket, $object, $filePath, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 列出Bucket内所有目录和文件, 注意如果符合条件的文件数目超过设置的max-keys, 用户需要使用返回的nextMarker作为入参,通过 - * 循环调用ListObjects得到所有的文件,具体操作见下面的 listAllObjects 示例 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function listObjects($ossClient, $bucket) -{ - $prefix = 'oss-php-sdk-test/'; - $delimiter = '/'; - $nextMarker = ''; - $maxkeys = 1000; - $options = array( - 'delimiter' => $delimiter, - 'prefix' => $prefix, - 'max-keys' => $maxkeys, - 'marker' => $nextMarker, - ); - try { - $listObjectInfo = $ossClient->listObjects($bucket, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - $objectList = $listObjectInfo->getObjectList(); // 文件列表 - $prefixList = $listObjectInfo->getPrefixList(); // 目录列表 - if (!empty($objectList)) { - print("objectList:\n"); - foreach ($objectList as $objectInfo) { - print($objectInfo->getKey() . "\n"); - } - } - if (!empty($prefixList)) { - print("prefixList: \n"); - foreach ($prefixList as $prefixInfo) { - print($prefixInfo->getPrefix() . "\n"); - } - } -} - -/** - * 列出Bucket内所有目录和文件, 根据返回的nextMarker循环得到所有Objects - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function listAllObjects($ossClient, $bucket) -{ - //构造dir下的文件和虚拟目录 - for ($i = 0; $i < 100; $i += 1) { - $ossClient->putObject($bucket, "dir/obj" . strval($i), "hi"); - $ossClient->createObjectDir($bucket, "dir/obj" . strval($i)); - } - - $prefix = 'dir/'; - $delimiter = '/'; - $nextMarker = ''; - $maxkeys = 30; - - while (true) { - $options = array( - 'delimiter' => $delimiter, - 'prefix' => $prefix, - 'max-keys' => $maxkeys, - 'marker' => $nextMarker, - ); - var_dump($options); - try { - $listObjectInfo = $ossClient->listObjects($bucket, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - // 得到nextMarker,从上一次listObjects读到的最后一个文件的下一个文件开始继续获取文件列表 - $nextMarker = $listObjectInfo->getNextMarker(); - $listObject = $listObjectInfo->getObjectList(); - $listPrefix = $listObjectInfo->getPrefixList(); - var_dump(count($listObject)); - var_dump(count($listPrefix)); - if ($nextMarker === '') { - break; - } - } -} - -/** - * 获取object的内容 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getObject($ossClient, $bucket) -{ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - $options = array(); - try { - $content = $ossClient->getObject($bucket, $object, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - if (file_get_contents(__FILE__) === $content) { - print(__FUNCTION__ . ": FileContent checked OK" . "\n"); - } else { - print(__FUNCTION__ . ": FileContent checked FAILED" . "\n"); - } -} - -/** - * put symlink - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function putSymlink($ossClient, $bucket) -{ - $symlink = "test-samples-symlink"; - $object = "test-samples-object"; - try { - $ossClient->putObject($bucket, $object, 'test-content'); - $ossClient->putSymlink($bucket, $symlink, $object); - $content = $ossClient->getObject($bucket, $symlink); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - if ($content == 'test-content') { - print(__FUNCTION__ . ": putSymlink checked OK" . "\n"); - } else { - print(__FUNCTION__ . ": putSymlink checked FAILED" . "\n"); - } -} - -/** - * 获取symlink - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getSymlink($ossClient, $bucket) -{ - $symlink = "test-samples-symlink"; - $object = "test-samples-object"; - try { - $ossClient->putObject($bucket, $object, 'test-content'); - $ossClient->putSymlink($bucket, $symlink, $object); - $content = $ossClient->getSymlink($bucket, $symlink); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - if ($content[OssClient::OSS_SYMLINK_TARGET]) { - print(__FUNCTION__ . ": getSymlink checked OK" . "\n"); - } else { - print(__FUNCTION__ . ": getSymlink checked FAILED" . "\n"); - } -} - -/** - * get_object_to_local_file - * - * 获取object - * 将object下载到指定的文件 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getObjectToLocalFile($ossClient, $bucket) -{ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - $localfile = "upload-test-object-name.txt"; - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $localfile, - ); - - try { - $ossClient->getObject($bucket, $object, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK, please check localfile: 'upload-test-object-name.txt'" . "\n"); - if (file_get_contents($localfile) === file_get_contents(__FILE__)) { - print(__FUNCTION__ . ": FileContent checked OK" . "\n"); - } else { - print(__FUNCTION__ . ": FileContent checked FAILED" . "\n"); - } - if (file_exists($localfile)) { - unlink($localfile); - } -} - -/** - * 拷贝object - * 当目的object和源object完全相同时,表示修改object的meta信息 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function copyObject($ossClient, $bucket) -{ - $fromBucket = $bucket; - $fromObject = "oss-php-sdk-test/upload-test-object-name.txt"; - $toBucket = $bucket; - $toObject = $fromObject . '.copy'; - $options = array(); - - try { - $ossClient->copyObject($fromBucket, $fromObject, $toBucket, $toObject, $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 修改Object Meta - * 利用copyObject接口的特性:当目的object和源object完全相同时,表示修改object的meta信息 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function modifyMetaForObject($ossClient, $bucket) -{ - $fromBucket = $bucket; - $fromObject = "oss-php-sdk-test/upload-test-object-name.txt"; - $toBucket = $bucket; - $toObject = $fromObject; - $copyOptions = array( - OssClient::OSS_HEADERS => array( - 'Cache-Control' => 'max-age=60', - 'Content-Disposition' => 'attachment; filename="xxxxxx"', - ), - ); - try { - $ossClient->copyObject($fromBucket, $fromObject, $toBucket, $toObject, $copyOptions); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 获取object meta, 也就是getObjectMeta接口 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function getObjectMeta($ossClient, $bucket) -{ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - try { - $objectMeta = $ossClient->getObjectMeta($bucket, $object); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - if (isset($objectMeta[strtolower('Content-Disposition')]) && - 'attachment; filename="xxxxxx"' === $objectMeta[strtolower('Content-Disposition')] - ) { - print(__FUNCTION__ . ": ObjectMeta checked OK" . "\n"); - } else { - print(__FUNCTION__ . ": ObjectMeta checked FAILED" . "\n"); - } -} - -/** - * 删除object - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function deleteObject($ossClient, $bucket) -{ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - try { - $ossClient->deleteObject($bucket, $object); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - - -/** - * 批量删除object - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function deleteObjects($ossClient, $bucket) -{ - $objects = array(); - $objects[] = "oss-php-sdk-test/upload-test-object-name.txt"; - $objects[] = "oss-php-sdk-test/upload-test-object-name.txt.copy"; - try { - $ossClient->deleteObjects($bucket, $objects); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); -} - -/** - * 判断object是否存在 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - */ -function doesObjectExist($ossClient, $bucket) -{ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - try { - $exist = $ossClient->doesObjectExist($bucket, $object); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - var_dump($exist); -} - diff --git a/vendor/aliyuncs/oss-sdk-php/samples/RunAll.php b/vendor/aliyuncs/oss-sdk-php/samples/RunAll.php deleted file mode 100644 index a4d6d9b9..00000000 --- a/vendor/aliyuncs/oss-sdk-php/samples/RunAll.php +++ /dev/null @@ -1,13 +0,0 @@ -uploadFile($bucket, "a.file", __FILE__); - -// 生成GetObject的签名url,用户可以使用这个url直接在浏览器下载 -$signedUrl = $ossClient->signUrl($bucket, "a.file", 3600); -Common::println($signedUrl); - -// 生成用于putObject的签名URL,用户可以直接用put方法使用这个url上传文件到 "a.file" -$signedUrl = $ossClient->signUrl($bucket, "a.file", "3600", "PUT"); -Common::println($signedUrl); - -// 生成从本地文件上传PutObject的签名url, 用户可以直接使用这个url把本地文件上传到 "a.file" -$signedUrl = $ossClient->signUrl($bucket, "a.file", 3600, "PUT", array('Content-Type' => 'txt')); -Common::println($signedUrl); - -//******************************* 完整用法参考下面函数 **************************************************** - -getSignedUrlForPuttingObject($ossClient, $bucket); -getSignedUrlForPuttingObjectFromFile($ossClient, $bucket); -getSignedUrlForGettingObject($ossClient, $bucket); - -/** - * 生成GetObject的签名url,主要用于私有权限下的读访问控制 - * - * @param $ossClient OssClient OssClient实例 - * @param $bucket string 存储空间名称 - * @return null - */ -function getSignedUrlForGettingObject($ossClient, $bucket) -{ - $object = "test/test-signature-test-upload-and-download.txt"; - $timeout = 3600; - try { - $signedUrl = $ossClient->signUrl($bucket, $object, $timeout); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": signedUrl: " . $signedUrl . "\n"); - /** - * 可以类似的代码来访问签名的URL,也可以输入到浏览器中去访问 - */ - $request = new RequestCore($signedUrl); - $request->set_method('GET'); - $request->add_header('Content-Type', ''); - $request->send_request(); - $res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code()); - if ($res->isOK()) { - print(__FUNCTION__ . ": OK" . "\n"); - } else { - print(__FUNCTION__ . ": FAILED" . "\n"); - }; -} - -/** - * 生成PutObject的签名url,主要用于私有权限下的写访问控制 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @return null - * @throws OssException - */ -function getSignedUrlForPuttingObject($ossClient, $bucket) -{ - $object = "test/test-signature-test-upload-and-download.txt"; - $timeout = 3600; - $options = NULL; - try { - $signedUrl = $ossClient->signUrl($bucket, $object, $timeout, "PUT"); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": signedUrl: " . $signedUrl . "\n"); - $content = file_get_contents(__FILE__); - - $request = new RequestCore($signedUrl); - $request->set_method('PUT'); - $request->add_header('Content-Type', ''); - $request->add_header('Content-Length', strlen($content)); - $request->set_body($content); - $request->send_request(); - $res = new ResponseCore($request->get_response_header(), - $request->get_response_body(), $request->get_response_code()); - if ($res->isOK()) { - print(__FUNCTION__ . ": OK" . "\n"); - } else { - print(__FUNCTION__ . ": FAILED" . "\n"); - }; -} - -/** - * 生成PutObject的签名url,主要用于私有权限下的写访问控制, 用户可以利用生成的signedUrl - * 从文件上传文件 - * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 - * @throws OssException - */ -function getSignedUrlForPuttingObjectFromFile($ossClient, $bucket) -{ - $file = __FILE__; - $object = "test/test-signature-test-upload-and-download.txt"; - $timeout = 3600; - $options = array('Content-Type' => 'txt'); - try { - $signedUrl = $ossClient->signUrl($bucket, $object, $timeout, "PUT", $options); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": signedUrl: " . $signedUrl . "\n"); - - $request = new RequestCore($signedUrl); - $request->set_method('PUT'); - $request->add_header('Content-Type', 'txt'); - $request->set_read_file($file); - $request->set_read_stream_size(filesize($file)); - $request->send_request(); - $res = new ResponseCore($request->get_response_header(), - $request->get_response_body(), $request->get_response_code()); - if ($res->isOK()) { - print(__FUNCTION__ . ": OK" . "\n"); - } else { - print(__FUNCTION__ . ": FAILED" . "\n"); - }; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php deleted file mode 100644 index e9b88ffa..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php +++ /dev/null @@ -1,262 +0,0 @@ - 1) { - $ext = strtolower(end($parts)); - if (isset(self::$mime_types[$ext])) { - return self::$mime_types[$ext]; - } - } - - return null; - } - - private static $mime_types = array( - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'apk' => 'application/vnd.android.package-archive', - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'doc' => 'application/msword', - 'ogg' => 'audio/ogg', - 'pdf' => 'application/pdf', - 'rtf' => 'text/rtf', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'otg' => 'application/vnd.oasis.opendocument.graphics-template', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'otp' => 'application/vnd.oasis.opendocument.presentation-template', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - 'oth' => 'application/vnd.oasis.opendocument.text-web', - 'sxw' => 'application/vnd.sun.xml.writer', - 'stw' => 'application/vnd.sun.xml.writer.template', - 'sxc' => 'application/vnd.sun.xml.calc', - 'stc' => 'application/vnd.sun.xml.calc.template', - 'sxd' => 'application/vnd.sun.xml.draw', - 'std' => 'application/vnd.sun.xml.draw.template', - 'sxi' => 'application/vnd.sun.xml.impress', - 'sti' => 'application/vnd.sun.xml.impress.template', - 'sxg' => 'application/vnd.sun.xml.writer.global', - 'sxm' => 'application/vnd.sun.xml.math', - 'sis' => 'application/vnd.symbian.install', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'wmlsc' => 'application/vnd.wap.wmlscriptc', - 'bcpio' => 'application/x-bcpio', - 'torrent' => 'application/x-bittorrent', - 'bz2' => 'application/x-bzip2', - 'vcd' => 'application/x-cdlink', - 'pgn' => 'application/x-chess-pgn', - 'cpio' => 'application/x-cpio', - 'csh' => 'application/x-csh', - 'dvi' => 'application/x-dvi', - 'spl' => 'application/x-futuresplash', - 'gtar' => 'application/x-gtar', - 'hdf' => 'application/x-hdf', - 'jar' => 'application/java-archive', - 'jnlp' => 'application/x-java-jnlp-file', - 'js' => 'application/javascript', - 'json' => 'application/json', - 'ksp' => 'application/x-kspread', - 'chrt' => 'application/x-kchart', - 'kil' => 'application/x-killustrator', - 'latex' => 'application/x-latex', - 'rpm' => 'application/x-rpm', - 'sh' => 'application/x-sh', - 'shar' => 'application/x-shar', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'sv4cpio' => 'application/x-sv4cpio', - 'sv4crc' => 'application/x-sv4crc', - 'tar' => 'application/x-tar', - 'tcl' => 'application/x-tcl', - 'tex' => 'application/x-tex', - 'man' => 'application/x-troff-man', - 'me' => 'application/x-troff-me', - 'ms' => 'application/x-troff-ms', - 'ustar' => 'application/x-ustar', - 'src' => 'application/x-wais-source', - 'zip' => 'application/zip', - 'm3u' => 'audio/x-mpegurl', - 'ra' => 'audio/x-pn-realaudio', - 'wav' => 'audio/x-wav', - 'wma' => 'audio/x-ms-wma', - 'wax' => 'audio/x-ms-wax', - 'pdb' => 'chemical/x-pdb', - 'xyz' => 'chemical/x-xyz', - 'bmp' => 'image/bmp', - 'gif' => 'image/gif', - 'ief' => 'image/ief', - 'png' => 'image/png', - 'wbmp' => 'image/vnd.wap.wbmp', - 'ras' => 'image/x-cmu-raster', - 'pnm' => 'image/x-portable-anymap', - 'pbm' => 'image/x-portable-bitmap', - 'pgm' => 'image/x-portable-graymap', - 'ppm' => 'image/x-portable-pixmap', - 'rgb' => 'image/x-rgb', - 'xbm' => 'image/x-xbitmap', - 'xpm' => 'image/x-xpixmap', - 'xwd' => 'image/x-xwindowdump', - 'css' => 'text/css', - 'rtx' => 'text/richtext', - 'tsv' => 'text/tab-separated-values', - 'jad' => 'text/vnd.sun.j2me.app-descriptor', - 'wml' => 'text/vnd.wap.wml', - 'wmls' => 'text/vnd.wap.wmlscript', - 'etx' => 'text/x-setext', - 'mxu' => 'video/vnd.mpegurl', - 'flv' => 'video/x-flv', - 'wm' => 'video/x-ms-wm', - 'wmv' => 'video/x-ms-wmv', - 'wmx' => 'video/x-ms-wmx', - 'wvx' => 'video/x-ms-wvx', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'ice' => 'x-conference/x-cooltalk', - '3gp' => 'video/3gpp', - 'ai' => 'application/postscript', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'asc' => 'text/plain', - 'atom' => 'application/atom+xml', - 'au' => 'audio/basic', - 'bin' => 'application/octet-stream', - 'cdf' => 'application/x-netcdf', - 'cgm' => 'image/cgm', - 'class' => 'application/octet-stream', - 'dcr' => 'application/x-director', - 'dif' => 'video/x-dv', - 'dir' => 'application/x-director', - 'djv' => 'image/vnd.djvu', - 'djvu' => 'image/vnd.djvu', - 'dll' => 'application/octet-stream', - 'dmg' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'dtd' => 'application/xml-dtd', - 'dv' => 'video/x-dv', - 'dxr' => 'application/x-director', - 'eps' => 'application/postscript', - 'exe' => 'application/octet-stream', - 'ez' => 'application/andrew-inset', - 'gram' => 'application/srgs', - 'grxml' => 'application/srgs+xml', - 'gz' => 'application/x-gzip', - 'htm' => 'text/html', - 'html' => 'text/html', - 'ico' => 'image/x-icon', - 'ics' => 'text/calendar', - 'ifb' => 'text/calendar', - 'iges' => 'model/iges', - 'igs' => 'model/iges', - 'jp2' => 'image/jp2', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'kar' => 'audio/midi', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'm4a' => 'audio/mp4a-latm', - 'm4p' => 'audio/mp4a-latm', - 'm4u' => 'video/vnd.mpegurl', - 'm4v' => 'video/x-m4v', - 'mac' => 'image/x-macpaint', - 'mathml' => 'application/mathml+xml', - 'mesh' => 'model/mesh', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mov' => 'video/quicktime', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mp4' => 'video/mp4', - 'mpe' => 'video/mpeg', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpga' => 'audio/mpeg', - 'msh' => 'model/mesh', - 'nc' => 'application/x-netcdf', - 'oda' => 'application/oda', - 'ogv' => 'video/ogv', - 'pct' => 'image/pict', - 'pic' => 'image/pict', - 'pict' => 'image/pict', - 'pnt' => 'image/x-macpaint', - 'pntg' => 'image/x-macpaint', - 'ps' => 'application/postscript', - 'qt' => 'video/quicktime', - 'qti' => 'image/x-quicktime', - 'qtif' => 'image/x-quicktime', - 'ram' => 'audio/x-pn-realaudio', - 'rdf' => 'application/rdf+xml', - 'rm' => 'application/vnd.rn-realmedia', - 'roff' => 'application/x-troff', - 'sgm' => 'text/sgml', - 'sgml' => 'text/sgml', - 'silo' => 'model/mesh', - 'skd' => 'application/x-koan', - 'skm' => 'application/x-koan', - 'skp' => 'application/x-koan', - 'skt' => 'application/x-koan', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'snd' => 'audio/basic', - 'so' => 'application/octet-stream', - 'svg' => 'image/svg+xml', - 't' => 'application/x-troff', - 'texi' => 'application/x-texinfo', - 'texinfo' => 'application/x-texinfo', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'tr' => 'application/x-troff', - 'txt' => 'text/plain', - 'vrml' => 'model/vrml', - 'vxml' => 'application/voicexml+xml', - 'webm' => 'video/webm', - 'webp' => 'image/webp', - 'wrl' => 'model/vrml', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'xml' => 'application/xml', - 'xsl' => 'application/xml', - 'xslt' => 'application/xslt+xml', - 'xul' => 'application/vnd.mozilla.xul+xml', - ); -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php deleted file mode 100644 index b0e9e8b0..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php +++ /dev/null @@ -1,54 +0,0 @@ -details = $details; - } else { - $message = $details; - parent::__construct($message); - } - } - - public function getHTTPStatus() - { - return isset($this->details['status']) ? $this->details['status'] : ''; - } - - public function getRequestId() - { - return isset($this->details['request-id']) ? $this->details['request-id'] : ''; - } - - public function getErrorCode() - { - return isset($this->details['code']) ? $this->details['code'] : ''; - } - - public function getErrorMessage() - { - return isset($this->details['message']) ? $this->details['message'] : ''; - } - - public function getDetails() - { - return isset($this->details['body']) ? $this->details['body'] : ''; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php deleted file mode 100644 index 6e5d4133..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php +++ /dev/null @@ -1,461 +0,0 @@ - $value) { - if (is_string($key) && !is_array($value)) { - $temp[] = rawurlencode($key) . '=' . rawurlencode($value); - } - } - return implode('&', $temp); - } - - /** - * 转义字符替换 - * - * @param string $subject - * @return string - */ - public static function sReplace($subject) - { - $search = array('<', '>', '&', '\'', '"'); - $replace = array('<', '>', '&', ''', '"'); - return str_replace($search, $replace, $subject); - } - - /** - * 检查是否是中文编码 - * - * @param $str - * @return int - */ - public static function chkChinese($str) - { - return preg_match('/[\x80-\xff]./', $str); - } - - /** - * 检测是否GB2312编码 - * - * @param string $str - * @return boolean false UTF-8编码 TRUE GB2312编码 - */ - public static function isGb2312($str) - { - for ($i = 0; $i < strlen($str); $i++) { - $v = ord($str[$i]); - if ($v > 127) { - if (($v >= 228) && ($v <= 233)) { - if (($i + 2) >= (strlen($str) - 1)) return true; // not enough characters - $v1 = ord($str[$i + 1]); - $v2 = ord($str[$i + 2]); - if (($v1 >= 128) && ($v1 <= 191) && ($v2 >= 128) && ($v2 <= 191)) - return false; - else - return true; - } - } - } - return false; - } - - /** - * 检测是否GBK编码 - * - * @param string $str - * @param boolean $gbk - * @return boolean - */ - public static function checkChar($str, $gbk = true) - { - for ($i = 0; $i < strlen($str); $i++) { - $v = ord($str[$i]); - if ($v > 127) { - if (($v >= 228) && ($v <= 233)) { - if (($i + 2) >= (strlen($str) - 1)) return $gbk ? true : FALSE; // not enough characters - $v1 = ord($str[$i + 1]); - $v2 = ord($str[$i + 2]); - if ($gbk) { - return (($v1 >= 128) && ($v1 <= 191) && ($v2 >= 128) && ($v2 <= 191)) ? FALSE : TRUE;//GBK - } else { - return (($v1 >= 128) && ($v1 <= 191) && ($v2 >= 128) && ($v2 <= 191)) ? TRUE : FALSE; - } - } - } - } - return $gbk ? TRUE : FALSE; - } - - /** - * 检验bucket名称是否合法 - * bucket的命名规范: - * 1. 只能包括小写字母,数字 - * 2. 必须以小写字母或者数字开头 - * 3. 长度必须在3-63字节之间 - * - * @param string $bucket Bucket名称 - * @return boolean - */ - public static function validateBucket($bucket) - { - $pattern = '/^[a-z0-9][a-z0-9-]{2,62}$/'; - if (!preg_match($pattern, $bucket)) { - return false; - } - return true; - } - - /** - * 检验object名称是否合法 - * object命名规范: - * 1. 规则长度必须在1-1023字节之间 - * 2. 使用UTF-8编码 - * 3. 不能以 "/" "\\"开头 - * - * @param string $object Object名称 - * @return boolean - */ - public static function validateObject($object) - { - $pattern = '/^.{1,1023}$/'; - if (empty($object) || !preg_match($pattern, $object) || - self::startsWith($object, '/') || self::startsWith($object, '\\') - ) { - return false; - } - return true; - } - - - /** - * 判断字符串$str是不是以$findMe开始 - * - * @param string $str - * @param string $findMe - * @return bool - */ - public static function startsWith($str, $findMe) - { - if (strpos($str, $findMe) === 0) { - return true; - } else { - return false; - } - } - - /** - * 生成createBucketXmlBody接口的xml消息 - * - * @param string $storageClass - * @return string - */ - public static function createBucketXmlBody($storageClass) - { - $xml = new \SimpleXMLElement(''); - $xml->addChild('StorageClass', $storageClass); - return $xml->asXML(); - } - - /** - * 检验$options - * - * @param array $options - * @throws OssException - * @return boolean - */ - public static function validateOptions($options) - { - //$options - if ($options != NULL && !is_array($options)) { - throw new OssException ($options . ':' . 'option must be array'); - } - } - - /** - * 检查上传文件的内容是否合法 - * - * @param $content string - * @throws OssException - */ - public static function validateContent($content) - { - if (empty($content)) { - throw new OssException("http body content is invalid"); - } - } - - /** - * 校验BUCKET/OBJECT/OBJECT GROUP是否为空 - * - * @param string $name - * @param string $errMsg - * @throws OssException - * @return void - */ - public static function throwOssExceptionWithMessageIfEmpty($name, $errMsg) - { - if (empty($name)) { - throw new OssException($errMsg); - } - } - - /** - * 仅供测试使用的接口,请勿使用 - * - * @param $filename - * @param $size - */ - public static function generateFile($filename, $size) - { - if (file_exists($filename) && $size == filesize($filename)) { - echo $filename . " already exists, no need to create again. "; - return; - } - $part_size = 1 * 1024 * 1024; - $fp = fopen($filename, "w"); - $characters = << 0) { - if ($size < $part_size) { - $write_size = $size; - } else { - $write_size = $part_size; - } - $size -= $write_size; - $a = $characters[rand(0, $charactersLength - 1)]; - $content = str_repeat($a, $write_size); - $flag = fwrite($fp, $content); - if (!$flag) { - echo "write to " . $filename . " failed.
"; - break; - } - } - } else { - echo "open " . $filename . " failed.
"; - } - fclose($fp); - } - - /** - * 得到文件的md5编码 - * - * @param $filename - * @param $from_pos - * @param $to_pos - * @return string - */ - public static function getMd5SumForFile($filename, $from_pos, $to_pos) - { - $content_md5 = ""; - if (($to_pos - $from_pos) > self::OSS_MAX_PART_SIZE) { - return $content_md5; - } - $filesize = filesize($filename); - if ($from_pos >= $filesize || $to_pos >= $filesize || $from_pos < 0 || $to_pos < 0) { - return $content_md5; - } - - $total_length = $to_pos - $from_pos + 1; - $buffer = 8192; - $left_length = $total_length; - if (!file_exists($filename)) { - return $content_md5; - } - - if (false === $fh = fopen($filename, 'rb')) { - return $content_md5; - } - - fseek($fh, $from_pos); - $data = ''; - while (!feof($fh)) { - if ($left_length >= $buffer) { - $read_length = $buffer; - } else { - $read_length = $left_length; - } - if ($read_length <= 0) { - break; - } else { - $data .= fread($fh, $read_length); - $left_length = $left_length - $read_length; - } - } - fclose($fh); - $content_md5 = base64_encode(md5($data, true)); - return $content_md5; - } - - /** - * 检测是否windows系统,因为windows系统默认编码为GBK - * - * @return bool - */ - public static function isWin() - { - return strtoupper(substr(PHP_OS, 0, 3)) == "WIN"; - } - - /** - * 主要是由于windows系统编码是gbk,遇到中文时候,如果不进行转换处理会出现找不到文件的问题 - * - * @param $file_path - * @return string - */ - public static function encodePath($file_path) - { - if (self::chkChinese($file_path) && self::isWin()) { - $file_path = iconv('utf-8', 'gbk', $file_path); - } - return $file_path; - } - - /** - * 判断用户输入的endpoint是否是 xxx.xxx.xxx.xxx:port 或者 xxx.xxx.xxx.xxx的ip格式 - * - * @param string $endpoint 需要做判断的endpoint - * @return boolean - */ - public static function isIPFormat($endpoint) - { - $ip_array = explode(":", $endpoint); - $hostname = $ip_array[0]; - $ret = filter_var($hostname, FILTER_VALIDATE_IP); - if (!$ret) { - return false; - } else { - return true; - } - } - - /** - * 生成DeleteMultiObjects接口的xml消息 - * - * @param string[] $objects - * @param bool $quiet - * @return string - */ - public static function createDeleteObjectsXmlBody($objects, $quiet) - { - $xml = new \SimpleXMLElement(''); - $xml->addChild('Quiet', $quiet); - foreach ($objects as $object) { - $sub_object = $xml->addChild('Object'); - $object = OssUtil::sReplace($object); - $sub_object->addChild('Key', $object); - } - return $xml->asXML(); - } - - /** - * 生成CompleteMultipartUpload接口的xml消息 - * - * @param array[] $listParts - * @return string - */ - public static function createCompleteMultipartUploadXmlBody($listParts) - { - $xml = new \SimpleXMLElement(''); - foreach ($listParts as $node) { - $part = $xml->addChild('Part'); - $part->addChild('PartNumber', $node['PartNumber']); - $part->addChild('ETag', $node['ETag']); - } - return $xml->asXML(); - } - - /** - * 读取目录 - * - * @param string $dir - * @param string $exclude - * @param bool $recursive - * @return string[] - */ - public static function readDir($dir, $exclude = ".|..|.svn|.git", $recursive = false) - { - $file_list_array = array(); - $base_path = $dir; - $exclude_array = explode("|", $exclude); - $exclude_array = array_unique(array_merge($exclude_array, array('.', '..'))); - - if ($recursive) { - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir)) as $new_file) { - if ($new_file->isDir()) continue; - $object = str_replace($base_path, '', $new_file); - if (!in_array(strtolower($object), $exclude_array)) { - $object = ltrim($object, '/'); - if (is_file($new_file)) { - $key = md5($new_file . $object, false); - $file_list_array[$key] = array('path' => $new_file, 'file' => $object,); - } - } - } - } else if ($handle = opendir($dir)) { - while (false !== ($file = readdir($handle))) { - if (!in_array(strtolower($file), $exclude_array)) { - $new_file = $dir . '/' . $file; - $object = $file; - $object = ltrim($object, '/'); - if (is_file($new_file)) { - $key = md5($new_file . $object, false); - $file_list_array[$key] = array('path' => $new_file, 'file' => $object,); - } - } - } - closedir($handle); - } - return $file_list_array; - } - - /** - * Decode key based on the encoding type - * - * @param string $key - * @param string $encoding - * @return string - */ - public static function decodeKey($key, $encoding) - { - if ($encoding == "") { - return $key; - } - - if ($encoding == "url") { - return rawurldecode($key); - } else { - throw new OssException("Unrecognized encoding type: " . $encoding); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/LICENSE b/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/LICENSE deleted file mode 100644 index 49b38bd6..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2006-2010 Ryan Parman, Foleeo Inc., and contributors. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - - * Neither the name of Ryan Parman, Foleeo Inc. nor the names of its contributors may be used to - endorse or promote products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS -AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php deleted file mode 100644 index 06d0f878..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php +++ /dev/null @@ -1,896 +0,0 @@ -). - */ - public $request_class = 'OSS\Http\RequestCore'; - - /** - * The default class to use for HTTP Responses (defaults to ). - */ - public $response_class = 'OSS\Http\ResponseCore'; - - /** - * Default useragent string to use. - */ - public $useragent = 'RequestCore/1.4.3'; - - /** - * File to read from while streaming up. - */ - public $read_file = null; - - /** - * The resource to read from while streaming up. - */ - public $read_stream = null; - - /** - * The size of the stream to read from. - */ - public $read_stream_size = null; - - /** - * The length already read from the stream. - */ - public $read_stream_read = 0; - - /** - * File to write to while streaming down. - */ - public $write_file = null; - - /** - * The resource to write to while streaming down. - */ - public $write_stream = null; - - /** - * Stores the intended starting seek position. - */ - public $seek_position = null; - - /** - * The location of the cacert.pem file to use. - */ - public $cacert_location = false; - - /** - * The state of SSL certificate verification. - */ - public $ssl_verification = true; - - /** - * The user-defined callback function to call when a stream is read from. - */ - public $registered_streaming_read_callback = null; - - /** - * The user-defined callback function to call when a stream is written to. - */ - public $registered_streaming_write_callback = null; - - /** - * 请求超时时间, 默认是5184000秒,6天 - * - * @var int - */ - public $timeout = 5184000; - - /** - * 连接超时时间,默认是10秒 - * - * @var int - */ - public $connect_timeout = 10; - - /*%******************************************************************************************%*/ - // CONSTANTS - - /** - * GET HTTP Method - */ - const HTTP_GET = 'GET'; - - /** - * POST HTTP Method - */ - const HTTP_POST = 'POST'; - - /** - * PUT HTTP Method - */ - const HTTP_PUT = 'PUT'; - - /** - * DELETE HTTP Method - */ - const HTTP_DELETE = 'DELETE'; - - /** - * HEAD HTTP Method - */ - const HTTP_HEAD = 'HEAD'; - - - /*%******************************************************************************************%*/ - // CONSTRUCTOR/DESTRUCTOR - - /** - * Constructs a new instance of this class. - * - * @param string $url (Optional) The URL to request or service endpoint to query. - * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port` - * @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class. - * @return $this A reference to the current instance. - */ - public function __construct($url = null, $proxy = null, $helpers = null) - { - // Set some default values. - $this->request_url = $url; - $this->method = self::HTTP_GET; - $this->request_headers = array(); - $this->request_body = ''; - - // Set a new Request class if one was set. - if (isset($helpers['request']) && !empty($helpers['request'])) { - $this->request_class = $helpers['request']; - } - - // Set a new Request class if one was set. - if (isset($helpers['response']) && !empty($helpers['response'])) { - $this->response_class = $helpers['response']; - } - - if ($proxy) { - $this->set_proxy($proxy); - } - - return $this; - } - - /** - * Destructs the instance. Closes opened file handles. - * - * @return $this A reference to the current instance. - */ - public function __destruct() - { - if (isset($this->read_file) && isset($this->read_stream)) { - fclose($this->read_stream); - } - - if (isset($this->write_file) && isset($this->write_stream)) { - fclose($this->write_stream); - } - - return $this; - } - - - /*%******************************************************************************************%*/ - // REQUEST METHODS - - /** - * Sets the credentials to use for authentication. - * - * @param string $user (Required) The username to authenticate with. - * @param string $pass (Required) The password to authenticate with. - * @return $this A reference to the current instance. - */ - public function set_credentials($user, $pass) - { - $this->username = $user; - $this->password = $pass; - return $this; - } - - /** - * Adds a custom HTTP header to the cURL request. - * - * @param string $key (Required) The custom HTTP header to set. - * @param mixed $value (Required) The value to assign to the custom HTTP header. - * @return $this A reference to the current instance. - */ - public function add_header($key, $value) - { - $this->request_headers[$key] = $value; - return $this; - } - - /** - * Removes an HTTP header from the cURL request. - * - * @param string $key (Required) The custom HTTP header to set. - * @return $this A reference to the current instance. - */ - public function remove_header($key) - { - if (isset($this->request_headers[$key])) { - unset($this->request_headers[$key]); - } - return $this; - } - - /** - * Set the method type for the request. - * - * @param string $method (Required) One of the following constants: , , , , . - * @return $this A reference to the current instance. - */ - public function set_method($method) - { - $this->method = strtoupper($method); - return $this; - } - - /** - * Sets a custom useragent string for the class. - * - * @param string $ua (Required) The useragent string to use. - * @return $this A reference to the current instance. - */ - public function set_useragent($ua) - { - $this->useragent = $ua; - return $this; - } - - /** - * Set the body to send in the request. - * - * @param string $body (Required) The textual content to send along in the body of the request. - * @return $this A reference to the current instance. - */ - public function set_body($body) - { - $this->request_body = $body; - return $this; - } - - /** - * Set the URL to make the request to. - * - * @param string $url (Required) The URL to make the request to. - * @return $this A reference to the current instance. - */ - public function set_request_url($url) - { - $this->request_url = $url; - return $this; - } - - /** - * Set additional CURLOPT settings. These will merge with the default settings, and override if - * there is a duplicate. - * - * @param array $curlopts (Optional) A set of key-value pairs that set `CURLOPT` options. These will merge with the existing CURLOPTs, and ones passed here will override the defaults. Keys should be the `CURLOPT_*` constants, not strings. - * @return $this A reference to the current instance. - */ - public function set_curlopts($curlopts) - { - $this->curlopts = $curlopts; - return $this; - } - - /** - * Sets the length in bytes to read from the stream while streaming up. - * - * @param integer $size (Required) The length in bytes to read from the stream. - * @return $this A reference to the current instance. - */ - public function set_read_stream_size($size) - { - $this->read_stream_size = $size; - - return $this; - } - - /** - * Sets the resource to read from while streaming up. Reads the stream from its current position until - * EOF or `$size` bytes have been read. If `$size` is not given it will be determined by and - * . - * - * @param resource $resource (Required) The readable resource to read from. - * @param integer $size (Optional) The size of the stream to read. - * @return $this A reference to the current instance. - */ - public function set_read_stream($resource, $size = null) - { - if (!isset($size) || $size < 0) { - $stats = fstat($resource); - - if ($stats && $stats['size'] >= 0) { - $position = ftell($resource); - - if ($position !== false && $position >= 0) { - $size = $stats['size'] - $position; - } - } - } - - $this->read_stream = $resource; - - return $this->set_read_stream_size($size); - } - - /** - * Sets the file to read from while streaming up. - * - * @param string $location (Required) The readable location to read from. - * @return $this A reference to the current instance. - */ - public function set_read_file($location) - { - $this->read_file = $location; - $read_file_handle = fopen($location, 'r'); - - return $this->set_read_stream($read_file_handle); - } - - /** - * Sets the resource to write to while streaming down. - * - * @param resource $resource (Required) The writeable resource to write to. - * @return $this A reference to the current instance. - */ - public function set_write_stream($resource) - { - $this->write_stream = $resource; - - return $this; - } - - /** - * Sets the file to write to while streaming down. - * - * @param string $location (Required) The writeable location to write to. - * @return $this A reference to the current instance. - */ - public function set_write_file($location) - { - $this->write_file = $location; - } - - /** - * Set the proxy to use for making requests. - * - * @param string $proxy (Required) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port` - * @return $this A reference to the current instance. - */ - public function set_proxy($proxy) - { - $proxy = parse_url($proxy); - $proxy['user'] = isset($proxy['user']) ? $proxy['user'] : null; - $proxy['pass'] = isset($proxy['pass']) ? $proxy['pass'] : null; - $proxy['port'] = isset($proxy['port']) ? $proxy['port'] : null; - $this->proxy = $proxy; - return $this; - } - - /** - * Set the intended starting seek position. - * - * @param integer $position (Required) The byte-position of the stream to begin reading from. - * @return $this A reference to the current instance. - */ - public function set_seek_position($position) - { - $this->seek_position = isset($position) ? (integer)$position : null; - - return $this; - } - - /** - * A callback function that is invoked by cURL for streaming up. - * - * @param resource $curl_handle (Required) The cURL handle for the request. - * @param resource $header_content (Required) The header callback result. - * @return headers from a stream. - */ - public function streaming_header_callback($curl_handle, $header_content) - { - $code = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE); - - if (isset($this->write_file) && intval($code) / 100 == 2 && !isset($this->write_file_handle)) - { - $this->write_file_handle = fopen($this->write_file, 'w'); - $this->set_write_stream($this->write_file_handle); - } - - $this->response_raw_headers .= $header_content; - return strlen($header_content); - } - - - /** - * Register a callback function to execute whenever a data stream is read from using - * . - * - * The user-defined callback function should accept three arguments: - * - *
    - *
  • $curl_handle - resource - Required - The cURL handle resource that represents the in-progress transfer.
  • - *
  • $file_handle - resource - Required - The file handle resource that represents the file on the local file system.
  • - *
  • $length - integer - Required - The length in kilobytes of the data chunk that was transferred.
  • - *
- * - * @param string|array|function $callback (Required) The callback function is called by , so you can pass the following values:
    - *
  • The name of a global function to execute, passed as a string.
  • - *
  • A method to execute, passed as array('ClassName', 'MethodName').
  • - *
  • An anonymous function (PHP 5.3+).
- * @return $this A reference to the current instance. - */ - public function register_streaming_read_callback($callback) - { - $this->registered_streaming_read_callback = $callback; - - return $this; - } - - /** - * Register a callback function to execute whenever a data stream is written to using - * . - * - * The user-defined callback function should accept two arguments: - * - *
    - *
  • $curl_handle - resource - Required - The cURL handle resource that represents the in-progress transfer.
  • - *
  • $length - integer - Required - The length in kilobytes of the data chunk that was transferred.
  • - *
- * - * @param string|array|function $callback (Required) The callback function is called by , so you can pass the following values:
    - *
  • The name of a global function to execute, passed as a string.
  • - *
  • A method to execute, passed as array('ClassName', 'MethodName').
  • - *
  • An anonymous function (PHP 5.3+).
- * @return $this A reference to the current instance. - */ - public function register_streaming_write_callback($callback) - { - $this->registered_streaming_write_callback = $callback; - - return $this; - } - - - /*%******************************************************************************************%*/ - // PREPARE, SEND, AND PROCESS REQUEST - - /** - * A callback function that is invoked by cURL for streaming up. - * - * @param resource $curl_handle (Required) The cURL handle for the request. - * @param resource $file_handle (Required) The open file handle resource. - * @param integer $length (Required) The maximum number of bytes to read. - * @return binary Binary data from a stream. - */ - public function streaming_read_callback($curl_handle, $file_handle, $length) - { - // Once we've sent as much as we're supposed to send... - if ($this->read_stream_read >= $this->read_stream_size) { - // Send EOF - return ''; - } - - // If we're at the beginning of an upload and need to seek... - if ($this->read_stream_read == 0 && isset($this->seek_position) && $this->seek_position !== ftell($this->read_stream)) { - if (fseek($this->read_stream, $this->seek_position) !== 0) { - throw new RequestCore_Exception('The stream does not support seeking and is either not at the requested position or the position is unknown.'); - } - } - - $read = fread($this->read_stream, min($this->read_stream_size - $this->read_stream_read, $length)); // Remaining upload data or cURL's requested chunk size - $this->read_stream_read += strlen($read); - - $out = $read === false ? '' : $read; - - // Execute callback function - if ($this->registered_streaming_read_callback) { - call_user_func($this->registered_streaming_read_callback, $curl_handle, $file_handle, $out); - } - - return $out; - } - - /** - * A callback function that is invoked by cURL for streaming down. - * - * @param resource $curl_handle (Required) The cURL handle for the request. - * @param binary $data (Required) The data to write. - * @return integer The number of bytes written. - */ - public function streaming_write_callback($curl_handle, $data) - { - $code = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE); - - if (intval($code) / 100 != 2) - { - $this->response_error_body .= $data; - return strlen($data); - } - - $length = strlen($data); - $written_total = 0; - $written_last = 0; - - while ($written_total < $length) { - $written_last = fwrite($this->write_stream, substr($data, $written_total)); - - if ($written_last === false) { - return $written_total; - } - - $written_total += $written_last; - } - - // Execute callback function - if ($this->registered_streaming_write_callback) { - call_user_func($this->registered_streaming_write_callback, $curl_handle, $written_total); - } - - return $written_total; - } - - /** - * Prepares and adds the details of the cURL request. This can be passed along to a - * function. - * - * @return resource The handle for the cURL object. - * - */ - public function prep_request() - { - $curl_handle = curl_init(); - - // Set default options. - curl_setopt($curl_handle, CURLOPT_URL, $this->request_url); - curl_setopt($curl_handle, CURLOPT_FILETIME, true); - curl_setopt($curl_handle, CURLOPT_FRESH_CONNECT, false); -// curl_setopt($curl_handle, CURLOPT_CLOSEPOLICY, CURLCLOSEPOLICY_LEAST_RECENTLY_USED); - curl_setopt($curl_handle, CURLOPT_MAXREDIRS, 5); - curl_setopt($curl_handle, CURLOPT_HEADER, true); - curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl_handle, CURLOPT_TIMEOUT, $this->timeout); - curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, $this->connect_timeout); - curl_setopt($curl_handle, CURLOPT_NOSIGNAL, true); - curl_setopt($curl_handle, CURLOPT_REFERER, $this->request_url); - curl_setopt($curl_handle, CURLOPT_USERAGENT, $this->useragent); - curl_setopt($curl_handle, CURLOPT_HEADERFUNCTION, array($this, 'streaming_header_callback')); - curl_setopt($curl_handle, CURLOPT_READFUNCTION, array($this, 'streaming_read_callback')); - - // Verification of the SSL cert - if ($this->ssl_verification) { - curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, 2); - } else { - curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, false); - } - - // chmod the file as 0755 - if ($this->cacert_location === true) { - curl_setopt($curl_handle, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem'); - } elseif (is_string($this->cacert_location)) { - curl_setopt($curl_handle, CURLOPT_CAINFO, $this->cacert_location); - } - - // Debug mode - if ($this->debug_mode) { - curl_setopt($curl_handle, CURLOPT_VERBOSE, true); - } - - // Handle open_basedir & safe mode - if (!ini_get('safe_mode') && !ini_get('open_basedir')) { - curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true); - } - - // Enable a proxy connection if requested. - if ($this->proxy) { - - $host = $this->proxy['host']; - $host .= ($this->proxy['port']) ? ':' . $this->proxy['port'] : ''; - curl_setopt($curl_handle, CURLOPT_PROXY, $host); - - if (isset($this->proxy['user']) && isset($this->proxy['pass'])) { - curl_setopt($curl_handle, CURLOPT_PROXYUSERPWD, $this->proxy['user'] . ':' . $this->proxy['pass']); - } - } - - // Set credentials for HTTP Basic/Digest Authentication. - if ($this->username && $this->password) { - curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - curl_setopt($curl_handle, CURLOPT_USERPWD, $this->username . ':' . $this->password); - } - - // Handle the encoding if we can. - if (extension_loaded('zlib')) { - curl_setopt($curl_handle, CURLOPT_ENCODING, ''); - } - - // Process custom headers - if (isset($this->request_headers) && count($this->request_headers)) { - $temp_headers = array(); - - foreach ($this->request_headers as $k => $v) { - $temp_headers[] = $k . ': ' . $v; - } - - curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $temp_headers); - } - - switch ($this->method) { - case self::HTTP_PUT: - //unset($this->read_stream); - curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'PUT'); - if (isset($this->read_stream)) { - if (!isset($this->read_stream_size) || $this->read_stream_size < 0) { - throw new RequestCore_Exception('The stream size for the streaming upload cannot be determined.'); - } - curl_setopt($curl_handle, CURLOPT_INFILESIZE, $this->read_stream_size); - curl_setopt($curl_handle, CURLOPT_UPLOAD, true); - } else { - curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body); - } - break; - - case self::HTTP_POST: - curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'POST'); - if (isset($this->read_stream)) { - if (!isset($this->read_stream_size) || $this->read_stream_size < 0) { - throw new RequestCore_Exception('The stream size for the streaming upload cannot be determined.'); - } - curl_setopt($curl_handle, CURLOPT_INFILESIZE, $this->read_stream_size); - curl_setopt($curl_handle, CURLOPT_UPLOAD, true); - } else { - curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body); - } - break; - - case self::HTTP_HEAD: - curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, self::HTTP_HEAD); - curl_setopt($curl_handle, CURLOPT_NOBODY, 1); - break; - - default: // Assumed GET - curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, $this->method); - if (isset($this->write_stream) || isset($this->write_file)) { - curl_setopt($curl_handle, CURLOPT_WRITEFUNCTION, array($this, 'streaming_write_callback')); - curl_setopt($curl_handle, CURLOPT_HEADER, false); - } else { - curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body); - } - break; - } - - // Merge in the CURLOPTs - if (isset($this->curlopts) && sizeof($this->curlopts) > 0) { - foreach ($this->curlopts as $k => $v) { - curl_setopt($curl_handle, $k, $v); - } - } - - return $curl_handle; - } - - /** - * Take the post-processed cURL data and break it down into useful header/body/info chunks. Uses the - * data stored in the `curl_handle` and `response` properties unless replacement data is passed in via - * parameters. - * - * @param resource $curl_handle (Optional) The reference to the already executed cURL request. - * @param string $response (Optional) The actual response content itself that needs to be parsed. - * @return ResponseCore A object containing a parsed HTTP response. - */ - public function process_response($curl_handle = null, $response = null) - { - // Accept a custom one if it's passed. - if ($curl_handle && $response) { - $this->response = $response; - } - - // As long as this came back as a valid resource... - if (is_resource($curl_handle)) { - // Determine what's what. - $header_size = curl_getinfo($curl_handle, CURLINFO_HEADER_SIZE); - $this->response_headers = substr($this->response, 0, $header_size); - $this->response_body = substr($this->response, $header_size); - $this->response_code = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE); - $this->response_info = curl_getinfo($curl_handle); - - if (intval($this->response_code) / 100 != 2 && isset($this->write_file)) - { - $this->response_headers = $this->response_raw_headers; - $this->response_body = $this->response_error_body; - } - - // Parse out the headers - $this->response_headers = explode("\r\n\r\n", trim($this->response_headers)); - $this->response_headers = array_pop($this->response_headers); - $this->response_headers = explode("\r\n", $this->response_headers); - array_shift($this->response_headers); - - // Loop through and split up the headers. - $header_assoc = array(); - foreach ($this->response_headers as $header) { - $kv = explode(': ', $header); - $header_assoc[strtolower($kv[0])] = isset($kv[1]) ? $kv[1] : ''; - } - - // Reset the headers to the appropriate property. - $this->response_headers = $header_assoc; - $this->response_headers['info'] = $this->response_info; - $this->response_headers['info']['method'] = $this->method; - - if ($curl_handle && $response) { - return new ResponseCore($this->response_headers, $this->response_body, $this->response_code); - } - } - - // Return false - return false; - } - - /** - * Sends the request, calling necessary utility functions to update built-in properties. - * - * @param boolean $parse (Optional) Whether to parse the response with ResponseCore or not. - * @return string The resulting unparsed data from the request. - */ - public function send_request($parse = false) - { - set_time_limit(0); - - $curl_handle = $this->prep_request(); - $this->response = curl_exec($curl_handle); - - if ($this->response === false) { - throw new RequestCore_Exception('cURL resource: ' . (string)$curl_handle . '; cURL error: ' . curl_error($curl_handle) . ' (' . curl_errno($curl_handle) . ')'); - } - - $parsed_response = $this->process_response($curl_handle, $this->response); - - curl_close($curl_handle); - - if ($parse) { - return $parsed_response; - } - - return $this->response; - } - - /*%******************************************************************************************%*/ - // RESPONSE METHODS - - /** - * Get the HTTP response headers from the request. - * - * @param string $header (Optional) A specific header value to return. Defaults to all headers. - * @return string|array All or selected header values. - */ - public function get_response_header($header = null) - { - if ($header) { - return $this->response_headers[strtolower($header)]; - } - return $this->response_headers; - } - - /** - * Get the HTTP response body from the request. - * - * @return string The response body. - */ - public function get_response_body() - { - return $this->response_body; - } - - /** - * Get the HTTP response code from the request. - * - * @return string The HTTP response code. - */ - public function get_response_code() - { - return $this->response_code; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore_Exception.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore_Exception.php deleted file mode 100644 index cb4e83c6..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore_Exception.php +++ /dev/null @@ -1,8 +0,0 @@ -). - * @param string $body (Required) XML-formatted response from AWS. - * @param integer $status (Optional) HTTP response status code from the request. - * @return Mixed Contains an `header` property (HTTP headers as an associative array), a or `body` property, and an `status` code. - */ - public function __construct($header, $body, $status = null) - { - $this->header = $header; - $this->body = $body; - $this->status = $status; - - return $this; - } - - /** - * Did we receive the status code we expected? - * - * @param integer|array $codes (Optional) The status code(s) to expect. Pass an for a single acceptable value, or an of integers for multiple acceptable values. - * @return boolean Whether we received the expected status code or not. - */ - public function isOK($codes = array(200, 201, 204, 206)) - { - if (is_array($codes)) { - return in_array($this->status, $codes); - } - - return $this->status === $codes; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php deleted file mode 100644 index 9b89674f..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php +++ /dev/null @@ -1,78 +0,0 @@ -location = $location; - $this->name = $name; - $this->createDate = $createDate; - } - - /** - * 得到bucket所在的region - * - * @return string - */ - public function getLocation() - { - return $this->location; - } - - /** - * 得到bucket的名称 - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * 得到bucket的创建时间 - * - * @return string - */ - public function getCreateDate() - { - return $this->createDate; - } - - /** - * bucket所在的region - * - * @var string - */ - private $location; - /** - * bucket的名称 - * - * @var string - */ - private $name; - - /** - * bucket的创建事件 - * - * @var string - */ - private $createDate; - -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php deleted file mode 100644 index 910717f9..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php +++ /dev/null @@ -1,39 +0,0 @@ -bucketList = $bucketList; - } - - /** - * 得到BucketInfo列表 - * - * @return BucketInfo[] - */ - public function getBucketList() - { - return $this->bucketList; - } - - /** - * BucketInfo信息列表 - * - * @var array - */ - private $bucketList = array(); -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php deleted file mode 100644 index f3597d2f..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php +++ /dev/null @@ -1,99 +0,0 @@ -cnameList = array(); - } - - /** - * @return array - * @example - * array(2) { - * [0]=> - * array(3) { - * ["Domain"]=> - * string(11) "www.foo.com" - * ["Status"]=> - * string(7) "enabled" - * ["LastModified"]=> - * string(8) "20150101" - * } - * [1]=> - * array(3) { - * ["Domain"]=> - * string(7) "bar.com" - * ["Status"]=> - * string(8) "disabled" - * ["LastModified"]=> - * string(8) "20160101" - * } - * } - */ - public function getCnames() - { - return $this->cnameList; - } - - - public function addCname($cname) - { - if (count($this->cnameList) >= self::OSS_MAX_RULES) { - throw new OssException( - "num of cname in the config exceeds self::OSS_MAX_RULES: " . strval(self::OSS_MAX_RULES)); - } - $this->cnameList[] = array('Domain' => $cname); - } - - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - if (!isset($xml->Cname)) return; - foreach ($xml->Cname as $entry) { - $cname = array(); - foreach ($entry as $key => $value) { - $cname[strval($key)] = strval($value); - } - $this->cnameList[] = $cname; - } - } - - public function serializeToXml() - { - $strXml = << - - -EOF; - $xml = new \SimpleXMLElement($strXml); - foreach ($this->cnameList as $cname) { - $node = $xml->addChild('Cname'); - foreach ($cname as $key => $value) { - $node->addChild($key, $value); - } - } - return $xml->asXML(); - } - - public function __toString() - { - return $this->serializeToXml(); - } - - const OSS_MAX_RULES = 10; - - private $cnameList = array(); -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php deleted file mode 100644 index c44c10a1..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php +++ /dev/null @@ -1,113 +0,0 @@ -rules = array(); - } - - /** - * 得到CorsRule列表 - * - * @return CorsRule[] - */ - public function getRules() - { - return $this->rules; - } - - - /** - * 添加一条CorsRule - * - * @param CorsRule $rule - * @throws OssException - */ - public function addRule($rule) - { - if (count($this->rules) >= self::OSS_MAX_RULES) { - throw new OssException("num of rules in the config exceeds self::OSS_MAX_RULES: " . strval(self::OSS_MAX_RULES)); - } - $this->rules[] = $rule; - } - - /** - * 从xml数据中解析出CorsConfig - * - * @param string $strXml - * @throws OssException - * @return null - */ - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - if (!isset($xml->CORSRule)) return; - foreach ($xml->CORSRule as $rule) { - $corsRule = new CorsRule(); - foreach ($rule as $key => $value) { - if ($key === self::OSS_CORS_ALLOWED_HEADER) { - $corsRule->addAllowedHeader(strval($value)); - } elseif ($key === self::OSS_CORS_ALLOWED_METHOD) { - $corsRule->addAllowedMethod(strval($value)); - } elseif ($key === self::OSS_CORS_ALLOWED_ORIGIN) { - $corsRule->addAllowedOrigin(strval($value)); - } elseif ($key === self::OSS_CORS_EXPOSE_HEADER) { - $corsRule->addExposeHeader(strval($value)); - } elseif ($key === self::OSS_CORS_MAX_AGE_SECONDS) { - $corsRule->setMaxAgeSeconds(strval($value)); - } - } - $this->addRule($corsRule); - } - return; - } - - /** - * 生成xml字符串 - * - * @return string - */ - public function serializeToXml() - { - $xml = new \SimpleXMLElement(''); - foreach ($this->rules as $rule) { - $xmlRule = $xml->addChild('CORSRule'); - $rule->appendToXml($xmlRule); - } - return $xml->asXML(); - } - - public function __toString() - { - return $this->serializeToXml(); - } - - const OSS_CORS_ALLOWED_ORIGIN = 'AllowedOrigin'; - const OSS_CORS_ALLOWED_METHOD = 'AllowedMethod'; - const OSS_CORS_ALLOWED_HEADER = 'AllowedHeader'; - const OSS_CORS_EXPOSE_HEADER = 'ExposeHeader'; - const OSS_CORS_MAX_AGE_SECONDS = 'MaxAgeSeconds'; - const OSS_MAX_RULES = 10; - - /** - * orsRule列表 - * - * @var CorsRule[] - */ - private $rules = array(); -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php deleted file mode 100644 index 2cbe1c17..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php +++ /dev/null @@ -1,150 +0,0 @@ -allowedOrigins[] = $allowedOrigin; - } - } - - /** - * Rule中增加一条allowedMethod - * - * @param string $allowedMethod - */ - public function addAllowedMethod($allowedMethod) - { - if (!empty($allowedMethod)) { - $this->allowedMethods[] = $allowedMethod; - } - } - - /** - * Rule中增加一条allowedHeader - * - * @param string $allowedHeader - */ - public function addAllowedHeader($allowedHeader) - { - if (!empty($allowedHeader)) { - $this->allowedHeaders[] = $allowedHeader; - } - } - - /** - * Rule中增加一条exposeHeader - * - * @param string $exposeHeader - */ - public function addExposeHeader($exposeHeader) - { - if (!empty($exposeHeader)) { - $this->exposeHeaders[] = $exposeHeader; - } - } - - /** - * @return int - */ - public function getMaxAgeSeconds() - { - return $this->maxAgeSeconds; - } - - /** - * @param int $maxAgeSeconds - */ - public function setMaxAgeSeconds($maxAgeSeconds) - { - $this->maxAgeSeconds = $maxAgeSeconds; - } - - /** - * 得到AllowedHeaders列表 - * - * @return string[] - */ - public function getAllowedHeaders() - { - return $this->allowedHeaders; - } - - /** - * 得到AllowedOrigins列表 - * - * @return string[] - */ - public function getAllowedOrigins() - { - return $this->allowedOrigins; - } - - /** - * 得到AllowedMethods列表 - * - * @return string[] - */ - public function getAllowedMethods() - { - return $this->allowedMethods; - } - - /** - * 得到ExposeHeaders列表 - * - * @return string[] - */ - public function getExposeHeaders() - { - return $this->exposeHeaders; - } - - /** - * 根据提供的xmlRule, 把this按照一定的规则插入到$xmlRule中 - * - * @param \SimpleXMLElement $xmlRule - * @throws OssException - */ - public function appendToXml(&$xmlRule) - { - if (!isset($this->maxAgeSeconds)) { - throw new OssException("maxAgeSeconds is not set in the Rule"); - } - foreach ($this->allowedOrigins as $allowedOrigin) { - $xmlRule->addChild(CorsConfig::OSS_CORS_ALLOWED_ORIGIN, $allowedOrigin); - } - foreach ($this->allowedMethods as $allowedMethod) { - $xmlRule->addChild(CorsConfig::OSS_CORS_ALLOWED_METHOD, $allowedMethod); - } - foreach ($this->allowedHeaders as $allowedHeader) { - $xmlRule->addChild(CorsConfig::OSS_CORS_ALLOWED_HEADER, $allowedHeader); - } - foreach ($this->exposeHeaders as $exposeHeader) { - $xmlRule->addChild(CorsConfig::OSS_CORS_EXPOSE_HEADER, $exposeHeader); - } - $xmlRule->addChild(CorsConfig::OSS_CORS_MAX_AGE_SECONDS, strval($this->maxAgeSeconds)); - } - - private $allowedHeaders = array(); - private $allowedOrigins = array(); - private $allowedMethods = array(); - private $exposeHeaders = array(); - private $maxAgeSeconds = null; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php deleted file mode 100644 index 6643444a..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php +++ /dev/null @@ -1,34 +0,0 @@ -liveRecordList; - } - - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - - if (isset($xml->LiveRecord)) { - foreach ($xml->LiveRecord as $record) { - $liveRecord = new LiveChannelHistory(); - $liveRecord->parseFromXmlNode($record); - $this->liveRecordList[] = $liveRecord; - } - } - } - - public function serializeToXml() - { - throw new OssException("Not implemented."); - } - - private $liveRecordList = array(); -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php deleted file mode 100644 index 0b5edfc4..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php +++ /dev/null @@ -1,68 +0,0 @@ -description; - } - - public function getStatus() - { - return $this->status; - } - - public function getType() - { - return $this->type; - } - - public function getFragDuration() - { - return $this->fragDuration; - } - - public function getFragCount() - { - return $this->fragCount; - } - - public function getPlayListName() - { - return $this->playlistName; - } - - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - - $this->description = strval($xml->Description); - $this->status = strval($xml->Status); - - if (isset($xml->Target)) { - foreach ($xml->Target as $target) { - $this->type = strval($target->Type); - $this->fragDuration = strval($target->FragDuration); - $this->fragCount = strval($target->FragCount); - $this->playlistName = strval($target->PlaylistName); - } - } - } - - public function serializeToXml() - { - throw new OssException("Not implemented."); - } - - private $description; - private $status; - private $type; - private $fragDuration; - private $fragCount; - private $playlistName; -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php deleted file mode 100644 index 2ee7a68b..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php +++ /dev/null @@ -1,107 +0,0 @@ -status; - } - - public function getConnectedTime() - { - return $this->connectedTime; - } - - public function getRemoteAddr() - { - return $this->remoteAddr; - } - - public function getVideoWidth() - { - return $this->videoWidth; - } - public function getVideoHeight() - { - return $this->videoHeight; - } - public function getVideoFrameRate() - { - return $this->videoFrameRate; - } - public function getVideoBandwidth() - { - return $this->videoBandwidth; - } - public function getVideoCodec() - { - return $this->videoCodec; - } - - public function getAudioBandwidth() - { - return $this->audioBandwidth; - } - public function getAudioSampleRate() - { - return $this->audioSampleRate; - } - public function getAudioCodec() - { - return $this->audioCodec; - } - - - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - $this->status = strval($xml->Status); - $this->connectedTime = strval($xml->ConnectedTime); - $this->remoteAddr = strval($xml->RemoteAddr); - - if (isset($xml->Video)) { - foreach ($xml->Video as $video) { - $this->videoWidth = intval($video->Width); - $this->videoHeight = intval($video->Height); - $this->videoFrameRate = intval($video->FrameRate); - $this->videoBandwidth = intval($video->Bandwidth); - $this->videoCodec = strval($video->Codec); - } - } - - if (isset($xml->Video)) { - foreach ($xml->Audio as $audio) { - $this->audioBandwidth = intval($audio->Bandwidth); - $this->audioSampleRate = intval($audio->SampleRate); - $this->audioCodec = strval($audio->Codec); - } - } - - } - - public function serializeToXml() - { - throw new OssException("Not implemented."); - } - - private $status; - private $connectedTime; - private $remoteAddr; - - private $videoWidth; - private $videoHeight; - private $videoFrameRate; - private $videoBandwidth; - private $videoCodec; - - private $audioBandwidth; - private $audioSampleRate; - private $audioCodec; - - -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php deleted file mode 100644 index 5abd825d..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php +++ /dev/null @@ -1,88 +0,0 @@ -action = $action; - $this->timeSpec = $timeSpec; - $this->timeValue = $timeValue; - } - - /** - * @return LifecycleAction - */ - public function getAction() - { - return $this->action; - } - - /** - * @param string $action - */ - public function setAction($action) - { - $this->action = $action; - } - - /** - * @return string - */ - public function getTimeSpec() - { - return $this->timeSpec; - } - - /** - * @param string $timeSpec - */ - public function setTimeSpec($timeSpec) - { - $this->timeSpec = $timeSpec; - } - - /** - * @return string - */ - public function getTimeValue() - { - return $this->timeValue; - } - - /** - * @param string $timeValue - */ - public function setTimeValue($timeValue) - { - $this->timeValue = $timeValue; - } - - /** - * appendToXml 把actions插入到xml中 - * - * @param \SimpleXMLElement $xmlRule - */ - public function appendToXml(&$xmlRule) - { - $xmlAction = $xmlRule->addChild($this->action); - $xmlAction->addChild($this->timeSpec, $this->timeValue); - } - - private $action; - private $timeSpec; - private $timeValue; - -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php deleted file mode 100644 index fc4f5755..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php +++ /dev/null @@ -1,107 +0,0 @@ -rules = array(); - $xml = simplexml_load_string($strXml); - if (!isset($xml->Rule)) return; - $this->rules = array(); - foreach ($xml->Rule as $rule) { - $id = strval($rule->ID); - $prefix = strval($rule->Prefix); - $status = strval($rule->Status); - $actions = array(); - foreach ($rule as $key => $value) { - if ($key === 'ID' || $key === 'Prefix' || $key === 'Status') continue; - $action = $key; - $timeSpec = null; - $timeValue = null; - foreach ($value as $timeSpecKey => $timeValueValue) { - $timeSpec = $timeSpecKey; - $timeValue = strval($timeValueValue); - } - $actions[] = new LifecycleAction($action, $timeSpec, $timeValue); - } - $this->rules[] = new LifecycleRule($id, $prefix, $status, $actions); - } - return; - } - - - /** - * 生成xml字符串 - * - * @return string - */ - public function serializeToXml() - { - - $xml = new \SimpleXMLElement(''); - foreach ($this->rules as $rule) { - $xmlRule = $xml->addChild('Rule'); - $rule->appendToXml($xmlRule); - } - return $xml->asXML(); - } - - /** - * - * 添加LifecycleRule - * - * @param LifecycleRule $lifecycleRule - * @throws OssException - */ - public function addRule($lifecycleRule) - { - if (!isset($lifecycleRule)) { - throw new OssException("lifecycleRule is null"); - } - $this->rules[] = $lifecycleRule; - } - - /** - * 将配置转换成字符串,便于用户查看 - * - * @return string - */ - public function __toString() - { - return $this->serializeToXml(); - } - - /** - * 得到所有的生命周期规则 - * - * @return LifecycleRule[] - */ - public function getRules() - { - return $this->rules; - } - - /** - * @var LifecycleRule[] - */ - private $rules; -} - - diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php deleted file mode 100644 index ec615b9a..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php +++ /dev/null @@ -1,126 +0,0 @@ -id; - } - - /** - * @param string $id 规则ID - */ - public function setId($id) - { - $this->id = $id; - } - - /** - * 得到文件前缀 - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * 设置文件前缀 - * - * @param string $prefix 文件前缀 - */ - public function setPrefix($prefix) - { - $this->prefix = $prefix; - } - - /** - * Lifecycle规则的状态 - * - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * 设置Lifecycle规则状态 - * - * @param string $status - */ - public function setStatus($status) - { - $this->status = $status; - } - - /** - * - * @return LifecycleAction[] - */ - public function getActions() - { - return $this->actions; - } - - /** - * @param LifecycleAction[] $actions - */ - public function setActions($actions) - { - $this->actions = $actions; - } - - - /** - * LifecycleRule constructor. - * - * @param string $id 规则ID - * @param string $prefix 文件前缀 - * @param string $status 规则状态,可选[self::LIFECYCLE_STATUS_ENABLED, self::LIFECYCLE_STATUS_DISABLED] - * @param LifecycleAction[] $actions - */ - public function __construct($id, $prefix, $status, $actions) - { - $this->id = $id; - $this->prefix = $prefix; - $this->status = $status; - $this->actions = $actions; - } - - /** - * @param \SimpleXMLElement $xmlRule - */ - public function appendToXml(&$xmlRule) - { - $xmlRule->addChild('ID', $this->id); - $xmlRule->addChild('Prefix', $this->prefix); - $xmlRule->addChild('Status', $this->status); - foreach ($this->actions as $action) { - $action->appendToXml($xmlRule); - } - } - - private $id; - private $prefix; - private $status; - private $actions = array(); - - const LIFECYCLE_STATUS_ENABLED = 'Enabled'; - const LIFECYCLE_STATUS_DISABLED = 'Disabled'; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ListMultipartUploadInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ListMultipartUploadInfo.php deleted file mode 100644 index 105d005b..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ListMultipartUploadInfo.php +++ /dev/null @@ -1,134 +0,0 @@ -bucket = $bucket; - $this->keyMarker = $keyMarker; - $this->uploadIdMarker = $uploadIdMarker; - $this->nextKeyMarker = $nextKeyMarker; - $this->nextUploadIdMarker = $nextUploadIdMarker; - $this->delimiter = $delimiter; - $this->prefix = $prefix; - $this->maxUploads = $maxUploads; - $this->isTruncated = $isTruncated; - $this->uploads = $uploads; - } - - /** - * 得到bucket名称 - * - * @return string - */ - public function getBucket() - { - return $this->bucket; - } - - /** - * @return string - */ - public function getKeyMarker() - { - return $this->keyMarker; - } - - /** - * - * @return string - */ - public function getUploadIdMarker() - { - return $this->uploadIdMarker; - } - - /** - * @return string - */ - public function getNextKeyMarker() - { - return $this->nextKeyMarker; - } - - /** - * @return string - */ - public function getNextUploadIdMarker() - { - return $this->nextUploadIdMarker; - } - - /** - * @return string - */ - public function getDelimiter() - { - return $this->delimiter; - } - - /** - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * @return int - */ - public function getMaxUploads() - { - return $this->maxUploads; - } - - /** - * @return string - */ - public function getIsTruncated() - { - return $this->isTruncated; - } - - /** - * @return UploadInfo[] - */ - public function getUploads() - { - return $this->uploads; - } - - private $bucket = ""; - private $keyMarker = ""; - private $uploadIdMarker = ""; - private $nextKeyMarker = ""; - private $nextUploadIdMarker = ""; - private $delimiter = ""; - private $prefix = ""; - private $maxUploads = 0; - private $isTruncated = "false"; - private $uploads = array(); -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ListPartsInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ListPartsInfo.php deleted file mode 100644 index f1d10ee9..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ListPartsInfo.php +++ /dev/null @@ -1,97 +0,0 @@ -bucket = $bucket; - $this->key = $key; - $this->uploadId = $uploadId; - $this->nextPartNumberMarker = $nextPartNumberMarker; - $this->maxParts = $maxParts; - $this->isTruncated = $isTruncated; - $this->listPart = $listPart; - } - - /** - * @return string - */ - public function getBucket() - { - return $this->bucket; - } - - /** - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * @return string - */ - public function getUploadId() - { - return $this->uploadId; - } - - /** - * @return int - */ - public function getNextPartNumberMarker() - { - return $this->nextPartNumberMarker; - } - - /** - * @return int - */ - public function getMaxParts() - { - return $this->maxParts; - } - - /** - * @return string - */ - public function getIsTruncated() - { - return $this->isTruncated; - } - - /** - * @return array - */ - public function getListPart() - { - return $this->listPart; - } - - private $bucket = ""; - private $key = ""; - private $uploadId = ""; - private $nextPartNumberMarker = 0; - private $maxParts = 0; - private $isTruncated = ""; - private $listPart = array(); -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelConfig.php deleted file mode 100644 index dadedc91..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelConfig.php +++ /dev/null @@ -1,121 +0,0 @@ -description = $option['description']; - } - if (isset($option['status'])) { - $this->status = $option['status']; - } - if (isset($option['type'])) { - $this->type = $option['type']; - } - if (isset($option['fragDuration'])) { - $this->fragDuration = $option['fragDuration']; - } - if (isset($option['fragCount'])) { - $this->fragCount = $option['fragCount']; - } - if (isset($option['playListName'])) { - $this->playListName = $option['playListName']; - } - } - - public function getDescription() - { - return $this->description; - } - - public function getStatus() - { - return $this->status; - } - - public function getType() - { - return $this->type; - } - - public function getFragDuration() - { - return $this->fragDuration; - } - - public function getFragCount() - { - return $this->fragCount; - } - - public function getPlayListName() - { - return $this->playListName; - } - - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - $this->description = strval($xml->Description); - $this->status = strval($xml->Status); - $target = $xml->Target; - $this->type = strval($target->Type); - $this->fragDuration = intval($target->FragDuration); - $this->fragCount = intval($target->FragCount); - $this->playListName = strval($target->PlayListName); - } - - public function serializeToXml() - { - $strXml = << - - -EOF; - $xml = new \SimpleXMLElement($strXml); - if (isset($this->description)) { - $xml->addChild('Description', $this->description); - } - - if (isset($this->status)) { - $xml->addChild('Status', $this->status); - } - - $node = $xml->addChild('Target'); - $node->addChild('Type', $this->type); - - if (isset($this->fragDuration)) { - $node->addChild('FragDuration', $this->fragDuration); - } - - if (isset($this->fragCount)) { - $node->addChild('FragCount', $this->fragCount); - } - - if (isset($this->playListName)) { - $node->addChild('PlayListName', $this->playListName); - } - - return $xml->asXML(); - } - - public function __toString() - { - return $this->serializeToXml(); - } - - private $description; - private $status = "enabled"; - private $type; - private $fragDuration = 5; - private $fragCount = 3; - private $playListName = "playlist.m3u8"; -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelHistory.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelHistory.php deleted file mode 100644 index 1c1fd4db..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelHistory.php +++ /dev/null @@ -1,59 +0,0 @@ -startTime; - } - - public function getEndTime() - { - return $this->endTime; - } - - public function getRemoteAddr() - { - return $this->remoteAddr; - } - - public function parseFromXmlNode($xml) - { - if (isset($xml->StartTime)) { - $this->startTime = strval($xml->StartTime); - } - - if (isset($xml->EndTime)) { - $this->endTime = strval($xml->EndTime); - } - - if (isset($xml->RemoteAddr)) { - $this->remoteAddr = strval($xml->RemoteAddr); - } - } - - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - $this->parseFromXmlNode($xml); - } - - public function serializeToXml() - { - throw new OssException("Not implemented."); - } - - private $startTime; - private $endTime; - private $remoteAddr; -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelInfo.php deleted file mode 100644 index c63ec54d..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelInfo.php +++ /dev/null @@ -1,107 +0,0 @@ -name = $name; - $this->description = $description; - $this->publishUrls = array(); - $this->playUrls = array(); - } - - public function getName() - { - return $this->name; - } - - public function setName($name) - { - $this->name = $name; - } - - public function getPublishUrls() - { - return $this->publishUrls; - } - - public function getPlayUrls() - { - return $this->playUrls; - } - - public function getStatus() - { - return $this->status; - } - - public function getLastModified() - { - return $this->lastModified; - } - - public function getDescription() - { - return $this->description; - } - - public function setDescription($description) - { - $this->description = $description; - } - - public function parseFromXmlNode($xml) - { - if (isset($xml->Name)) { - $this->name = strval($xml->Name); - } - - if (isset($xml->Description)) { - $this->description = strval($xml->Description); - } - - if (isset($xml->Status)) { - $this->status = strval($xml->Status); - } - - if (isset($xml->LastModified)) { - $this->lastModified = strval($xml->LastModified); - } - - if (isset($xml->PublishUrls)) { - foreach ($xml->PublishUrls as $url) { - $this->publishUrls[] = strval($url->Url); - } - } - - if (isset($xml->PlayUrls)) { - foreach ($xml->PlayUrls as $url) { - $this->playUrls[] = strval($url->Url); - } - } - } - - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - $this->parseFromXmlNode($xml); - } - - public function serializeToXml() - { - throw new OssException("Not implemented."); - } - - private $name; - private $description; - private $publishUrls; - private $playUrls; - private $status; - private $lastModified; -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php deleted file mode 100644 index bb5093aa..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php +++ /dev/null @@ -1,107 +0,0 @@ -bucket; - } - - public function setBucketName($name) - { - $this->bucket = $name; - } - - /** - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * @return string - */ - public function getMarker() - { - return $this->marker; - } - - /** - * @return int - */ - public function getMaxKeys() - { - return $this->maxKeys; - } - - /** - * @return mixed - */ - public function getIsTruncated() - { - return $this->isTruncated; - } - - /** - * @return LiveChannelInfo[] - */ - public function getChannelList() - { - return $this->channelList; - } - - /** - * @return string - */ - public function getNextMarker() - { - return $this->nextMarker; - } - - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - - $this->prefix = strval($xml->Prefix); - $this->marker = strval($xml->Marker); - $this->maxKeys = intval($xml->MaxKeys); - $this->isTruncated = (strval($xml->IsTruncated) == 'true'); - $this->nextMarker = strval($xml->NextMarker); - - if (isset($xml->LiveChannel)) { - foreach ($xml->LiveChannel as $chan) { - $channel = new LiveChannelInfo(); - $channel->parseFromXmlNode($chan); - $this->channelList[] = $channel; - } - } - } - - public function serializeToXml() - { - throw new OssException("Not implemented."); - } - - private $bucket = ''; - private $prefix = ''; - private $marker = ''; - private $nextMarker = ''; - private $maxKeys = 100; - private $isTruncated = 'false'; - private $channelList = array(); -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php deleted file mode 100644 index 978421a2..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php +++ /dev/null @@ -1,86 +0,0 @@ -targetBucket = $targetBucket; - $this->targetPrefix = $targetPrefix; - } - - /** - * @param $strXml - * @return null - */ - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - if (!isset($xml->LoggingEnabled)) return; - foreach ($xml->LoggingEnabled as $status) { - foreach ($status as $key => $value) { - if ($key === 'TargetBucket') { - $this->targetBucket = strval($value); - } elseif ($key === 'TargetPrefix') { - $this->targetPrefix = strval($value); - } - } - break; - } - } - - /** - * 序列化成xml字符串 - * - */ - public function serializeToXml() - { - $xml = new \SimpleXMLElement(''); - if (isset($this->targetBucket) && isset($this->targetPrefix)) { - $loggingEnabled = $xml->addChild('LoggingEnabled'); - $loggingEnabled->addChild('TargetBucket', $this->targetBucket); - $loggingEnabled->addChild('TargetPrefix', $this->targetPrefix); - } - return $xml->asXML(); - } - - /** - * @return string - */ - public function __toString() - { - return $this->serializeToXml(); - } - - /** - * @return string - */ - public function getTargetBucket() - { - return $this->targetBucket; - } - - /** - * @return string - */ - public function getTargetPrefix() - { - return $this->targetPrefix; - } - - private $targetBucket = ""; - private $targetPrefix = ""; - -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php deleted file mode 100644 index 2ae6c99b..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php +++ /dev/null @@ -1,93 +0,0 @@ -key = $key; - $this->lastModified = $lastModified; - $this->eTag = $eTag; - $this->type = $type; - $this->size = $size; - $this->storageClass = $storageClass; - } - - /** - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * @return string - */ - public function getLastModified() - { - return $this->lastModified; - } - - /** - * @return string - */ - public function getETag() - { - return $this->eTag; - } - - /** - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * @return int - */ - public function getSize() - { - return $this->size; - } - - /** - * @return string - */ - public function getStorageClass() - { - return $this->storageClass; - } - - private $key = ""; - private $lastModified = ""; - private $eTag = ""; - private $type = ""; - private $size = 0; - private $storageClass = ""; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php deleted file mode 100644 index dbe7c7a7..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php +++ /dev/null @@ -1,126 +0,0 @@ -bucketName = $bucketName; - $this->prefix = $prefix; - $this->marker = $marker; - $this->nextMarker = $nextMarker; - $this->maxKeys = $maxKeys; - $this->delimiter = $delimiter; - $this->isTruncated = $isTruncated; - $this->objectList = $objectList; - $this->prefixList = $prefixList; - } - - /** - * @return string - */ - public function getBucketName() - { - return $this->bucketName; - } - - /** - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * @return string - */ - public function getMarker() - { - return $this->marker; - } - - /** - * @return int - */ - public function getMaxKeys() - { - return $this->maxKeys; - } - - /** - * @return string - */ - public function getDelimiter() - { - return $this->delimiter; - } - - /** - * @return mixed - */ - public function getIsTruncated() - { - return $this->isTruncated; - } - - /** - * 返回ListObjects接口返回数据中的ObjectInfo列表 - * - * @return ObjectInfo[] - */ - public function getObjectList() - { - return $this->objectList; - } - - /** - * 返回ListObjects接口返回数据中的PrefixInfo列表 - * - * @return PrefixInfo[] - */ - public function getPrefixList() - { - return $this->prefixList; - } - - /** - * @return string - */ - public function getNextMarker() - { - return $this->nextMarker; - } - - private $bucketName = ""; - private $prefix = ""; - private $marker = ""; - private $nextMarker = ""; - private $maxKeys = 0; - private $delimiter = ""; - private $isTruncated = null; - private $objectList = array(); - private $prefixList = array(); -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php deleted file mode 100644 index 439a84d3..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php +++ /dev/null @@ -1,63 +0,0 @@ -partNumber = $partNumber; - $this->lastModified = $lastModified; - $this->eTag = $eTag; - $this->size = $size; - } - - /** - * @return int - */ - public function getPartNumber() - { - return $this->partNumber; - } - - /** - * @return string - */ - public function getLastModified() - { - return $this->lastModified; - } - - /** - * @return string - */ - public function getETag() - { - return $this->eTag; - } - - /** - * @return int - */ - public function getSize() - { - return $this->size; - } - - private $partNumber = 0; - private $lastModified = ""; - private $eTag = ""; - private $size = 0; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php deleted file mode 100644 index e61eac44..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php +++ /dev/null @@ -1,36 +0,0 @@ -prefix = $prefix; - } - - /** - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - private $prefix; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php deleted file mode 100644 index 1d7d975c..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php +++ /dev/null @@ -1,93 +0,0 @@ -AllowEmptyReferer)) return; - if (!isset($xml->RefererList)) return; - $this->allowEmptyReferer = - (strval($xml->AllowEmptyReferer) === 'TRUE' || strval($xml->AllowEmptyReferer) === 'true') ? true : false; - - foreach ($xml->RefererList->Referer as $key => $refer) { - $this->refererList[] = strval($refer); - } - } - - - /** - * 把RefererConfig序列化成xml - * - * @return string - */ - public function serializeToXml() - { - $xml = new \SimpleXMLElement(''); - if ($this->allowEmptyReferer) { - $xml->addChild('AllowEmptyReferer', 'true'); - } else { - $xml->addChild('AllowEmptyReferer', 'false'); - } - $refererList = $xml->addChild('RefererList'); - foreach ($this->refererList as $referer) { - $refererList->addChild('Referer', $referer); - } - return $xml->asXML(); - } - - /** - * @return string - */ - function __toString() - { - return $this->serializeToXml(); - } - - /** - * @param boolean $allowEmptyReferer - */ - public function setAllowEmptyReferer($allowEmptyReferer) - { - $this->allowEmptyReferer = $allowEmptyReferer; - } - - /** - * @param string $referer - */ - public function addReferer($referer) - { - $this->refererList[] = $referer; - } - - /** - * @return boolean - */ - public function isAllowEmptyReferer() - { - return $this->allowEmptyReferer; - } - - /** - * @return array - */ - public function getRefererList() - { - return $this->refererList; - } - - private $allowEmptyReferer = true; - private $refererList = array(); -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php deleted file mode 100644 index 05e6332c..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php +++ /dev/null @@ -1,74 +0,0 @@ -storageCapacity = $storageCapacity; - } - - /** - * Not implemented - */ - public function parseFromXml($strXml) - { - throw new OssException("Not implemented."); - } - - /** - * 把StorageCapacityConfig序列化成xml - * - * @return string - */ - public function serializeToXml() - { - $xml = new \SimpleXMLElement(''); - $xml->addChild('StorageCapacity', strval($this->storageCapacity)); - return $xml->asXML(); - } - - /** - * To string - * - * @return string - */ - function __toString() - { - return $this->serializeToXml(); - } - - /** - * Set storage capacity - * - * @param int $storageCapacity - */ - public function setStorageCapacity($storageCapacity) - { - $this->storageCapacity = $storageCapacity; - } - - /** - * Get storage capacity - * - * @return int - */ - public function getStorageCapacity() - { - return $this->storageCapacity; - } - - private $storageCapacity = 0; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php deleted file mode 100644 index 8eaa3639..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php +++ /dev/null @@ -1,55 +0,0 @@ -key = $key; - $this->uploadId = $uploadId; - $this->initiated = $initiated; - } - - /** - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * @return string - */ - public function getUploadId() - { - return $this->uploadId; - } - - /** - * @return string - */ - public function getInitiated() - { - return $this->initiated; - } - - private $key = ""; - private $uploadId = ""; - private $initiated = ""; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php deleted file mode 100644 index 8ea08a03..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php +++ /dev/null @@ -1,76 +0,0 @@ -indexDocument = $indexDocument; - $this->errorDocument = $errorDocument; - } - - /** - * @param string $strXml - * @return null - */ - public function parseFromXml($strXml) - { - $xml = simplexml_load_string($strXml); - if (isset($xml->IndexDocument) && isset($xml->IndexDocument->Suffix)) { - $this->indexDocument = strval($xml->IndexDocument->Suffix); - } - if (isset($xml->ErrorDocument) && isset($xml->ErrorDocument->Key)) { - $this->errorDocument = strval($xml->ErrorDocument->Key); - } - } - - /** - * 把WebsiteConfig序列化成xml - * - * @return string - * @throws OssException - */ - public function serializeToXml() - { - $xml = new \SimpleXMLElement(''); - $index_document_part = $xml->addChild('IndexDocument'); - $error_document_part = $xml->addChild('ErrorDocument'); - $index_document_part->addChild('Suffix', $this->indexDocument); - $error_document_part->addChild('Key', $this->errorDocument); - return $xml->asXML(); - } - - /** - * @return string - */ - public function getIndexDocument() - { - return $this->indexDocument; - } - - /** - * @return string - */ - public function getErrorDocument() - { - return $this->errorDocument; - } - - private $indexDocument = ""; - private $errorDocument = ""; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php deleted file mode 100644 index d353a222..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php +++ /dev/null @@ -1,27 +0,0 @@ -hostname = $this->checkEndpoint($endpoint, $isCName); - $this->accessKeyId = $accessKeyId; - $this->accessKeySecret = $accessKeySecret; - $this->securityToken = $securityToken; - $this->requestProxy = $requestProxy; - - self::checkEnv(); - } - - /** - * 列举用户所有的Bucket[GetService], Endpoint类型为cname不能进行此操作 - * - * @param array $options - * @throws OssException - * @return BucketListInfo - */ - public function listBuckets($options = NULL) - { - if ($this->hostType === self::OSS_HOST_TYPE_CNAME) { - throw new OssException("operation is not permitted with CName host"); - } - $this->precheckOptions($options); - $options[self::OSS_BUCKET] = ''; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $response = $this->auth($options); - $result = new ListBucketsResult($response); - return $result->getData(); - } - - /** - * 创建bucket,默认创建的bucket的ACL是OssClient::OSS_ACL_TYPE_PRIVATE - * - * @param string $bucket - * @param string $acl - * @param array $options - * @param string $storageType - * @return null - */ - public function createBucket($bucket, $acl = self::OSS_ACL_TYPE_PRIVATE, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_HEADERS] = array(self::OSS_ACL => $acl); - if (isset($options[self::OSS_STORAGE])) { - $this->precheckStorage($options[self::OSS_STORAGE]); - $options[self::OSS_CONTENT] = OssUtil::createBucketXmlBody($options[self::OSS_STORAGE]); - unset($options[self::OSS_STORAGE]); - } - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 删除bucket - * 如果Bucket不为空(Bucket中有Object,或者有分块上传的碎片),则Bucket无法删除, - * 必须删除Bucket中的所有Object以及碎片后,Bucket才能成功删除。 - * - * @param string $bucket - * @param array $options - * @return null - */ - public function deleteBucket($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE; - $options[self::OSS_OBJECT] = '/'; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 判断bucket是否存在 - * - * @param string $bucket - * @return bool - * @throws OssException - */ - public function doesBucketExist($bucket) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'acl'; - $response = $this->auth($options); - $result = new ExistResult($response); - return $result->getData(); - } - - /** - * 获取bucket所属的数据中心位置信息 - * - * @param string $bucket - * @param array $options - * @throws OssException - * @return string - */ - public function getBucketLocation($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'location'; - $response = $this->auth($options); - $result = new GetLocationResult($response); - return $result->getData(); - } - - /** - * 获取Bucket的Meta信息 - * - * @param string $bucket - * @param array $options 具体参考SDK文档 - * @return array - */ - public function getBucketMeta($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD; - $options[self::OSS_OBJECT] = '/'; - $response = $this->auth($options); - $result = new HeaderResult($response); - return $result->getData(); - } - - /** - * 获取bucket的ACL配置情况 - * - * @param string $bucket - * @param array $options - * @throws OssException - * @return string - */ - public function getBucketAcl($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'acl'; - $response = $this->auth($options); - $result = new AclResult($response); - return $result->getData(); - } - - /** - * 设置bucket的ACL配置情况 - * - * @param string $bucket bucket名称 - * @param string $acl 读写权限,可选值 ['private', 'public-read', 'public-read-write'] - * @param array $options 可以为空 - * @throws OssException - * @return null - */ - public function putBucketAcl($bucket, $acl, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_HEADERS] = array(self::OSS_ACL => $acl); - $options[self::OSS_SUB_RESOURCE] = 'acl'; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取object的ACL属性 - * - * @param string $bucket - * @param string $object - * @throws OssException - * @return string - */ - public function getObjectAcl($bucket, $object) - { - $options = array(); - $this->precheckCommon($bucket, $object, $options, true); - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_SUB_RESOURCE] = 'acl'; - $response = $this->auth($options); - $result = new AclResult($response); - return $result->getData(); - } - - /** - * 设置object的ACL属性 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $acl 读写权限,可选值 ['default', 'private', 'public-read', 'public-read-write'] - * @throws OssException - * @return null - */ - public function putObjectAcl($bucket, $object, $acl) - { - $this->precheckCommon($bucket, $object, $options, true); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_HEADERS] = array(self::OSS_OBJECT_ACL => $acl); - $options[self::OSS_SUB_RESOURCE] = 'acl'; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取Bucket的访问日志配置情况 - * - * @param string $bucket bucket名称 - * @param array $options 可以为空 - * @throws OssException - * @return LoggingConfig - */ - public function getBucketLogging($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'logging'; - $response = $this->auth($options); - $result = new GetLoggingResult($response); - return $result->getData(); - } - - /** - * 开启Bucket访问日志记录功能,只有Bucket的所有者才能更改 - * - * @param string $bucket bucket名称 - * @param string $targetBucket 日志文件存放的bucket - * @param string $targetPrefix 日志的文件前缀 - * @param array $options 可以为空 - * @throws OssException - * @return null - */ - public function putBucketLogging($bucket, $targetBucket, $targetPrefix, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $this->precheckBucket($targetBucket, 'targetbucket is not allowed empty'); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'logging'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - - $loggingConfig = new LoggingConfig($targetBucket, $targetPrefix); - $options[self::OSS_CONTENT] = $loggingConfig->serializeToXml(); - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 关闭bucket访问日志记录功能 - * - * @param string $bucket bucket名称 - * @param array $options 可以为空 - * @throws OssException - * @return null - */ - public function deleteBucketLogging($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'logging'; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 将bucket设置成静态网站托管模式 - * - * @param string $bucket bucket名称 - * @param WebsiteConfig $websiteConfig - * @param array $options 可以为空 - * @throws OssException - * @return null - */ - public function putBucketWebsite($bucket, $websiteConfig, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'website'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $options[self::OSS_CONTENT] = $websiteConfig->serializeToXml(); - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取bucket的静态网站托管状态 - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return WebsiteConfig - */ - public function getBucketWebsite($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'website'; - $response = $this->auth($options); - $result = new GetWebsiteResult($response); - return $result->getData(); - } - - /** - * 关闭bucket的静态网站托管模式 - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return null - */ - public function deleteBucketWebsite($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'website'; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 在指定的bucket上设定一个跨域资源共享(CORS)的规则,如果原规则存在则覆盖原规则 - * - * @param string $bucket bucket名称 - * @param CorsConfig $corsConfig 跨域资源共享配置,具体规则参见SDK文档 - * @param array $options array - * @throws OssException - * @return null - */ - public function putBucketCors($bucket, $corsConfig, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'cors'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $options[self::OSS_CONTENT] = $corsConfig->serializeToXml(); - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取Bucket的CORS配置情况 - * - * @param string $bucket bucket名称 - * @param array $options 可以为空 - * @throws OssException - * @return CorsConfig - */ - public function getBucketCors($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'cors'; - $response = $this->auth($options); - $result = new GetCorsResult($response, __FUNCTION__); - return $result->getData(); - } - - /** - * 关闭指定Bucket对应的CORS功能并清空所有规则 - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return null - */ - public function deleteBucketCors($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'cors'; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 为指定Bucket增加CNAME绑定 - * - * @param string $bucket bucket名称 - * @param string $cname - * @param array $options - * @throws OssException - * @return null - */ - public function addBucketCname($bucket, $cname, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'cname'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $cnameConfig = new CnameConfig(); - $cnameConfig->addCname($cname); - $options[self::OSS_CONTENT] = $cnameConfig->serializeToXml(); - $options[self::OSS_COMP] = 'add'; - - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取指定Bucket已绑定的CNAME列表 - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return CnameConfig - */ - public function getBucketCname($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'cname'; - $response = $this->auth($options); - $result = new GetCnameResult($response); - return $result->getData(); - } - - /** - * 解除指定Bucket的CNAME绑定 - * - * @param string $bucket bucket名称 - * @param CnameConfig $cnameConfig - * @param array $options - * @throws OssException - * @return null - */ - public function deleteBucketCname($bucket, $cname, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'cname'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $cnameConfig = new CnameConfig(); - $cnameConfig->addCname($cname); - $options[self::OSS_CONTENT] = $cnameConfig->serializeToXml(); - $options[self::OSS_COMP] = 'delete'; - - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 为指定Bucket创建LiveChannel - * - * @param string $bucket bucket名称 - * @param string channelName $channelName - * @param LiveChannelConfig $channelConfig - * @param array $options - * @throws OssException - * @return LiveChannelInfo - */ - public function putBucketLiveChannel($bucket, $channelName, $channelConfig, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = $channelName; - $options[self::OSS_SUB_RESOURCE] = 'live'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $options[self::OSS_CONTENT] = $channelConfig->serializeToXml(); - - $response = $this->auth($options); - $result = new PutLiveChannelResult($response); - $info = $result->getData(); - $info->setName($channelName); - $info->setDescription($channelConfig->getDescription()); - - return $info; - } - - /** - * 设置LiveChannel的status - * - * @param string $bucket bucket名称 - * @param string channelName $channelName - * @param string channelStatus $channelStatus 为enabled或disabled - * @param array $options - * @throws OssException - * @return null - */ - public function putLiveChannelStatus($bucket, $channelName, $channelStatus, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = $channelName; - $options[self::OSS_SUB_RESOURCE] = 'live'; - $options[self::OSS_LIVE_CHANNEL_STATUS] = $channelStatus; - - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取LiveChannel信息 - * - * @param string $bucket bucket名称 - * @param string channelName $channelName - * @param array $options - * @throws OssException - * @return GetLiveChannelInfo - */ - public function getLiveChannelInfo($bucket, $channelName, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = $channelName; - $options[self::OSS_SUB_RESOURCE] = 'live'; - - $response = $this->auth($options); - $result = new GetLiveChannelInfoResult($response); - return $result->getData(); - } - - /** - * 获取LiveChannel状态信息 - * - * @param string $bucket bucket名称 - * @param string channelName $channelName - * @param array $options - * @throws OssException - * @return GetLiveChannelStatus - */ - public function getLiveChannelStatus($bucket, $channelName, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = $channelName; - $options[self::OSS_SUB_RESOURCE] = 'live'; - $options[self::OSS_COMP] = 'stat'; - - $response = $this->auth($options); - $result = new GetLiveChannelStatusResult($response); - return $result->getData(); - } - - /** - *获取LiveChannel推流记录 - * - * @param string $bucket bucket名称 - * @param string channelName $channelName - * @param array $options - * @throws OssException - * @return GetLiveChannelHistory - */ - public function getLiveChannelHistory($bucket, $channelName, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = $channelName; - $options[self::OSS_SUB_RESOURCE] = 'live'; - $options[self::OSS_COMP] = 'history'; - - $response = $this->auth($options); - $result = new GetLiveChannelHistoryResult($response); - return $result->getData(); - } - - /** - *获取指定Bucket下的live channel列表 - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return LiveChannelListInfo - */ - public function listBucketLiveChannels($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'live'; - $options[self::OSS_QUERY_STRING] = array( - 'prefix' => isset($options['prefix']) ? $options['prefix'] : '', - 'marker' => isset($options['marker']) ? $options['marker'] : '', - 'max-keys' => isset($options['max-keys']) ? $options['max-keys'] : '', - ); - $response = $this->auth($options); - $result = new ListLiveChannelResult($response); - $list = $result->getData(); - $list->setBucketName($bucket); - - return $list; - } - - /** - * 为指定LiveChannel生成播放列表 - * - * @param string $bucket bucket名称 - * @param string channelName $channelName - * @param string $playlistName 指定生成的点播播放列表的名称,必须以“.m3u8”结尾 - * @param array $setTime startTime和EndTime以unix时间戳格式给定,跨度不能超过一天 - * @throws OssException - * @return null - */ - public function postVodPlaylist($bucket, $channelName, $playlistName, $setTime) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_OBJECT] = $channelName . '/' . $playlistName; - $options[self::OSS_SUB_RESOURCE] = 'vod'; - $options[self::OSS_LIVE_CHANNEL_END_TIME] = $setTime['EndTime']; - $options[self::OSS_LIVE_CHANNEL_START_TIME] = $setTime['StartTime']; - - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 删除指定Bucket的LiveChannel - * - * @param string $bucket bucket名称 - * @param string channelName $channelName - * @param array $options - * @throws OssException - * @return null - */ - public function deleteBucketLiveChannel($bucket, $channelName, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE; - $options[self::OSS_OBJECT] = $channelName; - $options[self::OSS_SUB_RESOURCE] = 'live'; - - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 生成带签名的推流地址 - * - * @param string $bucket bucket名称 - * @param string channelName $channelName - * @param int timeout 设置超时时间,单位为秒 - * @param array $options - * @throws OssException - * @return 推流地址 - */ - public function signRtmpUrl($bucket, $channelName, $timeout = 60, $options = NULL) - { - $this->precheckCommon($bucket, $channelName, $options, false); - $expires = time() + $timeout; - $proto = 'rtmp://'; - $hostname = $this->generateHostname($bucket); - $cano_params = ''; - $query_items = array(); - $params = isset($options['params']) ? $options['params'] : array(); - uksort($params, 'strnatcasecmp'); - foreach ($params as $key => $value) { - $cano_params = $cano_params . $key . ':' . $value . "\n"; - $query_items[] = rawurlencode($key) . '=' . rawurlencode($value); - } - $resource = '/' . $bucket . '/' . $channelName; - - $string_to_sign = $expires . "\n" . $cano_params . $resource; - $signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->accessKeySecret, true)); - - $query_items[] = 'OSSAccessKeyId=' . rawurlencode($this->accessKeyId); - $query_items[] = 'Expires=' . rawurlencode($expires); - $query_items[] = 'Signature=' . rawurlencode($signature); - - return $proto . $hostname . '/live/' . $channelName . '?' . implode('&', $query_items); - } - - /** - * 检验跨域资源请求, 发送跨域请求之前会发送一个preflight请求(OPTIONS)并带上特定的来源域, - * HTTP方法和header信息等给OSS以决定是否发送真正的请求。 OSS可以通过putBucketCors接口 - * 来开启Bucket的CORS支持,开启CORS功能之后,OSS在收到浏览器preflight请求时会根据设定的 - * 规则评估是否允许本次请求 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $origin 请求来源域 - * @param string $request_method 表明实际请求中会使用的HTTP方法 - * @param string $request_headers 表明实际请求中会使用的除了简单头部之外的headers - * @param array $options - * @return array - * @throws OssException - * @link http://help.aliyun.com/document_detail/oss/api-reference/cors/OptionObject.html - */ - public function optionsObject($bucket, $object, $origin, $request_method, $request_headers, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_OPTIONS; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_HEADERS] = array( - self::OSS_OPTIONS_ORIGIN => $origin, - self::OSS_OPTIONS_REQUEST_HEADERS => $request_headers, - self::OSS_OPTIONS_REQUEST_METHOD => $request_method - ); - $response = $this->auth($options); - $result = new HeaderResult($response); - return $result->getData(); - } - - /** - * 设置Bucket的Lifecycle配置 - * - * @param string $bucket bucket名称 - * @param LifecycleConfig $lifecycleConfig Lifecycle配置类 - * @param array $options - * @throws OssException - * @return null - */ - public function putBucketLifecycle($bucket, $lifecycleConfig, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'lifecycle'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $options[self::OSS_CONTENT] = $lifecycleConfig->serializeToXml(); - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取Bucket的Lifecycle配置情况 - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return LifecycleConfig - */ - public function getBucketLifecycle($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'lifecycle'; - $response = $this->auth($options); - $result = new GetLifecycleResult($response); - return $result->getData(); - } - - /** - * 删除指定Bucket的生命周期配置 - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return null - */ - public function deleteBucketLifecycle($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'lifecycle'; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 设置一个bucket的referer访问白名单和是否允许referer字段为空的请求访问 - * Bucket Referer防盗链具体见OSS防盗链 - * - * @param string $bucket bucket名称 - * @param RefererConfig $refererConfig - * @param array $options - * @return ResponseCore - * @throws null - */ - public function putBucketReferer($bucket, $refererConfig, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'referer'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $options[self::OSS_CONTENT] = $refererConfig->serializeToXml(); - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取Bucket的Referer配置情况 - * Bucket Referer防盗链具体见OSS防盗链 - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return RefererConfig - */ - public function getBucketReferer($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'referer'; - $response = $this->auth($options); - $result = new GetRefererResult($response); - return $result->getData(); - } - - /** - * 设置bucket的容量大小,单位GB - * 当bucket的容量大于设置的容量时,禁止继续写入 - * - * @param string $bucket bucket名称 - * @param int $storageCapacity - * @param array $options - * @return ResponseCore - * @throws null - */ - public function putBucketStorageCapacity($bucket, $storageCapacity, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'qos'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $storageCapacityConfig = new StorageCapacityConfig($storageCapacity); - $options[self::OSS_CONTENT] = $storageCapacityConfig->serializeToXml(); - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取bucket的容量大小,单位GB - * - * @param string $bucket bucket名称 - * @param array $options - * @throws OssException - * @return int - */ - public function getBucketStorageCapacity($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'qos'; - $response = $this->auth($options); - $result = new GetStorageCapacityResult($response); - return $result->getData(); - } - - /** - * 获取bucket下的object列表 - * - * @param string $bucket - * @param array $options - * 其中options中的参数如下 - * $options = array( - * 'max-keys' => max-keys用于限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于1000。 - * 'prefix' => 限定返回的object key必须以prefix作为前缀。注意使用prefix查询时,返回的key中仍会包含prefix。 - * 'delimiter' => 是一个用于对Object名字进行分组的字符。所有名字包含指定的前缀且第一次出现delimiter字符之间的object作为一组元素 - * 'marker' => 用户设定结果从marker之后按字母排序的第一个开始返回。 - *) - * 其中 prefix,marker用来实现分页显示效果,参数的长度必须小于256字节。 - * @throws OssException - * @return ObjectListInfo - */ - public function listObjects($bucket, $options = NULL) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_HEADERS] = array( - self::OSS_DELIMITER => isset($options[self::OSS_DELIMITER]) ? $options[self::OSS_DELIMITER] : '/', - self::OSS_PREFIX => isset($options[self::OSS_PREFIX]) ? $options[self::OSS_PREFIX] : '', - self::OSS_MAX_KEYS => isset($options[self::OSS_MAX_KEYS]) ? $options[self::OSS_MAX_KEYS] : self::OSS_MAX_KEYS_VALUE, - self::OSS_MARKER => isset($options[self::OSS_MARKER]) ? $options[self::OSS_MARKER] : '', - ); - $query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array(); - $options[self::OSS_QUERY_STRING] = array_merge( - $query, - array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL) - ); - - $response = $this->auth($options); - $result = new ListObjectsResult($response); - return $result->getData(); - } - - /** - * 创建虚拟目录 (本函数会在object名称后增加'/', 所以创建目录的object名称不需要'/'结尾,否则,目录名称会变成'//') - * - * 暂不开放此接口 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param array $options - * @return null - */ - public function createObjectDir($bucket, $object, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = $object . '/'; - $options[self::OSS_CONTENT_LENGTH] = array(self::OSS_CONTENT_LENGTH => 0); - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 上传内存中的内容 - * - * @param string $bucket bucket名称 - * @param string $object objcet名称 - * @param string $content 上传的内容 - * @param array $options - * @return null - */ - public function putObject($bucket, $object, $content, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - - $options[self::OSS_CONTENT] = $content; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = $object; - - if (!isset($options[self::OSS_LENGTH])) { - $options[self::OSS_CONTENT_LENGTH] = strlen($options[self::OSS_CONTENT]); - } else { - $options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH]; - } - - $is_check_md5 = $this->isCheckMD5($options); - if ($is_check_md5) { - $content_md5 = base64_encode(md5($content, true)); - $options[self::OSS_CONTENT_MD5] = $content_md5; - } - - if (!isset($options[self::OSS_CONTENT_TYPE])) { - $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object); - } - $response = $this->auth($options); - - if (isset($options[self::OSS_CALLBACK]) && !empty($options[self::OSS_CALLBACK])) { - $result = new CallbackResult($response); - } else { - $result = new PutSetDeleteResult($response); - } - - return $result->getData(); - } - - /** - * 创建symlink - * @param string $bucket bucket名称 - * @param string $symlink symlink名称 - * @param string $targetObject 目标object名称 - * @param array $options - * @return null - */ - public function putSymlink($bucket, $symlink ,$targetObject, $options = NULL) - { - $this->precheckCommon($bucket, $symlink, $options); - - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = $symlink; - $options[self::OSS_SUB_RESOURCE] = self::OSS_SYMLINK; - $options[self::OSS_HEADERS][self::OSS_SYMLINK_TARGET] = rawurlencode($targetObject); - - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取symlink - *@param string $bucket bucket名称 - * @param string $symlink symlink名称 - * @return null - */ - public function getSymlink($bucket, $symlink) - { - $this->precheckCommon($bucket, $symlink, $options); - - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = $symlink; - $options[self::OSS_SUB_RESOURCE] = self::OSS_SYMLINK; - - $response = $this->auth($options); - $result = new SymlinkResult($response); - return $result->getData(); - } - - /** - * 上传本地文件 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $file 本地文件路径 - * @param array $options - * @return null - * @throws OssException - */ - public function uploadFile($bucket, $object, $file, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - OssUtil::throwOssExceptionWithMessageIfEmpty($file, "file path is invalid"); - $file = OssUtil::encodePath($file); - if (!file_exists($file)) { - throw new OssException($file . " file does not exist"); - } - $options[self::OSS_FILE_UPLOAD] = $file; - $file_size = filesize($options[self::OSS_FILE_UPLOAD]); - $is_check_md5 = $this->isCheckMD5($options); - if ($is_check_md5) { - $content_md5 = base64_encode(md5_file($options[self::OSS_FILE_UPLOAD], true)); - $options[self::OSS_CONTENT_MD5] = $content_md5; - } - if (!isset($options[self::OSS_CONTENT_TYPE])) { - $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object, $file); - } - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_CONTENT_LENGTH] = $file_size; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 追加上传内存中的内容 - * - * @param string $bucket bucket名称 - * @param string $object objcet名称 - * @param string $content 本次追加上传的内容 - * @param array $options - * @return int next append position - * @throws OssException - */ - public function appendObject($bucket, $object, $content, $position, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - - $options[self::OSS_CONTENT] = $content; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_SUB_RESOURCE] = 'append'; - $options[self::OSS_POSITION] = strval($position); - - if (!isset($options[self::OSS_LENGTH])) { - $options[self::OSS_CONTENT_LENGTH] = strlen($options[self::OSS_CONTENT]); - } else { - $options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH]; - } - - $is_check_md5 = $this->isCheckMD5($options); - if ($is_check_md5) { - $content_md5 = base64_encode(md5($content, true)); - $options[self::OSS_CONTENT_MD5] = $content_md5; - } - - if (!isset($options[self::OSS_CONTENT_TYPE])) { - $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object); - } - $response = $this->auth($options); - $result = new AppendResult($response); - return $result->getData(); - } - - /** - * 追加上传本地文件 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $file 追加上传的本地文件路径 - * @param array $options - * @return int next append position - * @throws OssException - */ - public function appendFile($bucket, $object, $file, $position, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - - OssUtil::throwOssExceptionWithMessageIfEmpty($file, "file path is invalid"); - $file = OssUtil::encodePath($file); - if (!file_exists($file)) { - throw new OssException($file . " file does not exist"); - } - $options[self::OSS_FILE_UPLOAD] = $file; - $file_size = filesize($options[self::OSS_FILE_UPLOAD]); - $is_check_md5 = $this->isCheckMD5($options); - if ($is_check_md5) { - $content_md5 = base64_encode(md5_file($options[self::OSS_FILE_UPLOAD], true)); - $options[self::OSS_CONTENT_MD5] = $content_md5; - } - if (!isset($options[self::OSS_CONTENT_TYPE])) { - $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object, $file); - } - - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_CONTENT_LENGTH] = $file_size; - $options[self::OSS_SUB_RESOURCE] = 'append'; - $options[self::OSS_POSITION] = strval($position); - - $response = $this->auth($options); - $result = new AppendResult($response); - return $result->getData(); - } - - /** - * 拷贝一个在OSS上已经存在的object成另外一个object - * - * @param string $fromBucket 源bucket名称 - * @param string $fromObject 源object名称 - * @param string $toBucket 目标bucket名称 - * @param string $toObject 目标object名称 - * @param array $options - * @return null - * @throws OssException - */ - public function copyObject($fromBucket, $fromObject, $toBucket, $toObject, $options = NULL) - { - $this->precheckCommon($fromBucket, $fromObject, $options); - $this->precheckCommon($toBucket, $toObject, $options); - $options[self::OSS_BUCKET] = $toBucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_OBJECT] = $toObject; - if (isset($options[self::OSS_HEADERS])) { - $options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = '/' . $fromBucket . '/' . $fromObject; - } else { - $options[self::OSS_HEADERS] = array(self::OSS_OBJECT_COPY_SOURCE => '/' . $fromBucket . '/' . $fromObject); - } - $response = $this->auth($options); - $result = new CopyObjectResult($response); - return $result->getData(); - } - - /** - * 获取Object的Meta信息 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $options 具体参考SDK文档 - * @return array - */ - public function getObjectMeta($bucket, $object, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD; - $options[self::OSS_OBJECT] = $object; - $response = $this->auth($options); - $result = new HeaderResult($response); - return $result->getData(); - } - - /** - * 删除某个Object - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param array $options - * @return null - */ - public function deleteObject($bucket, $object, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE; - $options[self::OSS_OBJECT] = $object; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 删除同一个Bucket中的多个Object - * - * @param string $bucket bucket名称 - * @param array $objects object列表 - * @param array $options - * @return ResponseCore - * @throws null - */ - public function deleteObjects($bucket, $objects, $options = null) - { - $this->precheckCommon($bucket, NULL, $options, false); - if (!is_array($objects) || !$objects) { - throw new OssException('objects must be array'); - } - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'delete'; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - $quiet = 'false'; - if (isset($options['quiet'])) { - if (is_bool($options['quiet'])) { //Boolean - $quiet = $options['quiet'] ? 'true' : 'false'; - } elseif (is_string($options['quiet'])) { // string - $quiet = ($options['quiet'] === 'true') ? 'true' : 'false'; - } - } - $xmlBody = OssUtil::createDeleteObjectsXmlBody($objects, $quiet); - $options[self::OSS_CONTENT] = $xmlBody; - $response = $this->auth($options); - $result = new DeleteObjectsResult($response); - return $result->getData(); - } - - /** - * 获得Object内容 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param array $options 该参数中必须设置ALIOSS::OSS_FILE_DOWNLOAD,ALIOSS::OSS_RANGE可选,可以根据实际情况设置;如果不设置,默认会下载全部内容 - * @return string - */ - public function getObject($bucket, $object, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_OBJECT] = $object; - if (isset($options[self::OSS_LAST_MODIFIED])) { - $options[self::OSS_HEADERS][self::OSS_IF_MODIFIED_SINCE] = $options[self::OSS_LAST_MODIFIED]; - unset($options[self::OSS_LAST_MODIFIED]); - } - if (isset($options[self::OSS_ETAG])) { - $options[self::OSS_HEADERS][self::OSS_IF_NONE_MATCH] = $options[self::OSS_ETAG]; - unset($options[self::OSS_ETAG]); - } - if (isset($options[self::OSS_RANGE])) { - $range = $options[self::OSS_RANGE]; - $options[self::OSS_HEADERS][self::OSS_RANGE] = "bytes=$range"; - unset($options[self::OSS_RANGE]); - } - $response = $this->auth($options); - $result = new BodyResult($response); - return $result->getData(); - } - - /** - * 检测Object是否存在 - * 通过获取Object的Meta信息来判断Object是否存在, 用户需要自行解析ResponseCore判断object是否存在 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param array $options - * @return bool - */ - public function doesObjectExist($bucket, $object, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD; - $options[self::OSS_OBJECT] = $object; - $response = $this->auth($options); - $result = new ExistResult($response); - return $result->getData(); - } - - /** - * 针对Archive类型的Object读取 - * 需要使用Restore操作让服务端执行解冻任务 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @return null - * @throws OssException - */ - public function restoreObject($bucket, $object, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_SUB_RESOURCE] = self::OSS_RESTORE; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 获取分片大小,根据用户提供的part_size,重新计算一个更合理的partsize - * - * @param int $partSize - * @return int - */ - private function computePartSize($partSize) - { - $partSize = (integer)$partSize; - if ($partSize <= self::OSS_MIN_PART_SIZE) { - $partSize = self::OSS_MIN_PART_SIZE; - } elseif ($partSize > self::OSS_MAX_PART_SIZE) { - $partSize = self::OSS_MAX_PART_SIZE; - } - return $partSize; - } - - /** - * 计算文件可以分成多少个part,以及每个part的长度以及起始位置 - * 方法必须在 中调用 - * - * @param integer $file_size 文件大小 - * @param integer $partSize part大小,默认5M - * @return array An array 包含 key-value 键值对. Key 为 `seekTo` 和 `length`. - */ - public function generateMultiuploadParts($file_size, $partSize = 5242880) - { - $i = 0; - $size_count = $file_size; - $values = array(); - $partSize = $this->computePartSize($partSize); - while ($size_count > 0) { - $size_count -= $partSize; - $values[] = array( - self::OSS_SEEK_TO => ($partSize * $i), - self::OSS_LENGTH => (($size_count > 0) ? $partSize : ($size_count + $partSize)), - ); - $i++; - } - return $values; - } - - /** - * 初始化multi-part upload - * - * @param string $bucket Bucket名称 - * @param string $object Object名称 - * @param array $options Key-Value数组 - * @throws OssException - * @return string 返回uploadid - */ - public function initiateMultipartUpload($bucket, $object, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_SUB_RESOURCE] = 'uploads'; - $options[self::OSS_CONTENT] = ''; - - if (!isset($options[self::OSS_CONTENT_TYPE])) { - $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object); - } - if (!isset($options[self::OSS_HEADERS])) { - $options[self::OSS_HEADERS] = array(); - } - $response = $this->auth($options); - $result = new InitiateMultipartUploadResult($response); - return $result->getData(); - } - - /** - * 分片上传的块上传接口 - * - * @param string $bucket Bucket名称 - * @param string $object Object名称 - * @param string $uploadId - * @param array $options Key-Value数组 - * @return string eTag - * @throws OssException - */ - public function uploadPart($bucket, $object, $uploadId, $options = null) - { - $this->precheckCommon($bucket, $object, $options); - $this->precheckParam($options, self::OSS_FILE_UPLOAD, __FUNCTION__); - $this->precheckParam($options, self::OSS_PART_NUM, __FUNCTION__); - - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_UPLOAD_ID] = $uploadId; - - if (isset($options[self::OSS_LENGTH])) { - $options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH]; - } - $response = $this->auth($options); - $result = new UploadPartResult($response); - return $result->getData(); - } - - /** - * 获取已成功上传的part - * - * @param string $bucket Bucket名称 - * @param string $object Object名称 - * @param string $uploadId uploadId - * @param array $options Key-Value数组 - * @return ListPartsInfo - * @throws OssException - */ - public function listParts($bucket, $object, $uploadId, $options = null) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_UPLOAD_ID] = $uploadId; - $options[self::OSS_QUERY_STRING] = array(); - foreach (array('max-parts', 'part-number-marker') as $param) { - if (isset($options[$param])) { - $options[self::OSS_QUERY_STRING][$param] = $options[$param]; - unset($options[$param]); - } - } - $response = $this->auth($options); - $result = new ListPartsResult($response); - return $result->getData(); - } - - /** - * 中止进行一半的分片上传操作 - * - * @param string $bucket Bucket名称 - * @param string $object Object名称 - * @param string $uploadId uploadId - * @param array $options Key-Value数组 - * @return null - * @throws OssException - */ - public function abortMultipartUpload($bucket, $object, $uploadId, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_UPLOAD_ID] = $uploadId; - $response = $this->auth($options); - $result = new PutSetDeleteResult($response); - return $result->getData(); - } - - /** - * 在将所有数据Part都上传完成后,调用此接口完成本次分块上传 - * - * @param string $bucket Bucket名称 - * @param string $object Object名称 - * @param string $uploadId uploadId - * @param array $listParts array( array("PartNumber"=> int, "ETag"=>string)) - * @param array $options Key-Value数组 - * @throws OssException - * @return null - */ - public function completeMultipartUpload($bucket, $object, $uploadId, $listParts, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - $options[self::OSS_METHOD] = self::OSS_HTTP_POST; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_UPLOAD_ID] = $uploadId; - $options[self::OSS_CONTENT_TYPE] = 'application/xml'; - if (!is_array($listParts)) { - throw new OssException("listParts must be array type"); - } - $options[self::OSS_CONTENT] = OssUtil::createCompleteMultipartUploadXmlBody($listParts); - $response = $this->auth($options); - if (isset($options[self::OSS_CALLBACK]) && !empty($options[self::OSS_CALLBACK])) { - $result = new CallbackResult($response); - } else { - $result = new PutSetDeleteResult($response); - } - return $result->getData(); - } - - /** - * 罗列出所有执行中的Multipart Upload事件,即已经被初始化的Multipart Upload但是未被 - * Complete或者Abort的Multipart Upload事件 - * - * @param string $bucket bucket - * @param array $options 关联数组 - * @throws OssException - * @return ListMultipartUploadInfo - */ - public function listMultipartUploads($bucket, $options = null) - { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_METHOD] = self::OSS_HTTP_GET; - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = '/'; - $options[self::OSS_SUB_RESOURCE] = 'uploads'; - - foreach (array('delimiter', 'key-marker', 'max-uploads', 'prefix', 'upload-id-marker') as $param) { - if (isset($options[$param])) { - $options[self::OSS_QUERY_STRING][$param] = $options[$param]; - unset($options[$param]); - } - } - $query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array(); - $options[self::OSS_QUERY_STRING] = array_merge( - $query, - array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL) - ); - - $response = $this->auth($options); - $result = new ListMultipartUploadResult($response); - return $result->getData(); - } - - /** - * 从一个已存在的Object中拷贝数据来上传一个Part - * - * @param string $fromBucket 源bucket名称 - * @param string $fromObject 源object名称 - * @param string $toBucket 目标bucket名称 - * @param string $toObject 目标object名称 - * @param int $partNumber 分块上传的块id - * @param string $uploadId 初始化multipart upload返回的uploadid - * @param array $options Key-Value数组 - * @return null - * @throws OssException - */ - public function uploadPartCopy($fromBucket, $fromObject, $toBucket, $toObject, $partNumber, $uploadId, $options = NULL) - { - $this->precheckCommon($fromBucket, $fromObject, $options); - $this->precheckCommon($toBucket, $toObject, $options); - - //如果没有设置$options['isFullCopy'],则需要强制判断copy的起止位置 - $start_range = "0"; - if (isset($options['start'])) { - $start_range = $options['start']; - } - $end_range = ""; - if (isset($options['end'])) { - $end_range = $options['end']; - } - $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; - $options[self::OSS_BUCKET] = $toBucket; - $options[self::OSS_OBJECT] = $toObject; - $options[self::OSS_PART_NUM] = $partNumber; - $options[self::OSS_UPLOAD_ID] = $uploadId; - - if (!isset($options[self::OSS_HEADERS])) { - $options[self::OSS_HEADERS] = array(); - } - - $options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = '/' . $fromBucket . '/' . $fromObject; - $options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE_RANGE] = "bytes=" . $start_range . "-" . $end_range; - $response = $this->auth($options); - $result = new UploadPartResult($response); - return $result->getData(); - } - - /** - * multipart上传统一封装,从初始化到完成multipart,以及出错后中止动作 - * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $file 需要上传的本地文件的路径 - * @param array $options Key-Value数组 - * @return null - * @throws OssException - */ - public function multiuploadFile($bucket, $object, $file, $options = null) - { - $this->precheckCommon($bucket, $object, $options); - if (isset($options[self::OSS_LENGTH])) { - $options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH]; - unset($options[self::OSS_LENGTH]); - } - if (empty($file)) { - throw new OssException("parameter invalid, file is empty"); - } - $uploadFile = OssUtil::encodePath($file); - if (!isset($options[self::OSS_CONTENT_TYPE])) { - $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object, $uploadFile); - } - - $upload_position = isset($options[self::OSS_SEEK_TO]) ? (integer)$options[self::OSS_SEEK_TO] : 0; - - if (isset($options[self::OSS_CONTENT_LENGTH])) { - $upload_file_size = (integer)$options[self::OSS_CONTENT_LENGTH]; - } else { - $upload_file_size = filesize($uploadFile); - if ($upload_file_size !== false) { - $upload_file_size -= $upload_position; - } - } - - if ($upload_position === false || !isset($upload_file_size) || $upload_file_size === false || $upload_file_size < 0) { - throw new OssException('The size of `fileUpload` cannot be determined in ' . __FUNCTION__ . '().'); - } - // 处理partSize - if (isset($options[self::OSS_PART_SIZE])) { - $options[self::OSS_PART_SIZE] = $this->computePartSize($options[self::OSS_PART_SIZE]); - } else { - $options[self::OSS_PART_SIZE] = self::OSS_MID_PART_SIZE; - } - - $is_check_md5 = $this->isCheckMD5($options); - // 如果上传的文件小于partSize,则直接使用普通方式上传 - if ($upload_file_size < $options[self::OSS_PART_SIZE] && !isset($options[self::OSS_UPLOAD_ID])) { - return $this->uploadFile($bucket, $object, $uploadFile, $options); - } - - // 初始化multipart - if (isset($options[self::OSS_UPLOAD_ID])) { - $uploadId = $options[self::OSS_UPLOAD_ID]; - } else { - // 初始化 - $uploadId = $this->initiateMultipartUpload($bucket, $object, $options); - } - - // 获取的分片 - $pieces = $this->generateMultiuploadParts($upload_file_size, (integer)$options[self::OSS_PART_SIZE]); - $response_upload_part = array(); - foreach ($pieces as $i => $piece) { - $from_pos = $upload_position + (integer)$piece[self::OSS_SEEK_TO]; - $to_pos = (integer)$piece[self::OSS_LENGTH] + $from_pos - 1; - $up_options = array( - self::OSS_FILE_UPLOAD => $uploadFile, - self::OSS_PART_NUM => ($i + 1), - self::OSS_SEEK_TO => $from_pos, - self::OSS_LENGTH => $to_pos - $from_pos + 1, - self::OSS_CHECK_MD5 => $is_check_md5, - ); - if ($is_check_md5) { - $content_md5 = OssUtil::getMd5SumForFile($uploadFile, $from_pos, $to_pos); - $up_options[self::OSS_CONTENT_MD5] = $content_md5; - } - $response_upload_part[] = $this->uploadPart($bucket, $object, $uploadId, $up_options); - } - - $uploadParts = array(); - foreach ($response_upload_part as $i => $etag) { - $uploadParts[] = array( - 'PartNumber' => ($i + 1), - 'ETag' => $etag, - ); - } - return $this->completeMultipartUpload($bucket, $object, $uploadId, $uploadParts); - } - - /** - * 上传本地目录内的文件或者目录到指定bucket的指定prefix的object中 - * - * @param string $bucket bucket名称 - * @param string $prefix 需要上传到的object的key前缀,可以理解成bucket中的子目录,结尾不能是'/',接口中会补充'/' - * @param string $localDirectory 需要上传的本地目录 - * @param string $exclude 需要排除的目录 - * @param bool $recursive 是否递归的上传localDirectory下的子目录内容 - * @param bool $checkMd5 - * @return array 返回两个列表 array("succeededList" => array("object"), "failedList" => array("object"=>"errorMessage")) - * @throws OssException - */ - public function uploadDir($bucket, $prefix, $localDirectory, $exclude = '.|..|.svn|.git', $recursive = false, $checkMd5 = true) - { - $retArray = array("succeededList" => array(), "failedList" => array()); - if (empty($bucket)) throw new OssException("parameter error, bucket is empty"); - if (!is_string($prefix)) throw new OssException("parameter error, prefix is not string"); - if (empty($localDirectory)) throw new OssException("parameter error, localDirectory is empty"); - $directory = $localDirectory; - $directory = OssUtil::encodePath($directory); - //判断是否目录 - if (!is_dir($directory)) { - throw new OssException('parameter error: ' . $directory . ' is not a directory, please check it'); - } - //read directory - $file_list_array = OssUtil::readDir($directory, $exclude, $recursive); - if (!$file_list_array) { - throw new OssException($directory . ' is empty...'); - } - foreach ($file_list_array as $k => $item) { - if (is_dir($item['path'])) { - continue; - } - $options = array( - self::OSS_PART_SIZE => self::OSS_MIN_PART_SIZE, - self::OSS_CHECK_MD5 => $checkMd5, - ); - $realObject = (!empty($prefix) ? $prefix . '/' : '') . $item['file']; - - try { - $this->multiuploadFile($bucket, $realObject, $item['path'], $options); - $retArray["succeededList"][] = $realObject; - } catch (OssException $e) { - $retArray["failedList"][$realObject] = $e->getMessage(); - } - } - return $retArray; - } - - /** - * 支持生成get和put签名, 用户可以生成一个具有一定有效期的 - * 签名过的url - * - * @param string $bucket - * @param string $object - * @param int $timeout - * @param string $method - * @param array $options Key-Value数组 - * @return string - * @throws OssException - */ - public function signUrl($bucket, $object, $timeout = 60, $method = self::OSS_HTTP_GET, $options = NULL) - { - $this->precheckCommon($bucket, $object, $options); - //method - if (self::OSS_HTTP_GET !== $method && self::OSS_HTTP_PUT !== $method) { - throw new OssException("method is invalid"); - } - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_OBJECT] = $object; - $options[self::OSS_METHOD] = $method; - if (!isset($options[self::OSS_CONTENT_TYPE])) { - $options[self::OSS_CONTENT_TYPE] = ''; - } - $timeout = time() + $timeout; - $options[self::OSS_PREAUTH] = $timeout; - $options[self::OSS_DATE] = $timeout; - $this->setSignStsInUrl(true); - return $this->auth($options); - } - - /** - * 检测options参数 - * - * @param array $options - * @throws OssException - */ - private function precheckOptions(&$options) - { - OssUtil::validateOptions($options); - if (!$options) { - $options = array(); - } - } - - /** - * 校验bucket参数 - * - * @param string $bucket - * @param string $errMsg - * @throws OssException - */ - private function precheckBucket($bucket, $errMsg = 'bucket is not allowed empty') - { - OssUtil::throwOssExceptionWithMessageIfEmpty($bucket, $errMsg); - } - - /** - * 校验object参数 - * - * @param string $object - * @throws OssException - */ - private function precheckObject($object) - { - OssUtil::throwOssExceptionWithMessageIfEmpty($object, "object name is empty"); - } - - /** - * 校验option restore - * - * @param string $restore - * @throws OssException - */ - private function precheckStorage($storage) - { - if (is_string($storage)) { - switch ($storage) { - case self::OSS_STORAGE_ARCHIVE: - return; - case self::OSS_STORAGE_IA: - return; - case self::OSS_STORAGE_STANDARD: - return; - default: - break; - } - } - throw new OssException('storage name is invalid'); - } - - /** - * 校验bucket,options参数 - * - * @param string $bucket - * @param string $object - * @param array $options - * @param bool $isCheckObject - */ - private function precheckCommon($bucket, $object, &$options, $isCheckObject = true) - { - if ($isCheckObject) { - $this->precheckObject($object); - } - $this->precheckOptions($options); - $this->precheckBucket($bucket); - } - - /** - * 参数校验 - * - * @param array $options - * @param string $param - * @param string $funcName - * @throws OssException - */ - private function precheckParam($options, $param, $funcName) - { - if (!isset($options[$param])) { - throw new OssException('The `' . $param . '` options is required in ' . $funcName . '().'); - } - } - - /** - * 检测md5 - * - * @param array $options - * @return bool|null - */ - private function isCheckMD5($options) - { - return $this->getValue($options, self::OSS_CHECK_MD5, false, true, true); - } - - /** - * 获取value - * - * @param array $options - * @param string $key - * @param string $default - * @param bool $isCheckEmpty - * @param bool $isCheckBool - * @return bool|null - */ - private function getValue($options, $key, $default = NULL, $isCheckEmpty = false, $isCheckBool = false) - { - $value = $default; - if (isset($options[$key])) { - if ($isCheckEmpty) { - if (!empty($options[$key])) { - $value = $options[$key]; - } - } else { - $value = $options[$key]; - } - unset($options[$key]); - } - if ($isCheckBool) { - if ($value !== true && $value !== false) { - $value = false; - } - } - return $value; - } - - /** - * 获取mimetype类型 - * - * @param string $object - * @return string - */ - private function getMimeType($object, $file = null) - { - if (!is_null($file)) { - $type = MimeTypes::getMimetype($file); - if (!is_null($type)) { - return $type; - } - } - - $type = MimeTypes::getMimetype($object); - if (!is_null($type)) { - return $type; - } - - return self::DEFAULT_CONTENT_TYPE; - } - - /** - * 验证并且执行请求,按照OSS Api协议,执行操作 - * - * @param array $options - * @return ResponseCore - * @throws OssException - * @throws RequestCore_Exception - */ - private function auth($options) - { - OssUtil::validateOptions($options); - //验证bucket,list_bucket时不需要验证 - $this->authPrecheckBucket($options); - //验证object - $this->authPrecheckObject($options); - //Object名称的编码必须是utf8 - $this->authPrecheckObjectEncoding($options); - //验证ACL - $this->authPrecheckAcl($options); - // 获得当次请求使用的协议头,是https还是http - $scheme = $this->useSSL ? 'https://' : 'http://'; - // 获得当次请求使用的hostname,如果是公共域名或者专有域名,bucket拼在前面构成三级域名 - $hostname = $this->generateHostname($options[self::OSS_BUCKET]); - $string_to_sign = ''; - $headers = $this->generateHeaders($options, $hostname); - $signable_query_string_params = $this->generateSignableQueryStringParam($options); - $signable_query_string = OssUtil::toQueryString($signable_query_string_params); - $resource_uri = $this->generateResourceUri($options); - //生成请求URL - $conjunction = '?'; - $non_signable_resource = ''; - if (isset($options[self::OSS_SUB_RESOURCE])) { - $conjunction = '&'; - } - if ($signable_query_string !== '') { - $signable_query_string = $conjunction . $signable_query_string; - $conjunction = '&'; - } - $query_string = $this->generateQueryString($options); - if ($query_string !== '') { - $non_signable_resource .= $conjunction . $query_string; - $conjunction = '&'; - } - $this->requestUrl = $scheme . $hostname . $resource_uri . $signable_query_string . $non_signable_resource; - - //创建请求 - $request = new RequestCore($this->requestUrl, $this->requestProxy); - $request->set_useragent($this->generateUserAgent()); - // Streaming uploads - if (isset($options[self::OSS_FILE_UPLOAD])) { - if (is_resource($options[self::OSS_FILE_UPLOAD])) { - $length = null; - - if (isset($options[self::OSS_CONTENT_LENGTH])) { - $length = $options[self::OSS_CONTENT_LENGTH]; - } elseif (isset($options[self::OSS_SEEK_TO])) { - $stats = fstat($options[self::OSS_FILE_UPLOAD]); - if ($stats && $stats[self::OSS_SIZE] >= 0) { - $length = $stats[self::OSS_SIZE] - (integer)$options[self::OSS_SEEK_TO]; - } - } - $request->set_read_stream($options[self::OSS_FILE_UPLOAD], $length); - } else { - $request->set_read_file($options[self::OSS_FILE_UPLOAD]); - $length = $request->read_stream_size; - if (isset($options[self::OSS_CONTENT_LENGTH])) { - $length = $options[self::OSS_CONTENT_LENGTH]; - } elseif (isset($options[self::OSS_SEEK_TO]) && isset($length)) { - $length -= (integer)$options[self::OSS_SEEK_TO]; - } - $request->set_read_stream_size($length); - } - } - if (isset($options[self::OSS_SEEK_TO])) { - $request->set_seek_position((integer)$options[self::OSS_SEEK_TO]); - } - if (isset($options[self::OSS_FILE_DOWNLOAD])) { - if (is_resource($options[self::OSS_FILE_DOWNLOAD])) { - $request->set_write_stream($options[self::OSS_FILE_DOWNLOAD]); - } else { - $request->set_write_file($options[self::OSS_FILE_DOWNLOAD]); - } - } - - if (isset($options[self::OSS_METHOD])) { - $request->set_method($options[self::OSS_METHOD]); - $string_to_sign .= $options[self::OSS_METHOD] . "\n"; - } - - if (isset($options[self::OSS_CONTENT])) { - $request->set_body($options[self::OSS_CONTENT]); - if ($headers[self::OSS_CONTENT_TYPE] === 'application/x-www-form-urlencoded') { - $headers[self::OSS_CONTENT_TYPE] = 'application/octet-stream'; - } - - $headers[self::OSS_CONTENT_LENGTH] = strlen($options[self::OSS_CONTENT]); - $headers[self::OSS_CONTENT_MD5] = base64_encode(md5($options[self::OSS_CONTENT], true)); - } - - if (isset($options[self::OSS_CALLBACK])) { - $headers[self::OSS_CALLBACK] = base64_encode($options[self::OSS_CALLBACK]); - } - if (isset($options[self::OSS_CALLBACK_VAR])) { - $headers[self::OSS_CALLBACK_VAR] = base64_encode($options[self::OSS_CALLBACK_VAR]); - } - - if (!isset($headers[self::OSS_ACCEPT_ENCODING])) { - $headers[self::OSS_ACCEPT_ENCODING] = ''; - } - - uksort($headers, 'strnatcasecmp'); - - foreach ($headers as $header_key => $header_value) { - $header_value = str_replace(array("\r", "\n"), '', $header_value); - if ($header_value !== '' || $header_key === self::OSS_ACCEPT_ENCODING) { - $request->add_header($header_key, $header_value); - } - - if ( - strtolower($header_key) === 'content-md5' || - strtolower($header_key) === 'content-type' || - strtolower($header_key) === 'date' || - (isset($options['self::OSS_PREAUTH']) && (integer)$options['self::OSS_PREAUTH'] > 0) - ) { - $string_to_sign .= $header_value . "\n"; - } elseif (substr(strtolower($header_key), 0, 6) === self::OSS_DEFAULT_PREFIX) { - $string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n"; - } - } - // 生成 signable_resource - $signable_resource = $this->generateSignableResource($options); - $string_to_sign .= rawurldecode($signable_resource) . urldecode($signable_query_string); - - //对?后面的要签名的string字母序排序 - $string_to_sign_ordered = $this->stringToSignSorted($string_to_sign); - - $signature = base64_encode(hash_hmac('sha1', $string_to_sign_ordered, $this->accessKeySecret, true)); - $request->add_header('Authorization', 'OSS ' . $this->accessKeyId . ':' . $signature); - - if (isset($options[self::OSS_PREAUTH]) && (integer)$options[self::OSS_PREAUTH] > 0) { - $signed_url = $this->requestUrl . $conjunction . self::OSS_URL_ACCESS_KEY_ID . '=' . rawurlencode($this->accessKeyId) . '&' . self::OSS_URL_EXPIRES . '=' . $options[self::OSS_PREAUTH] . '&' . self::OSS_URL_SIGNATURE . '=' . rawurlencode($signature); - return $signed_url; - } elseif (isset($options[self::OSS_PREAUTH])) { - return $this->requestUrl; - } - - if ($this->timeout !== 0) { - $request->timeout = $this->timeout; - } - if ($this->connectTimeout !== 0) { - $request->connect_timeout = $this->connectTimeout; - } - - try { - $request->send_request(); - } catch (RequestCore_Exception $e) { - throw(new OssException('RequestCoreException: ' . $e->getMessage())); - } - $response_header = $request->get_response_header(); - $response_header['oss-request-url'] = $this->requestUrl; - $response_header['oss-redirects'] = $this->redirects; - $response_header['oss-stringtosign'] = $string_to_sign; - $response_header['oss-requestheaders'] = $request->request_headers; - - $data = new ResponseCore($response_header, $request->get_response_body(), $request->get_response_code()); - //retry if OSS Internal Error - if ((integer)$request->get_response_code() === 500) { - if ($this->redirects <= $this->maxRetries) { - //设置休眠 - $delay = (integer)(pow(4, $this->redirects) * 100000); - usleep($delay); - $this->redirects++; - $data = $this->auth($options); - } - } - - $this->redirects = 0; - return $data; - } - - /** - * 设置最大尝试次数 - * - * @param int $maxRetries - * @return void - */ - public function setMaxTries($maxRetries = 3) - { - $this->maxRetries = $maxRetries; - } - - /** - * 获取最大尝试次数 - * - * @return int - */ - public function getMaxRetries() - { - return $this->maxRetries; - } - - /** - * 打开sts enable标志,使用户构造函数中传入的$sts生效 - * - * @param boolean $enable - */ - public function setSignStsInUrl($enable) - { - $this->enableStsInUrl = $enable; - } - - /** - * @return boolean - */ - public function isUseSSL() - { - return $this->useSSL; - } - - /** - * @param boolean $useSSL - */ - public function setUseSSL($useSSL) - { - $this->useSSL = $useSSL; - } - - /** - * 检查bucket名称格式是否正确,如果非法抛出异常 - * - * @param $options - * @throws OssException - */ - private function authPrecheckBucket($options) - { - if (!(('/' == $options[self::OSS_OBJECT]) && ('' == $options[self::OSS_BUCKET]) && ('GET' == $options[self::OSS_METHOD])) && !OssUtil::validateBucket($options[self::OSS_BUCKET])) { - throw new OssException('"' . $options[self::OSS_BUCKET] . '"' . 'bucket name is invalid'); - } - } - - /** - * - * 检查object名称格式是否正确,如果非法抛出异常 - * - * @param $options - * @throws OssException - */ - private function authPrecheckObject($options) - { - if (isset($options[self::OSS_OBJECT]) && $options[self::OSS_OBJECT] === '/') { - return; - } - - if (isset($options[self::OSS_OBJECT]) && !OssUtil::validateObject($options[self::OSS_OBJECT])) { - throw new OssException('"' . $options[self::OSS_OBJECT] . '"' . ' object name is invalid'); - } - } - - /** - * 检查object的编码,如果是gbk或者gb2312则尝试将其转化为utf8编码 - * - * @param mixed $options 参数 - */ - private function authPrecheckObjectEncoding(&$options) - { - $tmp_object = $options[self::OSS_OBJECT]; - try { - if (OssUtil::isGb2312($options[self::OSS_OBJECT])) { - $options[self::OSS_OBJECT] = iconv('GB2312', "UTF-8//IGNORE", $options[self::OSS_OBJECT]); - } elseif (OssUtil::checkChar($options[self::OSS_OBJECT], true)) { - $options[self::OSS_OBJECT] = iconv('GBK', "UTF-8//IGNORE", $options[self::OSS_OBJECT]); - } - } catch (\Exception $e) { - try { - $tmp_object = iconv(mb_detect_encoding($tmp_object), "UTF-8", $tmp_object); - } catch (\Exception $e) { - } - } - $options[self::OSS_OBJECT] = $tmp_object; - } - - /** - * 检查ACL是否是预定义中三种之一,如果不是抛出异常 - * - * @param $options - * @throws OssException - */ - private function authPrecheckAcl($options) - { - if (isset($options[self::OSS_HEADERS][self::OSS_ACL]) && !empty($options[self::OSS_HEADERS][self::OSS_ACL])) { - if (!in_array(strtolower($options[self::OSS_HEADERS][self::OSS_ACL]), self::$OSS_ACL_TYPES)) { - throw new OssException($options[self::OSS_HEADERS][self::OSS_ACL] . ':' . 'acl is invalid(private,public-read,public-read-write)'); - } - } - } - - /** - * 获得档次请求使用的域名 - * bucket在前的三级域名,或者二级域名,如果是cname或者ip的话,则是二级域名 - * - * @param $bucket - * @return string 剥掉协议头的域名 - */ - private function generateHostname($bucket) - { - if ($this->hostType === self::OSS_HOST_TYPE_IP) { - $hostname = $this->hostname; - } elseif ($this->hostType === self::OSS_HOST_TYPE_CNAME) { - $hostname = $this->hostname; - } else { - // 专有域或者官网endpoint - $hostname = ($bucket == '') ? $this->hostname : ($bucket . '.') . $this->hostname; - } - return $hostname; - } - - /** - * 获得当次请求的资源定位字段 - * - * @param $options - * @return string 资源定位字段 - */ - private function generateResourceUri($options) - { - $resource_uri = ""; - - // resource_uri + bucket - if (isset($options[self::OSS_BUCKET]) && '' !== $options[self::OSS_BUCKET]) { - if ($this->hostType === self::OSS_HOST_TYPE_IP) { - $resource_uri = '/' . $options[self::OSS_BUCKET]; - } - } - - // resource_uri + object - if (isset($options[self::OSS_OBJECT]) && '/' !== $options[self::OSS_OBJECT]) { - $resource_uri .= '/' . str_replace(array('%2F', '%25'), array('/', '%'), rawurlencode($options[self::OSS_OBJECT])); - } - - // resource_uri + sub_resource - $conjunction = '?'; - if (isset($options[self::OSS_SUB_RESOURCE])) { - $resource_uri .= $conjunction . $options[self::OSS_SUB_RESOURCE]; - } - return $resource_uri; - } - - /** - * 生成signalbe_query_string_param, array类型 - * - * @param array $options - * @return array - */ - private function generateSignableQueryStringParam($options) - { - $signableQueryStringParams = array(); - $signableList = array( - self::OSS_PART_NUM, - 'response-content-type', - 'response-content-language', - 'response-cache-control', - 'response-content-encoding', - 'response-expires', - 'response-content-disposition', - self::OSS_UPLOAD_ID, - self::OSS_COMP, - self::OSS_LIVE_CHANNEL_STATUS, - self::OSS_LIVE_CHANNEL_START_TIME, - self::OSS_LIVE_CHANNEL_END_TIME, - self::OSS_PROCESS, - self::OSS_POSITION, - self::OSS_SYMLINK, - self::OSS_RESTORE, - ); - - foreach ($signableList as $item) { - if (isset($options[$item])) { - $signableQueryStringParams[$item] = $options[$item]; - } - } - - if ($this->enableStsInUrl && (!is_null($this->securityToken))) { - $signableQueryStringParams["security-token"] = $this->securityToken; - } - - return $signableQueryStringParams; - } - - /** - * 生成用于签名resource段 - * - * @param mixed $options - * @return string - */ - private function generateSignableResource($options) - { - $signableResource = ""; - $signableResource .= '/'; - if (isset($options[self::OSS_BUCKET]) && '' !== $options[self::OSS_BUCKET]) { - $signableResource .= $options[self::OSS_BUCKET]; - // 如果操作没有Object操作的话,这里最后是否有斜线有个trick,ip的域名下,不需要加'/', 否则需要加'/' - if ($options[self::OSS_OBJECT] == '/') { - if ($this->hostType !== self::OSS_HOST_TYPE_IP) { - $signableResource .= "/"; - } - } - } - //signable_resource + object - if (isset($options[self::OSS_OBJECT]) && '/' !== $options[self::OSS_OBJECT]) { - $signableResource .= '/' . str_replace(array('%2F', '%25'), array('/', '%'), rawurlencode($options[self::OSS_OBJECT])); - } - if (isset($options[self::OSS_SUB_RESOURCE])) { - $signableResource .= '?' . $options[self::OSS_SUB_RESOURCE]; - } - return $signableResource; - } - - /** - * 生成query_string - * - * @param mixed $options - * @return string - */ - private function generateQueryString($options) - { - //请求参数 - $queryStringParams = array(); - if (isset($options[self::OSS_QUERY_STRING])) { - $queryStringParams = array_merge($queryStringParams, $options[self::OSS_QUERY_STRING]); - } - return OssUtil::toQueryString($queryStringParams); - } - - private function stringToSignSorted($string_to_sign) - { - $queryStringSorted = ''; - $explodeResult = explode('?', $string_to_sign); - $index = count($explodeResult); - if ($index === 1) - return $string_to_sign; - - $queryStringParams = explode('&', $explodeResult[$index - 1]); - sort($queryStringParams); - - foreach($queryStringParams as $params) - { - $queryStringSorted .= $params . '&'; - } - - $queryStringSorted = substr($queryStringSorted, 0, -1); - - return $explodeResult[0] . '?' . $queryStringSorted; - } - - /** - * 初始化headers - * - * @param mixed $options - * @param string $hostname hostname - * @return array - */ - private function generateHeaders($options, $hostname) - { - $headers = array( - self::OSS_CONTENT_MD5 => '', - self::OSS_CONTENT_TYPE => isset($options[self::OSS_CONTENT_TYPE]) ? $options[self::OSS_CONTENT_TYPE] : self::DEFAULT_CONTENT_TYPE, - self::OSS_DATE => isset($options[self::OSS_DATE]) ? $options[self::OSS_DATE] : gmdate('D, d M Y H:i:s \G\M\T'), - self::OSS_HOST => $hostname, - ); - if (isset($options[self::OSS_CONTENT_MD5])) { - $headers[self::OSS_CONTENT_MD5] = $options[self::OSS_CONTENT_MD5]; - } - - //添加stsSecurityToken - if ((!is_null($this->securityToken)) && (!$this->enableStsInUrl)) { - $headers[self::OSS_SECURITY_TOKEN] = $this->securityToken; - } - //合并HTTP headers - if (isset($options[self::OSS_HEADERS])) { - $headers = array_merge($headers, $options[self::OSS_HEADERS]); - } - return $headers; - } - - /** - * 生成请求用的UserAgent - * - * @return string - */ - private function generateUserAgent() - { - return self::OSS_NAME . "/" . self::OSS_VERSION . " (" . php_uname('s') . "/" . php_uname('r') . "/" . php_uname('m') . ";" . PHP_VERSION . ")"; - } - - /** - * 检查endpoint的种类 - * 如有有协议头,剥去协议头 - * 并且根据参数 is_cname 和endpoint本身,判定域名类型,是ip,cname,还是专有域或者官网域名 - * - * @param string $endpoint - * @param boolean $isCName - * @return string 剥掉协议头的域名 - */ - private function checkEndpoint($endpoint, $isCName) - { - $ret_endpoint = null; - if (strpos($endpoint, 'http://') === 0) { - $ret_endpoint = substr($endpoint, strlen('http://')); - } elseif (strpos($endpoint, 'https://') === 0) { - $ret_endpoint = substr($endpoint, strlen('https://')); - $this->useSSL = true; - } else { - $ret_endpoint = $endpoint; - } - - if ($isCName) { - $this->hostType = self::OSS_HOST_TYPE_CNAME; - } elseif (OssUtil::isIPFormat($ret_endpoint)) { - $this->hostType = self::OSS_HOST_TYPE_IP; - } else { - $this->hostType = self::OSS_HOST_TYPE_NORMAL; - } - return $ret_endpoint; - } - - /** - * 用来检查sdk所以来的扩展是否打开 - * - * @throws OssException - */ - public static function checkEnv() - { - if (function_exists('get_loaded_extensions')) { - //检测curl扩展 - $enabled_extension = array("curl"); - $extensions = get_loaded_extensions(); - if ($extensions) { - foreach ($enabled_extension as $item) { - if (!in_array($item, $extensions)) { - throw new OssException("Extension {" . $item . "} is not installed or not enabled, please check your php env."); - } - } - } else { - throw new OssException("function get_loaded_extensions not found."); - } - } else { - throw new OssException('Function get_loaded_extensions has been disabled, please check php config.'); - } - } - - /** - //* 设置http库的请求超时时间,单位秒 - * - * @param int $timeout - */ - public function setTimeout($timeout) - { - $this->timeout = $timeout; - } - - /** - * 设置http库的连接超时时间,单位秒 - * - * @param int $connectTimeout - */ - public function setConnectTimeout($connectTimeout) - { - $this->connectTimeout = $connectTimeout; - } - - // 生命周期相关常量 - const OSS_LIFECYCLE_EXPIRATION = "Expiration"; - const OSS_LIFECYCLE_TIMING_DAYS = "Days"; - const OSS_LIFECYCLE_TIMING_DATE = "Date"; - //OSS 内部常量 - const OSS_BUCKET = 'bucket'; - const OSS_OBJECT = 'object'; - const OSS_HEADERS = OssUtil::OSS_HEADERS; - const OSS_METHOD = 'method'; - const OSS_QUERY = 'query'; - const OSS_BASENAME = 'basename'; - const OSS_MAX_KEYS = 'max-keys'; - const OSS_UPLOAD_ID = 'uploadId'; - const OSS_PART_NUM = 'partNumber'; - const OSS_COMP = 'comp'; - const OSS_LIVE_CHANNEL_STATUS = 'status'; - const OSS_LIVE_CHANNEL_START_TIME = 'startTime'; - const OSS_LIVE_CHANNEL_END_TIME = 'endTime'; - const OSS_POSITION = 'position'; - const OSS_MAX_KEYS_VALUE = 100; - const OSS_MAX_OBJECT_GROUP_VALUE = OssUtil::OSS_MAX_OBJECT_GROUP_VALUE; - const OSS_MAX_PART_SIZE = OssUtil::OSS_MAX_PART_SIZE; - const OSS_MID_PART_SIZE = OssUtil::OSS_MID_PART_SIZE; - const OSS_MIN_PART_SIZE = OssUtil::OSS_MIN_PART_SIZE; - const OSS_FILE_SLICE_SIZE = 8192; - const OSS_PREFIX = 'prefix'; - const OSS_DELIMITER = 'delimiter'; - const OSS_MARKER = 'marker'; - const OSS_ACCEPT_ENCODING = 'Accept-Encoding'; - const OSS_CONTENT_MD5 = 'Content-Md5'; - const OSS_SELF_CONTENT_MD5 = 'x-oss-meta-md5'; - const OSS_CONTENT_TYPE = 'Content-Type'; - const OSS_CONTENT_LENGTH = 'Content-Length'; - const OSS_IF_MODIFIED_SINCE = 'If-Modified-Since'; - const OSS_IF_UNMODIFIED_SINCE = 'If-Unmodified-Since'; - const OSS_IF_MATCH = 'If-Match'; - const OSS_IF_NONE_MATCH = 'If-None-Match'; - const OSS_CACHE_CONTROL = 'Cache-Control'; - const OSS_EXPIRES = 'Expires'; - const OSS_PREAUTH = 'preauth'; - const OSS_CONTENT_COING = 'Content-Coding'; - const OSS_CONTENT_DISPOSTION = 'Content-Disposition'; - const OSS_RANGE = 'range'; - const OSS_ETAG = 'etag'; - const OSS_LAST_MODIFIED = 'lastmodified'; - const OS_CONTENT_RANGE = 'Content-Range'; - const OSS_CONTENT = OssUtil::OSS_CONTENT; - const OSS_BODY = 'body'; - const OSS_LENGTH = OssUtil::OSS_LENGTH; - const OSS_HOST = 'Host'; - const OSS_DATE = 'Date'; - const OSS_AUTHORIZATION = 'Authorization'; - const OSS_FILE_DOWNLOAD = 'fileDownload'; - const OSS_FILE_UPLOAD = 'fileUpload'; - const OSS_PART_SIZE = 'partSize'; - const OSS_SEEK_TO = 'seekTo'; - const OSS_SIZE = 'size'; - const OSS_QUERY_STRING = 'query_string'; - const OSS_SUB_RESOURCE = 'sub_resource'; - const OSS_DEFAULT_PREFIX = 'x-oss-'; - const OSS_CHECK_MD5 = 'checkmd5'; - const DEFAULT_CONTENT_TYPE = 'application/octet-stream'; - const OSS_SYMLINK_TARGET = 'x-oss-symlink-target'; - const OSS_SYMLINK = 'symlink'; - const OSS_HTTP_CODE = 'http_code'; - const OSS_REQUEST_ID = 'x-oss-request-id'; - const OSS_INFO = 'info'; - const OSS_STORAGE = 'storage'; - const OSS_RESTORE = 'restore'; - const OSS_STORAGE_STANDARD = 'Standard'; - const OSS_STORAGE_IA = 'IA'; - const OSS_STORAGE_ARCHIVE = 'Archive'; - - //私有URL变量 - const OSS_URL_ACCESS_KEY_ID = 'OSSAccessKeyId'; - const OSS_URL_EXPIRES = 'Expires'; - const OSS_URL_SIGNATURE = 'Signature'; - //HTTP方法 - const OSS_HTTP_GET = 'GET'; - const OSS_HTTP_PUT = 'PUT'; - const OSS_HTTP_HEAD = 'HEAD'; - const OSS_HTTP_POST = 'POST'; - const OSS_HTTP_DELETE = 'DELETE'; - const OSS_HTTP_OPTIONS = 'OPTIONS'; - //其他常量 - const OSS_ACL = 'x-oss-acl'; - const OSS_OBJECT_ACL = 'x-oss-object-acl'; - const OSS_OBJECT_GROUP = 'x-oss-file-group'; - const OSS_MULTI_PART = 'uploads'; - const OSS_MULTI_DELETE = 'delete'; - const OSS_OBJECT_COPY_SOURCE = 'x-oss-copy-source'; - const OSS_OBJECT_COPY_SOURCE_RANGE = "x-oss-copy-source-range"; - const OSS_PROCESS = "x-oss-process"; - const OSS_CALLBACK = "x-oss-callback"; - const OSS_CALLBACK_VAR = "x-oss-callback-var"; - //支持STS SecurityToken - const OSS_SECURITY_TOKEN = "x-oss-security-token"; - const OSS_ACL_TYPE_PRIVATE = 'private'; - const OSS_ACL_TYPE_PUBLIC_READ = 'public-read'; - const OSS_ACL_TYPE_PUBLIC_READ_WRITE = 'public-read-write'; - const OSS_ENCODING_TYPE = "encoding-type"; - const OSS_ENCODING_TYPE_URL = "url"; - - // 域名类型 - const OSS_HOST_TYPE_NORMAL = "normal";//http://bucket.oss-cn-hangzhou.aliyuncs.com/object - const OSS_HOST_TYPE_IP = "ip"; //http://1.1.1.1/bucket/object - const OSS_HOST_TYPE_SPECIAL = 'special'; //http://bucket.guizhou.gov/object - const OSS_HOST_TYPE_CNAME = "cname"; //http://mydomain.com/object - //OSS ACL数组 - static $OSS_ACL_TYPES = array( - self::OSS_ACL_TYPE_PRIVATE, - self::OSS_ACL_TYPE_PUBLIC_READ, - self::OSS_ACL_TYPE_PUBLIC_READ_WRITE - ); - // OssClient版本信息 - const OSS_NAME = "aliyun-sdk-php"; - const OSS_VERSION = "2.3.0"; - const OSS_BUILD = "20180105"; - const OSS_AUTHOR = ""; - const OSS_OPTIONS_ORIGIN = 'Origin'; - const OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method'; - const OSS_OPTIONS_REQUEST_HEADERS = 'Access-Control-Request-Headers'; - - //是否使用ssl - private $useSSL = false; - private $maxRetries = 3; - private $redirects = 0; - - // 用户提供的域名类型,有四种 OSS_HOST_TYPE_NORMAL, OSS_HOST_TYPE_IP, OSS_HOST_TYPE_SPECIAL, OSS_HOST_TYPE_CNAME - private $hostType = self::OSS_HOST_TYPE_NORMAL; - private $requestUrl; - private $accessKeyId; - private $accessKeySecret; - private $hostname; - private $securityToken; - private $requestProxy = null; - private $enableStsInUrl = false; - private $timeout = 0; - private $connectTimeout = 0; -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php deleted file mode 100644 index 6da08604..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php +++ /dev/null @@ -1,32 +0,0 @@ -rawResponse->body; - if (empty($content)) { - throw new OssException("body is null"); - } - $xml = simplexml_load_string($content); - if (isset($xml->AccessControlList->Grant)) { - return strval($xml->AccessControlList->Grant); - } else { - throw new OssException("xml format exception"); - } - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php deleted file mode 100644 index 433c03eb..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php +++ /dev/null @@ -1,27 +0,0 @@ -rawResponse->header; - if (isset($header["x-oss-next-append-position"])) { - return intval($header["x-oss-next-append-position"]); - } - throw new OssException("cannot get next-append-position"); - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php deleted file mode 100644 index 44ba15ef..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php +++ /dev/null @@ -1,19 +0,0 @@ -rawResponse->body) ? "" : $this->rawResponse->body; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php deleted file mode 100644 index 514e985c..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php +++ /dev/null @@ -1,21 +0,0 @@ -rawResponse->status; - if ((int)(intval($status) / 100) == 2 && (int)(intval($status)) !== 203) { - return true; - } - return false; - } - -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php deleted file mode 100644 index 498723e1..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php +++ /dev/null @@ -1,30 +0,0 @@ -rawResponse->body; - $xml = simplexml_load_string($body); - $result = array(); - - if (isset($xml->LastModified)) { - $result[] = $xml->LastModified; - } - if (isset($xml->ETag)) { - $result[] = $xml->ETag; - } - - return $result; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php deleted file mode 100644 index dc373b85..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php +++ /dev/null @@ -1,27 +0,0 @@ -rawResponse->body; - $xml = simplexml_load_string($body); - $objects = array(); - - if (isset($xml->Deleted)) { - foreach($xml->Deleted as $deleteKey) - $objects[] = $deleteKey->Key; - } - return $objects; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php deleted file mode 100644 index f7aa287c..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php +++ /dev/null @@ -1,35 +0,0 @@ -rawResponse->status) === 200 ? true : false; - } - - /** - * 根据返回http状态码判断,[200-299]即认为是OK, 判断是否存在的接口,404也认为是一种 - * 有效响应 - * - * @return bool - */ - protected function isResponseOk() - { - $status = $this->rawResponse->status; - if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) { - return true; - } - return false; - } - -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php deleted file mode 100644 index eed01f90..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php +++ /dev/null @@ -1,19 +0,0 @@ -rawResponse->body; - $config = new CnameConfig(); - $config->parseFromXml($content); - return $config; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php deleted file mode 100644 index a51afe2a..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php +++ /dev/null @@ -1,35 +0,0 @@ -rawResponse->body; - $config = new CorsConfig(); - $config->parseFromXml($content); - return $config; - } - - /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 - * - * @return bool - */ - protected function isResponseOk() - { - $status = $this->rawResponse->status; - if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) { - return true; - } - return false; - } - -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php deleted file mode 100644 index 6b440c35..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php +++ /dev/null @@ -1,41 +0,0 @@ -rawResponse->body; - $config = new LifecycleConfig(); - $config->parseFromXml($content); - return $config; - } - - /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 - * - * @return bool - */ - protected function isResponseOk() - { - $status = $this->rawResponse->status; - if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelHistoryResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelHistoryResult.php deleted file mode 100644 index 202a6681..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelHistoryResult.php +++ /dev/null @@ -1,19 +0,0 @@ -rawResponse->body; - $channelList = new GetLiveChannelHistory(); - $channelList->parseFromXml($content); - return $channelList; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelInfoResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelInfoResult.php deleted file mode 100644 index d5a9005e..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelInfoResult.php +++ /dev/null @@ -1,19 +0,0 @@ -rawResponse->body; - $channelList = new GetLiveChannelInfo(); - $channelList->parseFromXml($content); - return $channelList; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelStatusResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelStatusResult.php deleted file mode 100644 index 6b8a60f5..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelStatusResult.php +++ /dev/null @@ -1,19 +0,0 @@ -rawResponse->body; - $channelList = new GetLiveChannelStatus(); - $channelList->parseFromXml($content); - return $channelList; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLocationResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLocationResult.php deleted file mode 100644 index 71c4c96e..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLocationResult.php +++ /dev/null @@ -1,30 +0,0 @@ -rawResponse->body; - if (empty($content)) { - throw new OssException("body is null"); - } - $xml = simplexml_load_string($content); - return $xml; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php deleted file mode 100644 index 72fc3aeb..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php +++ /dev/null @@ -1,41 +0,0 @@ -rawResponse->body; - $config = new LoggingConfig(); - $config->parseFromXml($content); - return $config; - } - - /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 - * - * @return bool - */ - protected function isResponseOk() - { - $status = $this->rawResponse->status; - if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php deleted file mode 100644 index aee50d3a..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php +++ /dev/null @@ -1,41 +0,0 @@ -rawResponse->body; - $config = new RefererConfig(); - $config->parseFromXml($content); - return $config; - } - - /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 - * - * @return bool - */ - protected function isResponseOk() - { - $status = $this->rawResponse->status; - if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php deleted file mode 100644 index 84e49160..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php +++ /dev/null @@ -1,34 +0,0 @@ -rawResponse->body; - if (empty($content)) { - throw new OssException("body is null"); - } - $xml = simplexml_load_string($content); - if (isset($xml->StorageCapacity)) { - return intval($xml->StorageCapacity); - } else { - throw new OssException("xml format exception"); - } - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php deleted file mode 100644 index 3099172c..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php +++ /dev/null @@ -1,40 +0,0 @@ -rawResponse->body; - $config = new WebsiteConfig(); - $config->parseFromXml($content); - return $config; - } - - /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 - * - * @return bool - */ - protected function isResponseOk() - { - $status = $this->rawResponse->status; - if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php deleted file mode 100644 index c9aae561..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php +++ /dev/null @@ -1,23 +0,0 @@ -rawResponse->header) ? array() : $this->rawResponse->header; - } - -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php deleted file mode 100644 index af985f27..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php +++ /dev/null @@ -1,29 +0,0 @@ -rawResponse->body; - $xml = simplexml_load_string($content); - if (isset($xml->UploadId)) { - return strval($xml->UploadId); - } - throw new OssException("cannot get UploadId"); - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php deleted file mode 100644 index a58fb2d6..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php +++ /dev/null @@ -1,33 +0,0 @@ -rawResponse->body; - $xml = new \SimpleXMLElement($content); - if (isset($xml->Buckets) && isset($xml->Buckets->Bucket)) { - foreach ($xml->Buckets->Bucket as $bucket) { - $bucketInfo = new BucketInfo(strval($bucket->Location), - strval($bucket->Name), - strval($bucket->CreationDate)); - $bucketList[] = $bucketInfo; - } - } - return new BucketListInfo($bucketList); - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php deleted file mode 100644 index 1a6e2a41..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php +++ /dev/null @@ -1,16 +0,0 @@ -rawResponse->body; - $channelList = new LiveChannelListInfo(); - $channelList->parseFromXml($content); - return $channelList; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php deleted file mode 100644 index bcb20bf5..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php +++ /dev/null @@ -1,55 +0,0 @@ -rawResponse->body; - $xml = simplexml_load_string($content); - - $encodingType = isset($xml->EncodingType) ? strval($xml->EncodingType) : ""; - $bucket = isset($xml->Bucket) ? strval($xml->Bucket) : ""; - $keyMarker = isset($xml->KeyMarker) ? strval($xml->KeyMarker) : ""; - $keyMarker = OssUtil::decodeKey($keyMarker, $encodingType); - $uploadIdMarker = isset($xml->UploadIdMarker) ? strval($xml->UploadIdMarker) : ""; - $nextKeyMarker = isset($xml->NextKeyMarker) ? strval($xml->NextKeyMarker) : ""; - $nextKeyMarker = OssUtil::decodeKey($nextKeyMarker, $encodingType); - $nextUploadIdMarker = isset($xml->NextUploadIdMarker) ? strval($xml->NextUploadIdMarker) : ""; - $delimiter = isset($xml->Delimiter) ? strval($xml->Delimiter) : ""; - $delimiter = OssUtil::decodeKey($delimiter, $encodingType); - $prefix = isset($xml->Prefix) ? strval($xml->Prefix) : ""; - $prefix = OssUtil::decodeKey($prefix, $encodingType); - $maxUploads = isset($xml->MaxUploads) ? intval($xml->MaxUploads) : 0; - $isTruncated = isset($xml->IsTruncated) ? strval($xml->IsTruncated) : ""; - $listUpload = array(); - - if (isset($xml->Upload)) { - foreach ($xml->Upload as $upload) { - $key = isset($upload->Key) ? strval($upload->Key) : ""; - $key = OssUtil::decodeKey($key, $encodingType); - $uploadId = isset($upload->UploadId) ? strval($upload->UploadId) : ""; - $initiated = isset($upload->Initiated) ? strval($upload->Initiated) : ""; - $listUpload[] = new UploadInfo($key, $uploadId, $initiated); - } - } - return new ListMultipartUploadInfo($bucket, $keyMarker, $uploadIdMarker, - $nextKeyMarker, $nextUploadIdMarker, - $delimiter, $prefix, $maxUploads, $isTruncated, $listUpload); - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php deleted file mode 100644 index fcf493d2..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php +++ /dev/null @@ -1,71 +0,0 @@ -rawResponse->body); - $encodingType = isset($xml->EncodingType) ? strval($xml->EncodingType) : ""; - $objectList = $this->parseObjectList($xml, $encodingType); - $prefixList = $this->parsePrefixList($xml, $encodingType); - $bucketName = isset($xml->Name) ? strval($xml->Name) : ""; - $prefix = isset($xml->Prefix) ? strval($xml->Prefix) : ""; - $prefix = OssUtil::decodeKey($prefix, $encodingType); - $marker = isset($xml->Marker) ? strval($xml->Marker) : ""; - $marker = OssUtil::decodeKey($marker, $encodingType); - $maxKeys = isset($xml->MaxKeys) ? intval($xml->MaxKeys) : 0; - $delimiter = isset($xml->Delimiter) ? strval($xml->Delimiter) : ""; - $delimiter = OssUtil::decodeKey($delimiter, $encodingType); - $isTruncated = isset($xml->IsTruncated) ? strval($xml->IsTruncated) : ""; - $nextMarker = isset($xml->NextMarker) ? strval($xml->NextMarker) : ""; - $nextMarker = OssUtil::decodeKey($nextMarker, $encodingType); - return new ObjectListInfo($bucketName, $prefix, $marker, $nextMarker, $maxKeys, $delimiter, $isTruncated, $objectList, $prefixList); - } - - private function parseObjectList($xml, $encodingType) - { - $retList = array(); - if (isset($xml->Contents)) { - foreach ($xml->Contents as $content) { - $key = isset($content->Key) ? strval($content->Key) : ""; - $key = OssUtil::decodeKey($key, $encodingType); - $lastModified = isset($content->LastModified) ? strval($content->LastModified) : ""; - $eTag = isset($content->ETag) ? strval($content->ETag) : ""; - $type = isset($content->Type) ? strval($content->Type) : ""; - $size = isset($content->Size) ? intval($content->Size) : 0; - $storageClass = isset($content->StorageClass) ? strval($content->StorageClass) : ""; - $retList[] = new ObjectInfo($key, $lastModified, $eTag, $type, $size, $storageClass); - } - } - return $retList; - } - - private function parsePrefixList($xml, $encodingType) - { - $retList = array(); - if (isset($xml->CommonPrefixes)) { - foreach ($xml->CommonPrefixes as $commonPrefix) { - $prefix = isset($commonPrefix->Prefix) ? strval($commonPrefix->Prefix) : ""; - $prefix = OssUtil::decodeKey($prefix, $encodingType); - $retList[] = new PrefixInfo($prefix); - } - } - return $retList; - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php deleted file mode 100644 index fd8a1b86..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php +++ /dev/null @@ -1,42 +0,0 @@ -rawResponse->body; - $xml = simplexml_load_string($content); - $bucket = isset($xml->Bucket) ? strval($xml->Bucket) : ""; - $key = isset($xml->Key) ? strval($xml->Key) : ""; - $uploadId = isset($xml->UploadId) ? strval($xml->UploadId) : ""; - $nextPartNumberMarker = isset($xml->NextPartNumberMarker) ? intval($xml->NextPartNumberMarker) : ""; - $maxParts = isset($xml->MaxParts) ? intval($xml->MaxParts) : ""; - $isTruncated = isset($xml->IsTruncated) ? strval($xml->IsTruncated) : ""; - $partList = array(); - if (isset($xml->Part)) { - foreach ($xml->Part as $part) { - $partNumber = isset($part->PartNumber) ? intval($part->PartNumber) : ""; - $lastModified = isset($part->LastModified) ? strval($part->LastModified) : ""; - $eTag = isset($part->ETag) ? strval($part->ETag) : ""; - $size = isset($part->Size) ? intval($part->Size) : ""; - $partList[] = new PartInfo($partNumber, $lastModified, $eTag, $size); - } - } - return new ListPartsInfo($bucket, $key, $uploadId, $nextPartNumberMarker, $maxParts, $isTruncated, $partList); - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php deleted file mode 100644 index dcac86b7..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php +++ /dev/null @@ -1,16 +0,0 @@ -rawResponse->body; - $channel = new LiveChannelInfo(); - $channel->parseFromXml($content); - return $channel; - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/PutSetDeleteResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/PutSetDeleteResult.php deleted file mode 100644 index 97af003b..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/PutSetDeleteResult.php +++ /dev/null @@ -1,20 +0,0 @@ - $this->rawResponse->body); - return array_merge($this->rawResponse->header, $body); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php deleted file mode 100644 index 491256f0..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php +++ /dev/null @@ -1,175 +0,0 @@ -rawResponse = $response; - $this->parseResponse(); - } - - /** - * 获取requestId - * - * @return string - */ - public function getRequestId() - { - if (isset($this->rawResponse) && - isset($this->rawResponse->header) && - isset($this->rawResponse->header['x-oss-request-id']) - ) { - return $this->rawResponse->header['x-oss-request-id']; - } else { - return ''; - } - } - - /** - * 得到返回数据,不同的请求返回数据格式不同 - * - * $return mixed - */ - public function getData() - { - return $this->parsedData; - } - - /** - * 由子类实现,不同的请求返回数据有不同的解析逻辑,由子类实现 - * - * @return mixed - */ - abstract protected function parseDataFromResponse(); - - /** - * 操作是否成功 - * - * @return mixed - */ - public function isOK() - { - return $this->isOk; - } - - /** - * @throws OssException - */ - public function parseResponse() - { - $this->isOk = $this->isResponseOk(); - if ($this->isOk) { - $this->parsedData = $this->parseDataFromResponse(); - } else { - $httpStatus = strval($this->rawResponse->status); - $requestId = strval($this->getRequestId()); - $code = $this->retrieveErrorCode($this->rawResponse->body); - $message = $this->retrieveErrorMessage($this->rawResponse->body); - $body = $this->rawResponse->body; - - $details = array( - 'status' => $httpStatus, - 'request-id' => $requestId, - 'code' => $code, - 'message' => $message, - 'body' => $body - ); - throw new OssException($details); - } - } - - /** - * 尝试从body中获取错误Message - * - * @param $body - * @return string - */ - private function retrieveErrorMessage($body) - { - if (empty($body) || false === strpos($body, 'Message)) { - return strval($xml->Message); - } - return ''; - } - - /** - * 尝试从body中获取错误Code - * - * @param $body - * @return string - */ - private function retrieveErrorCode($body) - { - if (empty($body) || false === strpos($body, 'Code)) { - return strval($xml->Code); - } - return ''; - } - - /** - * 根据返回http状态码判断,[200-299]即认为是OK - * - * @return bool - */ - protected function isResponseOk() - { - $status = $this->rawResponse->status; - if ((int)(intval($status) / 100) == 2) { - return true; - } - return false; - } - - /** - * 返回原始的返回数据 - * - * @return ResponseCore - */ - public function getRawResponse() - { - return $this->rawResponse; - } - - /** - * 标示请求是否成功 - */ - protected $isOk = false; - /** - * 由子类解析过的数据 - */ - protected $parsedData = null; - /** - * 存放auth函数返回的原始Response - * - * @var ResponseCore - */ - protected $rawResponse; -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/SymlinkResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/SymlinkResult.php deleted file mode 100644 index 9c6d861a..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/SymlinkResult.php +++ /dev/null @@ -1,24 +0,0 @@ -rawResponse->header[OssClient::OSS_SYMLINK_TARGET] = rawurldecode($this->rawResponse->header[OssClient::OSS_SYMLINK_TARGET]); - return $this->rawResponse->header; - } -} - diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/UploadPartResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/UploadPartResult.php deleted file mode 100644 index c6b66d45..00000000 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/UploadPartResult.php +++ /dev/null @@ -1,28 +0,0 @@ -rawResponse->header; - if (isset($header["etag"])) { - return $header["etag"]; - } - throw new OssException("cannot get ETag"); - - } -} \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/AclResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/AclResultTest.php deleted file mode 100644 index 12f4b1a7..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/AclResultTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - - - 00220120222 - user_example - - - public-read - - -BBBB; - - private $invalidXml = << - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new AclResult($response); - $this->assertEquals("public-read", $result->getData()); - } - - public function testParseNullXml() - { - $response = new ResponseCore(array(), "", 200); - try { - new AclResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals('body is null', $e->getMessage()); - } - } - - public function testParseInvalidXml() - { - $response = new ResponseCore(array(), $this->invalidXml, 200); - try { - new AclResult($response); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals("xml format exception", $e->getMessage()); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BodyResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BodyResultTest.php deleted file mode 100644 index af13d4d4..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BodyResultTest.php +++ /dev/null @@ -1,26 +0,0 @@ -assertTrue($result->isOK()); - $this->assertEquals($result->getData(), "hi"); - } - - public function testParseInvalid404() - { - $response = new ResponseCore(array(), null, 200); - $result = new BodyResult($response); - $this->assertTrue($result->isOK()); - $this->assertEquals($result->getData(), ""); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketCnameTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketCnameTest.php deleted file mode 100644 index 87c9e543..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketCnameTest.php +++ /dev/null @@ -1,77 +0,0 @@ -client = Common::getOssClient(); - $this->bucketName = 'php-sdk-test-bucket-' . strval(rand(0, 10000)); - $this->client->createBucket($this->bucketName); - } - - public function tearDown() - { - $this->client->deleteBucket($this->bucketName); - } - - public function testBucketWithoutCname() - { - $cnameConfig = $this->client->getBucketCname($this->bucketName); - $this->assertEquals(0, count($cnameConfig->getCnames())); - } - - public function testAddCname() - { - $this->client->addBucketCname($this->bucketName, 'www.baidu.com'); - $this->client->addBucketCname($this->bucketName, 'www.qq.com'); - - $ret = $this->client->getBucketCname($this->bucketName); - $this->assertEquals(2, count($ret->getCnames())); - - // add another 2 cnames - $this->client->addBucketCname($this->bucketName, 'www.sina.com.cn'); - $this->client->addBucketCname($this->bucketName, 'www.iqiyi.com'); - - $ret = $this->client->getBucketCname($this->bucketName); - $cnames = $ret->getCnames(); - $cnameList = array(); - - foreach ($cnames as $c) { - $cnameList[] = $c['Domain']; - } - $should = array( - 'www.baidu.com', - 'www.qq.com', - 'www.sina.com.cn', - 'www.iqiyi.com' - ); - $this->assertEquals(4, count($cnames)); - $this->assertEquals(sort($should), sort($cnameList)); - } - - public function testDeleteCname() - { - $this->client->addBucketCname($this->bucketName, 'www.baidu.com'); - $this->client->addBucketCname($this->bucketName, 'www.qq.com'); - - $ret = $this->client->getBucketCname($this->bucketName); - $this->assertEquals(2, count($ret->getCnames())); - - // delete one cname - $this->client->deleteBucketCname($this->bucketName, 'www.baidu.com'); - - $ret = $this->client->getBucketCname($this->bucketName); - $this->assertEquals(1, count($ret->getCnames())); - $cnames = $ret->getCnames(); - $this->assertEquals('www.qq.com', $cnames[0]['Domain']); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketInfoTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketInfoTest.php deleted file mode 100644 index 80fa25c8..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketInfoTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertNotNull($bucketInfo); - $this->assertEquals('cn-beijing', $bucketInfo->getLocation()); - $this->assertEquals('name', $bucketInfo->getName()); - $this->assertEquals('today', $bucketInfo->getCreateDate()); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketLiveChannelTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketLiveChannelTest.php deleted file mode 100644 index bed68b03..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/BucketLiveChannelTest.php +++ /dev/null @@ -1,283 +0,0 @@ -client = Common::getOssClient(); - $this->bucketName = 'php-sdk-test-rtmp-bucket-name-' . strval(rand(0, 10000)); - $this->client->createBucket($this->bucketName); - Common::waitMetaSync(); - } - - public function tearDown() - { - ////to delete created bucket - //1. delele live channel - $list = $this->client->listBucketLiveChannels($this->bucketName); - if (count($list->getChannelList()) != 0) - { - foreach($list->getChannelList() as $list) - { - $this->client->deleteBucketLiveChannel($this->bucketName, $list->getName()); - } - } - //2. delete exsited object - $prefix = 'live-test/'; - $delimiter = '/'; - $nextMarker = ''; - $maxkeys = 1000; - $options = array( - 'delimiter' => $delimiter, - 'prefix' => $prefix, - 'max-keys' => $maxkeys, - 'marker' => $nextMarker, - ); - - try { - $listObjectInfo = $this->client->listObjects($this->bucketName, $options); - } catch (OssException $e) { - printf($e->getMessage() . "\n"); - return; - } - - $objectList = $listObjectInfo->getObjectList(); // 文件列表 - if (!empty($objectList)) - { - foreach($objectList as $objectInfo) - $this->client->deleteObject($this->bucketName, $objectInfo->getKey()); - } - //3. delete the bucket - $this->client->deleteBucket($this->bucketName); - } - - public function testPutLiveChannel() - { - $config = new LiveChannelConfig(array( - 'description' => 'live channel 1', - 'type' => 'HLS', - 'fragDuration' => 10, - 'fragCount' => 5, - 'playListName' => 'hello.m3u8' - )); - $info = $this->client->putBucketLiveChannel($this->bucketName, 'live-1', $config); - $this->client->deleteBucketLiveChannel($this->bucketName, 'live-1'); - - $this->assertEquals('live-1', $info->getName()); - $this->assertEquals('live channel 1', $info->getDescription()); - $this->assertEquals(1, count($info->getPublishUrls())); - $this->assertEquals(1, count($info->getPlayUrls())); - } - - public function testPutLiveChannelWithDefaultParams() - { - $config = new LiveChannelConfig(array( - 'description' => 'live channel 1', - 'type' => 'HLS', - )); - $info = $this->client->putBucketLiveChannel($this->bucketName, 'live-1', $config); - $this->client->deleteBucketLiveChannel($this->bucketName, 'live-1'); - - $this->assertEquals('live-1', $info->getName()); - $this->assertEquals('live channel 1', $info->getDescription()); - $this->assertEquals(1, count($info->getPublishUrls())); - $this->assertEquals(1, count($info->getPlayUrls())); - } - - public function testListLiveChannels() - { - $config = new LiveChannelConfig(array( - 'description' => 'live channel 1', - 'type' => 'HLS', - 'fragDuration' => 10, - 'fragCount' => 5, - 'playListName' => 'hello.m3u8' - )); - $this->client->putBucketLiveChannel($this->bucketName, 'live-1', $config); - - $config = new LiveChannelConfig(array( - 'description' => 'live channel 2', - 'type' => 'HLS', - 'fragDuration' => 10, - 'fragCount' => 5, - 'playListName' => 'hello.m3u8' - )); - $this->client->putBucketLiveChannel($this->bucketName, 'live-2', $config); - - $list = $this->client->listBucketLiveChannels($this->bucketName); - - $this->assertEquals($this->bucketName, $list->getBucketName()); - $this->assertEquals(false, $list->getIsTruncated()); - $channels = $list->getChannelList(); - $this->assertEquals(2, count($channels)); - - $chan1 = $channels[0]; - $this->assertEquals('live-1', $chan1->getName()); - $this->assertEquals('live channel 1', $chan1->getDescription()); - $this->assertEquals(1, count($chan1->getPublishUrls())); - $this->assertEquals(1, count($chan1->getPlayUrls())); - - $chan2 = $channels[1]; - $this->assertEquals('live-2', $chan2->getName()); - $this->assertEquals('live channel 2', $chan2->getDescription()); - $this->assertEquals(1, count($chan2->getPublishUrls())); - $this->assertEquals(1, count($chan2->getPlayUrls())); - - $list = $this->client->listBucketLiveChannels($this->bucketName, array( - 'prefix' => 'live-', - 'marker' => 'live-1', - 'max-keys' => 10 - )); - $channels = $list->getChannelList(); - $this->assertEquals(1, count($channels)); - $chan2 = $channels[0]; - $this->assertEquals('live-2', $chan2->getName()); - $this->assertEquals('live channel 2', $chan2->getDescription()); - $this->assertEquals(1, count($chan2->getPublishUrls())); - $this->assertEquals(1, count($chan2->getPlayUrls())); - - $this->client->deleteBucketLiveChannel($this->bucketName, 'live-1'); - $this->client->deleteBucketLiveChannel($this->bucketName, 'live-2'); - $list = $this->client->listBucketLiveChannels($this->bucketName, array( - 'prefix' => 'live-' - )); - $this->assertEquals(0, count($list->getChannelList())); - } - - public function testDeleteLiveChannel() - { - $channelName = 'live-to-delete'; - $config = new LiveChannelConfig(array( - 'description' => 'live channel to delete', - 'type' => 'HLS', - 'fragDuration' => 10, - 'fragCount' => 5, - 'playListName' => 'hello.m3u8' - )); - $this->client->putBucketLiveChannel($this->bucketName, $channelName, $config); - - $this->client->deleteBucketLiveChannel($this->bucketName, $channelName); - $list = $this->client->listBucketLiveChannels($this->bucketName, array( - 'prefix' => $channelName - )); - - $this->assertEquals(0, count($list->getChannelList())); - } - - public function testSignRtmpUrl() - { - $channelName = '90475'; - $bucket = 'douyu'; - $now = time(); - $url = $this->client->signRtmpUrl($bucket, $channelName, 900, array( - 'params' => array( - 'playlistName' => 'playlist.m3u8' - ) - )); - - $ret = parse_url($url); - $this->assertEquals('rtmp', $ret['scheme']); - parse_str($ret['query'], $query); - - $this->assertTrue(isset($query['OSSAccessKeyId'])); - $this->assertTrue(isset($query['Signature'])); - $this->assertTrue(intval($query['Expires']) - ($now + 900) < 3); - $this->assertEquals('playlist.m3u8', $query['playlistName']); - } - - public function testLiveChannelInfo() - { - $channelName = 'live-to-put-status'; - $config = new LiveChannelConfig(array( - 'description' => 'test live channel info', - 'type' => 'HLS', - 'fragDuration' => 10, - 'fragCount' => 5, - 'playListName' => 'hello.m3u8' - )); - $this->client->putBucketLiveChannel($this->bucketName, $channelName, $config); - - $info = $this->client->getLiveChannelInfo($this->bucketName, $channelName); - $this->assertEquals('test live channel info', $info->getDescription()); - $this->assertEquals('enabled', $info->getStatus()); - $this->assertEquals('HLS', $info->getType()); - $this->assertEquals(10, $info->getFragDuration()); - $this->assertEquals(5, $info->getFragCount()); - $this->assertEquals('playlist.m3u8', $info->getPlayListName()); - - $this->client->deleteBucketLiveChannel($this->bucketName, $channelName); - $list = $this->client->listBucketLiveChannels($this->bucketName, array( - 'prefix' => $channelName - )); - $this->assertEquals(0, count($list->getChannelList())); - } - - public function testPutLiveChannelStatus() - { - $channelName = 'live-to-put-status'; - $config = new LiveChannelConfig(array( - 'description' => 'test live channel info', - 'type' => 'HLS', - 'fragDuration' => 10, - 'fragCount' => 5, - 'playListName' => 'hello.m3u8' - )); - $this->client->putBucketLiveChannel($this->bucketName, $channelName, $config); - - $info = $this->client->getLiveChannelInfo($this->bucketName, $channelName); - $this->assertEquals('test live channel info', $info->getDescription()); - $this->assertEquals('enabled', $info->getStatus()); - $this->assertEquals('HLS', $info->getType()); - $this->assertEquals(10, $info->getFragDuration()); - $this->assertEquals(5, $info->getFragCount()); - $this->assertEquals('playlist.m3u8', $info->getPlayListName()); - $status = $this->client->getLiveChannelStatus($this->bucketName, $channelName); - $this->assertEquals('Idle', $status->getStatus()); - - - $resp = $this->client->putLiveChannelStatus($this->bucketName, $channelName, "disabled"); - $info = $this->client->getLiveChannelInfo($this->bucketName, $channelName); - $this->assertEquals('test live channel info', $info->getDescription()); - $this->assertEquals('disabled', $info->getStatus()); - $this->assertEquals('HLS', $info->getType()); - $this->assertEquals(10, $info->getFragDuration()); - $this->assertEquals(5, $info->getFragCount()); - $this->assertEquals('playlist.m3u8', $info->getPlayListName()); - - $status = $this->client->getLiveChannelStatus($this->bucketName, $channelName); - //getLiveChannelInfo - $this->assertEquals('Disabled', $status->getStatus()); - - $this->client->deleteBucketLiveChannel($this->bucketName, $channelName); - $list = $this->client->listBucketLiveChannels($this->bucketName, array( - 'prefix' => $channelName - )); - $this->assertEquals(0, count($list->getChannelList())); - - } - public function testLiveChannelHistory() - { - $channelName = 'live-test-history'; - $config = new LiveChannelConfig(array( - 'description' => 'test live channel info', - 'type' => 'HLS', - 'fragDuration' => 10, - 'fragCount' => 5, - 'playListName' => 'hello.m3u8' - )); - $this->client->putBucketLiveChannel($this->bucketName, $channelName, $config); - - $history = $this->client->getLiveChannelHistory($this->bucketName, $channelName); - $this->assertEquals(0, count($history->getLiveRecordList())); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CallbackTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CallbackTest.php deleted file mode 100644 index a0db0037..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CallbackTest.php +++ /dev/null @@ -1,297 +0,0 @@ -ossClient->putObject($this->bucket, $copiedObject, file_get_contents(__FILE__)); - - /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id - */ - try { - $upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - /* - * step 2. uploadPartCopy - */ - $copyId = 1; - $eTag = $this->ossClient->uploadPartCopy($this->bucket, $copiedObject, $this->bucket, $object, $copyId, $upload_id); - $upload_parts[] = array( - 'PartNumber' => $copyId, - 'ETag' => $eTag, - ); - - try { - $listPartsInfo = $this->ossClient->listParts($this->bucket, $object, $upload_id); - $this->assertNotNull($listPartsInfo); - } catch (OssException $e) { - $this->assertTrue(false); - } - - /** - * step 3. - */ - - $json = - '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size},\"x:var1\":${x:var1},\"x:var2\":${x:var2}}", - "callbackBodyType":"application/json" - }'; - - $var = - '{ - "x:var1":"value1", - "x:var2":"值2" - }'; - $options = array(OssClient::OSS_CALLBACK => $json, - OssClient::OSS_CALLBACK_VAR => $var - ); - - try { - $result = $this->ossClient->completeMultipartUpload($this->bucket, $object, $upload_id, $upload_parts, $options); - $this->assertEquals("200", $result['info']['http_code']); - $this->assertEquals("{\"Status\":\"OK\"}", $result['body']); - } catch (OssException $e) { - $this->assertTrue(false); - } - } - - public function testMultipartUploadCallbackFailed() - { - $object = "multipart-callback-test.txt"; - $copiedObject = "multipart-callback-test.txt.copied"; - $this->ossClient->putObject($this->bucket, $copiedObject, file_get_contents(__FILE__)); - - /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id - */ - try { - $upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - /* - * step 2. uploadPartCopy - */ - $copyId = 1; - $eTag = $this->ossClient->uploadPartCopy($this->bucket, $copiedObject, $this->bucket, $object, $copyId, $upload_id); - $upload_parts[] = array( - 'PartNumber' => $copyId, - 'ETag' => $eTag, - ); - - try { - $listPartsInfo = $this->ossClient->listParts($this->bucket, $object, $upload_id); - $this->assertNotNull($listPartsInfo); - } catch (OssException $e) { - $this->assertTrue(false); - } - - /** - * step 3. - */ - - $json = - '{ - "callbackUrl":"www.baidu.com", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size},\"x:var1\":${x:var1},\"x:var2\":${x:var2}}", - "callbackBodyType":"application/json" - }'; - - $var = - '{ - "x:var1":"value1", - "x:var2":"值2" - }'; - $options = array(OssClient::OSS_CALLBACK => $json, - OssClient::OSS_CALLBACK_VAR => $var - ); - - try { - $result = $this->ossClient->completeMultipartUpload($this->bucket, $object, $upload_id, $upload_parts, $options); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertTrue(true); - $this->assertEquals("203", $e->getHTTPStatus()); - } - - } - - public function testPutObjectCallbackNormal() - { - //json - { - $json = - '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size}}", - "callbackBodyType":"application/json" - }'; - $options = array(OssClient::OSS_CALLBACK => $json); - $this->putObjectCallbackOk($options, "200"); - } - //url - { - $url = - '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}", - "callbackBodyType":"application/x-www-form-urlencoded" - }'; - $options = array(OssClient::OSS_CALLBACK => $url); - $this->putObjectCallbackOk($options, "200"); - } - // Unspecified typre - { - $url = - '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}" - }'; - $options = array(OssClient::OSS_CALLBACK => $url); - $this->putObjectCallbackOk($options, "200"); - } - //json and body is chinese - { - $json = - '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"{\" 春水碧于天,画船听雨眠。\":\"垆边人似月,皓腕凝霜雪。\"}", - "callbackBodyType":"application/json" - }'; - $options = array(OssClient::OSS_CALLBACK => $json); - $this->putObjectCallbackOk($options, "200"); - } - //url and body is chinese - { - $url = - '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"春水碧于天,画船听雨眠。垆边人似月,皓腕凝霜雪", - "callbackBodyType":"application/x-www-form-urlencoded" - }'; - $options = array(OssClient::OSS_CALLBACK => $url); - $this->putObjectCallbackOk($options, "200"); - } - //json and add callback_var - { - $json = - '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size},\"x:var1\":${x:var1},\"x:var2\":${x:var2}}", - "callbackBodyType":"application/json" - }'; - - $var = - '{ - "x:var1":"value1", - "x:var2":"aliyun.com" - }'; - $options = array(OssClient::OSS_CALLBACK => $json, - OssClient::OSS_CALLBACK_VAR => $var - ); - $this->putObjectCallbackOk($options, "200"); - } - //url and add callback_var - { - $url = - '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}&my_var1=${x:var1}&my_var2=${x:var2}", - "callbackBodyType":"application/x-www-form-urlencoded" - }'; - $var = - '{ - "x:var1":"value1凌波不过横塘路,但目送,芳", - "x:var2":"值2" - }'; - $options = array(OssClient::OSS_CALLBACK => $url, - OssClient::OSS_CALLBACK_VAR => $var - ); - $this->putObjectCallbackOk($options, "200"); - } - - } - - public function testPutCallbackWithCallbackFailed() - { - { - $json = - '{ - "callbackUrl":"http://www.baidu.com", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size}}", - "callbackBodyType":"application/json" - }'; - $options = array(OssClient::OSS_CALLBACK => $json); - $this->putObjectCallbackFailed($options, "203"); - } - - { - $url = - '{ - "callbackUrl":"http://www.baidu.com", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", - "callbackBody":"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}&my_var1=${x:var1}&my_var2=${x:var2}", - "callbackBodyType":"application/x-www-form-urlencoded" - }'; - $options = array(OssClient::OSS_CALLBACK => $url); - $this->putObjectCallbackFailed($options, "203"); - } - - } - - private function putObjectCallbackOk($options, $status) - { - $object = "oss-php-sdk-callback-test.txt"; - $content = file_get_contents(__FILE__); - try { - $result = $this->ossClient->putObject($this->bucket, $object, $content, $options); - $this->assertEquals($status, $result['info']['http_code']); - $this->assertEquals("{\"Status\":\"OK\"}", $result['body']); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - private function putObjectCallbackFailed($options, $status) - { - $object = "oss-php-sdk-callback-test.txt"; - $content = file_get_contents(__FILE__); - try { - $result = $this->ossClient->putObject($this->bucket, $object, $content, $options); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals($status, $e->getHTTPStatus()); - $this->assertTrue(true); - } - } - - public function setUp() - { - parent::setUp(); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CnameConfigTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CnameConfigTest.php deleted file mode 100644 index e3c1ce90..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CnameConfigTest.php +++ /dev/null @@ -1,77 +0,0 @@ - - - - www.foo.com - enabled - 20150101 - - - bar.com - disabled - 20160101 - - -BBBB; - - public function testFromXml() - { - $cnameConfig = new CnameConfig(); - $cnameConfig->parseFromXml($this->xml1); - - $cnames = $cnameConfig->getCnames(); - $this->assertEquals(2, count($cnames)); - $this->assertEquals('www.foo.com', $cnames[0]['Domain']); - $this->assertEquals('enabled', $cnames[0]['Status']); - $this->assertEquals('20150101', $cnames[0]['LastModified']); - - $this->assertEquals('bar.com', $cnames[1]['Domain']); - $this->assertEquals('disabled', $cnames[1]['Status']); - $this->assertEquals('20160101', $cnames[1]['LastModified']); - } - - public function testToXml() - { - $cnameConfig = new CnameConfig(); - $cnameConfig->addCname('www.foo.com'); - $cnameConfig->addCname('bar.com'); - - $xml = $cnameConfig->serializeToXml(); - $comp = new CnameConfig(); - $comp->parseFromXml($xml); - - $cnames1 = $cnameConfig->getCnames(); - $cnames2 = $comp->getCnames(); - - $this->assertEquals(count($cnames1), count($cnames2)); - $this->assertEquals(count($cnames1[0]), count($cnames2[0])); - $this->assertEquals(1, count($cnames1[0])); - $this->assertEquals($cnames1[0]['Domain'], $cnames2[0]['Domain']); - } - - public function testCnameNumberLimit() - { - $cnameConfig = new CnameConfig(); - for ($i = 0; $i < CnameConfig::OSS_MAX_RULES; $i += 1) { - $cnameConfig->addCname(strval($i) . '.foo.com'); - } - try { - $cnameConfig->addCname('www.foo.com'); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals( - $e->getMessage(), - "num of cname in the config exceeds self::OSS_MAX_RULES: " . strval(CnameConfig::OSS_MAX_RULES)); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/Common.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/Common.php deleted file mode 100644 index 9d7190cc..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/Common.php +++ /dev/null @@ -1,70 +0,0 @@ -getMessage() . "\n"); - return null; - } - return $ossClient; - } - - public static function getBucketName() - { - return getenv('OSS_BUCKET'); - } - - /** - * 工具方法,创建一个bucket - */ - public static function createBucket() - { - $ossClient = self::getOssClient(); - if (is_null($ossClient)) exit(1); - $bucket = self::getBucketName(); - $acl = OssClient::OSS_ACL_TYPE_PUBLIC_READ; - try { - $ossClient->createBucket($bucket, $acl); - } catch (OssException $e) { - printf(__FUNCTION__ . ": FAILED\n"); - printf($e->getMessage() . "\n"); - return; - } - print(__FUNCTION__ . ": OK" . "\n"); - } - - /** - * Wait for bucket meta sync - */ - public static function waitMetaSync() - { - if (getenv('TRAVIS')) { - sleep(10); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ContentTypeTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ContentTypeTest.php deleted file mode 100644 index 606c8104..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ContentTypeTest.php +++ /dev/null @@ -1,133 +0,0 @@ -/dev/null', $output, $status); - - $this->assertEquals(0, $status); - } - - private function getContentType($bucket, $object) - { - $client = Common::getOssClient(); - $headers = $client->getObjectMeta($bucket, $object); - return $headers['content-type']; - } - - public function testByFileName() - { - $client = Common::getOssClient(); - $bucket = Common::getBucketName(); - - $file = '/tmp/x.html'; - $object = 'test/x'; - $this->runCmd('touch ' . $file); - - $client->uploadFile($bucket, $object, $file); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('text/html', $type); - - $file = '/tmp/x.json'; - $object = 'test/y'; - $this->runCmd('dd if=/dev/urandom of=' . $file . ' bs=1024 count=100'); - - $client->multiuploadFile($bucket, $object, $file, array('partSize' => 100)); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('application/json', $type); - } - - public function testByObjectKey() - { - $client = Common::getOssClient(); - $bucket = Common::getBucketName(); - - $object = "test/x.txt"; - $client->putObject($bucket, $object, "hello world"); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('text/plain', $type); - - $file = '/tmp/x.html'; - $object = 'test/x.txt'; - $this->runCmd('touch ' . $file); - - $client->uploadFile($bucket, $object, $file); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('text/html', $type); - - $file = '/tmp/x.none'; - $object = 'test/x.txt'; - $this->runCmd('touch ' . $file); - - $client->uploadFile($bucket, $object, $file); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('text/plain', $type); - - $file = '/tmp/x.mp3'; - $object = 'test/y.json'; - $this->runCmd('dd if=/dev/urandom of=' . $file . ' bs=1024 count=100'); - - $client->multiuploadFile($bucket, $object, $file, array('partSize' => 100)); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('audio/mpeg', $type); - - $file = '/tmp/x.none'; - $object = 'test/y.json'; - $this->runCmd('dd if=/dev/urandom of=' . $file . ' bs=1024 count=100'); - - $client->multiuploadFile($bucket, $object, $file, array('partSize' => 100)); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('application/json', $type); - } - - public function testByUser() - { - $client = Common::getOssClient(); - $bucket = Common::getBucketName(); - - $object = "test/x.txt"; - $client->putObject($bucket, $object, "hello world", array( - 'Content-Type' => 'text/html' - )); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('text/html', $type); - - $file = '/tmp/x.html'; - $object = 'test/x'; - $this->runCmd('touch ' . $file); - - $client->uploadFile($bucket, $object, $file, array( - 'Content-Type' => 'application/json' - )); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('application/json', $type); - - $file = '/tmp/x.json'; - $object = 'test/y'; - $this->runCmd('dd if=/dev/urandom of=' . $file . ' bs=1024 count=100'); - - $client->multiuploadFile($bucket, $object, $file, array( - 'partSize' => 100, - 'Content-Type' => 'audio/mpeg' - )); - $type = $this->getContentType($bucket, $object); - - $this->assertEquals('audio/mpeg', $type); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CopyObjectResult.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CopyObjectResult.php deleted file mode 100644 index 171d4c84..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CopyObjectResult.php +++ /dev/null @@ -1,52 +0,0 @@ - - - Fri, 24 Feb 2012 07:18:48 GMT - "5B3C1A2E053D763E1B002CC607C5A0FE" - -BBBB; - - public function testNullResponse() - { - $response = null; - try { - new CopyObjectResult($response); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('raw response is null', $e->getMessage()); - } - } - - public function testOkResponse() - { - $header= array(); - $response = new ResponseCore($header, $this->body, 200); - $result = new CopyObjectResult($response); - $data = $result->getData(); - $this->assertTrue($result->isOK()); - $this->assertEquals("Fri, 24 Feb 2012 07:18:48 GMT", $data[0]); - $this->assertEquals("\"5B3C1A2E053D763E1B002CC607C5A0FE\"", $data[1]); - } - - public function testFailResponse() - { - $response = new ResponseCore(array(), "", 404); - try { - new CopyObjectResult($response); - $this->assertFalse(true); - } catch (OssException $e) { - - } - } - -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CorsConfigTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CorsConfigTest.php deleted file mode 100644 index ddc4d3ab..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CorsConfigTest.php +++ /dev/null @@ -1,140 +0,0 @@ - - - -http://www.b.com -http://www.a.com -http://www.a.com -GET -PUT -POST -x-oss-test -x-oss-test2 -x-oss-test2 -x-oss-test3 -x-oss-test1 -x-oss-test1 -x-oss-test2 -10 - - -http://www.b.com -GET -x-oss-test -x-oss-test1 -110 - - -BBBB; - - private $validXml2 = << - - -http://www.b.com -http://www.a.com -http://www.a.com -GET -PUT -POST -x-oss-test -x-oss-test2 -x-oss-test2 -x-oss-test3 -x-oss-test1 -x-oss-test1 -x-oss-test2 -10 - - -BBBB; - - public function testParseValidXml() - { - $corsConfig = new CorsConfig(); - $corsConfig->parseFromXml($this->validXml); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($corsConfig->serializeToXml())); - $this->assertNotNull($corsConfig->getRules()); - $rules = $corsConfig->getRules(); - $this->assertNotNull($rules[0]->getAllowedHeaders()); - $this->assertNotNull($rules[0]->getAllowedMethods()); - $this->assertNotNull($rules[0]->getAllowedOrigins()); - $this->assertNotNull($rules[0]->getExposeHeaders()); - $this->assertNotNull($rules[0]->getMaxAgeSeconds()); - } - - public function testParseValidXml2() - { - $corsConfig = new CorsConfig(); - $corsConfig->parseFromXml($this->validXml2); - $this->assertEquals($this->cleanXml($this->validXml2), $this->cleanXml($corsConfig->serializeToXml())); - } - - public function testCreateCorsConfigFromMoreThan10Rules() - { - $corsConfig = new CorsConfig(); - $rule = new CorsRule(); - for ($i = 0; $i < CorsConfig::OSS_MAX_RULES; $i += 1) { - $corsConfig->addRule($rule); - } - try { - $corsConfig->addRule($rule); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals($e->getMessage(), "num of rules in the config exceeds self::OSS_MAX_RULES: " . strval(CorsConfig::OSS_MAX_RULES)); - } - } - - public function testCreateCorsConfigParamAbsent() - { - $corsConfig = new CorsConfig(); - $rule = new CorsRule(); - $corsConfig->addRule($rule); - - try { - $xml = $corsConfig->serializeToXml(); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals($e->getMessage(), "maxAgeSeconds is not set in the Rule"); - } - } - - public function testCreateCorsConfigFromScratch() - { - $corsConfig = new CorsConfig(); - $rule = new CorsRule(); - $rule->addAllowedHeader("x-oss-test"); - $rule->addAllowedHeader("x-oss-test2"); - $rule->addAllowedHeader("x-oss-test2"); - $rule->addAllowedHeader("x-oss-test3"); - $rule->addAllowedOrigin("http://www.b.com"); - $rule->addAllowedOrigin("http://www.a.com"); - $rule->addAllowedOrigin("http://www.a.com"); - $rule->addAllowedMethod("GET"); - $rule->addAllowedMethod("PUT"); - $rule->addAllowedMethod("POST"); - $rule->addExposeHeader("x-oss-test1"); - $rule->addExposeHeader("x-oss-test1"); - $rule->addExposeHeader("x-oss-test2"); - $rule->setMaxAgeSeconds(10); - $corsConfig->addRule($rule); - $this->assertEquals($this->cleanXml($this->validXml2), $this->cleanXml($corsConfig->serializeToXml())); - $this->assertEquals($this->cleanXml($this->validXml2), $this->cleanXml(strval($corsConfig))); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ExistResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ExistResultTest.php deleted file mode 100644 index e1b4e814..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ExistResultTest.php +++ /dev/null @@ -1,38 +0,0 @@ -assertTrue($result->isOK()); - $this->assertEquals($result->getData(), true); - } - - public function testParseInvalid404() - { - $response = new ResponseCore(array(), "", 404); - $result = new ExistResult($response); - $this->assertTrue($result->isOK()); - $this->assertEquals($result->getData(), false); - } - - public function testInvalidResponse() - { - $response = new ResponseCore(array(), "", 300); - try { - new ExistResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetCorsResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetCorsResultTest.php deleted file mode 100644 index a3281c85..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetCorsResultTest.php +++ /dev/null @@ -1,67 +0,0 @@ - - - -http://www.b.com -http://www.a.com -http://www.a.com -GET -PUT -POST -x-oss-test -x-oss-test2 -x-oss-test2 -x-oss-test3 -x-oss-test1 -x-oss-test1 -x-oss-test2 -10 - - -http://www.b.com -GET -x-oss-test -x-oss-test1 -110 - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new GetCorsResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $corsConfig = $result->getData(); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($corsConfig->serializeToXml())); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } - - public function testInvalidResponse() - { - $response = new ResponseCore(array(), $this->validXml, 300); - try { - new GetCorsResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetLifecycleResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetLifecycleResultTest.php deleted file mode 100644 index 92ae2086..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetLifecycleResultTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - - -delete obsoleted files -obsoleted/ -Enabled -3 - - -delete temporary files -temporary/ -Enabled -2022-10-12T00:00:00.000Z -2022-10-12T00:00:00.000Z - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new GetLifecycleResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $lifecycleConfig = $result->getData(); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($lifecycleConfig->serializeToXml())); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } - - public function testInvalidResponse() - { - $response = new ResponseCore(array(), $this->validXml, 300); - try { - new GetLifecycleResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - - } - } - -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetLoggingResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetLoggingResultTest.php deleted file mode 100644 index 61950148..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetLoggingResultTest.php +++ /dev/null @@ -1,51 +0,0 @@ - - - -TargetBucket -TargetPrefix - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new GetLoggingResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $loggingConfig = $result->getData(); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($loggingConfig->serializeToXml())); - $this->assertEquals("TargetBucket", $loggingConfig->getTargetBucket()); - $this->assertEquals("TargetPrefix", $loggingConfig->getTargetPrefix()); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } - - public function testInvalidResponse() - { - $response = new ResponseCore(array(), $this->validXml, 300); - try { - new GetLoggingResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetRefererResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetRefererResultTest.php deleted file mode 100644 index 072aa43a..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetRefererResultTest.php +++ /dev/null @@ -1,51 +0,0 @@ - - -true - -http://www.aliyun.com -https://www.aliyun.com -http://www.*.com -https://www.?.aliyuncs.com - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new GetRefererResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $refererConfig = $result->getData(); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($refererConfig->serializeToXml())); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } - - public function testInvalidResponse() - { - $response = new ResponseCore(array(), $this->validXml, 300); - try { - new GetRefererResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetWebsiteResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetWebsiteResultTest.php deleted file mode 100644 index 70e15594..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetWebsiteResultTest.php +++ /dev/null @@ -1,50 +0,0 @@ - - - -index.html - - -errorDocument.html - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new GetWebsiteResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $websiteConfig = $result->getData(); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($websiteConfig->serializeToXml())); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } - - public function testInvalidResponse() - { - $response = new ResponseCore(array(), $this->validXml, 300); - try { - new GetWebsiteResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/HeaderResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/HeaderResultTest.php deleted file mode 100644 index dae49754..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/HeaderResultTest.php +++ /dev/null @@ -1,23 +0,0 @@ - 'value'), "", 200); - $result = new HeaderResult($response); - $this->assertTrue($result->isOK()); - $this->assertTrue(is_array($result->getData())); - $data = $result->getData(); - $this->assertEquals($data['key'], 'value'); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/HttpTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/HttpTest.php deleted file mode 100644 index a59dfcd2..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/HttpTest.php +++ /dev/null @@ -1,77 +0,0 @@ -assertFalse($res->isOK()); - $this->assertTrue($res->isOK(500)); - } - - public function testGet() - { - $httpCore = new RequestCore("http://www.baidu.com"); - $httpResponse = $httpCore->send_request(); - $this->assertNotNull($httpResponse); - } - - public function testSetProxyAndTimeout() - { - $httpCore = new RequestCore("http://www.baidu.com"); - $httpCore->set_proxy("1.0.2.1:8888"); - $httpCore->connect_timeout = 1; - try { - $httpResponse = $httpCore->send_request(); - $this->assertTrue(false); - } catch (RequestCore_Exception $e) { - - } - } - - public function testGetParseTrue() - { - $httpCore = new RequestCore("http://www.baidu.com"); - $httpCore->curlopts = array(CURLOPT_HEADER => true); - $url = $httpCore->send_request(true); - foreach ($httpCore->get_response_header() as $key => $value) { - $this->assertEquals($httpCore->get_response_header($key), $value); - } - $this->assertNotNull($url); - } - - public function testParseResponse() - { - $httpCore = new RequestCore("http://www.baidu.com"); - $response = $httpCore->send_request(); - $parsed = $httpCore->process_response(null, $response); - $this->assertNotNull($parsed); - } - - public function testExceptionGet() - { - $httpCore = null; - $exception = false; - try { - $httpCore = new RequestCore("http://www.notexistsitexx.com"); - $httpCore->set_body(""); - $httpCore->set_method("GET"); - $httpCore->connect_timeout = 10; - $httpCore->timeout = 10; - $res = $httpCore->send_request(); - } catch (RequestCore_Exception $e) { - $exception = true; - } - $this->assertTrue($exception); - } -} - - diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/InitiateMultipartUploadResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/InitiateMultipartUploadResultTest.php deleted file mode 100644 index 9f6c7a53..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/InitiateMultipartUploadResultTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - - multipart_upload - multipart.data - 0004B9894A22E5B1888A1E29F8236E2D - -BBBB; - - private $invalidXml = << - - multipart_upload - multipart.data - -BBBB; - - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new InitiateMultipartUploadResult($response); - $this->assertEquals("0004B9894A22E5B1888A1E29F8236E2D", $result->getData()); - } - - public function testParseInvalidXml() - { - $response = new ResponseCore(array(), $this->invalidXml, 200); - try { - $result = new InitiateMultipartUploadResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LifecycleConfigTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LifecycleConfigTest.php deleted file mode 100644 index 7bd03318..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LifecycleConfigTest.php +++ /dev/null @@ -1,130 +0,0 @@ - - - -delete obsoleted files -obsoleted/ -Enabled -3 - - -delete temporary files -temporary/ -Enabled -2022-10-12T00:00:00.000Z -2022-10-12T00:00:00.000Z - - -BBBB; - - private $validLifecycle2 = << - -delete temporary files -temporary/ -Enabled -2022-10-12T00:00:00.000Z -2022-10-12T00:00:00.000Z - - -BBBB; - - private $nullLifecycle = << - -BBBB; - - public function testConstructValidConfig() - { - $lifecycleConfig = new LifecycleConfig(); - $actions = array(); - $actions[] = new LifecycleAction("Expiration", "Days", 3); - $lifecycleRule = new LifecycleRule("delete obsoleted files", "obsoleted/", "Enabled", $actions); - $lifecycleConfig->addRule($lifecycleRule); - $actions = array(); - $actions[] = new LifecycleAction("Expiration", "Date", '2022-10-12T00:00:00.000Z'); - $actions[] = new LifecycleAction("Expiration2", "Date", '2022-10-12T00:00:00.000Z'); - $lifecycleRule = new LifecycleRule("delete temporary files", "temporary/", "Enabled", $actions); - $lifecycleConfig->addRule($lifecycleRule); - try { - $lifecycleConfig->addRule(null); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('lifecycleRule is null', $e->getMessage()); - } - $this->assertEquals($this->cleanXml(strval($lifecycleConfig)), $this->cleanXml($this->validLifecycle)); - } - - public function testParseValidXml() - { - $lifecycleConfig = new LifecycleConfig(); - $lifecycleConfig->parseFromXml($this->validLifecycle); - $this->assertEquals($this->cleanXml($lifecycleConfig->serializeToXml()), $this->cleanXml($this->validLifecycle)); - $this->assertEquals(2, count($lifecycleConfig->getRules())); - $rules = $lifecycleConfig->getRules(); - $this->assertEquals('delete temporary files', $rules[1]->getId()); - } - - public function testParseValidXml2() - { - $lifecycleConfig = new LifecycleConfig(); - $lifecycleConfig->parseFromXml($this->validLifecycle2); - $this->assertEquals($this->cleanXml($lifecycleConfig->serializeToXml()), $this->cleanXml($this->validLifecycle2)); - $this->assertEquals(1, count($lifecycleConfig->getRules())); - $rules = $lifecycleConfig->getRules(); - $this->assertEquals('delete temporary files', $rules[0]->getId()); - } - - public function testParseNullXml() - { - $lifecycleConfig = new LifecycleConfig(); - $lifecycleConfig->parseFromXml($this->nullLifecycle); - $this->assertEquals($this->cleanXml($lifecycleConfig->serializeToXml()), $this->cleanXml($this->nullLifecycle)); - $this->assertEquals(0, count($lifecycleConfig->getRules())); - } - - public function testLifecycleRule() - { - $lifecycleRule = new LifecycleRule("x", "x", "x", array('x')); - $lifecycleRule->setId("id"); - $lifecycleRule->setPrefix("prefix"); - $lifecycleRule->setStatus("Enabled"); - $lifecycleRule->setActions(array()); - - $this->assertEquals('id', $lifecycleRule->getId()); - $this->assertEquals('prefix', $lifecycleRule->getPrefix()); - $this->assertEquals('Enabled', $lifecycleRule->getStatus()); - $this->assertEmpty($lifecycleRule->getActions()); - } - - public function testLifecycleAction() - { - $action = new LifecycleAction('x', 'x', 'x'); - $this->assertEquals($action->getAction(), 'x'); - $this->assertEquals($action->getTimeSpec(), 'x'); - $this->assertEquals($action->getTimeValue(), 'x'); - $action->setAction('y'); - $action->setTimeSpec('y'); - $action->setTimeValue('y'); - $this->assertEquals($action->getAction(), 'y'); - $this->assertEquals($action->getTimeSpec(), 'y'); - $this->assertEquals($action->getTimeValue(), 'y'); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListBucketsResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListBucketsResultTest.php deleted file mode 100644 index 1abe1f50..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListBucketsResultTest.php +++ /dev/null @@ -1,97 +0,0 @@ - - - - ut_test_put_bucket - ut_test_put_bucket - - - - oss-cn-hangzhou-a - xz02tphky6fjfiuc0 - 2014-05-15T11:18:32.000Z - - - oss-cn-hangzhou-a - xz02tphky6fjfiuc1 - 2014-05-15T11:18:32.000Z - - - -BBBB; - - private $nullXml = << - - - ut_test_put_bucket - ut_test_put_bucket - - - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new ListBucketsResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $bucketListInfo = $result->getData(); - $this->assertEquals(2, count($bucketListInfo->getBucketList())); - } - - public function testParseNullXml() - { - $response = new ResponseCore(array(), $this->nullXml, 200); - $result = new ListBucketsResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $bucketListInfo = $result->getData(); - $this->assertEquals(0, count($bucketListInfo->getBucketList())); - } - - public function test403() - { - $errorHeader = array( - 'x-oss-request-id' => '1a2b-3c4d' - ); - - $errorBody = <<< BBBB - - - NoSuchBucket - The specified bucket does not exist. - 566B870D207FB3044302EB0A - hello.oss-test.aliyun-inc.com - hello - -BBBB; - $response = new ResponseCore($errorHeader, $errorBody, 403); - try { - new ListBucketsResult($response); - } catch (OssException $e) { - $this->assertEquals( - $e->getMessage(), - 'NoSuchBucket: The specified bucket does not exist. RequestId: 1a2b-3c4d'); - $this->assertEquals($e->getHTTPStatus(), '403'); - $this->assertEquals($e->getRequestId(), '1a2b-3c4d'); - $this->assertEquals($e->getErrorCode(), 'NoSuchBucket'); - $this->assertEquals($e->getErrorMessage(), 'The specified bucket does not exist.'); - $this->assertEquals($e->getDetails(), $errorBody); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListMultipartUploadResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListMultipartUploadResultTest.php deleted file mode 100644 index 5c757d31..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListMultipartUploadResultTest.php +++ /dev/null @@ -1,114 +0,0 @@ - - - oss-example - xx - 3 - oss.avi - 0004B99B8E707874FC2D692FA5D77D3F - x - xx - 1000 - false - - multipart.data - 0004B999EF518A1FE585B0C9360DC4C8 - 2012-02-23T04:18:23.000Z - - - multipart.data - 0004B999EF5A239BB9138C6227D69F95 - 2012-02-23T04:18:23.000Z - - - oss.avi - 0004B99B8E707874FC2D692FA5D77D3F - 2012-02-23T06:14:27.000Z - - -BBBB; - - private $validXmlWithEncodedKey = << - - oss-example - url - php%2Bkey-marker - 3 - php%2Bnext-key-marker - 0004B99B8E707874FC2D692FA5D77D3F - %2F - php%2Bprefix - 1000 - true - - php%2Bkey-1 - 0004B999EF518A1FE585B0C9360DC4C8 - 2012-02-23T04:18:23.000Z - - - php%2Bkey-2 - 0004B999EF5A239BB9138C6227D69F95 - 2012-02-23T04:18:23.000Z - - - php%2Bkey-3 - 0004B99B8E707874FC2D692FA5D77D3F - 2012-02-23T06:14:27.000Z - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new ListMultipartUploadResult($response); - $listMultipartUploadInfo = $result->getData(); - $this->assertEquals("oss-example", $listMultipartUploadInfo->getBucket()); - $this->assertEquals("xx", $listMultipartUploadInfo->getKeyMarker()); - $this->assertEquals(3, $listMultipartUploadInfo->getUploadIdMarker()); - $this->assertEquals("oss.avi", $listMultipartUploadInfo->getNextKeyMarker()); - $this->assertEquals("0004B99B8E707874FC2D692FA5D77D3F", $listMultipartUploadInfo->getNextUploadIdMarker()); - $this->assertEquals("x", $listMultipartUploadInfo->getDelimiter()); - $this->assertEquals("xx", $listMultipartUploadInfo->getPrefix()); - $this->assertEquals(1000, $listMultipartUploadInfo->getMaxUploads()); - $this->assertEquals("false", $listMultipartUploadInfo->getIsTruncated()); - $uploads = $listMultipartUploadInfo->getUploads(); - $this->assertEquals("multipart.data", $uploads[0]->getKey()); - $this->assertEquals("0004B999EF518A1FE585B0C9360DC4C8", $uploads[0]->getUploadId()); - $this->assertEquals("2012-02-23T04:18:23.000Z", $uploads[0]->getInitiated()); - } - - public function testParseValidXmlWithEncodedKey() - { - $response = new ResponseCore(array(), $this->validXmlWithEncodedKey, 200); - $result = new ListMultipartUploadResult($response); - $listMultipartUploadInfo = $result->getData(); - $this->assertEquals("oss-example", $listMultipartUploadInfo->getBucket()); - $this->assertEquals("php+key-marker", $listMultipartUploadInfo->getKeyMarker()); - $this->assertEquals("php+next-key-marker", $listMultipartUploadInfo->getNextKeyMarker()); - $this->assertEquals(3, $listMultipartUploadInfo->getUploadIdMarker()); - $this->assertEquals("0004B99B8E707874FC2D692FA5D77D3F", $listMultipartUploadInfo->getNextUploadIdMarker()); - $this->assertEquals("/", $listMultipartUploadInfo->getDelimiter()); - $this->assertEquals("php+prefix", $listMultipartUploadInfo->getPrefix()); - $this->assertEquals(1000, $listMultipartUploadInfo->getMaxUploads()); - $this->assertEquals("true", $listMultipartUploadInfo->getIsTruncated()); - $uploads = $listMultipartUploadInfo->getUploads(); - $this->assertEquals("php+key-1", $uploads[0]->getKey()); - $this->assertEquals("0004B999EF518A1FE585B0C9360DC4C8", $uploads[0]->getUploadId()); - $this->assertEquals("2012-02-23T04:18:23.000Z", $uploads[0]->getInitiated()); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListObjectsResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListObjectsResultTest.php deleted file mode 100644 index 85f262ca..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListObjectsResultTest.php +++ /dev/null @@ -1,151 +0,0 @@ - - - testbucket-hf - - - 1000 - / - false - - oss-php-sdk-test/ - - - test/ - - -BBBB; - - private $validXml2 = << - - testbucket-hf - oss-php-sdk-test/ - xx - 1000 - / - false - - oss-php-sdk-test/upload-test-object-name.txt - 2015-11-18T03:36:00.000Z - "89B9E567E7EB8815F2F7D41851F9A2CD" - Normal - 13115 - Standard - - cname_user - cname_user - - - -BBBB; - - private $validXmlWithEncodedKey = << - - testbucket-hf - url - php%2Fprefix - php%2Fmarker - php%2Fnext-marker - 1000 - %2F - true - - php/a%2Bb - 2015-11-18T03:36:00.000Z - "89B9E567E7EB8815F2F7D41851F9A2CD" - Normal - 13115 - Standard - - cname_user - cname_user - - - -BBBB; - - public function testParseValidXml1() - { - $response = new ResponseCore(array(), $this->validXml1, 200); - $result = new ListObjectsResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $objectListInfo = $result->getData(); - $this->assertEquals(2, count($objectListInfo->getPrefixList())); - $this->assertEquals(0, count($objectListInfo->getObjectList())); - $this->assertEquals('testbucket-hf', $objectListInfo->getBucketName()); - $this->assertEquals('', $objectListInfo->getPrefix()); - $this->assertEquals('', $objectListInfo->getMarker()); - $this->assertEquals(1000, $objectListInfo->getMaxKeys()); - $this->assertEquals('/', $objectListInfo->getDelimiter()); - $this->assertEquals('false', $objectListInfo->getIsTruncated()); - $prefixes = $objectListInfo->getPrefixList(); - $this->assertEquals('oss-php-sdk-test/', $prefixes[0]->getPrefix()); - $this->assertEquals('test/', $prefixes[1]->getPrefix()); - } - - public function testParseValidXml2() - { - $response = new ResponseCore(array(), $this->validXml2, 200); - $result = new ListObjectsResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $objectListInfo = $result->getData(); - $this->assertEquals(0, count($objectListInfo->getPrefixList())); - $this->assertEquals(1, count($objectListInfo->getObjectList())); - $this->assertEquals('testbucket-hf', $objectListInfo->getBucketName()); - $this->assertEquals('oss-php-sdk-test/', $objectListInfo->getPrefix()); - $this->assertEquals('xx', $objectListInfo->getMarker()); - $this->assertEquals(1000, $objectListInfo->getMaxKeys()); - $this->assertEquals('/', $objectListInfo->getDelimiter()); - $this->assertEquals('false', $objectListInfo->getIsTruncated()); - $objects = $objectListInfo->getObjectList(); - $this->assertEquals('oss-php-sdk-test/upload-test-object-name.txt', $objects[0]->getKey()); - $this->assertEquals('2015-11-18T03:36:00.000Z', $objects[0]->getLastModified()); - $this->assertEquals('"89B9E567E7EB8815F2F7D41851F9A2CD"', $objects[0]->getETag()); - $this->assertEquals('Normal', $objects[0]->getType()); - $this->assertEquals(13115, $objects[0]->getSize()); - $this->assertEquals('Standard', $objects[0]->getStorageClass()); - } - - public function testParseValidXmlWithEncodedKey() - { - $response = new ResponseCore(array(), $this->validXmlWithEncodedKey, 200); - $result = new ListObjectsResult($response); - $this->assertTrue($result->isOK()); - $this->assertNotNull($result->getData()); - $this->assertNotNull($result->getRawResponse()); - $objectListInfo = $result->getData(); - $this->assertEquals(0, count($objectListInfo->getPrefixList())); - $this->assertEquals(1, count($objectListInfo->getObjectList())); - $this->assertEquals('testbucket-hf', $objectListInfo->getBucketName()); - $this->assertEquals('php/prefix', $objectListInfo->getPrefix()); - $this->assertEquals('php/marker', $objectListInfo->getMarker()); - $this->assertEquals('php/next-marker', $objectListInfo->getNextMarker()); - $this->assertEquals(1000, $objectListInfo->getMaxKeys()); - $this->assertEquals('/', $objectListInfo->getDelimiter()); - $this->assertEquals('true', $objectListInfo->getIsTruncated()); - $objects = $objectListInfo->getObjectList(); - $this->assertEquals('php/a+b', $objects[0]->getKey()); - $this->assertEquals('2015-11-18T03:36:00.000Z', $objects[0]->getLastModified()); - $this->assertEquals('"89B9E567E7EB8815F2F7D41851F9A2CD"', $objects[0]->getETag()); - $this->assertEquals('Normal', $objects[0]->getType()); - $this->assertEquals(13115, $objects[0]->getSize()); - $this->assertEquals('Standard', $objects[0]->getStorageClass()); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListPartsResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListPartsResultTest.php deleted file mode 100644 index c446714f..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListPartsResultTest.php +++ /dev/null @@ -1,62 +0,0 @@ - - - multipart_upload - multipart.data - 0004B999EF5A239BB9138C6227D69F95 - 5 - 1000 - false - - 1 - 2012-02-23T07:01:34.000Z - "3349DC700140D7F86A078484278075A9" - 6291456 - - - 2 - 2012-02-23T07:01:12.000Z - "3349DC700140D7F86A078484278075A9" - 6291456 - - - 5 - 2012-02-23T07:02:03.000Z - "7265F4D211B56873A381D321F586E4A9" - 1024 - - -BBBB; - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new ListPartsResult($response); - $listPartsInfo = $result->getData(); - $this->assertEquals("multipart_upload", $listPartsInfo->getBucket()); - $this->assertEquals("multipart.data", $listPartsInfo->getKey()); - $this->assertEquals("0004B999EF5A239BB9138C6227D69F95", $listPartsInfo->getUploadId()); - $this->assertEquals(5, $listPartsInfo->getNextPartNumberMarker()); - $this->assertEquals(1000, $listPartsInfo->getMaxParts()); - $this->assertEquals("false", $listPartsInfo->getIsTruncated()); - $this->assertEquals(3, count($listPartsInfo->getListPart())); - $parts = $listPartsInfo->getListPart(); - $this->assertEquals(1, $parts[0]->getPartNumber()); - $this->assertEquals('2012-02-23T07:01:34.000Z', $parts[0]->getLastModified()); - $this->assertEquals('"3349DC700140D7F86A078484278075A9"', $parts[0]->getETag()); - $this->assertEquals(6291456, $parts[0]->getSize()); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LiveChannelXmlTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LiveChannelXmlTest.php deleted file mode 100644 index cc3e2199..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LiveChannelXmlTest.php +++ /dev/null @@ -1,249 +0,0 @@ - - - xxx - enabled - - hls - 1000 - 5 - hello.m3u8 - - -BBBB; - - private $info = << - - live-1 - xxx - - rtmp://bucket.oss-cn-hangzhou.aliyuncs.com/live/213443245345 - - - http://bucket.oss-cn-hangzhou.aliyuncs.com/213443245345/播放列表.m3u8 - - enabled - 2015-11-24T14:25:31.000Z - -BBBB; - - private $list = << - -xxx - yyy - 100 - false - 121312132 - - 12123214323431 - xxx - - rtmp://bucket.oss-cn-hangzhou.aliyuncs.com/live/1 - - - http://bucket.oss-cn-hangzhou.aliyuncs.com/1/播放列表.m3u8 - - enabled - 2015-11-24T14:25:31.000Z - - - 432423432423 - yyy - - rtmp://bucket.oss-cn-hangzhou.aliyuncs.com/live/2 - - - http://bucket.oss-cn-hangzhou.aliyuncs.com/2/播放列表.m3u8 - - enabled - 2016-11-24T14:25:31.000Z - - -BBBB; - - private $status = << - - Live - 2016-10-20T14:25:31.000Z - 10.1.2.4:47745 - - - -BBBB; - - private $history = << - - - 2013-11-24T14:25:31.000Z - 2013-11-24T15:25:31.000Z - 10.101.194.148:56861 - - - 2014-11-24T14:25:31.000Z - 2014-11-24T15:25:31.000Z - 10.101.194.148:56862 - - - 2015-11-24T14:25:31.000Z - 2015-11-24T15:25:31.000Z - 10.101.194.148:56863 - - -BBBB; - - public function testLiveChannelStatus() - { - $stat = new GetLiveChannelStatus(); - $stat->parseFromXml($this->status); - - $this->assertEquals('Live', $stat->getStatus()); - $this->assertEquals('2016-10-20T14:25:31.000Z', $stat->getConnectedTime()); - $this->assertEquals('10.1.2.4:47745', $stat->getRemoteAddr()); - - $this->assertEquals(1280, $stat->getVideoWidth()); - $this->assertEquals(536, $stat->getVideoHeight()); - $this->assertEquals(24, $stat->getVideoFrameRate()); - $this->assertEquals(72513, $stat->getVideoBandwidth()); - $this->assertEquals('H264', $stat->getVideoCodec()); - $this->assertEquals(6519, $stat->getAudioBandwidth()); - $this->assertEquals(44100, $stat->getAudioSampleRate()); - $this->assertEquals('AAC', $stat->getAudioCodec()); - - } - - public function testLiveChannelHistory() - { - $history = new GetLiveChannelHistory(); - $history->parseFromXml($this->history); - - $recordList = $history->getLiveRecordList(); - $this->assertEquals(3, count($recordList)); - - $list0 = $recordList[0]; - $this->assertEquals('2013-11-24T14:25:31.000Z', $list0->getStartTime()); - $this->assertEquals('2013-11-24T15:25:31.000Z', $list0->getEndTime()); - $this->assertEquals('10.101.194.148:56861', $list0->getRemoteAddr()); - - $list1 = $recordList[1]; - $this->assertEquals('2014-11-24T14:25:31.000Z', $list1->getStartTime()); - $this->assertEquals('2014-11-24T15:25:31.000Z', $list1->getEndTime()); - $this->assertEquals('10.101.194.148:56862', $list1->getRemoteAddr()); - - $list2 = $recordList[2]; - $this->assertEquals('2015-11-24T14:25:31.000Z', $list2->getStartTime()); - $this->assertEquals('2015-11-24T15:25:31.000Z', $list2->getEndTime()); - $this->assertEquals('10.101.194.148:56863', $list2->getRemoteAddr()); - - } - - public function testLiveChannelConfig() - { - $config = new LiveChannelConfig(array('name' => 'live-1')); - $config->parseFromXml($this->config); - - $this->assertEquals('xxx', $config->getDescription()); - $this->assertEquals('enabled', $config->getStatus()); - $this->assertEquals('hls', $config->getType()); - $this->assertEquals(1000, $config->getFragDuration()); - $this->assertEquals(5, $config->getFragCount()); - $this->assertEquals('hello.m3u8', $config->getPlayListName()); - - $xml = $config->serializeToXml(); - $config2 = new LiveChannelConfig(array('name' => 'live-2')); - $config2->parseFromXml($xml); - $this->assertEquals('xxx', $config2->getDescription()); - $this->assertEquals('enabled', $config2->getStatus()); - $this->assertEquals('hls', $config2->getType()); - $this->assertEquals(1000, $config2->getFragDuration()); - $this->assertEquals(5, $config2->getFragCount()); - $this->assertEquals('hello.m3u8', $config2->getPlayListName()); - } - - public function testLiveChannelInfo() - { - $info = new LiveChannelInfo(array('name' => 'live-1')); - $info->parseFromXml($this->info); - - $this->assertEquals('live-1', $info->getName()); - $this->assertEquals('xxx', $info->getDescription()); - $this->assertEquals('enabled', $info->getStatus()); - $this->assertEquals('2015-11-24T14:25:31.000Z', $info->getLastModified()); - $pubs = $info->getPublishUrls(); - $this->assertEquals(1, count($pubs)); - $this->assertEquals('rtmp://bucket.oss-cn-hangzhou.aliyuncs.com/live/213443245345', $pubs[0]); - - $plays = $info->getPlayUrls(); - $this->assertEquals(1, count($plays)); - $this->assertEquals('http://bucket.oss-cn-hangzhou.aliyuncs.com/213443245345/播放列表.m3u8', $plays[0]); - } - - public function testLiveChannelList() - { - $list = new LiveChannelListInfo(); - $list->parseFromXml($this->list); - - $this->assertEquals('xxx', $list->getPrefix()); - $this->assertEquals('yyy', $list->getMarker()); - $this->assertEquals(100, $list->getMaxKeys()); - $this->assertEquals(false, $list->getIsTruncated()); - $this->assertEquals('121312132', $list->getNextMarker()); - - $channels = $list->getChannelList(); - $this->assertEquals(2, count($channels)); - - $chan1 = $channels[0]; - $this->assertEquals('12123214323431', $chan1->getName()); - $this->assertEquals('xxx', $chan1->getDescription()); - $this->assertEquals('enabled', $chan1->getStatus()); - $this->assertEquals('2015-11-24T14:25:31.000Z', $chan1->getLastModified()); - $pubs = $chan1->getPublishUrls(); - $this->assertEquals(1, count($pubs)); - $this->assertEquals('rtmp://bucket.oss-cn-hangzhou.aliyuncs.com/live/1', $pubs[0]); - - $plays = $chan1->getPlayUrls(); - $this->assertEquals(1, count($plays)); - $this->assertEquals('http://bucket.oss-cn-hangzhou.aliyuncs.com/1/播放列表.m3u8', $plays[0]); - - $chan2 = $channels[1]; - $this->assertEquals('432423432423', $chan2->getName()); - $this->assertEquals('yyy', $chan2->getDescription()); - $this->assertEquals('enabled', $chan2->getStatus()); - $this->assertEquals('2016-11-24T14:25:31.000Z', $chan2->getLastModified()); - $pubs = $chan2->getPublishUrls(); - $this->assertEquals(1, count($pubs)); - $this->assertEquals('rtmp://bucket.oss-cn-hangzhou.aliyuncs.com/live/2', $pubs[0]); - - $plays = $chan2->getPlayUrls(); - $this->assertEquals(1, count($plays)); - $this->assertEquals('http://bucket.oss-cn-hangzhou.aliyuncs.com/2/播放列表.m3u8', $plays[0]); - } - -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LoggingConfigTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LoggingConfigTest.php deleted file mode 100644 index 01496bb8..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/LoggingConfigTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - - -TargetBucket -TargetPrefix - - -BBBB; - - private $nullXml = << - -BBBB; - - public function testParseValidXml() - { - $loggingConfig = new LoggingConfig(); - $loggingConfig->parseFromXml($this->validXml); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml(strval($loggingConfig))); - } - - public function testConstruct() - { - $loggingConfig = new LoggingConfig('TargetBucket', 'TargetPrefix'); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($loggingConfig->serializeToXml())); - } - - public function testFailedConstruct() - { - $loggingConfig = new LoggingConfig('TargetBucket', null); - $this->assertEquals($this->cleanXml($this->nullXml), $this->cleanXml($loggingConfig->serializeToXml())); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/MimeTypesTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/MimeTypesTest.php deleted file mode 100644 index 0697409e..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/MimeTypesTest.php +++ /dev/null @@ -1,13 +0,0 @@ -assertEquals('application/xml', MimeTypes::getMimetype('file.xml')); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ObjectAclTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ObjectAclTest.php deleted file mode 100644 index d3972881..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ObjectAclTest.php +++ /dev/null @@ -1,28 +0,0 @@ -deleteObject($bucket, $object); - $client->putObject($bucket, $object, "hello world"); - - $acl = $client->getObjectAcl($bucket, $object); - $this->assertEquals('default', $acl); - - $client->putObjectAcl($bucket, $object, 'public-read'); - $acl = $client->getObjectAcl($bucket, $object); - $this->assertEquals('public-read', $acl); - - $content = $client->getObject($bucket, $object); - $this->assertEquals('hello world', $content); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketCorsTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketCorsTest.php deleted file mode 100644 index a32154b5..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketCorsTest.php +++ /dev/null @@ -1,84 +0,0 @@ -addAllowedHeader("x-oss-test"); - $rule->addAllowedHeader("x-oss-test2"); - $rule->addAllowedHeader("x-oss-test2"); - $rule->addAllowedHeader("x-oss-test3"); - $rule->addAllowedOrigin("http://www.b.com"); - $rule->addAllowedOrigin("http://www.a.com"); - $rule->addAllowedOrigin("http://www.a.com"); - $rule->addAllowedMethod("GET"); - $rule->addAllowedMethod("PUT"); - $rule->addAllowedMethod("POST"); - $rule->addExposeHeader("x-oss-test1"); - $rule->addExposeHeader("x-oss-test1"); - $rule->addExposeHeader("x-oss-test2"); - $rule->setMaxAgeSeconds(10); - $corsConfig->addRule($rule); - $rule = new CorsRule(); - $rule->addAllowedHeader("x-oss-test"); - $rule->addAllowedMethod("GET"); - $rule->addAllowedOrigin("http://www.b.com"); - $rule->addExposeHeader("x-oss-test1"); - $rule->setMaxAgeSeconds(110); - $corsConfig->addRule($rule); - - try { - $this->ossClient->putBucketCors($this->bucket, $corsConfig); - } catch (OssException $e) { - $this->assertFalse(True); - } - - try { - Common::waitMetaSync(); - $object = "cors/test.txt"; - $this->ossClient->putObject($this->bucket, $object, file_get_contents(__FILE__)); - $headers = $this->ossClient->optionsObject($this->bucket, $object, "http://www.a.com", "GET", "", null); - $this->assertNotEmpty($headers); - } catch (OssException $e) { - var_dump($e->getMessage()); - } - - try { - Common::waitMetaSync(); - $corsConfig2 = $this->ossClient->getBucketCors($this->bucket); - $this->assertNotNull($corsConfig2); - $this->assertEquals($corsConfig->serializeToXml(), $corsConfig2->serializeToXml()); - } catch (OssException $e) { - $this->assertFalse(True); - } - - try { - Common::waitMetaSync(); - $this->ossClient->deleteBucketCors($this->bucket); - } catch (OssException $e) { - $this->assertFalse(True); - } - - try { - Common::waitMetaSync(); - $corsConfig3 = $this->ossClient->getBucketCors($this->bucket); - $this->assertNotNull($corsConfig3); - $this->assertNotEquals($corsConfig->serializeToXml(), $corsConfig3->serializeToXml()); - } catch (OssException $e) { - $this->assertFalse(True); - } - - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketLifecycleTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketLifecycleTest.php deleted file mode 100644 index 46da1f06..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketLifecycleTest.php +++ /dev/null @@ -1,57 +0,0 @@ -addRule($lifecycleRule); - $actions = array(); - $actions[] = new LifecycleAction("Expiration", "Date", '2022-10-12T00:00:00.000Z'); - $lifecycleRule = new LifecycleRule("delete temporary files", "temporary/", "Enabled", $actions); - $lifecycleConfig->addRule($lifecycleRule); - - try { - $this->ossClient->putBucketLifecycle($this->bucket, $lifecycleConfig); - } catch (OssException $e) { - $this->assertTrue(false); - } - - try { - Common::waitMetaSync(); - $lifecycleConfig2 = $this->ossClient->getBucketLifecycle($this->bucket); - $this->assertEquals($lifecycleConfig->serializeToXml(), $lifecycleConfig2->serializeToXml()); - } catch (OssException $e) { - $this->assertTrue(false); - } - - try { - Common::waitMetaSync(); - $this->ossClient->deleteBucketLifecycle($this->bucket); - } catch (OssException $e) { - $this->assertTrue(false); - } - - try { - Common::waitMetaSync(); - $lifecycleConfig3 = $this->ossClient->getBucketLifecycle($this->bucket); - $this->assertNotEquals($lifecycleConfig->serializeToXml(), $lifecycleConfig3->serializeToXml()); - } catch (OssException $e) { - $this->assertTrue(false); - } - - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketLoggingTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketLoggingTest.php deleted file mode 100644 index 16a10ebf..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketLoggingTest.php +++ /dev/null @@ -1,43 +0,0 @@ -bucket, 'prefix'); - try { - $this->ossClient->putBucketLogging($this->bucket, $this->bucket, 'prefix'); - } catch (OssException $e) { - var_dump($e->getMessage()); - $this->assertTrue(false); - } - try { - Common::waitMetaSync(); - $loggingConfig2 = $this->ossClient->getBucketLogging($this->bucket); - $this->assertEquals($loggingConfig->serializeToXml(), $loggingConfig2->serializeToXml()); - } catch (OssException $e) { - $this->assertTrue(false); - } - try { - Common::waitMetaSync(); - $this->ossClient->deleteBucketLogging($this->bucket); - } catch (OssException $e) { - $this->assertTrue(false); - } - try { - Common::waitMetaSync(); - $loggingConfig3 = $this->ossClient->getBucketLogging($this->bucket); - $this->assertNotEquals($loggingConfig->serializeToXml(), $loggingConfig3->serializeToXml()); - } catch (OssException $e) { - $this->assertTrue(false); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketRefererTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketRefererTest.php deleted file mode 100644 index ba7d14f5..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketRefererTest.php +++ /dev/null @@ -1,48 +0,0 @@ -addReferer('http://www.aliyun.com'); - - try { - $this->ossClient->putBucketReferer($this->bucket, $refererConfig); - } catch (OssException $e) { - var_dump($e->getMessage()); - $this->assertTrue(false); - } - try { - Common::waitMetaSync(); - $refererConfig2 = $this->ossClient->getBucketReferer($this->bucket); - $this->assertEquals($refererConfig->serializeToXml(), $refererConfig2->serializeToXml()); - } catch (OssException $e) { - $this->assertTrue(false); - } - try { - Common::waitMetaSync(); - $nullRefererConfig = new RefererConfig(); - $nullRefererConfig->setAllowEmptyReferer(false); - $this->ossClient->putBucketReferer($this->bucket, $nullRefererConfig); - } catch (OssException $e) { - $this->assertTrue(false); - } - try { - Common::waitMetaSync(); - $refererConfig3 = $this->ossClient->getBucketLogging($this->bucket); - $this->assertNotEquals($refererConfig->serializeToXml(), $refererConfig3->serializeToXml()); - } catch (OssException $e) { - $this->assertTrue(false); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketStorageCapacityTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketStorageCapacityTest.php deleted file mode 100644 index 87548f97..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketStorageCapacityTest.php +++ /dev/null @@ -1,56 +0,0 @@ -ossClient->getBucketStorageCapacity($this->bucket); - $this->assertEquals($storageCapacity, -1); - } catch (OssException $e) { - $this->assertTrue(false); - } - - try { - $this->ossClient->putBucketStorageCapacity($this->bucket, 1000); - } catch (OssException $e) { - $this->assertTrue(false); - } - - try { - Common::waitMetaSync(); - $storageCapacity = $this->ossClient->getBucketStorageCapacity($this->bucket); - $this->assertEquals($storageCapacity, 1000); - } catch (OssException $e) { - $this->assertTrue(false); - } - - try { - $this->ossClient->putBucketStorageCapacity($this->bucket, 0); - - Common::waitMetaSync(); - - $storageCapacity = $this->ossClient->getBucketStorageCapacity($this->bucket); - $this->assertEquals($storageCapacity, 0); - - $this->ossClient->putObject($this->bucket, 'test-storage-capacity','test-content'); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals('Bucket storage exceed max storage capacity.',$e->getErrorMessage()); - } - - try { - $this->ossClient->putBucketStorageCapacity($this->bucket, -2); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals(400, $e->getHTTPStatus()); - $this->assertEquals('InvalidArgument', $e->getErrorCode()); - } - } - -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketTest.php deleted file mode 100644 index f207ca1a..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketTest.php +++ /dev/null @@ -1,113 +0,0 @@ -ossClient->createBucket("s"); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('"s"bucket name is invalid', $e->getMessage()); - } - } - - public function testBucketWithInvalidACL() - { - try { - $this->ossClient->createBucket($this->bucket, "invalid"); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('invalid:acl is invalid(private,public-read,public-read-write)', $e->getMessage()); - } - } - - public function testBucket() - { - $this->ossClient->createBucket($this->bucket, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE); - - $bucketListInfo = $this->ossClient->listBuckets(); - $this->assertNotNull($bucketListInfo); - - $bucketList = $bucketListInfo->getBucketList(); - $this->assertTrue(is_array($bucketList)); - $this->assertGreaterThan(0, count($bucketList)); - - $this->ossClient->putBucketAcl($this->bucket, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE); - Common::waitMetaSync(); - $this->assertEquals($this->ossClient->getBucketAcl($this->bucket), OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE); - - $this->assertTrue($this->ossClient->doesBucketExist($this->bucket)); - $this->assertFalse($this->ossClient->doesBucketExist($this->bucket . '-notexist')); - - $this->assertEquals($this->ossClient->getBucketLocation($this->bucket), 'oss-us-west-1'); - - $res = $this->ossClient->getBucketMeta($this->bucket); - $this->assertEquals('200', $res['info']['http_code']); - $this->assertEquals('oss-us-west-1', $res['x-oss-bucket-region']); - } - - public function testCreateBucketWithStorageType() - { - $object = 'storage-object'; - - $this->ossClient->putObject($this->archiveBucket, $object,'testcontent'); - try { - $this->ossClient->getObject($this->archiveBucket, $object); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals('403', $e->getHTTPStatus()); - $this->assertEquals('InvalidObjectState', $e->getErrorCode()); - } - - $this->ossClient->putObject($this->iaBucket, $object,'testcontent'); - $result = $this->ossClient->getObject($this->iaBucket, $object); - $this->assertEquals($result, 'testcontent'); - - $this->ossClient->putObject($this->bucket, $object,'testcontent'); - $result = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($result, 'testcontent'); - } - - public function setUp() - { - parent::setUp(); - - $this->iaBucket = 'ia-' . $this->bucket; - $this->archiveBucket = 'archive-' . $this->bucket; - $options = array( - OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_IA - ); - - $this->ossClient->createBucket($this->iaBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options); - - $options = array( - OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_ARCHIVE - ); - - $this->ossClient->createBucket($this->archiveBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options); - } - - public function tearDown() - { - parent::tearDown(); - - $object = 'storage-object'; - - $this->ossClient->deleteObject($this->iaBucket, $object); - $this->ossClient->deleteObject($this->archiveBucket, $object); - $this->ossClient->deleteBucket($this->iaBucket); - $this->ossClient->deleteBucket($this->archiveBucket); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketWebsiteTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketWebsiteTest.php deleted file mode 100644 index dfa9cc17..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketWebsiteTest.php +++ /dev/null @@ -1,46 +0,0 @@ -ossClient->putBucketWebsite($this->bucket, $websiteConfig); - } catch (OssException $e) { - var_dump($e->getMessage()); - $this->assertTrue(false); - } - - try { - Common::waitMetaSync(); - $websiteConfig2 = $this->ossClient->getBucketWebsite($this->bucket); - $this->assertEquals($websiteConfig->serializeToXml(), $websiteConfig2->serializeToXml()); - } catch (OssException $e) { - $this->assertTrue(false); - } - try { - Common::waitMetaSync(); - $this->ossClient->deleteBucketWebsite($this->bucket); - } catch (OssException $e) { - $this->assertTrue(false); - } - try { - Common::waitMetaSync(); - $websiteConfig3 = $this->ossClient->getBucketLogging($this->bucket); - $this->assertNotEquals($websiteConfig->serializeToXml(), $websiteConfig3->serializeToXml()); - } catch (OssException $e) { - $this->assertTrue(false); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientImageTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientImageTest.php deleted file mode 100644 index df8bd6c2..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientImageTest.php +++ /dev/null @@ -1,100 +0,0 @@ -client = Common::getOssClient(); - $this->bucketName = 'php-sdk-test-bucket-image-' . strval(rand(0, 10000)); - $this->client->createBucket($this->bucketName); - Common::waitMetaSync(); - $this->local_file = "example.jpg"; - $this->object = "oss-example.jpg"; - $this->download_file = "image.jpg"; - - $this->client->uploadFile($this->bucketName, $this->object, $this->local_file); - } - - public function tearDown() - { - $this->client->deleteObject($this->bucketName, $this->object); - $this->client->deleteBucket($this->bucketName); - } - - public function testImageResize() - { - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $this->download_file, - OssClient::OSS_PROCESS => "image/resize,m_fixed,h_100,w_100", ); - $this->check($options, 100, 100, 3267, 'jpg'); - } - - public function testImageCrop() - { - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $this->download_file, - OssClient::OSS_PROCESS => "image/crop,w_100,h_100,x_100,y_100,r_1", ); - $this->check($options, 100, 100, 1969, 'jpg'); - } - - public function testImageRotate() - { - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $this->download_file, - OssClient::OSS_PROCESS => "image/rotate,90", ); - $this->check($options, 267, 400, 20998, 'jpg'); - } - - public function testImageSharpen() - { - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $this->download_file, - OssClient::OSS_PROCESS => "image/sharpen,100", ); - $this->check($options, 400, 267, 23015, 'jpg'); - } - - public function testImageWatermark() - { - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $this->download_file, - OssClient::OSS_PROCESS => "image/watermark,text_SGVsbG8g5Zu-54mH5pyN5YqhIQ", ); - $this->check($options, 400, 267, 26369, 'jpg'); - } - - public function testImageFormat() - { - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $this->download_file, - OssClient::OSS_PROCESS => "image/format,png", ); - $this->check($options, 400, 267, 160733, 'png'); - } - - public function testImageTofile() - { - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $this->download_file, - OssClient::OSS_PROCESS => "image/resize,m_fixed,w_100,h_100", ); - $this->check($options, 100, 100, 3267, 'jpg'); - } - - private function check($options, $width, $height, $size, $type) - { - $this->client->getObject($this->bucketName, $this->object, $options); - $array = getimagesize($this->download_file); - $this->assertEquals($width, $array[0]); - $this->assertEquals($height, $array[1]); - $this->assertEquals($type === 'jpg' ? 2 : 3, $array[2]);//2 <=> jpg - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientMultipartUploadTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientMultipartUploadTest.php deleted file mode 100644 index a95f412d..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientMultipartUploadTest.php +++ /dev/null @@ -1,313 +0,0 @@ -ossClient->uploadDir($this->bucket, "", "abc/ds/s/s/notexitst"); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals("parameter error: abc/ds/s/s/notexitst is not a directory, please check it", $e->getMessage()); - } - - } - - public function testMultipartUploadBigFile() - { - $bigFileName = __DIR__ . DIRECTORY_SEPARATOR . "/bigfile.tmp"; - $localFilename = __DIR__ . DIRECTORY_SEPARATOR . "/localfile.tmp"; - OssUtil::generateFile($bigFileName, 6 * 1024 * 1024); - $object = 'mpu/multipart-bigfile-test.tmp'; - try { - $this->ossClient->multiuploadFile($this->bucket, $object, $bigFileName, array(OssClient::OSS_PART_SIZE => 1)); - $options = array(OssClient::OSS_FILE_DOWNLOAD => $localFilename); - $this->ossClient->getObject($this->bucket, $object, $options); - $this->assertEquals(md5_file($bigFileName), md5_file($localFilename)); - } catch (OssException $e) { - var_dump($e->getMessage()); - $this->assertFalse(true); - } - unlink($bigFileName); - unlink($localFilename); - } - - public function testMultipartUploadBigFileWithMD5Check() - { - $bigFileName = __DIR__ . DIRECTORY_SEPARATOR . "/bigfile.tmp"; - $localFilename = __DIR__ . DIRECTORY_SEPARATOR . "/localfile.tmp"; - OssUtil::generateFile($bigFileName, 6 * 1024 * 1024); - $object = 'mpu/multipart-bigfile-test.tmp'; - $options = array( - OssClient::OSS_CHECK_MD5 => true, - OssClient::OSS_PART_SIZE => 1, - ); - try { - $this->ossClient->multiuploadFile($this->bucket, $object, $bigFileName, $options); - $options = array(OssClient::OSS_FILE_DOWNLOAD => $localFilename); - $this->ossClient->getObject($this->bucket, $object, $options); - $this->assertEquals(md5_file($bigFileName), md5_file($localFilename)); - } catch (OssException $e) { - var_dump($e->getMessage()); - $this->assertFalse(true); - } - unlink($bigFileName); - unlink($localFilename); - } - - public function testCopyPart() - { - $object = "mpu/multipart-test.txt"; - $copiedObject = "mpu/multipart-test.txt.copied"; - $this->ossClient->putObject($this->bucket, $copiedObject, file_get_contents(__FILE__)); - /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id - */ - try { - $upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - /* - * step 2. uploadPartCopy - */ - $copyId = 1; - $eTag = $this->ossClient->uploadPartCopy($this->bucket, $copiedObject, $this->bucket, $object, $copyId, $upload_id); - $upload_parts[] = array( - 'PartNumber' => $copyId, - 'ETag' => $eTag, - ); - - try { - $listPartsInfo = $this->ossClient->listParts($this->bucket, $object, $upload_id); - $this->assertNotNull($listPartsInfo); - } catch (OssException $e) { - $this->assertTrue(false); - } - - /** - * step 3. - */ - try { - $this->ossClient->completeMultipartUpload($this->bucket, $object, $upload_id, $upload_parts); - } catch (OssException $e) { - var_dump($e->getMessage()); - $this->assertTrue(false); - } - - $this->assertEquals($this->ossClient->getObject($this->bucket, $object), file_get_contents(__FILE__)); - $this->assertEquals($this->ossClient->getObject($this->bucket, $copiedObject), file_get_contents(__FILE__)); - } - - public function testAbortMultipartUpload() - { - $object = "mpu/multipart-test.txt"; - /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id - */ - try { - $upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - /* - * step 2. 上传分片 - */ - $part_size = 10 * 1024 * 1024; - $upload_file = __FILE__; - $upload_filesize = filesize($upload_file); - $pieces = $this->ossClient->generateMultiuploadParts($upload_filesize, $part_size); - $response_upload_part = array(); - $upload_position = 0; - $is_check_md5 = true; - foreach ($pieces as $i => $piece) { - $from_pos = $upload_position + (integer)$piece[OssClient::OSS_SEEK_TO]; - $to_pos = (integer)$piece[OssClient::OSS_LENGTH] + $from_pos - 1; - $up_options = array( - OssClient::OSS_FILE_UPLOAD => $upload_file, - OssClient::OSS_PART_NUM => ($i + 1), - OssClient::OSS_SEEK_TO => $from_pos, - OssClient::OSS_LENGTH => $to_pos - $from_pos + 1, - OssClient::OSS_CHECK_MD5 => $is_check_md5, - ); - if ($is_check_md5) { - $content_md5 = OssUtil::getMd5SumForFile($upload_file, $from_pos, $to_pos); - $up_options[OssClient::OSS_CONTENT_MD5] = $content_md5; - } - //2. 将每一分片上传到OSS - try { - $response_upload_part[] = $this->ossClient->uploadPart($this->bucket, $object, $upload_id, $up_options); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - $upload_parts = array(); - foreach ($response_upload_part as $i => $eTag) { - $upload_parts[] = array( - 'PartNumber' => ($i + 1), - 'ETag' => $eTag, - ); - } - - try { - $listPartsInfo = $this->ossClient->listParts($this->bucket, $object, $upload_id); - $this->assertNotNull($listPartsInfo); - } catch (OssException $e) { - $this->assertTrue(false); - } - $this->assertEquals(1, count($listPartsInfo->getListPart())); - - $numOfMultipartUpload1 = 0; - $options = null; - try { - $listMultipartUploadInfo = $listMultipartUploadInfo = $this->ossClient->listMultipartUploads($this->bucket, $options); - $this->assertNotNull($listMultipartUploadInfo); - $numOfMultipartUpload1 = count($listMultipartUploadInfo->getUploads()); - } catch (OssException $e) { - $this->assertFalse(true); - } - - try { - $this->ossClient->abortMultipartUpload($this->bucket, $object, $upload_id); - } catch (OssException $e) { - $this->assertTrue(false); - } - - $numOfMultipartUpload2 = 0; - try { - $listMultipartUploadInfo = $listMultipartUploadInfo = $this->ossClient->listMultipartUploads($this->bucket, $options); - $this->assertNotNull($listMultipartUploadInfo); - $numOfMultipartUpload2 = count($listMultipartUploadInfo->getUploads()); - } catch (OssException $e) { - $this->assertFalse(true); - } - $this->assertEquals($numOfMultipartUpload1 - 1, $numOfMultipartUpload2); - } - - public function testPutObjectByRawApis() - { - $object = "mpu/multipart-test.txt"; - /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id - */ - try { - $upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - /* - * step 2. 上传分片 - */ - $part_size = 10 * 1024 * 1024; - $upload_file = __FILE__; - $upload_filesize = filesize($upload_file); - $pieces = $this->ossClient->generateMultiuploadParts($upload_filesize, $part_size); - $response_upload_part = array(); - $upload_position = 0; - $is_check_md5 = true; - foreach ($pieces as $i => $piece) { - $from_pos = $upload_position + (integer)$piece[OssClient::OSS_SEEK_TO]; - $to_pos = (integer)$piece[OssClient::OSS_LENGTH] + $from_pos - 1; - $up_options = array( - OssClient::OSS_FILE_UPLOAD => $upload_file, - OssClient::OSS_PART_NUM => ($i + 1), - OssClient::OSS_SEEK_TO => $from_pos, - OssClient::OSS_LENGTH => $to_pos - $from_pos + 1, - OssClient::OSS_CHECK_MD5 => $is_check_md5, - ); - if ($is_check_md5) { - $content_md5 = OssUtil::getMd5SumForFile($upload_file, $from_pos, $to_pos); - $up_options[OssClient::OSS_CONTENT_MD5] = $content_md5; - } - //2. 将每一分片上传到OSS - try { - $response_upload_part[] = $this->ossClient->uploadPart($this->bucket, $object, $upload_id, $up_options); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - $upload_parts = array(); - foreach ($response_upload_part as $i => $eTag) { - $upload_parts[] = array( - 'PartNumber' => ($i + 1), - 'ETag' => $eTag, - ); - } - - try { - $listPartsInfo = $this->ossClient->listParts($this->bucket, $object, $upload_id); - $this->assertNotNull($listPartsInfo); - } catch (OssException $e) { - $this->assertTrue(false); - } - - /** - * step 3. - */ - try { - $this->ossClient->completeMultipartUpload($this->bucket, $object, $upload_id, $upload_parts); - } catch (OssException $e) { - $this->assertTrue(false); - } - } - - function testPutObjectsByDir() - { - $localDirectory = dirname(__FILE__); - $prefix = "samples/codes"; - try { - $this->ossClient->uploadDir($this->bucket, $prefix, $localDirectory); - } catch (OssException $e) { - var_dump($e->getMessage()); - $this->assertFalse(true); - - } - $this->assertTrue($this->ossClient->doesObjectExist($this->bucket, 'samples/codes/' . "OssClientMultipartUploadTest.php")); - } - - public function testPutObjectByMultipartUpload() - { - $object = "mpu/multipart-test.txt"; - $file = __FILE__; - $options = array(); - - try { - $this->ossClient->multiuploadFile($this->bucket, $object, $file, $options); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testPutObjectByMultipartUploadWithMD5Check() - { - $object = "mpu/multipart-test.txt"; - $file = __FILE__; - $options = array(OssClient::OSS_CHECK_MD5 => true); - - try { - $this->ossClient->multiuploadFile($this->bucket, $object, $file, $options); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testListMultipartUploads() - { - $options = null; - try { - $listMultipartUploadInfo = $this->ossClient->listMultipartUploads($this->bucket, $options); - $this->assertNotNull($listMultipartUploadInfo); - } catch (OssException $e) { - $this->assertFalse(true); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTest.php deleted file mode 100644 index 34e3ded7..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTest.php +++ /dev/null @@ -1,588 +0,0 @@ -ossClient->getObjectMeta($this->bucket, $object); - $this->assertEquals('200', $res['info']['http_code']); - $this->assertEquals('text/plain', $res['content-type']); - $this->assertEquals('Accept-Encoding', $res['vary']); - $this->assertTrue(isset($res['content-length'])); - $this->assertFalse(isset($res['content-encoding'])); - } catch (OssException $e) { - $this->assertTrue(false); - } - - $options = array(OssClient::OSS_HEADERS => array(OssClient::OSS_ACCEPT_ENCODING => 'deflate, gzip')); - - try { - $res = $this->ossClient->getObjectMeta($this->bucket, $object, $options); - $this->assertEquals('200', $res['info']['http_code']); - $this->assertEquals('text/plain', $res['content-type']); - $this->assertEquals('Accept-Encoding', $res['vary']); - $this->assertFalse(isset($res['content-length'])); - $this->assertEquals('gzip', $res['content-encoding']); - } catch (OssException $e) { - $this->assertTrue(false); - } - } - - public function testGetObjectWithAcceptEncoding() - { - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - $options = array(OssClient::OSS_HEADERS => array(OssClient::OSS_ACCEPT_ENCODING => 'deflate, gzip')); - - try { - $res = $this->ossClient->getObject($this->bucket, $object, $options); - $this->assertEquals(file_get_contents(__FILE__), $res); - } catch (OssException $e) { - $this->assertTrue(false); - } - } - - public function testGetObjectWithHeader() - { - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - try { - $res = $this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_LAST_MODIFIED => "xx")); - $this->assertEquals(file_get_contents(__FILE__), $res); - } catch (OssException $e) { - $this->assertEquals('"/ilegal.txt" object name is invalid', $e->getMessage()); - } - } - - public function testGetObjectWithIleggalEtag() - { - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - try { - $res = $this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_ETAG => "xx")); - $this->assertEquals(file_get_contents(__FILE__), $res); - } catch (OssException $e) { - $this->assertEquals('"/ilegal.txt" object name is invalid', $e->getMessage()); - } - } - - public function testObject() - { - /** - * 上传本地变量到bucket - */ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - $content = file_get_contents(__FILE__); - $options = array( - OssClient::OSS_LENGTH => strlen($content), - OssClient::OSS_HEADERS => array( - 'Expires' => 'Fri, 28 Feb 2020 05:38:42 GMT', - 'Cache-Control' => 'no-cache', - 'Content-Disposition' => 'attachment;filename=oss_download.log', - 'Content-Encoding' => 'utf-8', - 'Content-Language' => 'zh-CN', - 'x-oss-server-side-encryption' => 'AES256', - 'x-oss-meta-self-define-title' => 'user define meta info', - ), - ); - - try { - $this->ossClient->putObject($this->bucket, $object, $content, $options); - } catch (OssException $e) { - $this->assertFalse(true); - } - - try { - $this->ossClient->putObject($this->bucket, $object, $content, $options); - } catch (OssException $e) { - $this->assertFalse(true); - } - - try { - $result = $this->ossClient->deleteObjects($this->bucket, "stringtype", $options); - $this->assertEquals('stringtype', $result[0]); - } catch (OssException $e) { - $this->assertEquals('objects must be array', $e->getMessage()); - } - - try { - $result = $this->ossClient->deleteObjects($this->bucket, "stringtype", $options); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('objects must be array', $e->getMessage()); - } - - try { - $this->ossClient->uploadFile($this->bucket, $object, "notexist.txt", $options); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('notexist.txt file does not exist', $e->getMessage()); - } - - /** - * getObject到本地变量,检查是否match - */ - try { - $content = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($content, file_get_contents(__FILE__)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * getObject的前五个字节 - */ - try { - $options = array(OssClient::OSS_RANGE => '0-4'); - $content = $this->ossClient->getObject($this->bucket, $object, $options); - $this->assertEquals($content, 'assertFalse(true); - } - - - /** - * 上传本地文件到object - */ - try { - $this->ossClient->uploadFile($this->bucket, $object, __FILE__); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 下载文件到本地变量,检查是否match - */ - try { - $content = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($content, file_get_contents(__FILE__)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 下载文件到本地文件 - */ - $localfile = "upload-test-object-name.txt"; - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $localfile, - ); - - try { - $this->ossClient->getObject($this->bucket, $object, $options); - } catch (OssException $e) { - $this->assertFalse(true); - } - $this->assertTrue(file_get_contents($localfile) === file_get_contents(__FILE__)); - if (file_exists($localfile)) { - unlink($localfile); - } - - /** - * 下载文件到本地文件 no such key - */ - $localfile = "upload-test-object-name-no-such-key.txt"; - $options = array( - OssClient::OSS_FILE_DOWNLOAD => $localfile, - ); - - try { - $this->ossClient->getObject($this->bucket, $object . "no-such-key", $options); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertTrue(true); - $this->assertFalse(file_exists($localfile)); - if (strpos($e, "The specified key does not exist") == false) - { - $this->assertTrue(true); - } - } - - /** - * 下载文件到内容 no such key - */ - try { - $result = $this->ossClient->getObject($this->bucket, $object . "no-such-key"); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertTrue(true); - if (strpos($e, "The specified key does not exist") == false) - { - $this->assertTrue(true); - } - } - - /** - * 复制object - */ - $to_bucket = $this->bucket; - $to_object = $object . '.copy'; - $options = array(); - try { - $result = $this->ossClient->copyObject($this->bucket, $object, $to_bucket, $to_object, $options); - $this->assertFalse(empty($result)); - $this->assertEquals(strlen("2016-11-21T03:46:58.000Z"), strlen($result[0])); - $this->assertEquals(strlen("\"5B3C1A2E053D763E1B002CC607C5A0FE\""), strlen($result[1])); - } catch (OssException $e) { - $this->assertFalse(true); - var_dump($e->getMessage()); - - } - - /** - * 检查复制的是否相同 - */ - try { - $content = $this->ossClient->getObject($this->bucket, $to_object); - $this->assertEquals($content, file_get_contents(__FILE__)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 列出bucket内的文件列表 - */ - $prefix = ''; - $delimiter = '/'; - $next_marker = ''; - $maxkeys = 1000; - $options = array( - 'delimiter' => $delimiter, - 'prefix' => $prefix, - 'max-keys' => $maxkeys, - 'marker' => $next_marker, - ); - - try { - $listObjectInfo = $this->ossClient->listObjects($this->bucket, $options); - $objectList = $listObjectInfo->getObjectList(); - $prefixList = $listObjectInfo->getPrefixList(); - $this->assertNotNull($objectList); - $this->assertNotNull($prefixList); - $this->assertTrue(is_array($objectList)); - $this->assertTrue(is_array($prefixList)); - - } catch (OssException $e) { - $this->assertTrue(false); - } - - /** - * 设置文件的meta信息 - */ - $from_bucket = $this->bucket; - $from_object = "oss-php-sdk-test/upload-test-object-name.txt"; - $to_bucket = $from_bucket; - $to_object = $from_object; - $copy_options = array( - OssClient::OSS_HEADERS => array( - 'Expires' => '2012-10-01 08:00:00', - 'Content-Disposition' => 'attachment; filename="xxxxxx"', - ), - ); - try { - $this->ossClient->copyObject($from_bucket, $from_object, $to_bucket, $to_object, $copy_options); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 获取文件的meta信息 - */ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - try { - $objectMeta = $this->ossClient->getObjectMeta($this->bucket, $object); - $this->assertEquals('attachment; filename="xxxxxx"', $objectMeta[strtolower('Content-Disposition')]); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 删除单个文件 - */ - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - - try { - $this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object)); - $this->ossClient->deleteObject($this->bucket, $object); - $this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 删除多个个文件 - */ - $object1 = "oss-php-sdk-test/upload-test-object-name.txt"; - $object2 = "oss-php-sdk-test/upload-test-object-name.txt.copy"; - $list = array($object1, $object2); - try { - $this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object2)); - - $result = $this->ossClient->deleteObjects($this->bucket, $list); - $this->assertEquals($list[1], $result[0]); - $this->assertEquals($list[0], $result[1]); - - $result = $this->ossClient->deleteObjects($this->bucket, $list, array('quiet' => 'true')); - $this->assertEquals(array(), $result); - $this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object2)); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testAppendObject() - { - $object = "oss-php-sdk-test/append-test-object-name.txt"; - $content_array = array('Hello OSS', 'Hi OSS', 'OSS OK'); - - /** - * 追加上传字符串 - */ - try { - $position = $this->ossClient->appendObject($this->bucket, $object, $content_array[0], 0); - $this->assertEquals($position, strlen($content_array[0])); - $position = $this->ossClient->appendObject($this->bucket, $object, $content_array[1], $position); - $this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1])); - $position = $this->ossClient->appendObject($this->bucket, $object, $content_array[2], $position); - $this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1]) + strlen($content_array[1])); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 检查内容的是否相同 - */ - try { - $content = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($content, implode($content_array)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - - /** - * 删除测试object - */ - try { - $this->ossClient->deleteObject($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 追加上传本地文件 - */ - try { - $position = $this->ossClient->appendFile($this->bucket, $object, __FILE__, 0); - $this->assertEquals($position, filesize(__FILE__)); - $position = $this->ossClient->appendFile($this->bucket, $object, __FILE__, $position); - $this->assertEquals($position, filesize(__FILE__) * 2); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 检查复制的是否相同 - */ - try { - $content = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($content, file_get_contents(__FILE__) . file_get_contents(__FILE__)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 删除测试object - */ - try { - $this->ossClient->deleteObject($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - - - $options = array( - OssClient::OSS_HEADERS => array( - 'Expires' => '2012-10-01 08:00:00', - 'Content-Disposition' => 'attachment; filename="xxxxxx"', - ), - ); - - /** - * 带option的追加上传 - */ - try { - $position = $this->ossClient->appendObject($this->bucket, $object, "Hello OSS, ", 0, $options); - $position = $this->ossClient->appendObject($this->bucket, $object, "Hi OSS.", $position); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 获取文件的meta信息 - */ - try { - $objectMeta = $this->ossClient->getObjectMeta($this->bucket, $object); - $this->assertEquals('attachment; filename="xxxxxx"', $objectMeta[strtolower('Content-Disposition')]); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 删除测试object - */ - try { - $this->ossClient->deleteObject($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testPutIllelObject() - { - $object = "/ilegal.txt"; - try { - $this->ossClient->putObject($this->bucket, $object, "hi", null); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('"/ilegal.txt" object name is invalid', $e->getMessage()); - } - } - - public function testCheckMD5() - { - $object = "oss-php-sdk-test/upload-test-object-name.txt"; - $content = file_get_contents(__FILE__); - $options = array(OssClient::OSS_CHECK_MD5 => true); - - /** - * 上传数据开启MD5 - */ - try { - $this->ossClient->putObject($this->bucket, $object, $content, $options); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 检查复制的是否相同 - */ - try { - $content = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($content, file_get_contents(__FILE__)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 上传文件开启MD5 - */ - try { - $this->ossClient->uploadFile($this->bucket, $object, __FILE__, $options); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 检查复制的是否相同 - */ - try { - $content = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($content, file_get_contents(__FILE__)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 删除测试object - */ - try { - $this->ossClient->deleteObject($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - - $object = "oss-php-sdk-test/append-test-object-name.txt"; - $content_array = array('Hello OSS', 'Hi OSS', 'OSS OK'); - $options = array(OssClient::OSS_CHECK_MD5 => true); - - /** - * 追加上传字符串 - */ - try { - $position = $this->ossClient->appendObject($this->bucket, $object, $content_array[0], 0, $options); - $this->assertEquals($position, strlen($content_array[0])); - $position = $this->ossClient->appendObject($this->bucket, $object, $content_array[1], $position, $options); - $this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1])); - $position = $this->ossClient->appendObject($this->bucket, $object, $content_array[2], $position, $options); - $this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1]) + strlen($content_array[1])); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 检查内容的是否相同 - */ - try { - $content = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($content, implode($content_array)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 删除测试object - */ - try { - $this->ossClient->deleteObject($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 追加上传本地文件 - */ - try { - $position = $this->ossClient->appendFile($this->bucket, $object, __FILE__, 0, $options); - $this->assertEquals($position, filesize(__FILE__)); - $position = $this->ossClient->appendFile($this->bucket, $object, __FILE__, $position, $options); - $this->assertEquals($position, filesize(__FILE__) * 2); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 检查复制的是否相同 - */ - try { - $content = $this->ossClient->getObject($this->bucket, $object); - $this->assertEquals($content, file_get_contents(__FILE__) . file_get_contents(__FILE__)); - } catch (OssException $e) { - $this->assertFalse(true); - } - - /** - * 删除测试object - */ - try { - $this->ossClient->deleteObject($this->bucket, $object); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function setUp() - { - parent::setUp(); - $this->ossClient->putObject($this->bucket, 'oss-php-sdk-test/upload-test-object-name.txt', file_get_contents(__FILE__)); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientRestoreObjectTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientRestoreObjectTest.php deleted file mode 100644 index cc1412f8..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientRestoreObjectTest.php +++ /dev/null @@ -1,96 +0,0 @@ -ossClient->putObject($this->iaBucket, $object,'testcontent'); - try{ - $this->ossClient->restoreObject($this->iaBucket, $object); - $this->assertTrue(false); - }catch (OssException $e){ - $this->assertEquals('400', $e->getHTTPStatus()); - $this->assertEquals('OperationNotSupported', $e->getErrorCode()); - } - } - - public function testNullObjectRestoreObject() - { - $object = 'null-object'; - - try{ - $this->ossClient->restoreObject($this->bucket, $object); - $this->assertTrue(false); - }catch (OssException $e){ - $this->assertEquals('404', $e->getHTTPStatus()); - } - } - - public function testArchiveRestoreObject() - { - $object = 'storage-object'; - - $this->ossClient->putObject($this->archiveBucket, $object,'testcontent'); - try{ - $this->ossClient->getObject($this->archiveBucket, $object); - $this->assertTrue(false); - }catch (OssException $e){ - $this->assertEquals('403', $e->getHTTPStatus()); - $this->assertEquals('InvalidObjectState', $e->getErrorCode()); - } - $result = $this->ossClient->restoreObject($this->archiveBucket, $object); - common::waitMetaSync(); - $this->assertEquals('202', $result['info']['http_code']); - - try{ - $this->ossClient->restoreObject($this->archiveBucket, $object); - }catch(OssException $e){ - $this->assertEquals('409', $e->getHTTPStatus()); - $this->assertEquals('RestoreAlreadyInProgress', $e->getErrorCode()); - } - } - - public function setUp() - { - parent::setUp(); - - $this->iaBucket = 'ia-' . $this->bucket; - $this->archiveBucket = 'archive-' . $this->bucket; - $options = array( - OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_IA - ); - - $this->ossClient->createBucket($this->iaBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options); - - $options = array( - OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_ARCHIVE - ); - - $this->ossClient->createBucket($this->archiveBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options); - } - - public function tearDown() - { - parent::tearDown(); - - $object = 'storage-object'; - - $this->ossClient->deleteObject($this->iaBucket, $object); - $this->ossClient->deleteObject($this->archiveBucket, $object); - $this->ossClient->deleteBucket($this->iaBucket); - $this->ossClient->deleteBucket($this->archiveBucket); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientSignatureTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientSignatureTest.php deleted file mode 100644 index 109121d0..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientSignatureTest.php +++ /dev/null @@ -1,111 +0,0 @@ -ossClient->putObject($this->bucket, $object, file_get_contents(__FILE__)); - $timeout = 3600; - try { - $signedUrl = $this->ossClient->signUrl($this->bucket, $object, $timeout); - } catch (OssException $e) { - $this->assertFalse(true); - } - - $request = new RequestCore($signedUrl); - $request->set_method('GET'); - $request->add_header('Content-Type', ''); - $request->send_request(); - $res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code()); - $this->assertEquals(file_get_contents(__FILE__), $res->body); - } - - public function testGetSignedUrlForPuttingObject() - { - $object = "a.file"; - $timeout = 3600; - try { - $signedUrl = $this->ossClient->signUrl($this->bucket, $object, $timeout, "PUT"); - $content = file_get_contents(__FILE__); - $request = new RequestCore($signedUrl); - $request->set_method('PUT'); - $request->add_header('Content-Type', ''); - $request->add_header('Content-Length', strlen($content)); - $request->set_body($content); - $request->send_request(); - $res = new ResponseCore($request->get_response_header(), - $request->get_response_body(), $request->get_response_code()); - $this->assertTrue($res->isOK()); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testGetSignedUrlForPuttingObjectFromFile() - { - $file = __FILE__; - $object = "a.file"; - $timeout = 3600; - $options = array('Content-Type' => 'txt'); - try { - $signedUrl = $this->ossClient->signUrl($this->bucket, $object, $timeout, "PUT", $options); - $request = new RequestCore($signedUrl); - $request->set_method('PUT'); - $request->add_header('Content-Type', 'txt'); - $request->set_read_file($file); - $request->set_read_stream_size(filesize($file)); - $request->send_request(); - $res = new ResponseCore($request->get_response_header(), - $request->get_response_body(), $request->get_response_code()); - $this->assertTrue($res->isOK()); - } catch (OssException $e) { - $this->assertFalse(true); - } - - } - - public function tearDown() - { - $this->ossClient->deleteObject($this->bucket, "a.file"); - parent::tearDown(); - } - - public function setUp() - { - parent::setUp(); - /** - * 上传本地变量到bucket - */ - $object = "a.file"; - $content = file_get_contents(__FILE__); - $options = array( - OssClient::OSS_LENGTH => strlen($content), - OssClient::OSS_HEADERS => array( - 'Expires' => 'Fri, 28 Feb 2020 05:38:42 GMT', - 'Cache-Control' => 'no-cache', - 'Content-Disposition' => 'attachment;filename=oss_download.log', - 'Content-Encoding' => 'utf-8', - 'Content-Language' => 'zh-CN', - 'x-oss-server-side-encryption' => 'AES256', - 'x-oss-meta-self-define-title' => 'user define meta info', - ), - ); - - try { - $this->ossClient->putObject($this->bucket, $object, $content, $options); - } catch (OssException $e) { - $this->assertFalse(true); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientTest.php deleted file mode 100644 index f92b3461..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientTest.php +++ /dev/null @@ -1,216 +0,0 @@ -assertFalse($ossClient->isUseSSL()); - $ossClient->setUseSSL(true); - $this->assertTrue($ossClient->isUseSSL()); - $this->assertTrue(true); - $this->assertEquals(3, $ossClient->getMaxRetries()); - $ossClient->setMaxTries(4); - $this->assertEquals(4, $ossClient->getMaxRetries()); - $ossClient->setTimeout(10); - $ossClient->setConnectTimeout(20); - } catch (OssException $e) { - assertFalse(true); - } - } - - public function testConstrunct2() - { - try { - $ossClient = new OssClient('id', "", 'http://oss-cn-hangzhou.aliyuncs.com'); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals("access key secret is empty", $e->getMessage()); - } - } - - public function testConstrunct3() - { - try { - $ossClient = new OssClient("", 'key', 'http://oss-cn-hangzhou.aliyuncs.com'); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals("access key id is empty", $e->getMessage()); - } - } - - public function testConstrunct4() - { - try { - $ossClient = new OssClient('id', 'key', ""); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('endpoint is empty', $e->getMessage()); - } - } - - public function testConstrunct5() - { - try { - $ossClient = new OssClient('id', 'key', "123.123.123.1"); - } catch (OssException $e) { - $this->assertTrue(false); - } - } - - public function testConstrunct6() - { - try { - $ossClient = new OssClient('id', 'key', "https://123.123.123.1"); - $this->assertTrue($ossClient->isUseSSL()); - } catch (OssException $e) { - $this->assertTrue(false); - } - } - - public function testConstrunct7() - { - try { - $ossClient = new OssClient('id', 'key', "http://123.123.123.1"); - $this->assertFalse($ossClient->isUseSSL()); - } catch (OssException $e) { - $this->assertTrue(false); - } - } - - public function testConstrunct8() - { - try { - $ossClient = new OssClient('id', 'key', "http://123.123.123.1", true); - $ossClient->listBuckets(); - $this->assertFalse(true); - } catch (OssException $e) { - - } - } - - public function testConstrunct9() - { - try { - $accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' '; - $accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' '; - $endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ '; - $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false); - $ossClient->listBuckets(); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testSupportPutEmptyObject() - { - try { - $accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' '; - $accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' '; - $endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ '; - $bucket = getenv('OSS_BUCKET'); - $ossClient = new OssClient($accessKeyId, $accessKeySecret , $endpoint, false); - $ossClient->putObject($bucket,'test_emptybody',''); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testCreateObjectDir() - { - try { - $accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' '; - $accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' '; - $endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ '; - $bucket = getenv('OSS_BUCKET'); - $object='test-dir'; - $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false); - $ossClient->createObjectDir($bucket,$object); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testGetBucketCors() - { - try { - $accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' '; - $accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' '; - $endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ '; - $bucket = getenv('OSS_BUCKET'); - $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false); - $ossClient->getBucketCors($bucket); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testGetBucketCname() - { - try { - $accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' '; - $accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' '; - $endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ '; - $bucket = getenv('OSS_BUCKET'); - $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false); - $ossClient->getBucketCname($bucket); - } catch (OssException $e) { - $this->assertFalse(true); - } - } - - public function testProxySupport() - { - $accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' '; - $accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' '; - $endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ '; - $bucket = getenv('OSS_BUCKET') . '-proxy'; - $requestProxy = getenv('OSS_PROXY'); - $key = 'test-proxy-srv-object'; - $content = 'test-content'; - $proxys = parse_url($requestProxy); - - $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false, null, $requestProxy); - - $result = $ossClient->createBucket($bucket); - $this->checkProxy($result, $proxys); - - $result = $ossClient->putObject($bucket, $key, $content); - $this->checkProxy($result, $proxys); - $result = $ossClient->getObject($bucket, $key); - $this->assertEquals($content, $result); - - // list object - $objectListInfo = $ossClient->listObjects($bucket); - $objectList = $objectListInfo->getObjectList(); - $this->assertNotNull($objectList); - $this->assertTrue(is_array($objectList)); - $objects = array(); - foreach ($objectList as $value) { - $objects[] = $value->getKey(); - } - $this->assertEquals(1, count($objects)); - $this->assertTrue(in_array($key, $objects)); - - $result = $ossClient->deleteObject($bucket, $key); - $this->checkProxy($result,$proxys); - - $result = $ossClient->deleteBucket($bucket); - $this->checkProxy($result, $proxys); - } - - private function checkProxy($result, $proxys) - { - $this->assertEquals($result['info']['primary_ip'], $proxys['host']); - $this->assertEquals($result['info']['primary_port'], $proxys['port']); - $this->assertTrue(array_key_exists('via', $result)); - } - -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssExceptionTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssExceptionTest.php deleted file mode 100644 index 4a418d53..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssExceptionTest.php +++ /dev/null @@ -1,19 +0,0 @@ -assertTrue(false); - } catch (OssException $e) { - $this->assertNotNull($e); - $this->assertEquals($e->getMessage(), "ERR"); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssUtilTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssUtilTest.php deleted file mode 100644 index adf64571..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssUtilTest.php +++ /dev/null @@ -1,225 +0,0 @@ -assertEquals(OssUtil::chkChinese("hello,world"), 0); - $str = '你好,这里是卖咖啡!'; - $strGBK = OssUtil::encodePath($str); - $this->assertEquals(OssUtil::chkChinese($str), 1); - $this->assertEquals(OssUtil::chkChinese($strGBK), 1); - } - - public function testIsGB2312() - { - $str = '你好,这里是卖咖啡!'; - $this->assertFalse(OssUtil::isGb2312($str)); - } - - public function testCheckChar() - { - $str = '你好,这里是卖咖啡!'; - $this->assertFalse(OssUtil::checkChar($str)); - $this->assertTrue(OssUtil::checkChar(iconv("UTF-8", "GB2312//IGNORE", $str))); - } - - public function testIsIpFormat() - { - $this->assertTrue(OssUtil::isIPFormat("10.101.160.147")); - $this->assertTrue(OssUtil::isIPFormat("12.12.12.34")); - $this->assertTrue(OssUtil::isIPFormat("12.12.12.12")); - $this->assertTrue(OssUtil::isIPFormat("255.255.255.255")); - $this->assertTrue(OssUtil::isIPFormat("0.1.1.1")); - $this->assertFalse(OssUtil::isIPFormat("0.1.1.x")); - $this->assertFalse(OssUtil::isIPFormat("0.1.1.256")); - $this->assertFalse(OssUtil::isIPFormat("256.1.1.1")); - $this->assertFalse(OssUtil::isIPFormat("0.1.1.0.1")); - $this->assertTrue(OssUtil::isIPFormat("10.10.10.10:123")); - } - - public function testToQueryString() - { - $option = array("a" => "b"); - $this->assertEquals('a=b', OssUtil::toQueryString($option)); - } - - public function testSReplace() - { - $str = "<>&'\""; - $this->assertEquals("&lt;&gt;&'"", OssUtil::sReplace($str)); - } - - public function testCheckChinese() - { - $str = '你好,这里是卖咖啡!'; - $this->assertEquals(OssUtil::chkChinese($str), 1); - if (OssUtil::isWin()) { - $strGB = OssUtil::encodePath($str); - $this->assertEquals($str, iconv("GB2312", "UTF-8", $strGB)); - } - } - - public function testValidateOption() - { - $option = 'string'; - - try { - OssUtil::validateOptions($option); - $this->assertFalse(true); - } catch (OssException $e) { - $this->assertEquals("string:option must be array", $e->getMessage()); - } - - $option = null; - - try { - OssUtil::validateOptions($option); - $this->assertTrue(true); - } catch (OssException $e) { - $this->assertFalse(true); - } - - } - - public function testCreateDeleteObjectsXmlBody() - { - $xml = <<trueobj1 -BBBB; - $a = array('obj1'); - $this->assertEquals($xml, $this->cleanXml(OssUtil::createDeleteObjectsXmlBody($a, 'true'))); - } - - public function testCreateCompleteMultipartUploadXmlBody() - { - $xml = <<2xx -BBBB; - $a = array(array("PartNumber" => 2, "ETag" => "xx")); - $this->assertEquals($this->cleanXml(OssUtil::createCompleteMultipartUploadXmlBody($a)), $xml); - } - - public function testCreateBucketXmlBody() - { - $xml = <<Standard -BBBB; - $storageClass ="Standard"; - $this->assertEquals($this->cleanXml(OssUtil::createBucketXmlBody($storageClass)), $xml); - } - - public function testValidateBucket() - { - $this->assertTrue(OssUtil::validateBucket("xxx")); - $this->assertFalse(OssUtil::validateBucket("XXXqwe123")); - $this->assertFalse(OssUtil::validateBucket("XX")); - $this->assertFalse(OssUtil::validateBucket("/X")); - $this->assertFalse(OssUtil::validateBucket("")); - } - - public function testValidateObject() - { - $this->assertTrue(OssUtil::validateObject("xxx")); - $this->assertTrue(OssUtil::validateObject("xxx23")); - $this->assertTrue(OssUtil::validateObject("12321-xxx")); - $this->assertTrue(OssUtil::validateObject("x")); - $this->assertFalse(OssUtil::validateObject("/aa")); - $this->assertFalse(OssUtil::validateObject("\\aa")); - $this->assertFalse(OssUtil::validateObject("")); - } - - public function testStartWith() - { - $this->assertTrue(OssUtil::startsWith("xxab", "xx"), true); - } - - public function testReadDir() - { - $list = OssUtil::readDir("./src", ".|..|.svn|.git", true); - $this->assertNotNull($list); - } - - public function testIsWin() - { - //$this->assertTrue(OssUtil::isWin()); - } - - public function testGetMd5SumForFile() - { - $this->assertEquals(OssUtil::getMd5SumForFile(__FILE__, 0, filesize(__FILE__) - 1), base64_encode(md5(file_get_contents(__FILE__), true))); - } - - public function testGenerateFile() - { - $path = __DIR__ . DIRECTORY_SEPARATOR . "generatedFile.txt"; - OssUtil::generateFile($path, 1024 * 1024); - $this->assertEquals(filesize($path), 1024 * 1024); - unlink($path); - } - - public function testThrowOssExceptionWithMessageIfEmpty() - { - $null = null; - try { - OssUtil::throwOssExceptionWithMessageIfEmpty($null, "xx"); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals('xx', $e->getMessage()); - } - } - - public function testThrowOssExceptionWithMessageIfEmpty2() - { - $null = ""; - try { - OssUtil::throwOssExceptionWithMessageIfEmpty($null, "xx"); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals('xx', $e->getMessage()); - } - } - - public function testValidContent() - { - $null = ""; - try { - OssUtil::validateContent($null); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals('http body content is invalid', $e->getMessage()); - } - - $notnull = "x"; - try { - OssUtil::validateContent($notnull); - $this->assertTrue(true); - } catch (OssException $e) { - $this->assertEquals('http body content is invalid', $e->getMessage()); - } - } - - public function testThrowOssExceptionWithMessageIfEmpty3() - { - $null = "xx"; - try { - OssUtil::throwOssExceptionWithMessageIfEmpty($null, "xx"); - $this->assertTrue(True); - } catch (OssException $e) { - $this->assertTrue(false); - } - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } - -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/PutSetDeleteResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/PutSetDeleteResultTest.php deleted file mode 100644 index b298e441..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/PutSetDeleteResultTest.php +++ /dev/null @@ -1,66 +0,0 @@ -assertFalse(true); - } catch (OssException $e) { - $this->assertEquals('raw response is null', $e->getMessage()); - } - } - - public function testOkResponse() - { - $header= array( - 'x-oss-request-id' => '582AA51E004C4550BD27E0E4', - 'etag' => '595FA1EA77945233921DF12427F9C7CE', - 'content-md5' => 'WV+h6neUUjOSHfEkJ/nHzg==', - 'info' => array( - 'http_code' => '200', - 'method' => 'PUT' - ), - ); - $response = new ResponseCore($header, "this is a mock body, just for test", 200); - $result = new PutSetDeleteResult($response); - $data = $result->getData(); - $this->assertTrue($result->isOK()); - $this->assertEquals("this is a mock body, just for test", $data['body']); - $this->assertEquals('582AA51E004C4550BD27E0E4', $data['x-oss-request-id']); - $this->assertEquals('595FA1EA77945233921DF12427F9C7CE', $data['etag']); - $this->assertEquals('WV+h6neUUjOSHfEkJ/nHzg==', $data['content-md5']); - $this->assertEquals('200', $data['info']['http_code']); - $this->assertEquals('PUT', $data['info']['method']); - } - - public function testFailResponse() - { - $response = new ResponseCore(array(), "", 301); - try { - new PutSetDeleteResult($response); - $this->assertFalse(true); - } catch (OssException $e) { - - } - } - - public function setUp() - { - - } - - public function tearDown() - { - - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/RefererConfigTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/RefererConfigTest.php deleted file mode 100644 index 8360a242..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/RefererConfigTest.php +++ /dev/null @@ -1,54 +0,0 @@ - - -true - -http://www.aliyun.com -https://www.aliyun.com -http://www.*.com -https://www.?.aliyuncs.com - - -BBBB; - - private $validXml2 = << - -true - -http://www.aliyun.com - - -BBBB; - - public function testParseValidXml() - { - $refererConfig = new RefererConfig(); - $refererConfig->parseFromXml($this->validXml); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($refererConfig->serializeToXml())); - } - - public function testParseValidXml2() - { - $refererConfig = new RefererConfig(); - $refererConfig->parseFromXml($this->validXml2); - $this->assertEquals(true, $refererConfig->isAllowEmptyReferer()); - $this->assertEquals(1, count($refererConfig->getRefererList())); - $this->assertEquals($this->cleanXml($this->validXml2), $this->cleanXml(strval($refererConfig))); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/StorageCapacityTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/StorageCapacityTest.php deleted file mode 100644 index 4562da7c..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/StorageCapacityTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - - 1 - -BBBB; - - private $validXml = << - - 1 - -BBBB; - - public function testParseInValidXml() - { - $response = new ResponseCore(array(), $this->inValidXml, 300); - try { - new GetStorageCapacityResult($response); - $this->assertTrue(false); - } catch (OssException $e) {} - } - - public function testParseEmptyXml() - { - $response = new ResponseCore(array(), "", 300); - try { - new GetStorageCapacityResult($response); - $this->assertTrue(false); - } catch (OssException $e) {} - } - - public function testParseValidXml() - { - $response = new ResponseCore(array(), $this->validXml, 200); - $result = new GetStorageCapacityResult($response); - $this->assertEquals($result->getData(), 1); - } - - public function testSerializeToXml() - { - $xml = "\n1\n"; - - $storageCapacityConfig = new StorageCapacityConfig(1); - $content = $storageCapacityConfig->serializeToXml(); - $this->assertEquals($content, $xml); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/SymlinkTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/SymlinkTest.php deleted file mode 100644 index d257c948..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/SymlinkTest.php +++ /dev/null @@ -1,74 +0,0 @@ -ossClient ->putObject($bucket, $object, 'test_content'); - $this->ossClient->putSymlink($bucket, $symlink, $object); - $result = $this->ossClient->getObject($bucket, $symlink); - $this->assertEquals('test_content', $result); - - $this->ossClient ->putObject($bucket, $special_object, 'test_content'); - $this->ossClient->putSymlink($bucket, $symlink, $special_object); - $result = $this->ossClient->getObject($bucket, $symlink); - $this->assertEquals('test_content', $result); - } - - public function testGetSymlink() - { - $bucket = getenv('OSS_BUCKET'); - $symlink = 'test-link'; - $object = 'exist_object^$#!~'; - - $result = $this->ossClient->getSymlink($bucket, $symlink); - $this->assertEquals($result[OssClient::OSS_SYMLINK_TARGET], $object); - $this->assertEquals('200', $result[OssClient::OSS_INFO][OssClient::OSS_HTTP_CODE]); - $this->assertTrue(isset($result[OssClient::OSS_ETAG])); - $this->assertTrue(isset($result[OssClient::OSS_REQUEST_ID])); - } - - public function testPutNullSymlink() - { - $bucket = getenv('OSS_BUCKET'); - $symlink = 'null-link'; - $object_not_exist = 'not_exist_object+$#!b不'; - $this->ossClient->putSymlink($bucket, $symlink, $object_not_exist); - - try{ - $this->ossClient->getObject($bucket, $symlink); - $this->assertTrue(false); - }catch (OssException $e){ - $this->assertEquals('The symlink target object does not exist', $e->getErrorMessage()); - } - } - - public function testGetNullSymlink() - { - $bucket = getenv('OSS_BUCKET'); - $symlink = 'null-link-new'; - - try{ - $result = $this->ossClient->getSymlink($bucket, $symlink); - $this->assertTrue(false); - }catch (OssException $e){ - $this->assertEquals('The specified key does not exist.', $e->getErrorMessage()); - } - } -} - - diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/TestOssClientBase.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/TestOssClientBase.php deleted file mode 100644 index 4abd31f9..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/TestOssClientBase.php +++ /dev/null @@ -1,51 +0,0 @@ -bucket = Common::getBucketName() . rand(100000, 999999); - $this->ossClient = Common::getOssClient(); - $this->ossClient->createBucket($this->bucket); - Common::waitMetaSync(); - } - - public function tearDown() - { - if (!$this->ossClient->doesBucketExist($this->bucket)) { - return; - } - - $objects = $this->ossClient->listObjects( - $this->bucket, array('max-keys' => 1000, 'delimiter' => ''))->getObjectList(); - $keys = array(); - foreach ($objects as $obj) { - $keys[] = $obj->getKey(); - } - if (count($keys) > 0) { - $this->ossClient->deleteObjects($this->bucket, $keys); - } - $uploads = $this->ossClient->listMultipartUploads($this->bucket)->getUploads(); - foreach ($uploads as $up) { - $this->ossClient->abortMultipartUpload($this->bucket, $up->getKey(), $up->getUploadId()); - } - - $this->ossClient->deleteBucket($this->bucket); - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/UploadPartResultTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/UploadPartResultTest.php deleted file mode 100644 index e4789efe..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/UploadPartResultTest.php +++ /dev/null @@ -1,33 +0,0 @@ - '7265F4D211B56873A381D321F586E4A9'); - private $invalidHeader = array(); - - public function testParseValidHeader() - { - $response = new ResponseCore($this->validHeader, "", 200); - $result = new UploadPartResult($response); - $eTag = $result->getData(); - $this->assertEquals('7265F4D211B56873A381D321F586E4A9', $eTag); - } - - public function testParseInvalidHeader() - { - $response = new ResponseCore($this->invalidHeader, "", 200); - try { - new UploadPartResult($response); - $this->assertTrue(false); - } catch (OssException $e) { - $this->assertEquals('cannot get ETag', $e->getMessage()); - } - } -} diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/WebsiteConfigTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/WebsiteConfigTest.php deleted file mode 100644 index 2ec0fcbb..00000000 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/WebsiteConfigTest.php +++ /dev/null @@ -1,56 +0,0 @@ - - - -index.html - - -errorDocument.html - - -BBBB; - - private $nullXml = << -BBBB; - private $nullXml2 = << -BBBB; - - public function testParseValidXml() - { - $websiteConfig = new WebsiteConfig("index"); - $websiteConfig->parseFromXml($this->validXml); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($websiteConfig->serializeToXml())); - } - - public function testParsenullXml() - { - $websiteConfig = new WebsiteConfig(); - $websiteConfig->parseFromXml($this->nullXml); - $this->assertTrue($this->cleanXml($this->nullXml) === $this->cleanXml($websiteConfig->serializeToXml()) || - $this->cleanXml($this->nullXml2) === $this->cleanXml($websiteConfig->serializeToXml())); - } - - public function testWebsiteConstruct() - { - $websiteConfig = new WebsiteConfig("index.html", "errorDocument.html"); - $this->assertEquals('index.html', $websiteConfig->getIndexDocument()); - $this->assertEquals('errorDocument.html', $websiteConfig->getErrorDocument()); - $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($websiteConfig->serializeToXml())); - } - - private function cleanXml($xml) - { - return str_replace("\n", "", str_replace("\r", "", $xml)); - } -} diff --git a/vendor/autoload.php b/vendor/autoload.php deleted file mode 100644 index 878a0b44..00000000 --- a/vendor/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ - 'app_name', - 'db' => - array ( - 'host' => 'localhost', - 'user' => 'sample_user', - 'pass' => 'sample_pass', - 'port' => 3306, - ), - 'other' => - array ( - 'multi' => - array ( - 'deep' => - array ( - 'nested' => 'config_value', - ), - ), - ), -); - -``` - -### Instance ConfigManager object - -```php -use clagiordano\weblibs\configmanager\ConfigManager; - -/** - * Instance object to read argument file - */ -$config = new ConfigManager("configfile.php"); -``` - -### Check if a value exists into config file - -```php -/** - * Check if a value exists into config file - */ -$value = $config->existValue('app'); -``` - -### Read a simple element from config file - -```php -/** - * Read a simple element from config file - */ -$value = $config->getValue('app'); -``` - -### Access to a nested element from config - -```php -/** - * Access to a nested element from config - */ -$nestedValue = $config->getValue('other.multi.deep.nested'); -``` - -### Change config value at runtime - -```php -/** - * Change config value at runtime - */ -$this->config->setValue('other.multi.deep.nested', "SUPERNESTED"); -``` - -### Save config file with original name (OVERWRITE) - -```php -/** - * Save config file with original name (OVERWRITE) - */ -$this->config->saveConfigFile(); -``` - -### Or save config file with a different name - -```php -/** - * Save config file with original name (OVERWRITE) - */ -$this->config->saveConfigFile('/new/file/name/or/path/test.php'); -``` - -### Optionally you can also reload config file from disk after save - -```php -/** - * Optionally you can also reload config file from disk after save - */ -$this->config->saveConfigFile('/new/file/name/or/path/test.php', true); -``` - -### Load another configuration file without reinstance ConfigManager - -```php -/** - * Load another configuration file without reinstance ConfigManager - */ -$this->config->loadConfig('another_config_file.php'); -``` - -## Legal -*Copyright (C) Claudio Giordano * diff --git a/vendor/clagiordano/weblibs-configmanager/composer.json b/vendor/clagiordano/weblibs-configmanager/composer.json deleted file mode 100644 index f330d2bf..00000000 --- a/vendor/clagiordano/weblibs-configmanager/composer.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "clagiordano/weblibs-configmanager", - "description": "weblibs-configmanager is a tool library for easily read and access to php config array file and direct read/write configuration file / object", - "type": "library", - "license": "LGPL-3.0-or-later", - "keywords": ["clagiordano", "weblibs", "configuration", "manager", "tool"], - "authors": [ - { - "name": "Claudio Giordano", - "email": "claudio.giordano@autistici.org", - "role": "Developer" - } - ], - "autoload": { - "psr-4": { - "clagiordano\\weblibs\\configmanager\\": "src/" - } - }, - "require": { - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8", - "clagiordano/phpunit-result-printer": "^1" - }, - "autoload-dev": { - "psr-4": { - "clagiordano\\weblibs\\configmanager\\tests\\": "tests/", - "clagiordano\\weblibs\\configmanager\\testdata\\": "testdata/" - } - }, - "scripts": { - "test": "./vendor/bin/phpunit --no-coverage", - "coverage": "./vendor/bin/phpunit" - } -} diff --git a/vendor/clagiordano/weblibs-configmanager/composer.lock b/vendor/clagiordano/weblibs-configmanager/composer.lock deleted file mode 100644 index f65537e1..00000000 --- a/vendor/clagiordano/weblibs-configmanager/composer.lock +++ /dev/null @@ -1,1235 +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": "4891effe3d8ee390aa06d5a8dd37fb9c", - "packages": [], - "packages-dev": [ - { - "name": "clagiordano/phpunit-result-printer", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/clagiordano/phpunit-result-printer.git", - "reference": "b4351f747af7964bcdb1cc0d1aa9fe007022b3ac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/clagiordano/phpunit-result-printer/zipball/b4351f747af7964bcdb1cc0d1aa9fe007022b3ac", - "reference": "b4351f747af7964bcdb1cc0d1aa9fe007022b3ac", - "shasum": "" - }, - "require": { - "phpunit/phpunit": "4.8.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "clagiordano\\PhpunitResultPrinter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Phpunit custom result printer class", - "time": "2019-07-16T10:33:26+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" - }, - "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://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2019-03-17T17:37:11+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.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": "2018-08-07T13:53:10+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", - "phpdocumentor/type-resolver": "~0.4 || ^1.0.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": "2019-09-12T14:27:41+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "shasum": "" - }, - "require": { - "php": "^7.1", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "^7.1", - "mockery/mockery": "~1", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.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": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-08-22T18:11:29+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.8.1", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "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-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "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": "2019-06-13T12:50:23+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.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": "2015-10-06T15:47:00+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.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": "2017-11-27T13:52:08+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": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.12", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-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": "2017-12-04T08:55:13+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.36", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.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": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-06-21T08:07:12+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "abandoned": true, - "time": "2015-10-02T06:51:40+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.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" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-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" - ], - "time": "2017-05-22T07:24:03+00:00" - }, - { - "name": "sebastian/environment", - "version": "1.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.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": "2016-08-18T05:49:44+00:00" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.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": "2016-06-17T09:04:28+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.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": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "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": "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": "2016-10-03T07:41:43+00:00" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "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": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21T13:59:46+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.12.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.12-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2019-08-06T08:03:45+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.4.31", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "3dc414b7db30695bae671a1d86013d03f4ae9834" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/3dc414b7db30695bae671a1d86013d03f4ae9834", - "reference": "3dc414b7db30695bae671a1d86013d03f4ae9834", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "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 Yaml Component", - "homepage": "https://symfony.com", - "time": "2019-08-20T13:31:17+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.5.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" - }, - "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": "2019-08-24T08:43:50+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.4" - }, - "platform-dev": [] -} diff --git a/vendor/clagiordano/weblibs-configmanager/phpunit.xml b/vendor/clagiordano/weblibs-configmanager/phpunit.xml deleted file mode 100644 index 25777b90..00000000 --- a/vendor/clagiordano/weblibs-configmanager/phpunit.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - ./tests/ - - - diff --git a/vendor/clagiordano/weblibs-configmanager/src/ConfigManager.php b/vendor/clagiordano/weblibs-configmanager/src/ConfigManager.php deleted file mode 100644 index 58a44afc..00000000 --- a/vendor/clagiordano/weblibs-configmanager/src/ConfigManager.php +++ /dev/null @@ -1,148 +0,0 @@ -loadConfig($configFilePath); - } - - /** - * Load config data from file and store it into internal property - * - * @param null|string $configFilePath - * - * @return ConfigManager - */ - public function loadConfig($configFilePath = null) - { - if (!is_null($configFilePath)) { - $this->configFilePath = $configFilePath; - - if (file_exists($configFilePath)) { - $this->configData = require $configFilePath; - } - } - - return $this; - } - - /** - * Prepare and write config file on disk - * - * @param null|string $configFilePath - * @param bool $autoReloadConfig - * - * @return ConfigManager - * @throws \RuntimeException - */ - public function saveConfigFile($configFilePath = null, $autoReloadConfig = false) - { - if (is_null($configFilePath)) { - $configFilePath = $this->configFilePath; - } - - $configFileContent = "configData, true); - $configFileContent .= ";\n\n"; - - try { - file_put_contents($configFilePath, $configFileContent); - } catch (\Exception $exc) { - throw new \RuntimeException( - __METHOD__ . ": Failed to write config file to path '{$configFilePath}'" - ); - } - - if ($autoReloadConfig) { - $this->loadConfig($configFilePath); - } - - return $this; - } - - /** - * Get value pointer from config for get/set value - * - * @param string $configPath - * - * @return mixed - */ - private function & getValuePointer($configPath) - { - $configData =& $this->configData; - $parts = explode('.', $configPath); - $length = count($parts); - - for ($i = 0; $i < $length; $i++) { - if (!isset($configData[ $parts[ $i ] ])) { - $configData[ $parts[ $i ] ] = ($i === $length) ? [] : null; - } - $configData = &$configData[ $parts[ $i ] ]; - } - - return $configData; - } - - /** - * Get value from config data throught keyValue path - * - * @param string $configPath - * @param mixed $defaultValue - * - * @return mixed - */ - public function getValue($configPath, $defaultValue = null) - { - $stored = $this->getValuePointer($configPath); - - return is_null($stored) ? $defaultValue : $stored; - } - - /** - * Check if exist required config for keyValue - * - * @param string $keyValue - * - * @return mixed - */ - public function existValue($keyValue) - { - return !is_null($this->getValue($keyValue)); - } - - /** - * Set value in config path - * - * @param string $configPath - * @param mixed $newValue - * - * @return ConfigManager - */ - public function setValue($configPath, $newValue) - { - $configData = &$this->getValuePointer($configPath); - $configData = $newValue; - - return $this; - } -} diff --git a/vendor/clagiordano/weblibs-configmanager/tests/ConfigManagerTest.php b/vendor/clagiordano/weblibs-configmanager/tests/ConfigManagerTest.php deleted file mode 100644 index 1d129636..00000000 --- a/vendor/clagiordano/weblibs-configmanager/tests/ConfigManagerTest.php +++ /dev/null @@ -1,113 +0,0 @@ -config = new ConfigManager("TestConfigData.php"); - $this->assertInstanceOf('clagiordano\weblibs\configmanager\ConfigManager', $this->config); - - $this->assertFileExists($this->configFile); - $this->config->loadConfig($this->configFile); - } - - public function testBasicUsage() - { - $this->assertNotNull( - $this->config->getValue('app') - ); - } - - public function testFastUsage() - { - $this->assertNotNull( - $this->config->getValue('app') - ); - } - - public function testFastInvalidKey() - { - $this->assertNull( - $this->config->getValue('invalidKey') - ); - } - - public function testFastInvalidKeyWithDefault() - { - $this->assertEquals( - $this->config->getValue('invalidKey', 'defaultValue'), - 'defaultValue' - ); - } - - public function testFastNestedConfig() - { - $this->assertNotNull( - $this->config->getValue('other.multi.deep.nested') - ); - } - - public function testCheckExistConfig() - { - $this->assertTrue( - $this->config->existValue('other.multi.deep.nested') - ); - } - - public function testCheckNotExistConfig() - { - $this->assertFalse( - $this->config->existValue('invalid.config.path') - ); - } - - public function testSetValue() - { - $this->config->setValue('other.multi.deep.nested', __FUNCTION__); - - $this->assertEquals( - $this->config->getValue('other.multi.deep.nested'), - __FUNCTION__ - ); - } - - public function testFailedSaveConfig() - { - $this->setExpectedException('Exception'); - $this->config->saveConfigFile('/invalid/path'); - } - - public function testSuccessSaveConfigOnTempAndReload() - { - $this->config->setValue('other.multi.deep.nested', "SUPERNESTED"); - $this->config->saveConfigFile("/tmp/testconfig.php", true); - - $this->assertEquals( - $this->config->getValue('other.multi.deep.nested'), - "SUPERNESTED" - ); - } - - public function testOverwriteSameConfigFile() - { - $this->config->saveConfigFile(); - } - - public function testFailWriteConfig() - { - $this->setExpectedException('\RuntimeException'); - $this->config->saveConfigFile('/invalid/path/test.php'); - } -} \ No newline at end of file diff --git a/vendor/clagiordano/weblibs-configmanager/testsdata/sample_config_data.php b/vendor/clagiordano/weblibs-configmanager/testsdata/sample_config_data.php deleted file mode 100644 index 4a99ef05..00000000 --- a/vendor/clagiordano/weblibs-configmanager/testsdata/sample_config_data.php +++ /dev/null @@ -1,23 +0,0 @@ - 'app_name', - 'db' => - array ( - 'host' => 'localhost', - 'user' => 'sample_user', - 'pass' => 'sample_pass', - 'port' => 3306, - ), - 'other' => - array ( - 'multi' => - array ( - 'deep' => - array ( - 'nested' => 'config_value', - ), - ), - ), -); - diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php deleted file mode 100644 index 95106127..00000000 --- a/vendor/composer/ClassLoader.php +++ /dev/null @@ -1,445 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see https://www.php-fig.org/psr/psr-0/ - * @see https://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - private $classMapAuthoritative = false; - private $missingClasses = array(); - private $apcuPrefix; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php deleted file mode 100644 index adc7e858..00000000 --- a/vendor/composer/InstalledVersions.php +++ /dev/null @@ -1,576 +0,0 @@ - - array ( - 'pretty_version' => 'dev-feature/composer-tool', - 'version' => 'dev-feature/composer-tool', - 'aliases' => - array ( - ), - 'reference' => '41c98e2f9c0c3c32ea7a6644910033079df34751', - 'name' => 'topthink/think', - ), - 'versions' => - array ( - 'adbario/php-dot-notation' => - array ( - 'pretty_version' => '2.2.0', - 'version' => '2.2.0.0', - 'aliases' => - array ( - ), - 'reference' => 'eee4fc81296531e6aafba4c2bbccfc5adab1676e', - ), - 'alibabacloud/client' => - array ( - 'pretty_version' => '1.5.18', - 'version' => '1.5.18.0', - 'aliases' => - array ( - ), - 'reference' => '5dcf7b8fdfa64abdae7a5ca867289baf95e8e12a', - ), - 'aliyuncs/oss-sdk-php' => - array ( - 'pretty_version' => 'v2.3.0', - 'version' => '2.3.0.0', - 'aliases' => - array ( - ), - 'reference' => 'e69f57916678458642ac9d2fd341ae78a56996c8', - ), - 'clagiordano/weblibs-configmanager' => - array ( - 'pretty_version' => 'v1.0.7', - 'version' => '1.0.7.0', - 'aliases' => - array ( - ), - 'reference' => '6ef4c27354368deb2f54b39bbe06601da8c873a0', - ), - 'danielstjules/stringy' => - array ( - 'pretty_version' => '3.1.0', - 'version' => '3.1.0.0', - 'aliases' => - array ( - ), - 'reference' => 'df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e', - ), - 'doctrine/annotations' => - array ( - 'pretty_version' => '1.13.2', - 'version' => '1.13.2.0', - 'aliases' => - array ( - ), - 'reference' => '5b668aef16090008790395c02c893b1ba13f7e08', - ), - 'doctrine/lexer' => - array ( - 'pretty_version' => '1.2.1', - 'version' => '1.2.1.0', - 'aliases' => - array ( - ), - 'reference' => 'e864bbf5904cb8f5bb334f99209b48018522f042', - ), - 'eaglewu/swoole-ide-helper' => - array ( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'aliases' => - array ( - ), - 'reference' => 'a255daa05feffbf4b88d59897a9470696d2fe259', - ), - 'guzzlehttp/command' => - array ( - 'pretty_version' => '1.0.0', - 'version' => '1.0.0.0', - 'aliases' => - array ( - ), - 'reference' => '2aaa2521a8f8269d6f5dfc13fe2af12c76921034', - ), - 'guzzlehttp/guzzle' => - array ( - 'pretty_version' => '6.4.1', - 'version' => '6.4.1.0', - 'aliases' => - array ( - ), - 'reference' => '0895c932405407fd3a7368b6910c09a24d26db11', - ), - 'guzzlehttp/guzzle-services' => - array ( - 'pretty_version' => '1.1.3', - 'version' => '1.1.3.0', - 'aliases' => - array ( - ), - 'reference' => '9e3abf20161cbf662d616cbb995f2811771759f7', - ), - 'guzzlehttp/promises' => - array ( - 'pretty_version' => 'v1.3.1', - 'version' => '1.3.1.0', - 'aliases' => - array ( - ), - 'reference' => 'a59da6cf61d80060647ff4d3eb2c03a2bc694646', - ), - 'guzzlehttp/psr7' => - array ( - 'pretty_version' => '1.6.1', - 'version' => '1.6.1.0', - 'aliases' => - array ( - ), - 'reference' => '239400de7a173fe9901b9ac7c06497751f00727a', - ), - 'jianyan74/php-excel' => - array ( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => '5b569e16ba35fa48ff7449a7f593172f8284f66b', - ), - 'league/flysystem' => - array ( - 'pretty_version' => '1.0.57', - 'version' => '1.0.57.0', - 'aliases' => - array ( - ), - 'reference' => '0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a', - ), - 'league/flysystem-cached-adapter' => - array ( - 'pretty_version' => '1.0.9', - 'version' => '1.0.9.0', - 'aliases' => - array ( - ), - 'reference' => '08ef74e9be88100807a3b92cc9048a312bf01d6f', - ), - 'markbaker/complex' => - array ( - 'pretty_version' => '1.4.8', - 'version' => '1.4.8.0', - 'aliases' => - array ( - ), - 'reference' => '8eaa40cceec7bf0518187530b2e63871be661b72', - ), - 'markbaker/matrix' => - array ( - 'pretty_version' => '1.2.0', - 'version' => '1.2.0.0', - 'aliases' => - array ( - ), - 'reference' => '5348c5a67e3b75cd209d70103f916a93b1f1ed21', - ), - 'mtdowling/jmespath.php' => - array ( - 'pretty_version' => '2.4.0', - 'version' => '2.4.0.0', - 'aliases' => - array ( - ), - 'reference' => 'adcc9531682cf87dfda21e1fd5d0e7a41d292fac', - ), - 'phpoffice/phpspreadsheet' => - array ( - 'pretty_version' => '1.12.0', - 'version' => '1.12.0.0', - 'aliases' => - array ( - ), - 'reference' => 'f79611d6dc1f6b7e8e30b738fc371b392001dbfd', - ), - 'psr/cache' => - array ( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8', - ), - 'psr/container' => - array ( - 'pretty_version' => '1.0.0', - 'version' => '1.0.0.0', - 'aliases' => - array ( - ), - 'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f', - ), - 'psr/http-message' => - array ( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', - ), - 'psr/http-message-implementation' => - array ( - 'provided' => - array ( - 0 => '1.0', - ), - ), - 'psr/log' => - array ( - 'pretty_version' => '1.1.2', - 'version' => '1.1.2.0', - 'aliases' => - array ( - ), - 'reference' => '446d54b4cb6bf489fc9d75f55843658e6f25d801', - ), - 'psr/simple-cache' => - array ( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', - ), - 'qcloud/cos-sdk-v5' => - array ( - 'pretty_version' => 'v2.0.3', - 'version' => '2.0.3.0', - 'aliases' => - array ( - ), - 'reference' => '5dea6bc8be6f8e48fb95a5c4670800d1d796ac42', - ), - 'qiniu/php-sdk' => - array ( - 'pretty_version' => 'v7.2.10', - 'version' => '7.2.10.0', - 'aliases' => - array ( - ), - 'reference' => 'd89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8', - ), - 'ralouphie/getallheaders' => - array ( - 'pretty_version' => '3.0.3', - 'version' => '3.0.3.0', - 'aliases' => - array ( - ), - 'reference' => '120b605dfeb996808c31b6477290a714d356e822', - ), - 'symfony/polyfill-mbstring' => - array ( - 'pretty_version' => 'v1.16.0', - 'version' => '1.16.0.0', - 'aliases' => - array ( - ), - 'reference' => 'a54881ec0ab3b2005c406aed0023c062879031e7', - ), - 'symfony/polyfill-php72' => - array ( - 'pretty_version' => 'v1.12.0', - 'version' => '1.12.0.0', - 'aliases' => - array ( - ), - 'reference' => '04ce3335667451138df4307d6a9b61565560199e', - ), - 'symfony/var-dumper' => - array ( - 'pretty_version' => 'v4.3.6', - 'version' => '4.3.6.0', - 'aliases' => - array ( - ), - 'reference' => 'ea4940845535c85ff5c505e13b3205b0076d07bf', - ), - 'topthink/framework' => - array ( - 'pretty_version' => 'v6.0.8', - 'version' => '6.0.8.0', - 'aliases' => - array ( - ), - 'reference' => '4789343672aef06d571d556da369c0e156609bce', - ), - 'topthink/think' => - array ( - 'pretty_version' => 'dev-feature/composer-tool', - 'version' => 'dev-feature/composer-tool', - 'aliases' => - array ( - ), - 'reference' => '41c98e2f9c0c3c32ea7a6644910033079df34751', - ), - 'topthink/think-captcha' => - array ( - 'pretty_version' => 'v3.0.2', - 'version' => '3.0.2.0', - 'aliases' => - array ( - ), - 'reference' => '0b4305da19e118cefd934007875a8112f9352f01', - ), - 'topthink/think-helper' => - array ( - 'pretty_version' => 'v3.1.4', - 'version' => '3.1.4.0', - 'aliases' => - array ( - ), - 'reference' => 'c28d37743bda4a0455286ca85b17b5791d626e10', - ), - 'topthink/think-multi-app' => - array ( - 'pretty_version' => 'v1.0.11', - 'version' => '1.0.11.0', - 'aliases' => - array ( - ), - 'reference' => '215f4a6bb88e53ad41b448c61957336eb55ce6f9', - ), - 'topthink/think-orm' => - array ( - 'pretty_version' => 'v2.0.27', - 'version' => '2.0.27.0', - 'aliases' => - array ( - ), - 'reference' => '02affaaccade2cdd8bbb2d2f5d15e46113e6eb50', - ), - 'topthink/think-template' => - array ( - 'pretty_version' => 'v2.0.7', - 'version' => '2.0.7.0', - 'aliases' => - array ( - ), - 'reference' => 'e98bdbb4a4c94b442f17dfceba81e0134d4fbd19', - ), - 'topthink/think-view' => - array ( - 'pretty_version' => 'v1.0.13', - 'version' => '1.0.13.0', - 'aliases' => - array ( - ), - 'reference' => '90803b73f781db5d42619082c4597afc58b2d4c5', - ), - 'zhongshaofa/easy-admin' => - array ( - 'pretty_version' => 'v1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => 'e09be94938283d7c0210a3c04c38287757942a56', - ), - 'zhongshaofa/thinkphp-log-trace' => - array ( - 'pretty_version' => 'v1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => '20388c806bd78f493cb806ad1bce2f5c81c9e969', - ), - ), -); - - - - - - - -public static function getInstalledPackages() -{ -return array_keys(self::$installed['versions']); -} - - - - - - - - - -public static function isInstalled($packageName) -{ -return isset(self::$installed['versions'][$packageName]); -} - - - - - - - - - - - - - - -public static function satisfies(VersionParser $parser, $packageName, $constraint) -{ -$constraint = $parser->parseConstraints($constraint); -$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); - -return $provided->matches($constraint); -} - - - - - - - - - - -public static function getVersionRanges($packageName) -{ -if (!isset(self::$installed['versions'][$packageName])) { -throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); -} - -$ranges = array(); -if (isset(self::$installed['versions'][$packageName]['pretty_version'])) { -$ranges[] = self::$installed['versions'][$packageName]['pretty_version']; -} -if (array_key_exists('aliases', self::$installed['versions'][$packageName])) { -$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']); -} -if (array_key_exists('replaced', self::$installed['versions'][$packageName])) { -$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']); -} -if (array_key_exists('provided', self::$installed['versions'][$packageName])) { -$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']); -} - -return implode(' || ', $ranges); -} - - - - - -public static function getVersion($packageName) -{ -if (!isset(self::$installed['versions'][$packageName])) { -throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); -} - -if (!isset(self::$installed['versions'][$packageName]['version'])) { -return null; -} - -return self::$installed['versions'][$packageName]['version']; -} - - - - - -public static function getPrettyVersion($packageName) -{ -if (!isset(self::$installed['versions'][$packageName])) { -throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); -} - -if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) { -return null; -} - -return self::$installed['versions'][$packageName]['pretty_version']; -} - - - - - -public static function getReference($packageName) -{ -if (!isset(self::$installed['versions'][$packageName])) { -throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); -} - -if (!isset(self::$installed['versions'][$packageName]['reference'])) { -return null; -} - -return self::$installed['versions'][$packageName]['reference']; -} - - - - - -public static function getRootPackage() -{ -return self::$installed['root']; -} - - - - - - - -public static function getRawData() -{ -return self::$installed; -} - - - - - - - - - - - - - - - - - - - -public static function reload($data) -{ -self::$installed = $data; -} -} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE deleted file mode 100644 index f27399a0..00000000 --- a/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php deleted file mode 100644 index b26f1b13..00000000 --- a/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,10 +0,0 @@ - $vendorDir . '/composer/InstalledVersions.php', -); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php deleted file mode 100644 index 60c58be6..00000000 --- a/vendor/composer/autoload_files.php +++ /dev/null @@ -1,81 +0,0 @@ - $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', - 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', - 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', - '9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php', - '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', - 'abede361264e2ae69ec1eee813a101af' => $vendorDir . '/markbaker/complex/classes/src/functions/abs.php', - '21a5860fbef5be28db5ddfbc3cca67c4' => $vendorDir . '/markbaker/complex/classes/src/functions/acos.php', - '1546e3f9d127f2a9bb2d1b6c31c26ef1' => $vendorDir . '/markbaker/complex/classes/src/functions/acosh.php', - 'd2516f7f4fba5ea5905f494b4a8262e0' => $vendorDir . '/markbaker/complex/classes/src/functions/acot.php', - '4511163d560956219b96882c0980b65e' => $vendorDir . '/markbaker/complex/classes/src/functions/acoth.php', - 'c361f5616dc2a8da4fa3e137077cd4ea' => $vendorDir . '/markbaker/complex/classes/src/functions/acsc.php', - '02d68920fc98da71991ce569c91df0f6' => $vendorDir . '/markbaker/complex/classes/src/functions/acsch.php', - '88e19525eae308b4a6aa3419364875d3' => $vendorDir . '/markbaker/complex/classes/src/functions/argument.php', - '60e8e2d0827b58bfc904f13957e51849' => $vendorDir . '/markbaker/complex/classes/src/functions/asec.php', - '13d2f040713999eab66c359b4d79871d' => $vendorDir . '/markbaker/complex/classes/src/functions/asech.php', - '838ab38beb32c68a79d3cd2c007d5a04' => $vendorDir . '/markbaker/complex/classes/src/functions/asin.php', - 'bb28eccd0f8f008333a1b3c163d604ac' => $vendorDir . '/markbaker/complex/classes/src/functions/asinh.php', - '9e483de83558c98f7d3feaa402c78cb3' => $vendorDir . '/markbaker/complex/classes/src/functions/atan.php', - '36b74b5b765ded91ee58c8ee3c0e85e3' => $vendorDir . '/markbaker/complex/classes/src/functions/atanh.php', - '05c15ee9510da7fd6bf6136f436500c0' => $vendorDir . '/markbaker/complex/classes/src/functions/conjugate.php', - 'd3208dfbce2505e370788f9f22f6785f' => $vendorDir . '/markbaker/complex/classes/src/functions/cos.php', - '141cf1fb3a3046f8b64534b0ebab33ca' => $vendorDir . '/markbaker/complex/classes/src/functions/cosh.php', - 'be660df75fd0dbe7fa7c03b7434b3294' => $vendorDir . '/markbaker/complex/classes/src/functions/cot.php', - '01e31ea298a51bc9e91517e3ce6b9e76' => $vendorDir . '/markbaker/complex/classes/src/functions/coth.php', - '803ddd97f7b1da68982a7b087c3476f6' => $vendorDir . '/markbaker/complex/classes/src/functions/csc.php', - '3001cdfd101ec3c32da34ee43c2e149b' => $vendorDir . '/markbaker/complex/classes/src/functions/csch.php', - '77b2d7629ef2a93fabb8c56754a91051' => $vendorDir . '/markbaker/complex/classes/src/functions/exp.php', - '4a4471296dec796c21d4f4b6552396a9' => $vendorDir . '/markbaker/complex/classes/src/functions/inverse.php', - 'c3e9897e1744b88deb56fcdc39d34d85' => $vendorDir . '/markbaker/complex/classes/src/functions/ln.php', - 'a83cacf2de942cff288de15a83afd26d' => $vendorDir . '/markbaker/complex/classes/src/functions/log2.php', - '6a861dacc9ee2f3061241d4c7772fa21' => $vendorDir . '/markbaker/complex/classes/src/functions/log10.php', - '4d2522d968c8ba78d6c13548a1b4200e' => $vendorDir . '/markbaker/complex/classes/src/functions/negative.php', - 'fd587ca933fc0447fa5ab4843bdd97f7' => $vendorDir . '/markbaker/complex/classes/src/functions/pow.php', - '383ef01c62028fc78cd4388082fce3c2' => $vendorDir . '/markbaker/complex/classes/src/functions/rho.php', - '150fbd1b95029dc47292da97ecab9375' => $vendorDir . '/markbaker/complex/classes/src/functions/sec.php', - '549abd9bae174286d660bdaa07407c68' => $vendorDir . '/markbaker/complex/classes/src/functions/sech.php', - '6bfbf5eaea6b17a0ed85cb21ba80370c' => $vendorDir . '/markbaker/complex/classes/src/functions/sin.php', - '22efe13f1a497b8e199540ae2d9dc59c' => $vendorDir . '/markbaker/complex/classes/src/functions/sinh.php', - 'e90135ab8e787795a509ed7147de207d' => $vendorDir . '/markbaker/complex/classes/src/functions/sqrt.php', - 'bb0a7923ffc6a90919cd64ec54ff06bc' => $vendorDir . '/markbaker/complex/classes/src/functions/tan.php', - '2d302f32ce0fd4e433dd91c5bb404a28' => $vendorDir . '/markbaker/complex/classes/src/functions/tanh.php', - '24dd4658a952171a4ee79218c4f9fd06' => $vendorDir . '/markbaker/complex/classes/src/functions/theta.php', - 'e49b7876281d6f5bc39536dde96d1f4a' => $vendorDir . '/markbaker/complex/classes/src/operations/add.php', - '47596e02b43cd6da7700134fd08f88cf' => $vendorDir . '/markbaker/complex/classes/src/operations/subtract.php', - '883af48563631547925fa4c3b48ead07' => $vendorDir . '/markbaker/complex/classes/src/operations/multiply.php', - 'f190e3308e6ca23234a2875edc985c03' => $vendorDir . '/markbaker/complex/classes/src/operations/divideby.php', - 'ac9e33ce6841aa5bf5d16d465a2f03a7' => $vendorDir . '/markbaker/complex/classes/src/operations/divideinto.php', - '9d8e013a5160a09477beb8e44f8ae97b' => $vendorDir . '/markbaker/matrix/classes/src/functions/adjoint.php', - '6e78d1bdea6248d6aa117229efae50f2' => $vendorDir . '/markbaker/matrix/classes/src/functions/antidiagonal.php', - '4623d87924d94f5412fe5afbf1cef31d' => $vendorDir . '/markbaker/matrix/classes/src/functions/cofactors.php', - '901fd1f6950a637ca85f66b701a45e13' => $vendorDir . '/markbaker/matrix/classes/src/functions/determinant.php', - '83057abc0e4acc99ba80154ee5d02a49' => $vendorDir . '/markbaker/matrix/classes/src/functions/diagonal.php', - '07b7fd7a434451149b4fd477fca0ce06' => $vendorDir . '/markbaker/matrix/classes/src/functions/identity.php', - 'c8d43b340583e07ae89f2a3baef2cf89' => $vendorDir . '/markbaker/matrix/classes/src/functions/inverse.php', - '499bb10ed7a3aee2ba4c09a31a85e8d1' => $vendorDir . '/markbaker/matrix/classes/src/functions/minors.php', - '1cad2e6414d652e8b1c64e8967f6f37d' => $vendorDir . '/markbaker/matrix/classes/src/functions/trace.php', - '95a7f134ac17161d07def442b3b737e8' => $vendorDir . '/markbaker/matrix/classes/src/functions/transpose.php', - 'b3a6bc628377118d4b4b8ba08d1eb949' => $vendorDir . '/markbaker/matrix/classes/src/operations/add.php', - '5fef6d0e407f3f8887266dfa4a6c534c' => $vendorDir . '/markbaker/matrix/classes/src/operations/directsum.php', - '684ba247e1385946e3babdaa054119de' => $vendorDir . '/markbaker/matrix/classes/src/operations/subtract.php', - 'aa53dcba601214d17ad405b7c291b7e8' => $vendorDir . '/markbaker/matrix/classes/src/operations/multiply.php', - '75c79eb1b25749b05a47976f32b0d8a2' => $vendorDir . '/markbaker/matrix/classes/src/operations/divideby.php', - '6ab8ad87a734f276a6bcd5a0fe1289be' => $vendorDir . '/markbaker/matrix/classes/src/operations/divideinto.php', - '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', - 'd767e4fc2dc52fe66584ab8c6684783e' => $vendorDir . '/adbario/php-dot-notation/src/helpers.php', - '65fec9ebcfbb3cbb4fd0d519687aea01' => $vendorDir . '/danielstjules/stringy/src/Create.php', - 'b067bc7112e384b61c701452d53a14a8' => $vendorDir . '/mtdowling/jmespath.php/src/JmesPath.php', - '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', - '66453932bc1be9fb2f910a27947d11b6' => $vendorDir . '/alibabacloud/client/src/Functions.php', - '841780ea2e1d6545ea3a253239d59c05' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/functions.php', - '1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php', -); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php deleted file mode 100644 index f2a05097..00000000 --- a/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,11 +0,0 @@ - array($vendorDir . '/qcloud/cos-sdk-v5/src'), - '' => array($baseDir . '/extend'), -); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php deleted file mode 100644 index e458f009..00000000 --- a/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,46 +0,0 @@ - array($vendorDir . '/topthink/think-view/src'), - 'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'), - 'think\\app\\' => array($vendorDir . '/topthink/think-multi-app/src'), - 'think\\' => array($vendorDir . '/topthink/framework/src/think', $vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/think-template/src'), - 'jianyan\\excel\\' => array($vendorDir . '/jianyan74/php-excel/src'), - 'clagiordano\\weblibs\\configmanager\\' => array($vendorDir . '/clagiordano/weblibs-configmanager/src'), - 'app\\' => array($baseDir . '/app'), - 'Test\\' => array($vendorDir . '/zhongshaofa/easy-admin/tests', $vendorDir . '/zhongshaofa/thinkphp-log-trace/tests'), - 'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'), - 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), - 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), - 'Stringy\\' => array($vendorDir . '/danielstjules/stringy/src'), - 'Qiniu\\' => array($vendorDir . '/qiniu/php-sdk/src/Qiniu'), - 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), - 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), - 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), - 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), - 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), - 'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'), - 'OSS\\' => array($vendorDir . '/aliyuncs/oss-sdk-php/src/OSS'), - 'MockApp\\' => array($vendorDir . '/zhongshaofa/easy-admin/mock_app'), - 'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'), - 'LogTrace\\' => array($vendorDir . '/zhongshaofa/thinkphp-log-trace/src'), - 'League\\Flysystem\\Cached\\' => array($vendorDir . '/league/flysystem-cached-adapter/src'), - 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), - 'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'), - 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), - 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), - 'GuzzleHttp\\Command\\Guzzle\\' => array($vendorDir . '/guzzlehttp/guzzle-services/src'), - 'GuzzleHttp\\Command\\' => array($vendorDir . '/guzzlehttp/command/src'), - 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), - 'EasyAdmin\\' => array($vendorDir . '/zhongshaofa/easy-admin/src'), - 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer'), - 'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations'), - 'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'), - 'AlibabaCloud\\Client\\' => array($vendorDir . '/alibabacloud/client/src'), - 'Adbar\\' => array($vendorDir . '/adbario/php-dot-notation/src'), -); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php deleted file mode 100644 index 8e38231b..00000000 --- a/vendor/composer/autoload_real.php +++ /dev/null @@ -1,75 +0,0 @@ -= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit6bad1cb7ba829cb65a670b5323a9e093::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->register(true); - - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit6bad1cb7ba829cb65a670b5323a9e093::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire6bad1cb7ba829cb65a670b5323a9e093($fileIdentifier, $file); - } - - return $loader; - } -} - -function composerRequire6bad1cb7ba829cb65a670b5323a9e093($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - require $file; - - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - } -} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php deleted file mode 100644 index 7b96af2c..00000000 --- a/vendor/composer/autoload_static.php +++ /dev/null @@ -1,359 +0,0 @@ - __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', - 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', - 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', - '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', - '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - 'abede361264e2ae69ec1eee813a101af' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/abs.php', - '21a5860fbef5be28db5ddfbc3cca67c4' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acos.php', - '1546e3f9d127f2a9bb2d1b6c31c26ef1' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acosh.php', - 'd2516f7f4fba5ea5905f494b4a8262e0' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acot.php', - '4511163d560956219b96882c0980b65e' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acoth.php', - 'c361f5616dc2a8da4fa3e137077cd4ea' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acsc.php', - '02d68920fc98da71991ce569c91df0f6' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acsch.php', - '88e19525eae308b4a6aa3419364875d3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/argument.php', - '60e8e2d0827b58bfc904f13957e51849' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asec.php', - '13d2f040713999eab66c359b4d79871d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asech.php', - '838ab38beb32c68a79d3cd2c007d5a04' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asin.php', - 'bb28eccd0f8f008333a1b3c163d604ac' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asinh.php', - '9e483de83558c98f7d3feaa402c78cb3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/atan.php', - '36b74b5b765ded91ee58c8ee3c0e85e3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/atanh.php', - '05c15ee9510da7fd6bf6136f436500c0' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/conjugate.php', - 'd3208dfbce2505e370788f9f22f6785f' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cos.php', - '141cf1fb3a3046f8b64534b0ebab33ca' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cosh.php', - 'be660df75fd0dbe7fa7c03b7434b3294' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cot.php', - '01e31ea298a51bc9e91517e3ce6b9e76' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/coth.php', - '803ddd97f7b1da68982a7b087c3476f6' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/csc.php', - '3001cdfd101ec3c32da34ee43c2e149b' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/csch.php', - '77b2d7629ef2a93fabb8c56754a91051' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/exp.php', - '4a4471296dec796c21d4f4b6552396a9' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/inverse.php', - 'c3e9897e1744b88deb56fcdc39d34d85' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/ln.php', - 'a83cacf2de942cff288de15a83afd26d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/log2.php', - '6a861dacc9ee2f3061241d4c7772fa21' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/log10.php', - '4d2522d968c8ba78d6c13548a1b4200e' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/negative.php', - 'fd587ca933fc0447fa5ab4843bdd97f7' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/pow.php', - '383ef01c62028fc78cd4388082fce3c2' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/rho.php', - '150fbd1b95029dc47292da97ecab9375' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sec.php', - '549abd9bae174286d660bdaa07407c68' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sech.php', - '6bfbf5eaea6b17a0ed85cb21ba80370c' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sin.php', - '22efe13f1a497b8e199540ae2d9dc59c' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sinh.php', - 'e90135ab8e787795a509ed7147de207d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sqrt.php', - 'bb0a7923ffc6a90919cd64ec54ff06bc' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/tan.php', - '2d302f32ce0fd4e433dd91c5bb404a28' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/tanh.php', - '24dd4658a952171a4ee79218c4f9fd06' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/theta.php', - 'e49b7876281d6f5bc39536dde96d1f4a' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/add.php', - '47596e02b43cd6da7700134fd08f88cf' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/subtract.php', - '883af48563631547925fa4c3b48ead07' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/multiply.php', - 'f190e3308e6ca23234a2875edc985c03' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/divideby.php', - 'ac9e33ce6841aa5bf5d16d465a2f03a7' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/divideinto.php', - '9d8e013a5160a09477beb8e44f8ae97b' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/adjoint.php', - '6e78d1bdea6248d6aa117229efae50f2' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/antidiagonal.php', - '4623d87924d94f5412fe5afbf1cef31d' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/cofactors.php', - '901fd1f6950a637ca85f66b701a45e13' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/determinant.php', - '83057abc0e4acc99ba80154ee5d02a49' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/diagonal.php', - '07b7fd7a434451149b4fd477fca0ce06' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/identity.php', - 'c8d43b340583e07ae89f2a3baef2cf89' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/inverse.php', - '499bb10ed7a3aee2ba4c09a31a85e8d1' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/minors.php', - '1cad2e6414d652e8b1c64e8967f6f37d' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/trace.php', - '95a7f134ac17161d07def442b3b737e8' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/transpose.php', - 'b3a6bc628377118d4b4b8ba08d1eb949' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/add.php', - '5fef6d0e407f3f8887266dfa4a6c534c' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/directsum.php', - '684ba247e1385946e3babdaa054119de' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/subtract.php', - 'aa53dcba601214d17ad405b7c291b7e8' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/multiply.php', - '75c79eb1b25749b05a47976f32b0d8a2' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/divideby.php', - '6ab8ad87a734f276a6bcd5a0fe1289be' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/divideinto.php', - '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', - 'd767e4fc2dc52fe66584ab8c6684783e' => __DIR__ . '/..' . '/adbario/php-dot-notation/src/helpers.php', - '65fec9ebcfbb3cbb4fd0d519687aea01' => __DIR__ . '/..' . '/danielstjules/stringy/src/Create.php', - 'b067bc7112e384b61c701452d53a14a8' => __DIR__ . '/..' . '/mtdowling/jmespath.php/src/JmesPath.php', - '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', - '66453932bc1be9fb2f910a27947d11b6' => __DIR__ . '/..' . '/alibabacloud/client/src/Functions.php', - '841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php', - '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', - ); - - public static $prefixLengthsPsr4 = array ( - 't' => - array ( - 'think\\view\\driver\\' => 18, - 'think\\captcha\\' => 14, - 'think\\app\\' => 10, - 'think\\' => 6, - ), - 'j' => - array ( - 'jianyan\\excel\\' => 14, - ), - 'c' => - array ( - 'clagiordano\\weblibs\\configmanager\\' => 34, - ), - 'a' => - array ( - 'app\\' => 4, - ), - 'T' => - array ( - 'Test\\' => 5, - ), - 'S' => - array ( - 'Symfony\\Polyfill\\Php72\\' => 23, - 'Symfony\\Polyfill\\Mbstring\\' => 26, - 'Symfony\\Component\\VarDumper\\' => 28, - 'Stringy\\' => 8, - ), - 'Q' => - array ( - 'Qiniu\\' => 6, - ), - 'P' => - array ( - 'Psr\\SimpleCache\\' => 16, - 'Psr\\Log\\' => 8, - 'Psr\\Http\\Message\\' => 17, - 'Psr\\Container\\' => 14, - 'Psr\\Cache\\' => 10, - 'PhpOffice\\PhpSpreadsheet\\' => 25, - ), - 'O' => - array ( - 'OSS\\' => 4, - ), - 'M' => - array ( - 'MockApp\\' => 8, - 'Matrix\\' => 7, - ), - 'L' => - array ( - 'LogTrace\\' => 9, - 'League\\Flysystem\\Cached\\' => 24, - 'League\\Flysystem\\' => 17, - ), - 'J' => - array ( - 'JmesPath\\' => 9, - ), - 'G' => - array ( - 'GuzzleHttp\\Psr7\\' => 16, - 'GuzzleHttp\\Promise\\' => 19, - 'GuzzleHttp\\Command\\Guzzle\\' => 26, - 'GuzzleHttp\\Command\\' => 19, - 'GuzzleHttp\\' => 11, - ), - 'E' => - array ( - 'EasyAdmin\\' => 10, - ), - 'D' => - array ( - 'Doctrine\\Common\\Lexer\\' => 22, - 'Doctrine\\Common\\Annotations\\' => 28, - ), - 'C' => - array ( - 'Complex\\' => 8, - ), - 'A' => - array ( - 'AlibabaCloud\\Client\\' => 20, - 'Adbar\\' => 6, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'think\\view\\driver\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-view/src', - ), - 'think\\captcha\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-captcha/src', - ), - 'think\\app\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-multi-app/src', - ), - 'think\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/framework/src/think', - 1 => __DIR__ . '/..' . '/topthink/think-helper/src', - 2 => __DIR__ . '/..' . '/topthink/think-orm/src', - 3 => __DIR__ . '/..' . '/topthink/think-template/src', - ), - 'jianyan\\excel\\' => - array ( - 0 => __DIR__ . '/..' . '/jianyan74/php-excel/src', - ), - 'clagiordano\\weblibs\\configmanager\\' => - array ( - 0 => __DIR__ . '/..' . '/clagiordano/weblibs-configmanager/src', - ), - 'app\\' => - array ( - 0 => __DIR__ . '/../..' . '/app', - ), - 'Test\\' => - array ( - 0 => __DIR__ . '/..' . '/zhongshaofa/easy-admin/tests', - 1 => __DIR__ . '/..' . '/zhongshaofa/thinkphp-log-trace/tests', - ), - 'Symfony\\Polyfill\\Php72\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-php72', - ), - 'Symfony\\Polyfill\\Mbstring\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', - ), - 'Symfony\\Component\\VarDumper\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/var-dumper', - ), - 'Stringy\\' => - array ( - 0 => __DIR__ . '/..' . '/danielstjules/stringy/src', - ), - 'Qiniu\\' => - array ( - 0 => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu', - ), - 'Psr\\SimpleCache\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/simple-cache/src', - ), - 'Psr\\Log\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', - ), - 'Psr\\Http\\Message\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/http-message/src', - ), - 'Psr\\Container\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/container/src', - ), - 'Psr\\Cache\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/cache/src', - ), - 'PhpOffice\\PhpSpreadsheet\\' => - array ( - 0 => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet', - ), - 'OSS\\' => - array ( - 0 => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS', - ), - 'MockApp\\' => - array ( - 0 => __DIR__ . '/..' . '/zhongshaofa/easy-admin/mock_app', - ), - 'Matrix\\' => - array ( - 0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src', - ), - 'LogTrace\\' => - array ( - 0 => __DIR__ . '/..' . '/zhongshaofa/thinkphp-log-trace/src', - ), - 'League\\Flysystem\\Cached\\' => - array ( - 0 => __DIR__ . '/..' . '/league/flysystem-cached-adapter/src', - ), - 'League\\Flysystem\\' => - array ( - 0 => __DIR__ . '/..' . '/league/flysystem/src', - ), - 'JmesPath\\' => - array ( - 0 => __DIR__ . '/..' . '/mtdowling/jmespath.php/src', - ), - 'GuzzleHttp\\Psr7\\' => - array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', - ), - 'GuzzleHttp\\Promise\\' => - array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src', - ), - 'GuzzleHttp\\Command\\Guzzle\\' => - array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle-services/src', - ), - 'GuzzleHttp\\Command\\' => - array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/command/src', - ), - 'GuzzleHttp\\' => - array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', - ), - 'EasyAdmin\\' => - array ( - 0 => __DIR__ . '/..' . '/zhongshaofa/easy-admin/src', - ), - 'Doctrine\\Common\\Lexer\\' => - array ( - 0 => __DIR__ . '/..' . '/doctrine/lexer/lib/Doctrine/Common/Lexer', - ), - 'Doctrine\\Common\\Annotations\\' => - array ( - 0 => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations', - ), - 'Complex\\' => - array ( - 0 => __DIR__ . '/..' . '/markbaker/complex/classes/src', - ), - 'AlibabaCloud\\Client\\' => - array ( - 0 => __DIR__ . '/..' . '/alibabacloud/client/src', - ), - 'Adbar\\' => - array ( - 0 => __DIR__ . '/..' . '/adbario/php-dot-notation/src', - ), - ); - - public static $prefixesPsr0 = array ( - 'Q' => - array ( - 'Qcloud\\Cos\\' => - array ( - 0 => __DIR__ . '/..' . '/qcloud/cos-sdk-v5/src', - ), - ), - ); - - public static $fallbackDirsPsr0 = array ( - 0 => __DIR__ . '/../..' . '/extend', - ); - - public static $classMap = array ( - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit6bad1cb7ba829cb65a670b5323a9e093::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit6bad1cb7ba829cb65a670b5323a9e093::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit6bad1cb7ba829cb65a670b5323a9e093::$prefixesPsr0; - $loader->fallbackDirsPsr0 = ComposerStaticInit6bad1cb7ba829cb65a670b5323a9e093::$fallbackDirsPsr0; - $loader->classMap = ComposerStaticInit6bad1cb7ba829cb65a670b5323a9e093::$classMap; - - }, null, ClassLoader::class); - } -} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json deleted file mode 100644 index ea094f3a..00000000 --- a/vendor/composer/installed.json +++ /dev/null @@ -1,2599 +0,0 @@ -{ - "packages": [ - { - "name": "adbario/php-dot-notation", - "version": "2.2.0", - "version_normalized": "2.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/adbario/php-dot-notation.git", - "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/eee4fc81296531e6aafba4c2bbccfc5adab1676e", - "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-json": "*", - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.0|^5.0|^6.0", - "squizlabs/php_codesniffer": "^3.0" - }, - "time": "2019-01-01T23:59:15+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Adbar\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Riku Särkinen", - "email": "riku@adbar.io" - } - ], - "description": "PHP dot notation access to arrays", - "homepage": "https://github.com/adbario/php-dot-notation", - "keywords": [ - "ArrayAccess", - "dotnotation" - ], - "install-path": "../adbario/php-dot-notation" - }, - { - "name": "alibabacloud/client", - "version": "1.5.18", - "version_normalized": "1.5.18.0", - "source": { - "type": "git", - "url": "https://github.com/aliyun/openapi-sdk-php-client.git", - "reference": "5dcf7b8fdfa64abdae7a5ca867289baf95e8e12a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/aliyun/openapi-sdk-php-client/zipball/5dcf7b8fdfa64abdae7a5ca867289baf95e8e12a", - "reference": "5dcf7b8fdfa64abdae7a5ca867289baf95e8e12a", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "adbario/php-dot-notation": "^2.2", - "clagiordano/weblibs-configmanager": "^1.0", - "danielstjules/stringy": "^3.1", - "ext-curl": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-openssl": "*", - "ext-simplexml": "*", - "ext-xmlwriter": "*", - "guzzlehttp/guzzle": "^6.3", - "mtdowling/jmespath.php": "^2.4", - "php": ">=5.5" - }, - "require-dev": { - "composer/composer": "^1.8", - "drupal/coder": "^8.3", - "ext-dom": "*", - "ext-pcre": "*", - "ext-sockets": "*", - "ext-spl": "*", - "league/climate": "^3.2.4", - "mikey179/vfsstream": "^1.6", - "monolog/monolog": "^1.24", - "phpunit/phpunit": "^4.8.35|^5.4.3", - "psr/cache": "^1.0", - "symfony/dotenv": "^3.4", - "symfony/var-dumper": "^3.4" - }, - "suggest": { - "ext-sockets": "To use client-side monitoring" - }, - "time": "2019-10-11T11:09:47+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "AlibabaCloud\\Client\\": "src" - }, - "files": [ - "src/Functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Alibaba Cloud SDK", - "email": "sdk-team@alibabacloud.com", - "homepage": "http://www.alibabacloud.com" - } - ], - "description": "Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project", - "homepage": "https://www.alibabacloud.com/", - "keywords": [ - "alibaba", - "alibabacloud", - "aliyun", - "client", - "cloud", - "library", - "sdk", - "tool" - ], - "install-path": "../alibabacloud/client" - }, - { - "name": "aliyuncs/oss-sdk-php", - "version": "v2.3.0", - "version_normalized": "2.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/aliyun/aliyun-oss-php-sdk.git", - "reference": "e69f57916678458642ac9d2fd341ae78a56996c8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/e69f57916678458642ac9d2fd341ae78a56996c8", - "reference": "e69f57916678458642ac9d2fd341ae78a56996c8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "~1.0" - }, - "time": "2018-01-08T06:59:35+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "OSS\\": "src/OSS" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Aliyuncs", - "homepage": "http://www.aliyun.com" - } - ], - "description": "Aliyun OSS SDK for PHP", - "homepage": "http://www.aliyun.com/product/oss/", - "install-path": "../aliyuncs/oss-sdk-php" - }, - { - "name": "clagiordano/weblibs-configmanager", - "version": "v1.0.7", - "version_normalized": "1.0.7.0", - "source": { - "type": "git", - "url": "https://github.com/clagiordano/weblibs-configmanager.git", - "reference": "6ef4c27354368deb2f54b39bbe06601da8c873a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/clagiordano/weblibs-configmanager/zipball/6ef4c27354368deb2f54b39bbe06601da8c873a0", - "reference": "6ef4c27354368deb2f54b39bbe06601da8c873a0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.4" - }, - "require-dev": { - "clagiordano/phpunit-result-printer": "^1", - "phpunit/phpunit": "^4.8" - }, - "time": "2019-09-25T22:10:10+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "clagiordano\\weblibs\\configmanager\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0-or-later" - ], - "authors": [ - { - "name": "Claudio Giordano", - "email": "claudio.giordano@autistici.org", - "role": "Developer" - } - ], - "description": "weblibs-configmanager is a tool library for easily read and access to php config array file and direct read/write configuration file / object", - "keywords": [ - "clagiordano", - "configuration", - "manager", - "tool", - "weblibs" - ], - "install-path": "../clagiordano/weblibs-configmanager" - }, - { - "name": "danielstjules/stringy", - "version": "3.1.0", - "version_normalized": "3.1.0.0", - "source": { - "type": "git", - "url": "https://github.com/danielstjules/Stringy.git", - "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", - "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.4.0", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "time": "2017-06-12T01:10:27+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Stringy\\": "src/" - }, - "files": [ - "src/Create.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel St. Jules", - "email": "danielst.jules@gmail.com", - "homepage": "http://www.danielstjules.com" - } - ], - "description": "A string manipulation library with multibyte support", - "homepage": "https://github.com/danielstjules/Stringy", - "keywords": [ - "UTF", - "helpers", - "manipulation", - "methods", - "multibyte", - "string", - "utf-8", - "utility", - "utils" - ], - "install-path": "../danielstjules/stringy" - }, - { - "name": "doctrine/annotations", - "version": "1.13.2", - "version_normalized": "1.13.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "doctrine/lexer": "1.*", - "ext-tokenizer": "*", - "php": "^7.1 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" - }, - "time": "2021-08-05T19:00:23+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.2" - }, - "install-path": "../doctrine/annotations" - }, - { - "name": "doctrine/lexer", - "version": "1.2.1", - "version_normalized": "1.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" - }, - "time": "2020-05-25T17:44:05+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "support": { - "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", - "type": "tidelift" - } - ], - "install-path": "../doctrine/lexer" - }, - { - "name": "eaglewu/swoole-ide-helper", - "version": "dev-master", - "version_normalized": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wudi/swoole-ide-helper.git", - "reference": "a255daa05feffbf4b88d59897a9470696d2fe259" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wudi/swoole-ide-helper/zipball/a255daa05feffbf4b88d59897a9470696d2fe259", - "reference": "a255daa05feffbf4b88d59897a9470696d2fe259", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "time": "2019-11-02T07:18:22+00:00", - "type": "library", - "installation-source": "dist", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "eagle", - "email": "eaglewudi@gmail.com", - "role": "lead" - } - ], - "description": "Swoole IDE Helper, to improve auto-completion", - "keywords": [ - "autocomplete", - "codeintel", - "helper", - "ide", - "netbeans", - "phpdoc", - "phpstorm", - "sublime", - "swoole" - ], - "install-path": "../eaglewu/swoole-ide-helper" - }, - { - "name": "guzzlehttp/command", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/command.git", - "reference": "2aaa2521a8f8269d6f5dfc13fe2af12c76921034" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/command/zipball/2aaa2521a8f8269d6f5dfc13fe2af12c76921034", - "reference": "2aaa2521a8f8269d6f5dfc13fe2af12c76921034", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "guzzlehttp/guzzle": "^6.2", - "guzzlehttp/promises": "~1.3", - "guzzlehttp/psr7": "~1.0", - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "time": "2016-11-24T13:34:15+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.9-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "GuzzleHttp\\Command\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - } - ], - "description": "Provides the foundation for building command-based web service clients", - "install-path": "../guzzlehttp/command" - }, - { - "name": "guzzlehttp/guzzle", - "version": "6.4.1", - "version_normalized": "6.4.1.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "0895c932405407fd3a7368b6910c09a24d26db11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11", - "reference": "0895c932405407fd3a7368b6910c09a24d26db11", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" - }, - "suggest": { - "psr/log": "Required for using the Log middleware" - }, - "time": "2019-10-23T15:58:00+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "install-path": "../guzzlehttp/guzzle" - }, - { - "name": "guzzlehttp/guzzle-services", - "version": "1.1.3", - "version_normalized": "1.1.3.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle-services.git", - "reference": "9e3abf20161cbf662d616cbb995f2811771759f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle-services/zipball/9e3abf20161cbf662d616cbb995f2811771759f7", - "reference": "9e3abf20161cbf662d616cbb995f2811771759f7", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "guzzlehttp/command": "~1.0", - "guzzlehttp/guzzle": "^6.2", - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "gimler/guzzle-description-loader": "^0.0.4" - }, - "time": "2017-10-06T14:32:02+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "GuzzleHttp\\Command\\Guzzle\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - }, - { - "name": "Stefano Kowalke", - "email": "blueduck@mail.org", - "homepage": "https://github.com/konafets" - } - ], - "description": "Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.", - "install-path": "../guzzlehttp/guzzle-services" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "version_normalized": "1.3.1.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "time": "2016-12-20T10:07:11+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "install-path": "../guzzlehttp/promises" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.6.1", - "version_normalized": "1.6.1.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" - }, - "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" - }, - "time": "2019-07-01T23:21:34+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "install-path": "../guzzlehttp/psr7" - }, - { - "name": "jianyan74/php-excel", - "version": "1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/jianyan74/php-excel.git", - "reference": "5b569e16ba35fa48ff7449a7f593172f8284f66b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jianyan74/php-excel/zipball/5b569e16ba35fa48ff7449a7f593172f8284f66b", - "reference": "5b569e16ba35fa48ff7449a7f593172f8284f66b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.0", - "phpoffice/phpspreadsheet": "^1.3" - }, - "time": "2020-03-17T03:37:43+00:00", - "type": "extension", - "installation-source": "dist", - "autoload": { - "psr-4": { - "jianyan\\excel\\": "./src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "jianyan74" - } - ], - "description": "php excel 导入导出", - "keywords": [ - "csv", - "excel", - "html", - "jianyan74", - "xls", - "xlsx" - ], - "install-path": "../jianyan74/php-excel" - }, - { - "name": "league/flysystem", - "version": "1.0.57", - "version_normalized": "1.0.57.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", - "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-fileinfo": "*", - "php": ">=5.5.9" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.10" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "time": "2019-10-16T21:01:05+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "install-path": "../league/flysystem" - }, - { - "name": "league/flysystem-cached-adapter", - "version": "1.0.9", - "version_normalized": "1.0.9.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "league/flysystem": "~1.0", - "psr/cache": "^1.0.0" - }, - "require-dev": { - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12" - }, - "suggest": { - "ext-phpredis": "Pure C implemented extension for PHP" - }, - "time": "2018-07-09T20:51:04+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\Flysystem\\Cached\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "frankdejonge", - "email": "info@frenky.net" - } - ], - "description": "An adapter decorator to enable meta-data caching.", - "install-path": "../league/flysystem-cached-adapter" - }, - { - "name": "markbaker/complex", - "version": "1.4.8", - "version_normalized": "1.4.8.0", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPComplex.git", - "reference": "8eaa40cceec7bf0518187530b2e63871be661b72" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/8eaa40cceec7bf0518187530b2e63871be661b72", - "reference": "8eaa40cceec7bf0518187530b2e63871be661b72", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", - "phpcompatibility/php-compatibility": "^9.0", - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "2.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.35|^5.4.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "^3.4.0" - }, - "time": "2020-03-11T20:15:49+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Complex\\": "classes/src/" - }, - "files": [ - "classes/src/functions/abs.php", - "classes/src/functions/acos.php", - "classes/src/functions/acosh.php", - "classes/src/functions/acot.php", - "classes/src/functions/acoth.php", - "classes/src/functions/acsc.php", - "classes/src/functions/acsch.php", - "classes/src/functions/argument.php", - "classes/src/functions/asec.php", - "classes/src/functions/asech.php", - "classes/src/functions/asin.php", - "classes/src/functions/asinh.php", - "classes/src/functions/atan.php", - "classes/src/functions/atanh.php", - "classes/src/functions/conjugate.php", - "classes/src/functions/cos.php", - "classes/src/functions/cosh.php", - "classes/src/functions/cot.php", - "classes/src/functions/coth.php", - "classes/src/functions/csc.php", - "classes/src/functions/csch.php", - "classes/src/functions/exp.php", - "classes/src/functions/inverse.php", - "classes/src/functions/ln.php", - "classes/src/functions/log2.php", - "classes/src/functions/log10.php", - "classes/src/functions/negative.php", - "classes/src/functions/pow.php", - "classes/src/functions/rho.php", - "classes/src/functions/sec.php", - "classes/src/functions/sech.php", - "classes/src/functions/sin.php", - "classes/src/functions/sinh.php", - "classes/src/functions/sqrt.php", - "classes/src/functions/tan.php", - "classes/src/functions/tanh.php", - "classes/src/functions/theta.php", - "classes/src/operations/add.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "description": "PHP Class for working with complex numbers", - "homepage": "https://github.com/MarkBaker/PHPComplex", - "keywords": [ - "complex", - "mathematics" - ], - "install-path": "../markbaker/complex" - }, - { - "name": "markbaker/matrix", - "version": "1.2.0", - "version_normalized": "1.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPMatrix.git", - "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/5348c5a67e3b75cd209d70103f916a93b1f1ed21", - "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "dev-master", - "phpcompatibility/php-compatibility": "dev-master", - "phploc/phploc": "^4", - "phpmd/phpmd": "dev-master", - "phpunit/phpunit": "^5.7", - "sebastian/phpcpd": "^3.0", - "squizlabs/php_codesniffer": "^3.0@dev" - }, - "time": "2019-10-06T11:29:25+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Matrix\\": "classes/src/" - }, - "files": [ - "classes/src/functions/adjoint.php", - "classes/src/functions/antidiagonal.php", - "classes/src/functions/cofactors.php", - "classes/src/functions/determinant.php", - "classes/src/functions/diagonal.php", - "classes/src/functions/identity.php", - "classes/src/functions/inverse.php", - "classes/src/functions/minors.php", - "classes/src/functions/trace.php", - "classes/src/functions/transpose.php", - "classes/src/operations/add.php", - "classes/src/operations/directsum.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "description": "PHP Class for working with matrices", - "homepage": "https://github.com/MarkBaker/PHPMatrix", - "keywords": [ - "mathematics", - "matrix", - "vector" - ], - "install-path": "../markbaker/matrix" - }, - { - "name": "mtdowling/jmespath.php", - "version": "2.4.0", - "version_normalized": "2.4.0.0", - "source": { - "type": "git", - "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "adcc9531682cf87dfda21e1fd5d0e7a41d292fac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/adcc9531682cf87dfda21e1fd5d0e7a41d292fac", - "reference": "adcc9531682cf87dfda21e1fd5d0e7a41d292fac", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "time": "2016-12-03T22:08:25+00:00", - "bin": [ - "bin/jp.php" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "JmesPath\\": "src/" - }, - "files": [ - "src/JmesPath.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Declaratively specify how to extract elements from a JSON document", - "keywords": [ - "json", - "jsonpath" - ], - "install-path": "../mtdowling/jmespath.php" - }, - { - "name": "phpoffice/phpspreadsheet", - "version": "1.12.0", - "version_normalized": "1.12.0.0", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "f79611d6dc1f6b7e8e30b738fc371b392001dbfd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/f79611d6dc1f6b7e8e30b738fc371b392001dbfd", - "reference": "f79611d6dc1f6b7e8e30b738fc371b392001dbfd", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-ctype": "*", - "ext-dom": "*", - "ext-fileinfo": "*", - "ext-gd": "*", - "ext-iconv": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-xml": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "ext-zip": "*", - "ext-zlib": "*", - "markbaker/complex": "^1.4", - "markbaker/matrix": "^1.2", - "php": "^7.1", - "psr/simple-cache": "^1.0" - }, - "require-dev": { - "dompdf/dompdf": "^0.8.3", - "friendsofphp/php-cs-fixer": "^2.16", - "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^8.0", - "phpcompatibility/php-compatibility": "^9.3", - "phpunit/phpunit": "^7.5", - "squizlabs/php_codesniffer": "^3.5", - "tecnickcom/tcpdf": "^6.3" - }, - "suggest": { - "dompdf/dompdf": "Option for rendering PDF with PDF Writer", - "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", - "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" - }, - "time": "2020-04-27T08:12:48+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Maarten Balliauw", - "homepage": "https://blog.maartenballiauw.be" - }, - { - "name": "Mark Baker", - "homepage": "https://markbakeruk.net" - }, - { - "name": "Franck Lefevre", - "homepage": "https://rootslabs.net" - }, - { - "name": "Erik Tilt" - }, - { - "name": "Adrien Crivelli" - } - ], - "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", - "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", - "keywords": [ - "OpenXML", - "excel", - "gnumeric", - "ods", - "php", - "spreadsheet", - "xls", - "xlsx" - ], - "install-path": "../phpoffice/phpspreadsheet" - }, - { - "name": "psr/cache", - "version": "1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2016-08-06T20:24:11+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "install-path": "../psr/cache" - }, - { - "name": "psr/container", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2017-02-14T16:28:37+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "install-path": "../psr/container" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2016-08-06T14:39:51+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "install-path": "../psr/http-message" - }, - { - "name": "psr/log", - "version": "1.1.2", - "version_normalized": "1.1.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2019-11-01T11:05:21+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "installation-source": "dist", - "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" - ], - "install-path": "../psr/log" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2017-10-23T01:57:42+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "install-path": "../psr/simple-cache" - }, - { - "name": "qcloud/cos-sdk-v5", - "version": "v2.0.3", - "version_normalized": "2.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/tencentyun/cos-php-sdk-v5.git", - "reference": "5dea6bc8be6f8e48fb95a5c4670800d1d796ac42" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/5dea6bc8be6f8e48fb95a5c4670800d1d796ac42", - "reference": "5dea6bc8be6f8e48fb95a5c4670800d1d796ac42", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "guzzlehttp/guzzle": "~6.3", - "guzzlehttp/guzzle-services": "~1.1", - "php": ">=5.3.0" - }, - "time": "2019-11-07T11:55:10+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Qcloud\\Cos\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "yaozongyou", - "email": "yaozongyou@vip.qq.com" - }, - { - "name": "lewzylu", - "email": "327874225@qq.com" - } - ], - "description": "PHP SDK for QCloud COS", - "keywords": [ - "cos", - "php", - "qcloud" - ], - "install-path": "../qcloud/cos-sdk-v5" - }, - { - "name": "qiniu/php-sdk", - "version": "v7.2.10", - "version_normalized": "7.2.10.0", - "source": { - "type": "git", - "url": "https://github.com/qiniu/php-sdk.git", - "reference": "d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8", - "reference": "d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.3" - }, - "time": "2019-10-28T10:23:23+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Qiniu\\": "src/Qiniu" - }, - "files": [ - "src/Qiniu/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Qiniu", - "email": "sdk@qiniu.com", - "homepage": "http://www.qiniu.com" - } - ], - "description": "Qiniu Resource (Cloud) Storage SDK for PHP", - "homepage": "http://developer.qiniu.com/", - "keywords": [ - "cloud", - "qiniu", - "sdk", - "storage" - ], - "install-path": "../qiniu/php-sdk" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "version_normalized": "3.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "time": "2019-03-08T08:55:37+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "install-path": "../ralouphie/getallheaders" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.16.0", - "version_normalized": "1.16.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "a54881ec0ab3b2005c406aed0023c062879031e7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a54881ec0ab3b2005c406aed0023c062879031e7", - "reference": "a54881ec0ab3b2005c406aed0023c062879031e7", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "time": "2020-05-08T16:50:20+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.16-dev" - } - }, - "installation-source": "dist", - "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" - ], - "install-path": "../symfony/polyfill-mbstring" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.12.0", - "version_normalized": "1.12.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "04ce3335667451138df4307d6a9b61565560199e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", - "reference": "04ce3335667451138df4307d6a9b61565560199e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.3" - }, - "time": "2019-08-06T08:03:45+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.12-dev" - } - }, - "installation-source": "dist", - "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" - ], - "install-path": "../symfony/polyfill-php72" - }, - { - "name": "symfony/var-dumper", - "version": "v4.3.6", - "version_normalized": "4.3.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "ea4940845535c85ff5c505e13b3205b0076d07bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ea4940845535c85ff5c505e13b3205b0076d07bf", - "reference": "ea4940845535c85ff5c505e13b3205b0076d07bf", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "twig/twig": "~1.34|~2.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "time": "2019-10-13T12:02:04+00:00", - "bin": [ - "Resources/bin/var-dump-server" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "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 mechanism for exploring and dumping PHP variables", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "install-path": "../symfony/var-dumper" - }, - { - "name": "topthink/framework", - "version": "v6.0.8", - "version_normalized": "6.0.8.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/framework.git", - "reference": "4789343672aef06d571d556da369c0e156609bce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/4789343672aef06d571d556da369c0e156609bce", - "reference": "4789343672aef06d571d556da369c0e156609bce", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-json": "*", - "ext-mbstring": "*", - "league/flysystem": "^1.0", - "league/flysystem-cached-adapter": "^1.0", - "php": ">=7.1.0", - "psr/container": "~1.0", - "psr/log": "~1.0", - "psr/simple-cache": "^1.0", - "topthink/think-helper": "^3.1.1", - "topthink/think-orm": "^2.0" - }, - "require-dev": { - "mikey179/vfsstream": "^1.6", - "mockery/mockery": "^1.2", - "phpunit/phpunit": "^7.0" - }, - "time": "2021-04-27T00:41:08+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [], - "psr-4": { - "think\\": "src/think/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - }, - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "The ThinkPHP Framework.", - "homepage": "http://thinkphp.cn/", - "keywords": [ - "framework", - "orm", - "thinkphp" - ], - "support": { - "issues": "https://github.com/top-think/framework/issues", - "source": "https://github.com/top-think/framework/tree/v6.0.8" - }, - "install-path": "../topthink/framework" - }, - { - "name": "topthink/think-captcha", - "version": "v3.0.2", - "version_normalized": "3.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-captcha.git", - "reference": "0b4305da19e118cefd934007875a8112f9352f01" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-captcha/zipball/0b4305da19e118cefd934007875a8112f9352f01", - "reference": "0b4305da19e118cefd934007875a8112f9352f01", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "topthink/framework": "^6.0.0" - }, - "time": "2019-10-03T07:45:11+00:00", - "type": "library", - "extra": { - "think": { - "services": [ - "think\\captcha\\CaptchaService" - ], - "config": { - "captcha": "src/config.php" - } - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\captcha\\": "src/" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "captcha package for thinkphp", - "install-path": "../topthink/think-captcha" - }, - { - "name": "topthink/think-helper", - "version": "v3.1.4", - "version_normalized": "3.1.4.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-helper.git", - "reference": "c28d37743bda4a0455286ca85b17b5791d626e10" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-helper/zipball/c28d37743bda4a0455286ca85b17b5791d626e10", - "reference": "c28d37743bda4a0455286ca85b17b5791d626e10", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1.0" - }, - "time": "2019-11-08T08:01:10+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\": "src" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "The ThinkPHP6 Helper Package", - "install-path": "../topthink/think-helper" - }, - { - "name": "topthink/think-multi-app", - "version": "v1.0.11", - "version_normalized": "1.0.11.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-multi-app.git", - "reference": "215f4a6bb88e53ad41b448c61957336eb55ce6f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/215f4a6bb88e53ad41b448c61957336eb55ce6f9", - "reference": "215f4a6bb88e53ad41b448c61957336eb55ce6f9", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1.0", - "topthink/framework": "^6.0.0" - }, - "time": "2019-10-29T06:34:59+00:00", - "type": "library", - "extra": { - "think": { - "services": [ - "think\\app\\Service" - ] - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\app\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "description": "thinkphp6 multi app support", - "install-path": "../topthink/think-multi-app" - }, - { - "name": "topthink/think-orm", - "version": "v2.0.27", - "version_normalized": "2.0.27.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-orm.git", - "reference": "02affaaccade2cdd8bbb2d2f5d15e46113e6eb50" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-orm/zipball/02affaaccade2cdd8bbb2d2f5d15e46113e6eb50", - "reference": "02affaaccade2cdd8bbb2d2f5d15e46113e6eb50", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-json": "*", - "php": ">=7.1.0", - "psr/log": "~1.0", - "psr/simple-cache": "^1.0", - "topthink/think-helper": "^3.1" - }, - "time": "2019-10-23T02:16:50+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\": "src" - }, - "files": [] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "description": "think orm", - "keywords": [ - "database", - "orm" - ], - "install-path": "../topthink/think-orm" - }, - { - "name": "topthink/think-template", - "version": "v2.0.7", - "version_normalized": "2.0.7.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-template.git", - "reference": "e98bdbb4a4c94b442f17dfceba81e0134d4fbd19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-template/zipball/e98bdbb4a4c94b442f17dfceba81e0134d4fbd19", - "reference": "e98bdbb4a4c94b442f17dfceba81e0134d4fbd19", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1.0", - "psr/simple-cache": "^1.0" - }, - "time": "2019-09-20T15:31:04+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "description": "the php template engine", - "install-path": "../topthink/think-template" - }, - { - "name": "topthink/think-view", - "version": "v1.0.13", - "version_normalized": "1.0.13.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-view.git", - "reference": "90803b73f781db5d42619082c4597afc58b2d4c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-view/zipball/90803b73f781db5d42619082c4597afc58b2d4c5", - "reference": "90803b73f781db5d42619082c4597afc58b2d4c5", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1.0", - "topthink/think-template": "^2.0" - }, - "time": "2019-10-07T12:23:10+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\view\\driver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "description": "thinkphp template driver", - "install-path": "../topthink/think-view" - }, - { - "name": "zhongshaofa/easy-admin", - "version": "v1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/zhongshaofa/easyadmin-sdk.git", - "reference": "e09be94938283d7c0210a3c04c38287757942a56" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zhongshaofa/easyadmin-sdk/zipball/e09be94938283d7c0210a3c04c38287757942a56", - "reference": "e09be94938283d7c0210a3c04c38287757942a56", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "doctrine/annotations": "^1.13.1", - "ext-json": "*", - "php": ">=7.1.0" - }, - "require-dev": { - "mockery/mockery": "^1.3.0", - "phpunit/phpunit": "^8.5.0" - }, - "time": "2021-09-03T16:09:14+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "EasyAdmin\\": "src", - "MockApp\\": "mock_app", - "Test\\": "tests" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "zhongshaofa", - "email": "2286732552@qq.com" - } - ], - "description": "EasyAdmin工具,https://github.com/zhongshaofa/easyadmin-sdk", - "support": { - "issues": "https://github.com/zhongshaofa/easyadmin-sdk/issues", - "source": "https://github.com/zhongshaofa/easyadmin-sdk/tree/v1.0.1" - }, - "install-path": "../zhongshaofa/easy-admin" - }, - { - "name": "zhongshaofa/thinkphp-log-trace", - "version": "v1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/zhongshaofa/thinkphp-log-trace.git", - "reference": "20388c806bd78f493cb806ad1bce2f5c81c9e969" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zhongshaofa/thinkphp-log-trace/zipball/20388c806bd78f493cb806ad1bce2f5c81c9e969", - "reference": "20388c806bd78f493cb806ad1bce2f5c81c9e969", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-json": "*", - "php": ">=7.1.0" - }, - "require-dev": { - "mockery/mockery": "^1.3.0", - "phpunit/phpunit": "^8.5.0", - "topthink/framework": "^6.0.0" - }, - "time": "2021-09-04T09:43:49+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "LogTrace\\": "src", - "Test\\": "tests" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "zhongshaofa", - "email": "2286732552@qq.com" - } - ], - "description": "thinkphp6链路日志组件", - "support": { - "issues": "https://github.com/zhongshaofa/thinkphp-log-trace/issues", - "source": "https://github.com/zhongshaofa/thinkphp-log-trace/tree/v1.0.1" - }, - "install-path": "../zhongshaofa/thinkphp-log-trace" - } - ], - "dev": true -} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php deleted file mode 100644 index da878e37..00000000 --- a/vendor/composer/installed.php +++ /dev/null @@ -1,391 +0,0 @@ - - array ( - 'pretty_version' => 'dev-feature/composer-tool', - 'version' => 'dev-feature/composer-tool', - 'aliases' => - array ( - ), - 'reference' => '41c98e2f9c0c3c32ea7a6644910033079df34751', - 'name' => 'topthink/think', - ), - 'versions' => - array ( - 'adbario/php-dot-notation' => - array ( - 'pretty_version' => '2.2.0', - 'version' => '2.2.0.0', - 'aliases' => - array ( - ), - 'reference' => 'eee4fc81296531e6aafba4c2bbccfc5adab1676e', - ), - 'alibabacloud/client' => - array ( - 'pretty_version' => '1.5.18', - 'version' => '1.5.18.0', - 'aliases' => - array ( - ), - 'reference' => '5dcf7b8fdfa64abdae7a5ca867289baf95e8e12a', - ), - 'aliyuncs/oss-sdk-php' => - array ( - 'pretty_version' => 'v2.3.0', - 'version' => '2.3.0.0', - 'aliases' => - array ( - ), - 'reference' => 'e69f57916678458642ac9d2fd341ae78a56996c8', - ), - 'clagiordano/weblibs-configmanager' => - array ( - 'pretty_version' => 'v1.0.7', - 'version' => '1.0.7.0', - 'aliases' => - array ( - ), - 'reference' => '6ef4c27354368deb2f54b39bbe06601da8c873a0', - ), - 'danielstjules/stringy' => - array ( - 'pretty_version' => '3.1.0', - 'version' => '3.1.0.0', - 'aliases' => - array ( - ), - 'reference' => 'df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e', - ), - 'doctrine/annotations' => - array ( - 'pretty_version' => '1.13.2', - 'version' => '1.13.2.0', - 'aliases' => - array ( - ), - 'reference' => '5b668aef16090008790395c02c893b1ba13f7e08', - ), - 'doctrine/lexer' => - array ( - 'pretty_version' => '1.2.1', - 'version' => '1.2.1.0', - 'aliases' => - array ( - ), - 'reference' => 'e864bbf5904cb8f5bb334f99209b48018522f042', - ), - 'eaglewu/swoole-ide-helper' => - array ( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'aliases' => - array ( - ), - 'reference' => 'a255daa05feffbf4b88d59897a9470696d2fe259', - ), - 'guzzlehttp/command' => - array ( - 'pretty_version' => '1.0.0', - 'version' => '1.0.0.0', - 'aliases' => - array ( - ), - 'reference' => '2aaa2521a8f8269d6f5dfc13fe2af12c76921034', - ), - 'guzzlehttp/guzzle' => - array ( - 'pretty_version' => '6.4.1', - 'version' => '6.4.1.0', - 'aliases' => - array ( - ), - 'reference' => '0895c932405407fd3a7368b6910c09a24d26db11', - ), - 'guzzlehttp/guzzle-services' => - array ( - 'pretty_version' => '1.1.3', - 'version' => '1.1.3.0', - 'aliases' => - array ( - ), - 'reference' => '9e3abf20161cbf662d616cbb995f2811771759f7', - ), - 'guzzlehttp/promises' => - array ( - 'pretty_version' => 'v1.3.1', - 'version' => '1.3.1.0', - 'aliases' => - array ( - ), - 'reference' => 'a59da6cf61d80060647ff4d3eb2c03a2bc694646', - ), - 'guzzlehttp/psr7' => - array ( - 'pretty_version' => '1.6.1', - 'version' => '1.6.1.0', - 'aliases' => - array ( - ), - 'reference' => '239400de7a173fe9901b9ac7c06497751f00727a', - ), - 'jianyan74/php-excel' => - array ( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => '5b569e16ba35fa48ff7449a7f593172f8284f66b', - ), - 'league/flysystem' => - array ( - 'pretty_version' => '1.0.57', - 'version' => '1.0.57.0', - 'aliases' => - array ( - ), - 'reference' => '0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a', - ), - 'league/flysystem-cached-adapter' => - array ( - 'pretty_version' => '1.0.9', - 'version' => '1.0.9.0', - 'aliases' => - array ( - ), - 'reference' => '08ef74e9be88100807a3b92cc9048a312bf01d6f', - ), - 'markbaker/complex' => - array ( - 'pretty_version' => '1.4.8', - 'version' => '1.4.8.0', - 'aliases' => - array ( - ), - 'reference' => '8eaa40cceec7bf0518187530b2e63871be661b72', - ), - 'markbaker/matrix' => - array ( - 'pretty_version' => '1.2.0', - 'version' => '1.2.0.0', - 'aliases' => - array ( - ), - 'reference' => '5348c5a67e3b75cd209d70103f916a93b1f1ed21', - ), - 'mtdowling/jmespath.php' => - array ( - 'pretty_version' => '2.4.0', - 'version' => '2.4.0.0', - 'aliases' => - array ( - ), - 'reference' => 'adcc9531682cf87dfda21e1fd5d0e7a41d292fac', - ), - 'phpoffice/phpspreadsheet' => - array ( - 'pretty_version' => '1.12.0', - 'version' => '1.12.0.0', - 'aliases' => - array ( - ), - 'reference' => 'f79611d6dc1f6b7e8e30b738fc371b392001dbfd', - ), - 'psr/cache' => - array ( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8', - ), - 'psr/container' => - array ( - 'pretty_version' => '1.0.0', - 'version' => '1.0.0.0', - 'aliases' => - array ( - ), - 'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f', - ), - 'psr/http-message' => - array ( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', - ), - 'psr/http-message-implementation' => - array ( - 'provided' => - array ( - 0 => '1.0', - ), - ), - 'psr/log' => - array ( - 'pretty_version' => '1.1.2', - 'version' => '1.1.2.0', - 'aliases' => - array ( - ), - 'reference' => '446d54b4cb6bf489fc9d75f55843658e6f25d801', - ), - 'psr/simple-cache' => - array ( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', - ), - 'qcloud/cos-sdk-v5' => - array ( - 'pretty_version' => 'v2.0.3', - 'version' => '2.0.3.0', - 'aliases' => - array ( - ), - 'reference' => '5dea6bc8be6f8e48fb95a5c4670800d1d796ac42', - ), - 'qiniu/php-sdk' => - array ( - 'pretty_version' => 'v7.2.10', - 'version' => '7.2.10.0', - 'aliases' => - array ( - ), - 'reference' => 'd89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8', - ), - 'ralouphie/getallheaders' => - array ( - 'pretty_version' => '3.0.3', - 'version' => '3.0.3.0', - 'aliases' => - array ( - ), - 'reference' => '120b605dfeb996808c31b6477290a714d356e822', - ), - 'symfony/polyfill-mbstring' => - array ( - 'pretty_version' => 'v1.16.0', - 'version' => '1.16.0.0', - 'aliases' => - array ( - ), - 'reference' => 'a54881ec0ab3b2005c406aed0023c062879031e7', - ), - 'symfony/polyfill-php72' => - array ( - 'pretty_version' => 'v1.12.0', - 'version' => '1.12.0.0', - 'aliases' => - array ( - ), - 'reference' => '04ce3335667451138df4307d6a9b61565560199e', - ), - 'symfony/var-dumper' => - array ( - 'pretty_version' => 'v4.3.6', - 'version' => '4.3.6.0', - 'aliases' => - array ( - ), - 'reference' => 'ea4940845535c85ff5c505e13b3205b0076d07bf', - ), - 'topthink/framework' => - array ( - 'pretty_version' => 'v6.0.8', - 'version' => '6.0.8.0', - 'aliases' => - array ( - ), - 'reference' => '4789343672aef06d571d556da369c0e156609bce', - ), - 'topthink/think' => - array ( - 'pretty_version' => 'dev-feature/composer-tool', - 'version' => 'dev-feature/composer-tool', - 'aliases' => - array ( - ), - 'reference' => '41c98e2f9c0c3c32ea7a6644910033079df34751', - ), - 'topthink/think-captcha' => - array ( - 'pretty_version' => 'v3.0.2', - 'version' => '3.0.2.0', - 'aliases' => - array ( - ), - 'reference' => '0b4305da19e118cefd934007875a8112f9352f01', - ), - 'topthink/think-helper' => - array ( - 'pretty_version' => 'v3.1.4', - 'version' => '3.1.4.0', - 'aliases' => - array ( - ), - 'reference' => 'c28d37743bda4a0455286ca85b17b5791d626e10', - ), - 'topthink/think-multi-app' => - array ( - 'pretty_version' => 'v1.0.11', - 'version' => '1.0.11.0', - 'aliases' => - array ( - ), - 'reference' => '215f4a6bb88e53ad41b448c61957336eb55ce6f9', - ), - 'topthink/think-orm' => - array ( - 'pretty_version' => 'v2.0.27', - 'version' => '2.0.27.0', - 'aliases' => - array ( - ), - 'reference' => '02affaaccade2cdd8bbb2d2f5d15e46113e6eb50', - ), - 'topthink/think-template' => - array ( - 'pretty_version' => 'v2.0.7', - 'version' => '2.0.7.0', - 'aliases' => - array ( - ), - 'reference' => 'e98bdbb4a4c94b442f17dfceba81e0134d4fbd19', - ), - 'topthink/think-view' => - array ( - 'pretty_version' => 'v1.0.13', - 'version' => '1.0.13.0', - 'aliases' => - array ( - ), - 'reference' => '90803b73f781db5d42619082c4597afc58b2d4c5', - ), - 'zhongshaofa/easy-admin' => - array ( - 'pretty_version' => 'v1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => 'e09be94938283d7c0210a3c04c38287757942a56', - ), - 'zhongshaofa/thinkphp-log-trace' => - array ( - 'pretty_version' => 'v1.0.1', - 'version' => '1.0.1.0', - 'aliases' => - array ( - ), - 'reference' => '20388c806bd78f493cb806ad1bce2f5c81c9e969', - ), - ), -); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php deleted file mode 100644 index 4642a2b4..00000000 --- a/vendor/composer/platform_check.php +++ /dev/null @@ -1,37 +0,0 @@ -= 70200)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.'; -} - -$missingExtensions = array(); -extension_loaded('ctype') || $missingExtensions[] = 'ctype'; -extension_loaded('curl') || $missingExtensions[] = 'curl'; -extension_loaded('dom') || $missingExtensions[] = 'dom'; -extension_loaded('fileinfo') || $missingExtensions[] = 'fileinfo'; -extension_loaded('gd') || $missingExtensions[] = 'gd'; -extension_loaded('iconv') || $missingExtensions[] = 'iconv'; -extension_loaded('json') || $missingExtensions[] = 'json'; -extension_loaded('libxml') || $missingExtensions[] = 'libxml'; -extension_loaded('mbstring') || $missingExtensions[] = 'mbstring'; -extension_loaded('openssl') || $missingExtensions[] = 'openssl'; -extension_loaded('simplexml') || $missingExtensions[] = 'simplexml'; -extension_loaded('tokenizer') || $missingExtensions[] = 'tokenizer'; -extension_loaded('xml') || $missingExtensions[] = 'xml'; -extension_loaded('xmlreader') || $missingExtensions[] = 'xmlreader'; -extension_loaded('xmlwriter') || $missingExtensions[] = 'xmlwriter'; -extension_loaded('zip') || $missingExtensions[] = 'zip'; -extension_loaded('zlib') || $missingExtensions[] = 'zlib'; - -if ($missingExtensions) { - $issues[] = 'Your Composer dependencies require the following PHP extensions to be installed: ' . implode(', ', $missingExtensions); -} - -if ($issues) { - echo 'Composer detected issues in your platform:' . "\n\n" . implode("\n", $issues); - exit(104); -} diff --git a/vendor/danielstjules/stringy/CHANGELOG.md b/vendor/danielstjules/stringy/CHANGELOG.md deleted file mode 100644 index 3f135756..00000000 --- a/vendor/danielstjules/stringy/CHANGELOG.md +++ /dev/null @@ -1,180 +0,0 @@ -### 3.1.0 (2017-06-11) -* Add $language support to slugify -* Add bg specific transliteration -* ЬЪ/ьъ handling is now language-specific - -### 3.0.1 (2017-04-12) -* Don't replace @ in toAscii -* Use normal replacement for @ in slugify, e.g. user@home => user-home - -### 3.0.0 (2017-03-08) - -* Breaking change: added $language parameter to toAscii, before - $removeUnsupported -* Breaking change: dropped PHP 5.3 support -* Breaking change: any StaticStringy methods that previously returned instances - of Stringy now return strings - -### 2.4.0 (2017-03-02) - -* Add startsWithAny -* Add endsWithAny -* Add stripWhitespace -* Fix error handling for unsupported encodings -* Change private methods to protected for extending class -* Fix safeTruncate for strings without spaces -* Additional char support in toAscii, e.g. full width chars and wide - non-breaking space - -### 2.3.2 (2016-05-02) - -* Improve support without mbstring - -### 2.3.1 (2016-03-21) - -* Always use root namespace for mbstring functions - -### 2.3.0 (2016-03-19) - -* Add Persian characters in Stringy::charsArray() -* Use symfony/polyfill-mbstring to avoid dependency on ext-mbstring - -### 2.2.0 (2015-12-20) - -* isJSON now returns false for empty strings -* Update for German umlaut transformation -* Use reflection to generate method list for StaticStringy -* Added isBase64 method -* Improved toAscii char coverage - -### 2.1.0 (2015-09-02) - -* Added simplified StaticStringy class -* str in Stringy::create and constructor is now optional - -### 2.0.0 (2015-07-29) - - * Removed StaticStringy class - * Added append, prepend, toBoolean, repeat, between, slice, split, and lines - * camelize/upperCamelize now strip leading dashes and underscores - * titleize converts to lowercase, thus no longer preserving acronyms - -### 1.10.0 (2015-07-22) - - * Added trimLeft, trimRight - * Added support for unicode whitespace to trim - * Added delimit - * Added indexOf and indexOfLast - * Added htmlEncode and htmlDecode - * Added "Ç" in toAscii() - -### 1.9.0 (2015-02-09) - - * Added hasUpperCase and hasLowerCase - * Added $removeUnsupported parameter to toAscii() - * Improved toAscii support with additional Unicode spaces, Vietnamese chars, - and numerous other characters - * Separated the charsArray from toAscii as a protected method that may be - extended by inheriting classes - * Chars array is cached for better performance - -### 1.8.1 (2015-01-08) - - * Optimized chars() - * Added "ä Ä Ö Ü"" in toAscii() - * Added support for Unicode spaces in toAscii() - * Replaced instances of self::create() with static::create() - * Added missing test cases for safeTruncate() and longestCommonSuffix() - * Updated Stringy\create() to avoid collision when it already exists - -### 1.8.0 (2015-01-03) - - * Listed ext-mbstring in composer.json - * Added Stringy\create function for PHP 5.6 - -### 1.7.0 (2014-10-14) - - * Added containsAll and containsAny - * Light cleanup - -### 1.6.0 (2014-09-14) - - * Added toTitleCase - -### 1.5.2 (2014-07-09) - - * Announced support for HHVM - -### 1.5.1 (2014-04-19) - - * Fixed toAscii() failing to remove remaining non-ascii characters - * Updated slugify() to treat dash and underscore as delimiters by default - * Updated slugify() to remove leading and trailing delimiter, if present - -### 1.5.0 (2014-03-19) - - * Made both str and encoding protected, giving property access to subclasses - * Added getEncoding() - * Fixed isJSON() giving false negatives - * Cleaned up and simplified: replace(), collapseWhitespace(), underscored(), - dasherize(), pad(), padLeft(), padRight() and padBoth() - * Fixed handling consecutive invalid chars in slugify() - * Removed conflicting hard sign transliteration in toAscii() - -### 1.4.0 (2014-02-12) - - * Implemented the IteratorAggregate interface, added chars() - * Renamed count() to countSubstr() - * Updated count() to implement Countable interface - * Implemented the ArrayAccess interface with positive and negative indices - * Switched from PSR-0 to PSR-4 autoloading - -### 1.3.0 (2013-12-16) - - * Additional Bulgarian support for toAscii - * str property made private - * Constructor casts first argument to string - * Constructor throws an InvalidArgumentException when given an array - * Constructor throws an InvalidArgumentException when given an object without - a __toString method - -### 1.2.2 (2013-12-04) - - * Updated create function to use late static binding - * Added optional $replacement param to slugify - -### 1.2.1 (2013-10-11) - - * Cleaned up tests - * Added homepage to composer.json - -### 1.2.0 (2013-09-15) - - * Fixed pad's use of InvalidArgumentException - * Fixed replace(). It now correctly treats regex special chars as normal chars - * Added additional Cyrillic letters to toAscii - * Added $caseSensitive to contains() and count() - * Added toLowerCase() - * Added toUpperCase() - * Added regexReplace() - -### 1.1.0 (2013-08-31) - - * Fix for collapseWhitespace() - * Added isHexadecimal() - * Added constructor to Stringy\Stringy - * Added isSerialized() - * Added isJson() - -### 1.0.0 (2013-08-1) - - * 1.0.0 release - * Added test coverage for Stringy::create and method chaining - * Added tests for returned type - * Fixed StaticStringy::replace(). It was returning a Stringy object instead of string - * Renamed standardize() to the more appropriate toAscii() - * Cleaned up comments and README - -### 1.0.0-rc.1 (2013-07-28) - - * Release candidate diff --git a/vendor/danielstjules/stringy/LICENSE.txt b/vendor/danielstjules/stringy/LICENSE.txt deleted file mode 100644 index 0b703024..00000000 --- a/vendor/danielstjules/stringy/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2013 Daniel St. Jules - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/danielstjules/stringy/README.md b/vendor/danielstjules/stringy/README.md deleted file mode 100644 index df48e39a..00000000 --- a/vendor/danielstjules/stringy/README.md +++ /dev/null @@ -1,1082 +0,0 @@ -![Stringy](http://danielstjules.com/github/stringy-logo.png) - -A PHP string manipulation library with multibyte support. Compatible with PHP -5.4+, PHP 7+, and HHVM. - -``` php -s('string')->toTitleCase()->ensureRight('y') == 'Stringy' -``` - -Refer to the [1.x branch](https://github.com/danielstjules/Stringy/tree/1.x) or -[2.x branch](https://github.com/danielstjules/Stringy/tree/2.x) for older -documentation. - -[![Build Status](https://api.travis-ci.org/danielstjules/Stringy.svg?branch=master)](https://travis-ci.org/danielstjules/Stringy) -[![Total Downloads](https://poser.pugx.org/danielstjules/stringy/downloads)](https://packagist.org/packages/danielstjules/stringy) -[![License](https://poser.pugx.org/danielstjules/stringy/license)](https://packagist.org/packages/danielstjules/stringy) - -* [Why?](#why) -* [Installation](#installation) -* [OO and Chaining](#oo-and-chaining) -* [Implemented Interfaces](#implemented-interfaces) -* [PHP 5.6 Creation](#php-56-creation) -* [StaticStringy](#staticstringy) -* [Class methods](#class-methods) - * [create](#createmixed-str--encoding-) -* [Instance methods](#instance-methods) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
appendatbetweencamelize
charscollapseWhitespacecontainscontainsAll
containsAnycountSubstrdasherizedelimit
endsWithendsWithAnyensureLeftensureRight
firstgetEncodinghasLowerCasehasUpperCase
htmlDecodehtmlEncodehumanizeindexOf
indexOfLastinsertisAlphaisAlphanumeric
isBase64isBlankisHexadecimalisJson
isLowerCaseisSerializedisUpperCaselast
lengthlineslongestCommonPrefixlongestCommonSuffix
longestCommonSubstringlowerCaseFirstpadpadBoth
padLeftpadRightprependregexReplace
removeLeftremoveRightrepeatreplace
reversesafeTruncateshuffleslugify
slicesplitstartsWithstartsWithAny
stripWhitespacesubstrsurroundswapCase
tidytitleizetoAsciitoBoolean
toLowerCasetoSpacestoTabstoTitleCase
toUpperCasetrimtrimLefttrimRight
truncateunderscoredupperCamelizeupperCaseFirst
- -* [Extensions](#extensions) -* [Tests](#tests) -* [License](#license) - -## Why? - -In part due to a lack of multibyte support (including UTF-8) across many of -PHP's standard string functions. But also to offer an OO wrapper around the -`mbstring` module's multibyte-compatible functions. Stringy handles some quirks, -provides additional functionality, and hopefully makes strings a little easier -to work with! - -```php -// Standard library -strtoupper('fòôbàř'); // 'FòôBàř' -strlen('fòôbàř'); // 10 - -// mbstring -mb_strtoupper('fòôbàř'); // 'FÒÔBÀŘ' -mb_strlen('fòôbàř'); // '6' - -// Stringy -s('fòôbàř')->toUpperCase(); // 'FÒÔBÀŘ' -s('fòôbàř')->length(); // '6' -``` - -## Installation - -If you're using Composer to manage dependencies, you can include the following -in your composer.json file: - -```json -"require": { - "danielstjules/stringy": "~3.1.0" -} -``` - -Then, after running `composer update` or `php composer.phar update`, you can -load the class using Composer's autoloading: - -```php -require 'vendor/autoload.php'; -``` - -Otherwise, you can simply require the file directly: - -```php -require_once 'path/to/Stringy/src/Stringy.php'; -``` - -And in either case, I'd suggest using an alias. - -```php -use Stringy\Stringy as S; -``` - -Please note that Stringy relies on the `mbstring` module for its underlying -multibyte support. If the module is not found, Stringy will use -[symfony/polyfill-mbstring](https://github.com/symfony/polyfill-mbstring). -ex-mbstring is a non-default, but very common module. For example, with debian -and ubuntu, it's included in libapache2-mod-php5, php5-cli, and php5-fpm. For -OSX users, it's a default for any version of PHP installed with homebrew. -If compiling PHP from scratch, it can be included with the -`--enable-mbstring` flag. - -## OO and Chaining - -The library offers OO method chaining, as seen below: - -```php -use Stringy\Stringy as S; -echo S::create('fòô bàř')->collapseWhitespace()->swapCase(); // 'FÒÔ BÀŘ' -``` - -`Stringy\Stringy` has a __toString() method, which returns the current string -when the object is used in a string context, ie: -`(string) S::create('foo') // 'foo'` - -## Implemented Interfaces - -`Stringy\Stringy` implements the `IteratorAggregate` interface, meaning that -`foreach` can be used with an instance of the class: - -``` php -$stringy = S::create('fòôbàř'); -foreach ($stringy as $char) { - echo $char; -} -// 'fòôbàř' -``` - -It implements the `Countable` interface, enabling the use of `count()` to -retrieve the number of characters in the string: - -``` php -$stringy = S::create('fòô'); -count($stringy); // 3 -``` - -Furthermore, the `ArrayAccess` interface has been implemented. As a result, -`isset()` can be used to check if a character at a specific index exists. And -since `Stringy\Stringy` is immutable, any call to `offsetSet` or `offsetUnset` -will throw an exception. `offsetGet` has been implemented, however, and accepts -both positive and negative indexes. Invalid indexes result in an -`OutOfBoundsException`. - -``` php -$stringy = S::create('bàř'); -echo $stringy[2]; // 'ř' -echo $stringy[-2]; // 'à' -isset($stringy[-4]); // false - -$stringy[3]; // OutOfBoundsException -$stringy[2] = 'a'; // Exception -``` - -## PHP 5.6 Creation - -As of PHP 5.6, [`use function`](https://wiki.php.net/rfc/use_function) is -available for importing functions. Stringy exposes a namespaced function, -`Stringy\create`, which emits the same behaviour as `Stringy\Stringy::create()`. -If running PHP 5.6, or another runtime that supports the `use function` syntax, -you can take advantage of an even simpler API as seen below: - -``` php -use function Stringy\create as s; - -// Instead of: S::create('fòô bàř') -s('fòô bàř')->collapseWhitespace()->swapCase(); -``` - -## StaticStringy - -All methods listed under "Instance methods" are available as part of a static -wrapper. For StaticStringy methods, the optional encoding is expected to be the -last argument. The return value is not cast, and may thus be of type Stringy, -integer, boolean, etc. - -```php -use Stringy\StaticStringy as S; - -// Translates to Stringy::create('fòôbàř')->slice(0, 3); -// Returns a Stringy object with the string "fòô" -S::slice('fòôbàř', 0, 3); -``` - -## Class methods - -##### create(mixed $str [, $encoding ]) - -Creates a Stringy object and assigns both str and encoding properties -the supplied values. $str is cast to a string prior to assignment, and if -$encoding is not specified, it defaults to mb_internal_encoding(). It -then returns the initialized object. Throws an InvalidArgumentException -if the first argument is an array or object without a __toString method. - -```php -$stringy = S::create('fòôbàř'); // 'fòôbàř' -``` - -## Instance Methods - -Stringy objects are immutable. All examples below make use of PHP 5.6 -function importing, and PHP 5.4 short array syntax. They also assume the -encoding returned by mb_internal_encoding() is UTF-8. For further details, -see the documentation for the create method above, as well as the notes -on PHP 5.6 creation. - -##### append(string $string) - -Returns a new string with $string appended. - -```php -s('fòô')->append('bàř'); // 'fòôbàř' -``` - -##### at(int $index) - -Returns the character at $index, with indexes starting at 0. - -```php -s('fòôbàř')->at(3); // 'b' -``` - -##### between(string $start, string $end [, int $offset]) - -Returns the substring between $start and $end, if found, or an empty -string. An optional offset may be supplied from which to begin the -search for the start string. - -```php -s('{foo} and {bar}')->between('{', '}'); // 'foo' -``` - -##### camelize() - -Returns a camelCase version of the string. Trims surrounding spaces, -capitalizes letters following digits, spaces, dashes and underscores, -and removes spaces, dashes, as well as underscores. - -```php -s('Camel-Case')->camelize(); // 'camelCase' -``` - -##### chars() - -Returns an array consisting of the characters in the string. - -```php -s('fòôbàř')->chars(); // ['f', 'ò', 'ô', 'b', 'à', 'ř'] -``` - -##### collapseWhitespace() - -Trims the string and replaces consecutive whitespace characters with a -single space. This includes tabs and newline characters, as well as -multibyte whitespace such as the thin space and ideographic space. - -```php -s(' Ο συγγραφέας ')->collapseWhitespace(); // 'Ο συγγραφέας' -``` - -##### contains(string $needle [, boolean $caseSensitive = true ]) - -Returns true if the string contains $needle, false otherwise. By default, -the comparison is case-sensitive, but can be made insensitive -by setting $caseSensitive to false. - -```php -s('Ο συγγραφέας είπε')->contains('συγγραφέας'); // true -``` - -##### containsAll(array $needles [, boolean $caseSensitive = true ]) - -Returns true if the string contains all $needles, false otherwise. By -default the comparison is case-sensitive, but can be made insensitive by -setting $caseSensitive to false. - -```php -s('foo & bar')->containsAll(['foo', 'bar']); // true -``` - -##### containsAny(array $needles [, boolean $caseSensitive = true ]) - -Returns true if the string contains any $needles, false otherwise. By -default the comparison is case-sensitive, but can be made insensitive by -setting $caseSensitive to false. - -```php -s('str contains foo')->containsAny(['foo', 'bar']); // true -``` - -##### countSubstr(string $substring [, boolean $caseSensitive = true ]) - -Returns the number of occurrences of $substring in the given string. -By default, the comparison is case-sensitive, but can be made insensitive -by setting $caseSensitive to false. - -```php -s('Ο συγγραφέας είπε')->countSubstr('α'); // 2 -``` - -##### dasherize() - -Returns a lowercase and trimmed string separated by dashes. Dashes are -inserted before uppercase characters (with the exception of the first -character of the string), and in place of spaces as well as underscores. - -```php -s('fooBar')->dasherize(); // 'foo-bar' -``` - -##### delimit(int $delimiter) - -Returns a lowercase and trimmed string separated by the given delimiter. -Delimiters are inserted before uppercase characters (with the exception -of the first character of the string), and in place of spaces, dashes, -and underscores. Alpha delimiters are not converted to lowercase. - -```php -s('fooBar')->delimit('::'); // 'foo::bar' -``` - -##### endsWith(string $substring [, boolean $caseSensitive = true ]) - -Returns true if the string ends with $substring, false otherwise. By -default, the comparison is case-sensitive, but can be made insensitive by -setting $caseSensitive to false. - -```php -s('fòôbàř')->endsWith('bàř'); // true -``` - -##### endsWithAny(string[] $substrings [, boolean $caseSensitive = true ]) - -Returns true if the string ends with any of $substrings, false otherwise. -By default, the comparison is case-sensitive, but can be made insensitive -by setting $caseSensitive to false. - -```php -s('fòôbàř')->endsWithAny(['bàř', 'baz']); // true -``` - -##### ensureLeft(string $substring) - -Ensures that the string begins with $substring. If it doesn't, it's prepended. - -```php -s('foobar')->ensureLeft('http://'); // 'http://foobar' -``` - -##### ensureRight(string $substring) - -Ensures that the string ends with $substring. If it doesn't, it's appended. - -```php -s('foobar')->ensureRight('.com'); // 'foobar.com' -``` - -##### first(int $n) - -Returns the first $n characters of the string. - -```php -s('fòôbàř')->first(3); // 'fòô' -``` - -##### getEncoding() - -Returns the encoding used by the Stringy object. - -```php -s('fòôbàř')->getEncoding(); // 'UTF-8' -``` - -##### hasLowerCase() - -Returns true if the string contains a lower case char, false otherwise. - -```php -s('fòôbàř')->hasLowerCase(); // true -``` - -##### hasUpperCase() - -Returns true if the string contains an upper case char, false otherwise. - -```php -s('fòôbàř')->hasUpperCase(); // false -``` - -##### htmlDecode() - -Convert all HTML entities to their applicable characters. An alias of -html_entity_decode. For a list of flags, refer to -http://php.net/manual/en/function.html-entity-decode.php - -```php -s('&')->htmlDecode(); // '&' -``` - -##### htmlEncode() - -Convert all applicable characters to HTML entities. An alias of -htmlentities. Refer to http://php.net/manual/en/function.htmlentities.php -for a list of flags. - -```php -s('&')->htmlEncode(); // '&' -``` - -##### humanize() - -Capitalizes the first word of the string, replaces underscores with -spaces, and strips '_id'. - -```php -s('author_id')->humanize(); // 'Author' -``` - -##### indexOf(string $needle [, $offset = 0 ]); - -Returns the index of the first occurrence of $needle in the string, -and false if not found. Accepts an optional offset from which to begin -the search. A negative index searches from the end - -```php -s('string')->indexOf('ing'); // 3 -``` - -##### indexOfLast(string $needle [, $offset = 0 ]); - -Returns the index of the last occurrence of $needle in the string, -and false if not found. Accepts an optional offset from which to begin -the search. Offsets may be negative to count from the last character -in the string. - -```php -s('foobarfoo')->indexOfLast('foo'); // 10 -``` - -##### insert(int $index, string $substring) - -Inserts $substring into the string at the $index provided. - -```php -s('fòôbř')->insert('à', 4); // 'fòôbàř' -``` - -##### isAlpha() - -Returns true if the string contains only alphabetic chars, false otherwise. - -```php -s('丹尼爾')->isAlpha(); // true -``` - -##### isAlphanumeric() - -Returns true if the string contains only alphabetic and numeric chars, false -otherwise. - -```php -s('دانيال1')->isAlphanumeric(); // true -``` - -##### isBase64() - -Returns true if the string is base64 encoded, false otherwise. - -```php -s('Zm9vYmFy')->isBase64(); // true -``` - -##### isBlank() - -Returns true if the string contains only whitespace chars, false otherwise. - -```php -s("\n\t \v\f")->isBlank(); // true -``` - -##### isHexadecimal() - -Returns true if the string contains only hexadecimal chars, false otherwise. - -```php -s('A102F')->isHexadecimal(); // true -``` - -##### isJson() - -Returns true if the string is JSON, false otherwise. Unlike json_decode -in PHP 5.x, this method is consistent with PHP 7 and other JSON parsers, -in that an empty string is not considered valid JSON. - -```php -s('{"foo":"bar"}')->isJson(); // true -``` - -##### isLowerCase() - -Returns true if the string contains only lower case chars, false otherwise. - -```php -s('fòôbàř')->isLowerCase(); // true -``` - -##### isSerialized() - -Returns true if the string is serialized, false otherwise. - -```php -s('a:1:{s:3:"foo";s:3:"bar";}')->isSerialized(); // true -``` - -##### isUpperCase() - -Returns true if the string contains only upper case chars, false otherwise. - -```php -s('FÒÔBÀŘ')->isUpperCase(); // true -``` - -##### last(int $n) - -Returns the last $n characters of the string. - -```php -s('fòôbàř')->last(3); // 'bàř' -``` - -##### length() - -Returns the length of the string. An alias for PHP's mb_strlen() function. - -```php -s('fòôbàř')->length(); // 6 -``` - -##### lines() - -Splits on newlines and carriage returns, returning an array of Stringy -objects corresponding to the lines in the string. - -```php -s("fòô\r\nbàř\n")->lines(); // ['fòô', 'bàř', ''] -``` - -##### longestCommonPrefix(string $otherStr) - -Returns the longest common prefix between the string and $otherStr. - -```php -s('foobar')->longestCommonPrefix('foobaz'); // 'fooba' -``` - -##### longestCommonSuffix(string $otherStr) - -Returns the longest common suffix between the string and $otherStr. - -```php -s('fòôbàř')->longestCommonSuffix('fòrbàř'); // 'bàř' -``` - -##### longestCommonSubstring(string $otherStr) - -Returns the longest common substring between the string and $otherStr. In the -case of ties, it returns that which occurs first. - -```php -s('foobar')->longestCommonSubstring('boofar'); // 'oo' -``` - -##### lowerCaseFirst() - -Converts the first character of the supplied string to lower case. - -```php -s('Σ foo')->lowerCaseFirst(); // 'σ foo' -``` - -##### pad(int $length [, string $padStr = ' ' [, string $padType = 'right' ]]) - -Pads the string to a given length with $padStr. If length is less than -or equal to the length of the string, no padding takes places. The default -string used for padding is a space, and the default type (one of 'left', -'right', 'both') is 'right'. Throws an InvalidArgumentException if -$padType isn't one of those 3 values. - -```php -s('fòôbàř')->pad(9, '-/', 'left'); // '-/-fòôbàř' -``` - -##### padBoth(int $length [, string $padStr = ' ' ]) - -Returns a new string of a given length such that both sides of the string -string are padded. Alias for pad() with a $padType of 'both'. - -```php -s('foo bar')->padBoth(9, ' '); // ' foo bar ' -``` - -##### padLeft(int $length [, string $padStr = ' ' ]) - -Returns a new string of a given length such that the beginning of the -string is padded. Alias for pad() with a $padType of 'left'. - -```php -s('foo bar')->padLeft(9, ' '); // ' foo bar' -``` - -##### padRight(int $length [, string $padStr = ' ' ]) - -Returns a new string of a given length such that the end of the string is -padded. Alias for pad() with a $padType of 'right'. - -```php -s('foo bar')->padRight(10, '_*'); // 'foo bar_*_' -``` - -##### prepend(string $string) - -Returns a new string starting with $string. - -```php -s('bàř')->prepend('fòô'); // 'fòôbàř' -``` - -##### regexReplace(string $pattern, string $replacement [, string $options = 'msr']) - -Replaces all occurrences of $pattern in $str by $replacement. An alias -for mb_ereg_replace(). Note that the 'i' option with multibyte patterns -in mb_ereg_replace() requires PHP 5.6+ for correct results. This is due -to a lack of support in the bundled version of Oniguruma in PHP < 5.6, -and current versions of HHVM (3.8 and below). - -```php -s('fòô ')->regexReplace('f[òô]+\s', 'bàř'); // 'bàř' -s('fò')->regexReplace('(ò)', '\\1ô'); // 'fòô' -``` - -##### removeLeft(string $substring) - -Returns a new string with the prefix $substring removed, if present. - -```php -s('fòôbàř')->removeLeft('fòô'); // 'bàř' -``` - -##### removeRight(string $substring) - -Returns a new string with the suffix $substring removed, if present. - -```php -s('fòôbàř')->removeRight('bàř'); // 'fòô' -``` - -##### repeat(int $multiplier) - -Returns a repeated string given a multiplier. An alias for str_repeat. - -```php -s('α')->repeat(3); // 'ααα' -``` - -##### replace(string $search, string $replacement) - -Replaces all occurrences of $search in $str by $replacement. - -```php -s('fòô bàř fòô bàř')->replace('fòô ', ''); // 'bàř bàř' -``` - -##### reverse() - -Returns a reversed string. A multibyte version of strrev(). - -```php -s('fòôbàř')->reverse(); // 'řàbôòf' -``` - -##### safeTruncate(int $length [, string $substring = '' ]) - -Truncates the string to a given length, while ensuring that it does not -split words. If $substring is provided, and truncating occurs, the -string is further truncated so that the substring may be appended without -exceeding the desired length. - -```php -s('What are your plans today?')->safeTruncate(22, '...'); -// 'What are your plans...' -``` - -##### shuffle() - -A multibyte str_shuffle() function. It returns a string with its characters in -random order. - -```php -s('fòôbàř')->shuffle(); // 'àôřbòf' -``` - -##### slugify([, string $replacement = '-' [, string $language = 'en']]) - -Converts the string into an URL slug. This includes replacing non-ASCII -characters with their closest ASCII equivalents, removing remaining -non-ASCII and non-alphanumeric characters, and replacing whitespace with -$replacement. The replacement defaults to a single dash, and the string -is also converted to lowercase. The language of the source string can -also be supplied for language-specific transliteration. - -```php -s('Using strings like fòô bàř')->slugify(); // 'using-strings-like-foo-bar' -``` - -##### slice(int $start [, int $end ]) - -Returns the substring beginning at $start, and up to, but not including -the index specified by $end. If $end is omitted, the function extracts -the remaining string. If $end is negative, it is computed from the end -of the string. - -```php -s('fòôbàř')->slice(3, -1); // 'bà' -``` - -##### split(string $pattern [, int $limit ]) - -Splits the string with the provided regular expression, returning an -array of Stringy objects. An optional integer $limit will truncate the -results. - -```php -s('foo,bar,baz')->split(',', 2); // ['foo', 'bar'] -``` - -##### startsWith(string $substring [, boolean $caseSensitive = true ]) - -Returns true if the string begins with $substring, false otherwise. -By default, the comparison is case-sensitive, but can be made insensitive -by setting $caseSensitive to false. - -```php -s('FÒÔbàřbaz')->startsWith('fòôbàř', false); // true -``` - -##### startsWithAny(string[] $substrings [, boolean $caseSensitive = true ]) - -Returns true if the string begins with any of $substrings, false -otherwise. By default the comparison is case-sensitive, but can be made -insensitive by setting $caseSensitive to false. - -```php -s('FÒÔbàřbaz')->startsWithAny(['fòô', 'bàř'], false); // true -``` - -##### stripWhitespace() - -Strip all whitespace characters. This includes tabs and newline -characters, as well as multibyte whitespace such as the thin space -and ideographic space. - -```php -s(' Ο συγγραφέας ')->stripWhitespace(); // 'Οσυγγραφέας' -``` - -##### substr(int $start [, int $length ]) - -Returns the substring beginning at $start with the specified $length. -It differs from the mb_substr() function in that providing a $length of -null will return the rest of the string, rather than an empty string. - -```php -s('fòôbàř')->substr(2, 3); // 'ôbà' -``` - -##### surround(string $substring) - -Surrounds a string with the given substring. - -```php -s(' ͜ ')->surround('ʘ'); // 'ʘ ͜ ʘ' -``` - -##### swapCase() - -Returns a case swapped version of the string. - -```php -s('Ντανιλ')->swapCase(); // 'νΤΑΝΙΛ' -``` - -##### tidy() - -Returns a string with smart quotes, ellipsis characters, and dashes from -Windows-1252 (commonly used in Word documents) replaced by their ASCII equivalents. - -```php -s('“I see…”')->tidy(); // '"I see..."' -``` - -##### titleize([, array $ignore]) - -Returns a trimmed string with the first letter of each word capitalized. -Also accepts an array, $ignore, allowing you to list words not to be -capitalized. - -```php -$ignore = ['at', 'by', 'for', 'in', 'of', 'on', 'out', 'to', 'the']; -s('i like to watch television')->titleize($ignore); -// 'I Like to Watch Television' -``` - -##### toAscii([, string $language = 'en' [, bool $removeUnsupported = true ]]) - -Returns an ASCII version of the string. A set of non-ASCII characters are -replaced with their closest ASCII counterparts, and the rest are removed -by default. The language or locale of the source string can be supplied -for language-specific transliteration in any of the following formats: -en, en_GB, or en-GB. For example, passing "de" results in "äöü" mapping -to "aeoeue" rather than "aou" as in other languages. - -```php -s('fòôbàř')->toAscii(); // 'foobar' -s('äöü')->toAscii(); // 'aou' -s('äöü')->toAscii('de'); // 'aeoeue' -``` - -##### toBoolean() - -Returns a boolean representation of the given logical string value. -For example, 'true', '1', 'on' and 'yes' will return true. 'false', '0', -'off', and 'no' will return false. In all instances, case is ignored. -For other numeric strings, their sign will determine the return value. -In addition, blank strings consisting of only whitespace will return -false. For all other strings, the return value is a result of a -boolean cast. - -```php -s('OFF')->toBoolean(); // false -``` - -##### toLowerCase() - -Converts all characters in the string to lowercase. An alias for PHP's -mb_strtolower(). - -```php -s('FÒÔBÀŘ')->toLowerCase(); // 'fòôbàř' -``` - -##### toSpaces([, tabLength = 4 ]) - -Converts each tab in the string to some number of spaces, as defined by -$tabLength. By default, each tab is converted to 4 consecutive spaces. - -```php -s(' String speech = "Hi"')->toSpaces(); // ' String speech = "Hi"' -``` - -##### toTabs([, tabLength = 4 ]) - -Converts each occurrence of some consecutive number of spaces, as defined -by $tabLength, to a tab. By default, each 4 consecutive spaces are -converted to a tab. - -```php -s(' fòô bàř')->toTabs(); -// ' fòô bàř' -``` - -##### toTitleCase() - -Converts the first character of each word in the string to uppercase. - -```php -s('fòô bàř')->toTitleCase(); // 'Fòô Bàř' -``` - -##### toUpperCase() - -Converts all characters in the string to uppercase. An alias for PHP's -mb_strtoupper(). - -```php -s('fòôbàř')->toUpperCase(); // 'FÒÔBÀŘ' -``` - -##### trim([, string $chars]) - -Returns a string with whitespace removed from the start and end of the -string. Supports the removal of unicode whitespace. Accepts an optional -string of characters to strip instead of the defaults. - -```php -s(' fòôbàř ')->trim(); // 'fòôbàř' -``` - -##### trimLeft([, string $chars]) - -Returns a string with whitespace removed from the start of the string. -Supports the removal of unicode whitespace. Accepts an optional -string of characters to strip instead of the defaults. - -```php -s(' fòôbàř ')->trimLeft(); // 'fòôbàř ' -``` - -##### trimRight([, string $chars]) - -Returns a string with whitespace removed from the end of the string. -Supports the removal of unicode whitespace. Accepts an optional -string of characters to strip instead of the defaults. - -```php -s(' fòôbàř ')->trimRight(); // ' fòôbàř' -``` - -##### truncate(int $length [, string $substring = '' ]) - -Truncates the string to a given length. If $substring is provided, and -truncating occurs, the string is further truncated so that the substring -may be appended without exceeding the desired length. - -```php -s('What are your plans today?')->truncate(19, '...'); // 'What are your pl...' -``` - -##### underscored() - -Returns a lowercase and trimmed string separated by underscores. -Underscores are inserted before uppercase characters (with the exception -of the first character of the string), and in place of spaces as well as dashes. - -```php -s('TestUCase')->underscored(); // 'test_u_case' -``` - -##### upperCamelize() - -Returns an UpperCamelCase version of the supplied string. It trims -surrounding spaces, capitalizes letters following digits, spaces, dashes -and underscores, and removes spaces, dashes, underscores. - -```php -s('Upper Camel-Case')->upperCamelize(); // 'UpperCamelCase' -``` - -##### upperCaseFirst() - -Converts the first character of the supplied string to upper case. - -```php -s('σ foo')->upperCaseFirst(); // 'Σ foo' -``` - -## Extensions - -The following is a list of libraries that extend Stringy: - - * [SliceableStringy](https://github.com/danielstjules/SliceableStringy): -Python-like string slices in PHP - * [SubStringy](https://github.com/TCB13/SubStringy): -Advanced substring methods - -## Tests - -From the project directory, tests can be ran using `phpunit` - -## License - -Released under the MIT License - see `LICENSE.txt` for details. diff --git a/vendor/danielstjules/stringy/composer.json b/vendor/danielstjules/stringy/composer.json deleted file mode 100644 index 092989f4..00000000 --- a/vendor/danielstjules/stringy/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "danielstjules/stringy", - "description": "A string manipulation library with multibyte support", - "keywords": [ - "multibyte", "string", "manipulation", "utility", "methods", "utf-8", - "helpers", "utils", "utf" - ], - "homepage": "https://github.com/danielstjules/Stringy", - "license": "MIT", - "authors": [ - { - "name": "Daniel St. Jules", - "email": "danielst.jules@gmail.com", - "homepage": "http://www.danielstjules.com" - } - ], - "require": { - "php": ">=5.4.0", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "support": { - "issues": "https://github.com/danielstjules/Stringy/issues", - "source": "https://github.com/danielstjules/Stringy" - }, - "autoload": { - "psr-4": { "Stringy\\": "src/" }, - "files": ["src/Create.php"] - }, - "autoload-dev": { - "classmap": [ "tests" ] - } -} diff --git a/vendor/danielstjules/stringy/src/Create.php b/vendor/danielstjules/stringy/src/Create.php deleted file mode 100644 index c6a2f44a..00000000 --- a/vendor/danielstjules/stringy/src/Create.php +++ /dev/null @@ -1,19 +0,0 @@ -slice(0, 3); - * The result is not cast, so the return value may be of type Stringy, - * integer, boolean, etc. - * - * @param string $name - * @param mixed[] $arguments - * - * @return Stringy - * - * @throws \BadMethodCallException - */ - public static function __callStatic($name, $arguments) - { - if (!static::$methodArgs) { - $stringyClass = new ReflectionClass('Stringy\Stringy'); - $methods = $stringyClass->getMethods(ReflectionMethod::IS_PUBLIC); - - foreach ($methods as $method) { - $params = $method->getNumberOfParameters() + 2; - static::$methodArgs[$method->name] = $params; - } - } - - if (!isset(static::$methodArgs[$name])) { - throw new BadMethodCallException($name . ' is not a valid method'); - } - - $numArgs = count($arguments); - $str = ($numArgs) ? $arguments[0] : ''; - - if ($numArgs === static::$methodArgs[$name]) { - $args = array_slice($arguments, 1, -1); - $encoding = $arguments[$numArgs - 1]; - } else { - $args = array_slice($arguments, 1); - $encoding = null; - } - - $stringy = Stringy::create($str, $encoding); - - $result = call_user_func_array([$stringy, $name], $args); - - $cast = function($val) { - if (is_object($val) && $val instanceof Stringy) { - return (string) $val; - } else { - return $val; - } - }; - - return is_array($result) ? array_map($cast, $result) : $cast($result); - } -} diff --git a/vendor/danielstjules/stringy/src/Stringy.php b/vendor/danielstjules/stringy/src/Stringy.php deleted file mode 100644 index ccb6f5aa..00000000 --- a/vendor/danielstjules/stringy/src/Stringy.php +++ /dev/null @@ -1,1986 +0,0 @@ -str = (string) $str; - $this->encoding = $encoding ?: \mb_internal_encoding(); - } - - /** - * Creates a Stringy object and assigns both str and encoding properties - * the supplied values. $str is cast to a string prior to assignment, and if - * $encoding is not specified, it defaults to mb_internal_encoding(). It - * then returns the initialized object. Throws an InvalidArgumentException - * if the first argument is an array or object without a __toString method. - * - * @param mixed $str Value to modify, after being cast to string - * @param string $encoding The character encoding - * @return static A Stringy object - * @throws \InvalidArgumentException if an array or object without a - * __toString method is passed as the first argument - */ - public static function create($str = '', $encoding = null) - { - return new static($str, $encoding); - } - - /** - * Returns the value in $str. - * - * @return string The current value of the $str property - */ - public function __toString() - { - return $this->str; - } - - /** - * Returns a new string with $string appended. - * - * @param string $string The string to append - * @return static Object with appended $string - */ - public function append($string) - { - return static::create($this->str . $string, $this->encoding); - } - - /** - * Returns the character at $index, with indexes starting at 0. - * - * @param int $index Position of the character - * @return static The character at $index - */ - public function at($index) - { - return $this->substr($index, 1); - } - - /** - * Returns the substring between $start and $end, if found, or an empty - * string. An optional offset may be supplied from which to begin the - * search for the start string. - * - * @param string $start Delimiter marking the start of the substring - * @param string $end Delimiter marking the end of the substring - * @param int $offset Index from which to begin the search - * @return static Object whose $str is a substring between $start and $end - */ - public function between($start, $end, $offset = 0) - { - $startIndex = $this->indexOf($start, $offset); - if ($startIndex === false) { - return static::create('', $this->encoding); - } - - $substrIndex = $startIndex + \mb_strlen($start, $this->encoding); - $endIndex = $this->indexOf($end, $substrIndex); - if ($endIndex === false) { - return static::create('', $this->encoding); - } - - return $this->substr($substrIndex, $endIndex - $substrIndex); - } - - /** - * Returns a camelCase version of the string. Trims surrounding spaces, - * capitalizes letters following digits, spaces, dashes and underscores, - * and removes spaces, dashes, as well as underscores. - * - * @return static Object with $str in camelCase - */ - public function camelize() - { - $encoding = $this->encoding; - $stringy = $this->trim()->lowerCaseFirst(); - $stringy->str = preg_replace('/^[-_]+/', '', $stringy->str); - - $stringy->str = preg_replace_callback( - '/[-_\s]+(.)?/u', - function ($match) use ($encoding) { - if (isset($match[1])) { - return \mb_strtoupper($match[1], $encoding); - } - - return ''; - }, - $stringy->str - ); - - $stringy->str = preg_replace_callback( - '/[\d]+(.)?/u', - function ($match) use ($encoding) { - return \mb_strtoupper($match[0], $encoding); - }, - $stringy->str - ); - - return $stringy; - } - - /** - * Returns an array consisting of the characters in the string. - * - * @return array An array of string chars - */ - public function chars() - { - $chars = []; - for ($i = 0, $l = $this->length(); $i < $l; $i++) { - $chars[] = $this->at($i)->str; - } - - return $chars; - } - - /** - * Trims the string and replaces consecutive whitespace characters with a - * single space. This includes tabs and newline characters, as well as - * multibyte whitespace such as the thin space and ideographic space. - * - * @return static Object with a trimmed $str and condensed whitespace - */ - public function collapseWhitespace() - { - return $this->regexReplace('[[:space:]]+', ' ')->trim(); - } - - /** - * Returns true if the string contains $needle, false otherwise. By default - * the comparison is case-sensitive, but can be made insensitive by setting - * $caseSensitive to false. - * - * @param string $needle Substring to look for - * @param bool $caseSensitive Whether or not to enforce case-sensitivity - * @return bool Whether or not $str contains $needle - */ - public function contains($needle, $caseSensitive = true) - { - $encoding = $this->encoding; - - if ($caseSensitive) { - return (\mb_strpos($this->str, $needle, 0, $encoding) !== false); - } - - return (\mb_stripos($this->str, $needle, 0, $encoding) !== false); - } - - /** - * Returns true if the string contains all $needles, false otherwise. By - * default the comparison is case-sensitive, but can be made insensitive by - * setting $caseSensitive to false. - * - * @param string[] $needles Substrings to look for - * @param bool $caseSensitive Whether or not to enforce case-sensitivity - * @return bool Whether or not $str contains $needle - */ - public function containsAll($needles, $caseSensitive = true) - { - if (empty($needles)) { - return false; - } - - foreach ($needles as $needle) { - if (!$this->contains($needle, $caseSensitive)) { - return false; - } - } - - return true; - } - - /** - * Returns true if the string contains any $needles, false otherwise. By - * default the comparison is case-sensitive, but can be made insensitive by - * setting $caseSensitive to false. - * - * @param string[] $needles Substrings to look for - * @param bool $caseSensitive Whether or not to enforce case-sensitivity - * @return bool Whether or not $str contains $needle - */ - public function containsAny($needles, $caseSensitive = true) - { - if (empty($needles)) { - return false; - } - - foreach ($needles as $needle) { - if ($this->contains($needle, $caseSensitive)) { - return true; - } - } - - return false; - } - - /** - * Returns the length of the string, implementing the countable interface. - * - * @return int The number of characters in the string, given the encoding - */ - public function count() - { - return $this->length(); - } - - /** - * Returns the number of occurrences of $substring in the given string. - * By default, the comparison is case-sensitive, but can be made insensitive - * by setting $caseSensitive to false. - * - * @param string $substring The substring to search for - * @param bool $caseSensitive Whether or not to enforce case-sensitivity - * @return int The number of $substring occurrences - */ - public function countSubstr($substring, $caseSensitive = true) - { - if ($caseSensitive) { - return \mb_substr_count($this->str, $substring, $this->encoding); - } - - $str = \mb_strtoupper($this->str, $this->encoding); - $substring = \mb_strtoupper($substring, $this->encoding); - - return \mb_substr_count($str, $substring, $this->encoding); - } - - /** - * Returns a lowercase and trimmed string separated by dashes. Dashes are - * inserted before uppercase characters (with the exception of the first - * character of the string), and in place of spaces as well as underscores. - * - * @return static Object with a dasherized $str - */ - public function dasherize() - { - return $this->delimit('-'); - } - - /** - * Returns a lowercase and trimmed string separated by the given delimiter. - * Delimiters are inserted before uppercase characters (with the exception - * of the first character of the string), and in place of spaces, dashes, - * and underscores. Alpha delimiters are not converted to lowercase. - * - * @param string $delimiter Sequence used to separate parts of the string - * @return static Object with a delimited $str - */ - public function delimit($delimiter) - { - $regexEncoding = $this->regexEncoding(); - $this->regexEncoding($this->encoding); - - $str = $this->eregReplace('\B([A-Z])', '-\1', $this->trim()); - $str = \mb_strtolower($str, $this->encoding); - $str = $this->eregReplace('[-_\s]+', $delimiter, $str); - - $this->regexEncoding($regexEncoding); - - return static::create($str, $this->encoding); - } - - /** - * Returns true if the string ends with $substring, false otherwise. By - * default, the comparison is case-sensitive, but can be made insensitive - * by setting $caseSensitive to false. - * - * @param string $substring The substring to look for - * @param bool $caseSensitive Whether or not to enforce case-sensitivity - * @return bool Whether or not $str ends with $substring - */ - public function endsWith($substring, $caseSensitive = true) - { - $substringLength = \mb_strlen($substring, $this->encoding); - $strLength = $this->length(); - - $endOfStr = \mb_substr($this->str, $strLength - $substringLength, - $substringLength, $this->encoding); - - if (!$caseSensitive) { - $substring = \mb_strtolower($substring, $this->encoding); - $endOfStr = \mb_strtolower($endOfStr, $this->encoding); - } - - return (string) $substring === $endOfStr; - } - - /** - * Returns true if the string ends with any of $substrings, false otherwise. - * By default, the comparison is case-sensitive, but can be made insensitive - * by setting $caseSensitive to false. - * - * @param string[] $substrings Substrings to look for - * @param bool $caseSensitive Whether or not to enforce - * case-sensitivity - * @return bool Whether or not $str ends with $substring - */ - public function endsWithAny($substrings, $caseSensitive = true) - { - if (empty($substrings)) { - return false; - } - - foreach ($substrings as $substring) { - if ($this->endsWith($substring, $caseSensitive)) { - return true; - } - } - - return false; - } - - /** - * Ensures that the string begins with $substring. If it doesn't, it's - * prepended. - * - * @param string $substring The substring to add if not present - * @return static Object with its $str prefixed by the $substring - */ - public function ensureLeft($substring) - { - $stringy = static::create($this->str, $this->encoding); - - if (!$stringy->startsWith($substring)) { - $stringy->str = $substring . $stringy->str; - } - - return $stringy; - } - - /** - * Ensures that the string ends with $substring. If it doesn't, it's - * appended. - * - * @param string $substring The substring to add if not present - * @return static Object with its $str suffixed by the $substring - */ - public function ensureRight($substring) - { - $stringy = static::create($this->str, $this->encoding); - - if (!$stringy->endsWith($substring)) { - $stringy->str .= $substring; - } - - return $stringy; - } - - /** - * Returns the first $n characters of the string. - * - * @param int $n Number of characters to retrieve from the start - * @return static Object with its $str being the first $n chars - */ - public function first($n) - { - $stringy = static::create($this->str, $this->encoding); - - if ($n < 0) { - $stringy->str = ''; - return $stringy; - } - - return $stringy->substr(0, $n); - } - - /** - * Returns the encoding used by the Stringy object. - * - * @return string The current value of the $encoding property - */ - public function getEncoding() - { - return $this->encoding; - } - - /** - * Returns a new ArrayIterator, thus implementing the IteratorAggregate - * interface. The ArrayIterator's constructor is passed an array of chars - * in the multibyte string. This enables the use of foreach with instances - * of Stringy\Stringy. - * - * @return \ArrayIterator An iterator for the characters in the string - */ - public function getIterator() - { - return new ArrayIterator($this->chars()); - } - - /** - * Returns true if the string contains a lower case char, false - * otherwise. - * - * @return bool Whether or not the string contains a lower case character. - */ - public function hasLowerCase() - { - return $this->matchesPattern('.*[[:lower:]]'); - } - - /** - * Returns true if the string contains an upper case char, false - * otherwise. - * - * @return bool Whether or not the string contains an upper case character. - */ - public function hasUpperCase() - { - return $this->matchesPattern('.*[[:upper:]]'); - } - - - /** - * Convert all HTML entities to their applicable characters. An alias of - * html_entity_decode. For a list of flags, refer to - * http://php.net/manual/en/function.html-entity-decode.php - * - * @param int|null $flags Optional flags - * @return static Object with the resulting $str after being html decoded. - */ - public function htmlDecode($flags = ENT_COMPAT) - { - $str = html_entity_decode($this->str, $flags, $this->encoding); - - return static::create($str, $this->encoding); - } - - /** - * Convert all applicable characters to HTML entities. An alias of - * htmlentities. Refer to http://php.net/manual/en/function.htmlentities.php - * for a list of flags. - * - * @param int|null $flags Optional flags - * @return static Object with the resulting $str after being html encoded. - */ - public function htmlEncode($flags = ENT_COMPAT) - { - $str = htmlentities($this->str, $flags, $this->encoding); - - return static::create($str, $this->encoding); - } - - /** - * Capitalizes the first word of the string, replaces underscores with - * spaces, and strips '_id'. - * - * @return static Object with a humanized $str - */ - public function humanize() - { - $str = str_replace(['_id', '_'], ['', ' '], $this->str); - - return static::create($str, $this->encoding)->trim()->upperCaseFirst(); - } - - /** - * Returns the index of the first occurrence of $needle in the string, - * and false if not found. Accepts an optional offset from which to begin - * the search. - * - * @param string $needle Substring to look for - * @param int $offset Offset from which to search - * @return int|bool The occurrence's index if found, otherwise false - */ - public function indexOf($needle, $offset = 0) - { - return \mb_strpos($this->str, (string) $needle, - (int) $offset, $this->encoding); - } - - /** - * Returns the index of the last occurrence of $needle in the string, - * and false if not found. Accepts an optional offset from which to begin - * the search. Offsets may be negative to count from the last character - * in the string. - * - * @param string $needle Substring to look for - * @param int $offset Offset from which to search - * @return int|bool The last occurrence's index if found, otherwise false - */ - public function indexOfLast($needle, $offset = 0) - { - return \mb_strrpos($this->str, (string) $needle, - (int) $offset, $this->encoding); - } - - /** - * Inserts $substring into the string at the $index provided. - * - * @param string $substring String to be inserted - * @param int $index The index at which to insert the substring - * @return static Object with the resulting $str after the insertion - */ - public function insert($substring, $index) - { - $stringy = static::create($this->str, $this->encoding); - if ($index > $stringy->length()) { - return $stringy; - } - - $start = \mb_substr($stringy->str, 0, $index, $stringy->encoding); - $end = \mb_substr($stringy->str, $index, $stringy->length(), - $stringy->encoding); - - $stringy->str = $start . $substring . $end; - - return $stringy; - } - - /** - * Returns true if the string contains only alphabetic chars, false - * otherwise. - * - * @return bool Whether or not $str contains only alphabetic chars - */ - public function isAlpha() - { - return $this->matchesPattern('^[[:alpha:]]*$'); - } - - /** - * Returns true if the string contains only alphabetic and numeric chars, - * false otherwise. - * - * @return bool Whether or not $str contains only alphanumeric chars - */ - public function isAlphanumeric() - { - return $this->matchesPattern('^[[:alnum:]]*$'); - } - - /** - * Returns true if the string contains only whitespace chars, false - * otherwise. - * - * @return bool Whether or not $str contains only whitespace characters - */ - public function isBlank() - { - return $this->matchesPattern('^[[:space:]]*$'); - } - - /** - * Returns true if the string contains only hexadecimal chars, false - * otherwise. - * - * @return bool Whether or not $str contains only hexadecimal chars - */ - public function isHexadecimal() - { - return $this->matchesPattern('^[[:xdigit:]]*$'); - } - - /** - * Returns true if the string is JSON, false otherwise. Unlike json_decode - * in PHP 5.x, this method is consistent with PHP 7 and other JSON parsers, - * in that an empty string is not considered valid JSON. - * - * @return bool Whether or not $str is JSON - */ - public function isJson() - { - if (!$this->length()) { - return false; - } - - json_decode($this->str); - - return (json_last_error() === JSON_ERROR_NONE); - } - - /** - * Returns true if the string contains only lower case chars, false - * otherwise. - * - * @return bool Whether or not $str contains only lower case characters - */ - public function isLowerCase() - { - return $this->matchesPattern('^[[:lower:]]*$'); - } - - /** - * Returns true if the string is serialized, false otherwise. - * - * @return bool Whether or not $str is serialized - */ - public function isSerialized() - { - return $this->str === 'b:0;' || @unserialize($this->str) !== false; - } - - - /** - * Returns true if the string is base64 encoded, false otherwise. - * - * @return bool Whether or not $str is base64 encoded - */ - public function isBase64() - { - return (base64_encode(base64_decode($this->str, true)) === $this->str); - } - - /** - * Returns true if the string contains only lower case chars, false - * otherwise. - * - * @return bool Whether or not $str contains only lower case characters - */ - public function isUpperCase() - { - return $this->matchesPattern('^[[:upper:]]*$'); - } - - /** - * Returns the last $n characters of the string. - * - * @param int $n Number of characters to retrieve from the end - * @return static Object with its $str being the last $n chars - */ - public function last($n) - { - $stringy = static::create($this->str, $this->encoding); - - if ($n <= 0) { - $stringy->str = ''; - return $stringy; - } - - return $stringy->substr(-$n); - } - - /** - * Returns the length of the string. An alias for PHP's mb_strlen() function. - * - * @return int The number of characters in $str given the encoding - */ - public function length() - { - return \mb_strlen($this->str, $this->encoding); - } - - /** - * Splits on newlines and carriage returns, returning an array of Stringy - * objects corresponding to the lines in the string. - * - * @return static[] An array of Stringy objects - */ - public function lines() - { - $array = $this->split('[\r\n]{1,2}', $this->str); - for ($i = 0; $i < count($array); $i++) { - $array[$i] = static::create($array[$i], $this->encoding); - } - - return $array; - } - - /** - * Returns the longest common prefix between the string and $otherStr. - * - * @param string $otherStr Second string for comparison - * @return static Object with its $str being the longest common prefix - */ - public function longestCommonPrefix($otherStr) - { - $encoding = $this->encoding; - $maxLength = min($this->length(), \mb_strlen($otherStr, $encoding)); - - $longestCommonPrefix = ''; - for ($i = 0; $i < $maxLength; $i++) { - $char = \mb_substr($this->str, $i, 1, $encoding); - - if ($char == \mb_substr($otherStr, $i, 1, $encoding)) { - $longestCommonPrefix .= $char; - } else { - break; - } - } - - return static::create($longestCommonPrefix, $encoding); - } - - /** - * Returns the longest common suffix between the string and $otherStr. - * - * @param string $otherStr Second string for comparison - * @return static Object with its $str being the longest common suffix - */ - public function longestCommonSuffix($otherStr) - { - $encoding = $this->encoding; - $maxLength = min($this->length(), \mb_strlen($otherStr, $encoding)); - - $longestCommonSuffix = ''; - for ($i = 1; $i <= $maxLength; $i++) { - $char = \mb_substr($this->str, -$i, 1, $encoding); - - if ($char == \mb_substr($otherStr, -$i, 1, $encoding)) { - $longestCommonSuffix = $char . $longestCommonSuffix; - } else { - break; - } - } - - return static::create($longestCommonSuffix, $encoding); - } - - /** - * Returns the longest common substring between the string and $otherStr. - * In the case of ties, it returns that which occurs first. - * - * @param string $otherStr Second string for comparison - * @return static Object with its $str being the longest common substring - */ - public function longestCommonSubstring($otherStr) - { - // Uses dynamic programming to solve - // http://en.wikipedia.org/wiki/Longest_common_substring_problem - $encoding = $this->encoding; - $stringy = static::create($this->str, $encoding); - $strLength = $stringy->length(); - $otherLength = \mb_strlen($otherStr, $encoding); - - // Return if either string is empty - if ($strLength == 0 || $otherLength == 0) { - $stringy->str = ''; - return $stringy; - } - - $len = 0; - $end = 0; - $table = array_fill(0, $strLength + 1, - array_fill(0, $otherLength + 1, 0)); - - for ($i = 1; $i <= $strLength; $i++) { - for ($j = 1; $j <= $otherLength; $j++) { - $strChar = \mb_substr($stringy->str, $i - 1, 1, $encoding); - $otherChar = \mb_substr($otherStr, $j - 1, 1, $encoding); - - if ($strChar == $otherChar) { - $table[$i][$j] = $table[$i - 1][$j - 1] + 1; - if ($table[$i][$j] > $len) { - $len = $table[$i][$j]; - $end = $i; - } - } else { - $table[$i][$j] = 0; - } - } - } - - $stringy->str = \mb_substr($stringy->str, $end - $len, $len, $encoding); - - return $stringy; - } - - /** - * Converts the first character of the string to lower case. - * - * @return static Object with the first character of $str being lower case - */ - public function lowerCaseFirst() - { - $first = \mb_substr($this->str, 0, 1, $this->encoding); - $rest = \mb_substr($this->str, 1, $this->length() - 1, - $this->encoding); - - $str = \mb_strtolower($first, $this->encoding) . $rest; - - return static::create($str, $this->encoding); - } - - /** - * Returns whether or not a character exists at an index. Offsets may be - * negative to count from the last character in the string. Implements - * part of the ArrayAccess interface. - * - * @param mixed $offset The index to check - * @return boolean Whether or not the index exists - */ - public function offsetExists($offset) - { - $length = $this->length(); - $offset = (int) $offset; - - if ($offset >= 0) { - return ($length > $offset); - } - - return ($length >= abs($offset)); - } - - /** - * Returns the character at the given index. Offsets may be negative to - * count from the last character in the string. Implements part of the - * ArrayAccess interface, and throws an OutOfBoundsException if the index - * does not exist. - * - * @param mixed $offset The index from which to retrieve the char - * @return mixed The character at the specified index - * @throws \OutOfBoundsException If the positive or negative offset does - * not exist - */ - public function offsetGet($offset) - { - $offset = (int) $offset; - $length = $this->length(); - - if (($offset >= 0 && $length <= $offset) || $length < abs($offset)) { - throw new OutOfBoundsException('No character exists at the index'); - } - - return \mb_substr($this->str, $offset, 1, $this->encoding); - } - - /** - * Implements part of the ArrayAccess interface, but throws an exception - * when called. This maintains the immutability of Stringy objects. - * - * @param mixed $offset The index of the character - * @param mixed $value Value to set - * @throws \Exception When called - */ - public function offsetSet($offset, $value) - { - // Stringy is immutable, cannot directly set char - throw new Exception('Stringy object is immutable, cannot modify char'); - } - - /** - * Implements part of the ArrayAccess interface, but throws an exception - * when called. This maintains the immutability of Stringy objects. - * - * @param mixed $offset The index of the character - * @throws \Exception When called - */ - public function offsetUnset($offset) - { - // Don't allow directly modifying the string - throw new Exception('Stringy object is immutable, cannot unset char'); - } - - /** - * Pads the string to a given length with $padStr. If length is less than - * or equal to the length of the string, no padding takes places. The - * default string used for padding is a space, and the default type (one of - * 'left', 'right', 'both') is 'right'. Throws an InvalidArgumentException - * if $padType isn't one of those 3 values. - * - * @param int $length Desired string length after padding - * @param string $padStr String used to pad, defaults to space - * @param string $padType One of 'left', 'right', 'both' - * @return static Object with a padded $str - * @throws /InvalidArgumentException If $padType isn't one of 'right', - * 'left' or 'both' - */ - public function pad($length, $padStr = ' ', $padType = 'right') - { - if (!in_array($padType, ['left', 'right', 'both'])) { - throw new InvalidArgumentException('Pad expects $padType ' . - "to be one of 'left', 'right' or 'both'"); - } - - switch ($padType) { - case 'left': - return $this->padLeft($length, $padStr); - case 'right': - return $this->padRight($length, $padStr); - default: - return $this->padBoth($length, $padStr); - } - } - - /** - * Returns a new string of a given length such that both sides of the - * string are padded. Alias for pad() with a $padType of 'both'. - * - * @param int $length Desired string length after padding - * @param string $padStr String used to pad, defaults to space - * @return static String with padding applied - */ - public function padBoth($length, $padStr = ' ') - { - $padding = $length - $this->length(); - - return $this->applyPadding(floor($padding / 2), ceil($padding / 2), - $padStr); - } - - /** - * Returns a new string of a given length such that the beginning of the - * string is padded. Alias for pad() with a $padType of 'left'. - * - * @param int $length Desired string length after padding - * @param string $padStr String used to pad, defaults to space - * @return static String with left padding - */ - public function padLeft($length, $padStr = ' ') - { - return $this->applyPadding($length - $this->length(), 0, $padStr); - } - - /** - * Returns a new string of a given length such that the end of the string - * is padded. Alias for pad() with a $padType of 'right'. - * - * @param int $length Desired string length after padding - * @param string $padStr String used to pad, defaults to space - * @return static String with right padding - */ - public function padRight($length, $padStr = ' ') - { - return $this->applyPadding(0, $length - $this->length(), $padStr); - } - - /** - * Returns a new string starting with $string. - * - * @param string $string The string to append - * @return static Object with appended $string - */ - public function prepend($string) - { - return static::create($string . $this->str, $this->encoding); - } - - /** - * Replaces all occurrences of $pattern in $str by $replacement. An alias - * for mb_ereg_replace(). Note that the 'i' option with multibyte patterns - * in mb_ereg_replace() requires PHP 5.6+ for correct results. This is due - * to a lack of support in the bundled version of Oniguruma in PHP < 5.6, - * and current versions of HHVM (3.8 and below). - * - * @param string $pattern The regular expression pattern - * @param string $replacement The string to replace with - * @param string $options Matching conditions to be used - * @return static Object with the resulting $str after the replacements - */ - public function regexReplace($pattern, $replacement, $options = 'msr') - { - $regexEncoding = $this->regexEncoding(); - $this->regexEncoding($this->encoding); - - $str = $this->eregReplace($pattern, $replacement, $this->str, $options); - $this->regexEncoding($regexEncoding); - - return static::create($str, $this->encoding); - } - - /** - * Returns a new string with the prefix $substring removed, if present. - * - * @param string $substring The prefix to remove - * @return static Object having a $str without the prefix $substring - */ - public function removeLeft($substring) - { - $stringy = static::create($this->str, $this->encoding); - - if ($stringy->startsWith($substring)) { - $substringLength = \mb_strlen($substring, $stringy->encoding); - return $stringy->substr($substringLength); - } - - return $stringy; - } - - /** - * Returns a new string with the suffix $substring removed, if present. - * - * @param string $substring The suffix to remove - * @return static Object having a $str without the suffix $substring - */ - public function removeRight($substring) - { - $stringy = static::create($this->str, $this->encoding); - - if ($stringy->endsWith($substring)) { - $substringLength = \mb_strlen($substring, $stringy->encoding); - return $stringy->substr(0, $stringy->length() - $substringLength); - } - - return $stringy; - } - - /** - * Returns a repeated string given a multiplier. An alias for str_repeat. - * - * @param int $multiplier The number of times to repeat the string - * @return static Object with a repeated str - */ - public function repeat($multiplier) - { - $repeated = str_repeat($this->str, $multiplier); - - return static::create($repeated, $this->encoding); - } - - /** - * Replaces all occurrences of $search in $str by $replacement. - * - * @param string $search The needle to search for - * @param string $replacement The string to replace with - * @return static Object with the resulting $str after the replacements - */ - public function replace($search, $replacement) - { - return $this->regexReplace(preg_quote($search), $replacement); - } - - /** - * Returns a reversed string. A multibyte version of strrev(). - * - * @return static Object with a reversed $str - */ - public function reverse() - { - $strLength = $this->length(); - $reversed = ''; - - // Loop from last index of string to first - for ($i = $strLength - 1; $i >= 0; $i--) { - $reversed .= \mb_substr($this->str, $i, 1, $this->encoding); - } - - return static::create($reversed, $this->encoding); - } - - /** - * Truncates the string to a given length, while ensuring that it does not - * split words. If $substring is provided, and truncating occurs, the - * string is further truncated so that the substring may be appended without - * exceeding the desired length. - * - * @param int $length Desired length of the truncated string - * @param string $substring The substring to append if it can fit - * @return static Object with the resulting $str after truncating - */ - public function safeTruncate($length, $substring = '') - { - $stringy = static::create($this->str, $this->encoding); - if ($length >= $stringy->length()) { - return $stringy; - } - - // Need to further trim the string so we can append the substring - $encoding = $stringy->encoding; - $substringLength = \mb_strlen($substring, $encoding); - $length = $length - $substringLength; - - $truncated = \mb_substr($stringy->str, 0, $length, $encoding); - - // If the last word was truncated - if (mb_strpos($stringy->str, ' ', $length - 1, $encoding) != $length) { - // Find pos of the last occurrence of a space, get up to that - $lastPos = \mb_strrpos($truncated, ' ', 0, $encoding); - if ($lastPos !== false) { - $truncated = \mb_substr($truncated, 0, $lastPos, $encoding); - } - } - - $stringy->str = $truncated . $substring; - - return $stringy; - } - - /* - * A multibyte str_shuffle() function. It returns a string with its - * characters in random order. - * - * @return static Object with a shuffled $str - */ - public function shuffle() - { - $indexes = range(0, $this->length() - 1); - shuffle($indexes); - - $shuffledStr = ''; - foreach ($indexes as $i) { - $shuffledStr .= \mb_substr($this->str, $i, 1, $this->encoding); - } - - return static::create($shuffledStr, $this->encoding); - } - - /** - * Converts the string into an URL slug. This includes replacing non-ASCII - * characters with their closest ASCII equivalents, removing remaining - * non-ASCII and non-alphanumeric characters, and replacing whitespace with - * $replacement. The replacement defaults to a single dash, and the string - * is also converted to lowercase. The language of the source string can - * also be supplied for language-specific transliteration. - * - * @param string $replacement The string used to replace whitespace - * @param string $language Language of the source string - * @return static Object whose $str has been converted to an URL slug - */ - public function slugify($replacement = '-', $language = 'en') - { - $stringy = $this->toAscii($language); - - $stringy->str = str_replace('@', $replacement, $stringy); - $quotedReplacement = preg_quote($replacement); - $pattern = "/[^a-zA-Z\d\s-_$quotedReplacement]/u"; - $stringy->str = preg_replace($pattern, '', $stringy); - - return $stringy->toLowerCase()->delimit($replacement) - ->removeLeft($replacement)->removeRight($replacement); - } - - /** - * Returns true if the string begins with $substring, false otherwise. By - * default, the comparison is case-sensitive, but can be made insensitive - * by setting $caseSensitive to false. - * - * @param string $substring The substring to look for - * @param bool $caseSensitive Whether or not to enforce - * case-sensitivity - * @return bool Whether or not $str starts with $substring - */ - public function startsWith($substring, $caseSensitive = true) - { - $substringLength = \mb_strlen($substring, $this->encoding); - $startOfStr = \mb_substr($this->str, 0, $substringLength, - $this->encoding); - - if (!$caseSensitive) { - $substring = \mb_strtolower($substring, $this->encoding); - $startOfStr = \mb_strtolower($startOfStr, $this->encoding); - } - - return (string) $substring === $startOfStr; - } - - /** - * Returns true if the string begins with any of $substrings, false - * otherwise. By default the comparison is case-sensitive, but can be made - * insensitive by setting $caseSensitive to false. - * - * @param string[] $substrings Substrings to look for - * @param bool $caseSensitive Whether or not to enforce - * case-sensitivity - * @return bool Whether or not $str starts with $substring - */ - public function startsWithAny($substrings, $caseSensitive = true) - { - if (empty($substrings)) { - return false; - } - - foreach ($substrings as $substring) { - if ($this->startsWith($substring, $caseSensitive)) { - return true; - } - } - - return false; - } - - /** - * Returns the substring beginning at $start, and up to, but not including - * the index specified by $end. If $end is omitted, the function extracts - * the remaining string. If $end is negative, it is computed from the end - * of the string. - * - * @param int $start Initial index from which to begin extraction - * @param int $end Optional index at which to end extraction - * @return static Object with its $str being the extracted substring - */ - public function slice($start, $end = null) - { - if ($end === null) { - $length = $this->length(); - } elseif ($end >= 0 && $end <= $start) { - return static::create('', $this->encoding); - } elseif ($end < 0) { - $length = $this->length() + $end - $start; - } else { - $length = $end - $start; - } - - return $this->substr($start, $length); - } - - /** - * Splits the string with the provided regular expression, returning an - * array of Stringy objects. An optional integer $limit will truncate the - * results. - * - * @param string $pattern The regex with which to split the string - * @param int $limit Optional maximum number of results to return - * @return static[] An array of Stringy objects - */ - public function split($pattern, $limit = null) - { - if ($limit === 0) { - return []; - } - - // mb_split errors when supplied an empty pattern in < PHP 5.4.13 - // and HHVM < 3.8 - if ($pattern === '') { - return [static::create($this->str, $this->encoding)]; - } - - $regexEncoding = $this->regexEncoding(); - $this->regexEncoding($this->encoding); - - // mb_split returns the remaining unsplit string in the last index when - // supplying a limit - $limit = ($limit > 0) ? $limit += 1 : -1; - - static $functionExists; - if ($functionExists === null) { - $functionExists = function_exists('\mb_split'); - } - - if ($functionExists) { - $array = \mb_split($pattern, $this->str, $limit); - } else if ($this->supportsEncoding()) { - $array = \preg_split("/$pattern/", $this->str, $limit); - } - - $this->regexEncoding($regexEncoding); - - if ($limit > 0 && count($array) === $limit) { - array_pop($array); - } - - for ($i = 0; $i < count($array); $i++) { - $array[$i] = static::create($array[$i], $this->encoding); - } - - return $array; - } - - /** - * Strip all whitespace characters. This includes tabs and newline - * characters, as well as multibyte whitespace such as the thin space - * and ideographic space. - * - * @return static Object with whitespace stripped - */ - public function stripWhitespace() - { - return $this->regexReplace('[[:space:]]+', ''); - } - - /** - * Returns the substring beginning at $start with the specified $length. - * It differs from the mb_substr() function in that providing a $length of - * null will return the rest of the string, rather than an empty string. - * - * @param int $start Position of the first character to use - * @param int $length Maximum number of characters used - * @return static Object with its $str being the substring - */ - public function substr($start, $length = null) - { - $length = $length === null ? $this->length() : $length; - $str = \mb_substr($this->str, $start, $length, $this->encoding); - - return static::create($str, $this->encoding); - } - - /** - * Surrounds $str with the given substring. - * - * @param string $substring The substring to add to both sides - * @return static Object whose $str had the substring both prepended and - * appended - */ - public function surround($substring) - { - $str = implode('', [$substring, $this->str, $substring]); - - return static::create($str, $this->encoding); - } - - /** - * Returns a case swapped version of the string. - * - * @return static Object whose $str has each character's case swapped - */ - public function swapCase() - { - $stringy = static::create($this->str, $this->encoding); - $encoding = $stringy->encoding; - - $stringy->str = preg_replace_callback( - '/[\S]/u', - function ($match) use ($encoding) { - if ($match[0] == \mb_strtoupper($match[0], $encoding)) { - return \mb_strtolower($match[0], $encoding); - } - - return \mb_strtoupper($match[0], $encoding); - }, - $stringy->str - ); - - return $stringy; - } - - /** - * Returns a string with smart quotes, ellipsis characters, and dashes from - * Windows-1252 (commonly used in Word documents) replaced by their ASCII - * equivalents. - * - * @return static Object whose $str has those characters removed - */ - public function tidy() - { - $str = preg_replace([ - '/\x{2026}/u', - '/[\x{201C}\x{201D}]/u', - '/[\x{2018}\x{2019}]/u', - '/[\x{2013}\x{2014}]/u', - ], [ - '...', - '"', - "'", - '-', - ], $this->str); - - return static::create($str, $this->encoding); - } - - /** - * Returns a trimmed string with the first letter of each word capitalized. - * Also accepts an array, $ignore, allowing you to list words not to be - * capitalized. - * - * @param array $ignore An array of words not to capitalize - * @return static Object with a titleized $str - */ - public function titleize($ignore = null) - { - $stringy = static::create($this->trim(), $this->encoding); - $encoding = $this->encoding; - - $stringy->str = preg_replace_callback( - '/([\S]+)/u', - function ($match) use ($encoding, $ignore) { - if ($ignore && in_array($match[0], $ignore)) { - return $match[0]; - } - - $stringy = new Stringy($match[0], $encoding); - - return (string) $stringy->toLowerCase()->upperCaseFirst(); - }, - $stringy->str - ); - - return $stringy; - } - - /** - * Returns an ASCII version of the string. A set of non-ASCII characters are - * replaced with their closest ASCII counterparts, and the rest are removed - * by default. The language or locale of the source string can be supplied - * for language-specific transliteration in any of the following formats: - * en, en_GB, or en-GB. For example, passing "de" results in "äöü" mapping - * to "aeoeue" rather than "aou" as in other languages. - * - * @param string $language Language of the source string - * @param bool $removeUnsupported Whether or not to remove the - * unsupported characters - * @return static Object whose $str contains only ASCII characters - */ - public function toAscii($language = 'en', $removeUnsupported = true) - { - $str = $this->str; - - $langSpecific = $this->langSpecificCharsArray($language); - if (!empty($langSpecific)) { - $str = str_replace($langSpecific[0], $langSpecific[1], $str); - } - - foreach ($this->charsArray() as $key => $value) { - $str = str_replace($value, $key, $str); - } - - if ($removeUnsupported) { - $str = preg_replace('/[^\x20-\x7E]/u', '', $str); - } - - return static::create($str, $this->encoding); - } - - /** - * Returns a boolean representation of the given logical string value. - * For example, 'true', '1', 'on' and 'yes' will return true. 'false', '0', - * 'off', and 'no' will return false. In all instances, case is ignored. - * For other numeric strings, their sign will determine the return value. - * In addition, blank strings consisting of only whitespace will return - * false. For all other strings, the return value is a result of a - * boolean cast. - * - * @return bool A boolean value for the string - */ - public function toBoolean() - { - $key = $this->toLowerCase()->str; - $map = [ - 'true' => true, - '1' => true, - 'on' => true, - 'yes' => true, - 'false' => false, - '0' => false, - 'off' => false, - 'no' => false - ]; - - if (array_key_exists($key, $map)) { - return $map[$key]; - } elseif (is_numeric($this->str)) { - return (intval($this->str) > 0); - } - - return (bool) $this->regexReplace('[[:space:]]', '')->str; - } - - /** - * Converts all characters in the string to lowercase. An alias for PHP's - * mb_strtolower(). - * - * @return static Object with all characters of $str being lowercase - */ - public function toLowerCase() - { - $str = \mb_strtolower($this->str, $this->encoding); - - return static::create($str, $this->encoding); - } - - /** - * Converts each tab in the string to some number of spaces, as defined by - * $tabLength. By default, each tab is converted to 4 consecutive spaces. - * - * @param int $tabLength Number of spaces to replace each tab with - * @return static Object whose $str has had tabs switched to spaces - */ - public function toSpaces($tabLength = 4) - { - $spaces = str_repeat(' ', $tabLength); - $str = str_replace("\t", $spaces, $this->str); - - return static::create($str, $this->encoding); - } - - /** - * Converts each occurrence of some consecutive number of spaces, as - * defined by $tabLength, to a tab. By default, each 4 consecutive spaces - * are converted to a tab. - * - * @param int $tabLength Number of spaces to replace with a tab - * @return static Object whose $str has had spaces switched to tabs - */ - public function toTabs($tabLength = 4) - { - $spaces = str_repeat(' ', $tabLength); - $str = str_replace($spaces, "\t", $this->str); - - return static::create($str, $this->encoding); - } - - /** - * Converts the first character of each word in the string to uppercase. - * - * @return static Object with all characters of $str being title-cased - */ - public function toTitleCase() - { - $str = \mb_convert_case($this->str, \MB_CASE_TITLE, $this->encoding); - - return static::create($str, $this->encoding); - } - - /** - * Converts all characters in the string to uppercase. An alias for PHP's - * mb_strtoupper(). - * - * @return static Object with all characters of $str being uppercase - */ - public function toUpperCase() - { - $str = \mb_strtoupper($this->str, $this->encoding); - - return static::create($str, $this->encoding); - } - - /** - * Returns a string with whitespace removed from the start and end of the - * string. Supports the removal of unicode whitespace. Accepts an optional - * string of characters to strip instead of the defaults. - * - * @param string $chars Optional string of characters to strip - * @return static Object with a trimmed $str - */ - public function trim($chars = null) - { - $chars = ($chars) ? preg_quote($chars) : '[:space:]'; - - return $this->regexReplace("^[$chars]+|[$chars]+\$", ''); - } - - /** - * Returns a string with whitespace removed from the start of the string. - * Supports the removal of unicode whitespace. Accepts an optional - * string of characters to strip instead of the defaults. - * - * @param string $chars Optional string of characters to strip - * @return static Object with a trimmed $str - */ - public function trimLeft($chars = null) - { - $chars = ($chars) ? preg_quote($chars) : '[:space:]'; - - return $this->regexReplace("^[$chars]+", ''); - } - - /** - * Returns a string with whitespace removed from the end of the string. - * Supports the removal of unicode whitespace. Accepts an optional - * string of characters to strip instead of the defaults. - * - * @param string $chars Optional string of characters to strip - * @return static Object with a trimmed $str - */ - public function trimRight($chars = null) - { - $chars = ($chars) ? preg_quote($chars) : '[:space:]'; - - return $this->regexReplace("[$chars]+\$", ''); - } - - /** - * Truncates the string to a given length. If $substring is provided, and - * truncating occurs, the string is further truncated so that the substring - * may be appended without exceeding the desired length. - * - * @param int $length Desired length of the truncated string - * @param string $substring The substring to append if it can fit - * @return static Object with the resulting $str after truncating - */ - public function truncate($length, $substring = '') - { - $stringy = static::create($this->str, $this->encoding); - if ($length >= $stringy->length()) { - return $stringy; - } - - // Need to further trim the string so we can append the substring - $substringLength = \mb_strlen($substring, $stringy->encoding); - $length = $length - $substringLength; - - $truncated = \mb_substr($stringy->str, 0, $length, $stringy->encoding); - $stringy->str = $truncated . $substring; - - return $stringy; - } - - /** - * Returns a lowercase and trimmed string separated by underscores. - * Underscores are inserted before uppercase characters (with the exception - * of the first character of the string), and in place of spaces as well as - * dashes. - * - * @return static Object with an underscored $str - */ - public function underscored() - { - return $this->delimit('_'); - } - - /** - * Returns an UpperCamelCase version of the supplied string. It trims - * surrounding spaces, capitalizes letters following digits, spaces, dashes - * and underscores, and removes spaces, dashes, underscores. - * - * @return static Object with $str in UpperCamelCase - */ - public function upperCamelize() - { - return $this->camelize()->upperCaseFirst(); - } - - /** - * Converts the first character of the supplied string to upper case. - * - * @return static Object with the first character of $str being upper case - */ - public function upperCaseFirst() - { - $first = \mb_substr($this->str, 0, 1, $this->encoding); - $rest = \mb_substr($this->str, 1, $this->length() - 1, - $this->encoding); - - $str = \mb_strtoupper($first, $this->encoding) . $rest; - - return static::create($str, $this->encoding); - } - - /** - * Returns the replacements for the toAscii() method. - * - * @return array An array of replacements. - */ - protected function charsArray() - { - static $charsArray; - if (isset($charsArray)) return $charsArray; - - return $charsArray = [ - '0' => ['°', '₀', '۰', '0'], - '1' => ['¹', '₁', '۱', '1'], - '2' => ['²', '₂', '۲', '2'], - '3' => ['³', '₃', '۳', '3'], - '4' => ['⁴', '₄', '۴', '٤', '4'], - '5' => ['⁵', '₅', '۵', '٥', '5'], - '6' => ['⁶', '₆', '۶', '٦', '6'], - '7' => ['⁷', '₇', '۷', '7'], - '8' => ['⁸', '₈', '۸', '8'], - '9' => ['⁹', '₉', '۹', '9'], - 'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', - 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', - 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', - 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', - 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', - 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ', 'ا', 'a', 'ä'], - 'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', 'b'], - 'c' => ['ç', 'ć', 'č', 'ĉ', 'ċ', 'c'], - 'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', - 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ', 'd'], - 'e' => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'ề', 'ể', 'ễ', - 'ệ', 'ë', 'ē', 'ę', 'ě', 'ĕ', 'ė', 'ε', 'έ', 'ἐ', - 'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', 'ὲ', 'έ', 'е', 'ё', 'э', - 'є', 'ə', 'ဧ', 'ေ', 'ဲ', 'ე', 'ए', 'إ', 'ئ', 'e'], - 'f' => ['ф', 'φ', 'ف', 'ƒ', 'ფ', 'f'], - 'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ', - 'g'], - 'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ', 'h'], - 'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', - 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', - 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', - 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', - 'इ', 'ی', 'i'], - 'j' => ['ĵ', 'ј', 'Ј', 'ჯ', 'ج', 'j'], - 'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ', - 'ک', 'k'], - 'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ', - 'l'], - 'm' => ['м', 'μ', 'م', 'မ', 'მ', 'm'], - 'n' => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', - 'ნ', 'n'], - 'o' => ['ó', 'ò', 'ỏ', 'õ', 'ọ', 'ô', 'ố', 'ồ', 'ổ', 'ỗ', - 'ộ', 'ơ', 'ớ', 'ờ', 'ở', 'ỡ', 'ợ', 'ø', 'ō', 'ő', - 'ŏ', 'ο', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', 'ὸ', 'ό', - 'о', 'و', 'θ', 'ို', 'ǒ', 'ǿ', 'º', 'ო', 'ओ', 'o', - 'ö'], - 'p' => ['п', 'π', 'ပ', 'პ', 'پ', 'p'], - 'q' => ['ყ', 'q'], - 'r' => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر', 'რ', 'r'], - 's' => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص', 'စ', - 'ſ', 'ს', 's'], - 't' => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط', 'ဋ', 'တ', 'ŧ', - 'თ', 'ტ', 't'], - 'u' => ['ú', 'ù', 'ủ', 'ũ', 'ụ', 'ư', 'ứ', 'ừ', 'ử', 'ữ', - 'ự', 'û', 'ū', 'ů', 'ű', 'ŭ', 'ų', 'µ', 'у', 'ဉ', - 'ု', 'ူ', 'ǔ', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'უ', 'उ', 'u', - 'ў', 'ü'], - 'v' => ['в', 'ვ', 'ϐ', 'v'], - 'w' => ['ŵ', 'ω', 'ώ', 'ဝ', 'ွ', 'w'], - 'x' => ['χ', 'ξ', 'x'], - 'y' => ['ý', 'ỳ', 'ỷ', 'ỹ', 'ỵ', 'ÿ', 'ŷ', 'й', 'ы', 'υ', - 'ϋ', 'ύ', 'ΰ', 'ي', 'ယ', 'y'], - 'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ', 'z'], - 'aa' => ['ع', 'आ', 'آ'], - 'ae' => ['æ', 'ǽ'], - 'ai' => ['ऐ'], - 'ch' => ['ч', 'ჩ', 'ჭ', 'چ'], - 'dj' => ['ђ', 'đ'], - 'dz' => ['џ', 'ძ'], - 'ei' => ['ऍ'], - 'gh' => ['غ', 'ღ'], - 'ii' => ['ई'], - 'ij' => ['ij'], - 'kh' => ['х', 'خ', 'ხ'], - 'lj' => ['љ'], - 'nj' => ['њ'], - 'oe' => ['œ', 'ؤ'], - 'oi' => ['ऑ'], - 'oii' => ['ऒ'], - 'ps' => ['ψ'], - 'sh' => ['ш', 'შ', 'ش'], - 'shch' => ['щ'], - 'ss' => ['ß'], - 'sx' => ['ŝ'], - 'th' => ['þ', 'ϑ', 'ث', 'ذ', 'ظ'], - 'ts' => ['ц', 'ც', 'წ'], - 'uu' => ['ऊ'], - 'ya' => ['я'], - 'yu' => ['ю'], - 'zh' => ['ж', 'ჟ', 'ژ'], - '(c)' => ['©'], - 'A' => ['Á', 'À', 'Ả', 'Ã', 'Ạ', 'Ă', 'Ắ', 'Ằ', 'Ẳ', 'Ẵ', - 'Ặ', 'Â', 'Ấ', 'Ầ', 'Ẩ', 'Ẫ', 'Ậ', 'Å', 'Ā', 'Ą', - 'Α', 'Ά', 'Ἀ', 'Ἁ', 'Ἂ', 'Ἃ', 'Ἄ', 'Ἅ', 'Ἆ', 'Ἇ', - 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'Ᾰ', 'Ᾱ', - 'Ὰ', 'Ά', 'ᾼ', 'А', 'Ǻ', 'Ǎ', 'A', 'Ä'], - 'B' => ['Б', 'Β', 'ब', 'B'], - 'C' => ['Ç','Ć', 'Č', 'Ĉ', 'Ċ', 'C'], - 'D' => ['Ď', 'Ð', 'Đ', 'Ɖ', 'Ɗ', 'Ƌ', 'ᴅ', 'ᴆ', 'Д', 'Δ', - 'D'], - 'E' => ['É', 'È', 'Ẻ', 'Ẽ', 'Ẹ', 'Ê', 'Ế', 'Ề', 'Ể', 'Ễ', - 'Ệ', 'Ë', 'Ē', 'Ę', 'Ě', 'Ĕ', 'Ė', 'Ε', 'Έ', 'Ἐ', - 'Ἑ', 'Ἒ', 'Ἓ', 'Ἔ', 'Ἕ', 'Έ', 'Ὲ', 'Е', 'Ё', 'Э', - 'Є', 'Ə', 'E'], - 'F' => ['Ф', 'Φ', 'F'], - 'G' => ['Ğ', 'Ġ', 'Ģ', 'Г', 'Ґ', 'Γ', 'G'], - 'H' => ['Η', 'Ή', 'Ħ', 'H'], - 'I' => ['Í', 'Ì', 'Ỉ', 'Ĩ', 'Ị', 'Î', 'Ï', 'Ī', 'Ĭ', 'Į', - 'İ', 'Ι', 'Ί', 'Ϊ', 'Ἰ', 'Ἱ', 'Ἳ', 'Ἴ', 'Ἵ', 'Ἶ', - 'Ἷ', 'Ῐ', 'Ῑ', 'Ὶ', 'Ί', 'И', 'І', 'Ї', 'Ǐ', 'ϒ', - 'I'], - 'J' => ['J'], - 'K' => ['К', 'Κ', 'K'], - 'L' => ['Ĺ', 'Ł', 'Л', 'Λ', 'Ļ', 'Ľ', 'Ŀ', 'ल', 'L'], - 'M' => ['М', 'Μ', 'M'], - 'N' => ['Ń', 'Ñ', 'Ň', 'Ņ', 'Ŋ', 'Н', 'Ν', 'N'], - 'O' => ['Ó', 'Ò', 'Ỏ', 'Õ', 'Ọ', 'Ô', 'Ố', 'Ồ', 'Ổ', 'Ỗ', - 'Ộ', 'Ơ', 'Ớ', 'Ờ', 'Ở', 'Ỡ', 'Ợ', 'Ø', 'Ō', 'Ő', - 'Ŏ', 'Ο', 'Ό', 'Ὀ', 'Ὁ', 'Ὂ', 'Ὃ', 'Ὄ', 'Ὅ', 'Ὸ', - 'Ό', 'О', 'Θ', 'Ө', 'Ǒ', 'Ǿ', 'O', 'Ö'], - 'P' => ['П', 'Π', 'P'], - 'Q' => ['Q'], - 'R' => ['Ř', 'Ŕ', 'Р', 'Ρ', 'Ŗ', 'R'], - 'S' => ['Ş', 'Ŝ', 'Ș', 'Š', 'Ś', 'С', 'Σ', 'S'], - 'T' => ['Ť', 'Ţ', 'Ŧ', 'Ț', 'Т', 'Τ', 'T'], - 'U' => ['Ú', 'Ù', 'Ủ', 'Ũ', 'Ụ', 'Ư', 'Ứ', 'Ừ', 'Ử', 'Ữ', - 'Ự', 'Û', 'Ū', 'Ů', 'Ű', 'Ŭ', 'Ų', 'У', 'Ǔ', 'Ǖ', - 'Ǘ', 'Ǚ', 'Ǜ', 'U', 'Ў', 'Ü'], - 'V' => ['В', 'V'], - 'W' => ['Ω', 'Ώ', 'Ŵ', 'W'], - 'X' => ['Χ', 'Ξ', 'X'], - 'Y' => ['Ý', 'Ỳ', 'Ỷ', 'Ỹ', 'Ỵ', 'Ÿ', 'Ῠ', 'Ῡ', 'Ὺ', 'Ύ', - 'Ы', 'Й', 'Υ', 'Ϋ', 'Ŷ', 'Y'], - 'Z' => ['Ź', 'Ž', 'Ż', 'З', 'Ζ', 'Z'], - 'AE' => ['Æ', 'Ǽ'], - 'Ch' => ['Ч'], - 'Dj' => ['Ђ'], - 'Dz' => ['Џ'], - 'Gx' => ['Ĝ'], - 'Hx' => ['Ĥ'], - 'Ij' => ['IJ'], - 'Jx' => ['Ĵ'], - 'Kh' => ['Х'], - 'Lj' => ['Љ'], - 'Nj' => ['Њ'], - 'Oe' => ['Œ'], - 'Ps' => ['Ψ'], - 'Sh' => ['Ш'], - 'Shch' => ['Щ'], - 'Ss' => ['ẞ'], - 'Th' => ['Þ'], - 'Ts' => ['Ц'], - 'Ya' => ['Я'], - 'Yu' => ['Ю'], - 'Zh' => ['Ж'], - ' ' => ["\xC2\xA0", "\xE2\x80\x80", "\xE2\x80\x81", - "\xE2\x80\x82", "\xE2\x80\x83", "\xE2\x80\x84", - "\xE2\x80\x85", "\xE2\x80\x86", "\xE2\x80\x87", - "\xE2\x80\x88", "\xE2\x80\x89", "\xE2\x80\x8A", - "\xE2\x80\xAF", "\xE2\x81\x9F", "\xE3\x80\x80", - "\xEF\xBE\xA0"], - ]; - } - - /** - * Returns language-specific replacements for the toAscii() method. - * For example, German will map 'ä' to 'ae', while other languages - * will simply return 'a'. - * - * @param string $language Language of the source string - * @return array An array of replacements. - */ - protected static function langSpecificCharsArray($language = 'en') - { - $split = preg_split('/[-_]/', $language); - $language = strtolower($split[0]); - - static $charsArray = []; - if (isset($charsArray[$language])) { - return $charsArray[$language]; - } - - $languageSpecific = [ - 'de' => [ - ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü' ], - ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], - ], - 'bg' => [ - ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'], - ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'] - ] - ]; - - if (isset($languageSpecific[$language])) { - $charsArray[$language] = $languageSpecific[$language]; - } else { - $charsArray[$language] = []; - } - - return $charsArray[$language]; - } - - /** - * Adds the specified amount of left and right padding to the given string. - * The default character used is a space. - * - * @param int $left Length of left padding - * @param int $right Length of right padding - * @param string $padStr String used to pad - * @return static String with padding applied - */ - protected function applyPadding($left = 0, $right = 0, $padStr = ' ') - { - $stringy = static::create($this->str, $this->encoding); - $length = \mb_strlen($padStr, $stringy->encoding); - - $strLength = $stringy->length(); - $paddedLength = $strLength + $left + $right; - - if (!$length || $paddedLength <= $strLength) { - return $stringy; - } - - $leftPadding = \mb_substr(str_repeat($padStr, ceil($left / $length)), 0, - $left, $stringy->encoding); - $rightPadding = \mb_substr(str_repeat($padStr, ceil($right / $length)), - 0, $right, $stringy->encoding); - - $stringy->str = $leftPadding . $stringy->str . $rightPadding; - - return $stringy; - } - - /** - * Returns true if $str matches the supplied pattern, false otherwise. - * - * @param string $pattern Regex pattern to match against - * @return bool Whether or not $str matches the pattern - */ - protected function matchesPattern($pattern) - { - $regexEncoding = $this->regexEncoding(); - $this->regexEncoding($this->encoding); - - $match = \mb_ereg_match($pattern, $this->str); - $this->regexEncoding($regexEncoding); - - return $match; - } - - /** - * Alias for mb_ereg_replace with a fallback to preg_replace if the - * mbstring module is not installed. - */ - protected function eregReplace($pattern, $replacement, $string, $option = 'msr') - { - static $functionExists; - if ($functionExists === null) { - $functionExists = function_exists('\mb_split'); - } - - if ($functionExists) { - return \mb_ereg_replace($pattern, $replacement, $string, $option); - } else if ($this->supportsEncoding()) { - $option = str_replace('r', '', $option); - return \preg_replace("/$pattern/u$option", $replacement, $string); - } - } - - /** - * Alias for mb_regex_encoding which default to a noop if the mbstring - * module is not installed. - */ - protected function regexEncoding() - { - static $functionExists; - - if ($functionExists === null) { - $functionExists = function_exists('\mb_regex_encoding'); - } - - if ($functionExists) { - $args = func_get_args(); - return call_user_func_array('\mb_regex_encoding', $args); - } - } - - protected function supportsEncoding() - { - $supported = ['UTF-8' => true, 'ASCII' => true]; - - if (isset($supported[$this->encoding])) { - return true; - } else { - throw new \RuntimeException('Stringy method requires the ' . - 'mbstring module for encodings other than ASCII and UTF-8. ' . - 'Encoding used: ' . $this->encoding); - } - } -} diff --git a/vendor/doctrine/annotations/LICENSE b/vendor/doctrine/annotations/LICENSE deleted file mode 100644 index 5e781fce..00000000 --- a/vendor/doctrine/annotations/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2006-2013 Doctrine Project - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/doctrine/annotations/README.md b/vendor/doctrine/annotations/README.md deleted file mode 100644 index c2c7eb7b..00000000 --- a/vendor/doctrine/annotations/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Doctrine Annotations - -[![Build Status](https://github.com/doctrine/annotations/workflows/Continuous%20Integration/badge.svg?label=build)](https://github.com/doctrine/persistence/actions) -[![Dependency Status](https://www.versioneye.com/package/php--doctrine--annotations/badge.png)](https://www.versioneye.com/package/php--doctrine--annotations) -[![Reference Status](https://www.versioneye.com/php/doctrine:annotations/reference_badge.svg)](https://www.versioneye.com/php/doctrine:annotations/references) -[![Total Downloads](https://poser.pugx.org/doctrine/annotations/downloads.png)](https://packagist.org/packages/doctrine/annotations) -[![Latest Stable Version](https://img.shields.io/packagist/v/doctrine/annotations.svg?label=stable)](https://packagist.org/packages/doctrine/annotations) - -Docblock Annotations Parser library (extracted from [Doctrine Common](https://github.com/doctrine/common)). - -## Documentation - -See the [doctrine-project website](https://www.doctrine-project.org/projects/doctrine-annotations/en/latest/index.html). - -## Contributing - -When making a pull request, make sure your changes follow the -[Coding Standard Guidelines](https://www.doctrine-project.org/projects/doctrine-coding-standard/en/current/reference/index.html#introduction). diff --git a/vendor/doctrine/annotations/composer.json b/vendor/doctrine/annotations/composer.json deleted file mode 100644 index 00d02310..00000000 --- a/vendor/doctrine/annotations/composer.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "doctrine/annotations", - "type": "library", - "description": "Docblock Annotations Parser", - "keywords": ["annotations", "docblock", "parser"], - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "license": "MIT", - "authors": [ - {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, - {"name": "Roman Borschel", "email": "roman@code-factory.org"}, - {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, - {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, - {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} - ], - "require": { - "php": "^7.1 || ^8.0", - "ext-tokenizer": "*", - "doctrine/lexer": "1.*", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" - }, - "config": { - "sort-packages": true - }, - "autoload": { - "psr-4": { "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" } - }, - "autoload-dev": { - "psr-4": { - "Doctrine\\Performance\\Common\\Annotations\\": "tests/Doctrine/Performance/Common/Annotations", - "Doctrine\\Tests\\Common\\Annotations\\": "tests/Doctrine/Tests/Common/Annotations" - }, - "files": [ - "tests/Doctrine/Tests/Common/Annotations/Fixtures/functions.php", - "tests/Doctrine/Tests/Common/Annotations/Fixtures/SingleClassLOC1000.php" - ] - } -} diff --git a/vendor/doctrine/annotations/docs/en/annotations.rst b/vendor/doctrine/annotations/docs/en/annotations.rst deleted file mode 100644 index 2c3c4286..00000000 --- a/vendor/doctrine/annotations/docs/en/annotations.rst +++ /dev/null @@ -1,252 +0,0 @@ -Handling Annotations -==================== - -There are several different approaches to handling annotations in PHP. -Doctrine Annotations maps docblock annotations to PHP classes. Because -not all docblock annotations are used for metadata purposes a filter is -applied to ignore or skip classes that are not Doctrine annotations. - -Take a look at the following code snippet: - -.. code-block:: php - - namespace MyProject\Entities; - - use Doctrine\ORM\Mapping AS ORM; - use Symfony\Component\Validator\Constraints AS Assert; - - /** - * @author Benjamin Eberlei - * @ORM\Entity - * @MyProject\Annotations\Foobarable - */ - class User - { - /** - * @ORM\Id @ORM\Column @ORM\GeneratedValue - * @dummy - * @var int - */ - private $id; - - /** - * @ORM\Column(type="string") - * @Assert\NotEmpty - * @Assert\Email - * @var string - */ - private $email; - } - -In this snippet you can see a variety of different docblock annotations: - -- Documentation annotations such as ``@var`` and ``@author``. These - annotations are ignored and never considered for throwing an - exception due to wrongly used annotations. -- Annotations imported through use statements. The statement ``use - Doctrine\ORM\Mapping AS ORM`` makes all classes under that namespace - available as ``@ORM\ClassName``. Same goes for the import of - ``@Assert``. -- The ``@dummy`` annotation. It is not a documentation annotation and - not ignored. For Doctrine Annotations it is not entirely clear how - to handle this annotation. Depending on the configuration an exception - (unknown annotation) will be thrown when parsing this annotation. -- The fully qualified annotation ``@MyProject\Annotations\Foobarable``. - This is transformed directly into the given class name. - -How are these annotations loaded? From looking at the code you could -guess that the ORM Mapping, Assert Validation and the fully qualified -annotation can just be loaded using -the defined PHP autoloaders. This is not the case however: For error -handling reasons every check for class existence inside the -``AnnotationReader`` sets the second parameter $autoload -of ``class_exists($name, $autoload)`` to false. To work flawlessly the -``AnnotationReader`` requires silent autoloaders which many autoloaders are -not. Silent autoloading is NOT part of the `PSR-0 specification -`_ -for autoloading. - -This is why Doctrine Annotations uses its own autoloading mechanism -through a global registry. If you are wondering about the annotation -registry being global, there is no other way to solve the architectural -problems of autoloading annotation classes in a straightforward fashion. -Additionally if you think about PHP autoloading then you recognize it is -a global as well. - -To anticipate the configuration section, making the above PHP class work -with Doctrine Annotations requires this setup: - -.. code-block:: php - - use Doctrine\Common\Annotations\AnnotationReader; - use Doctrine\Common\Annotations\AnnotationRegistry; - - AnnotationRegistry::registerFile("/path/to/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); - AnnotationRegistry::registerAutoloadNamespace("Symfony\Component\Validator\Constraint", "/path/to/symfony/src"); - AnnotationRegistry::registerAutoloadNamespace("MyProject\Annotations", "/path/to/myproject/src"); - - $reader = new AnnotationReader(); - AnnotationReader::addGlobalIgnoredName('dummy'); - -The second block with the annotation registry calls registers all the -three different annotation namespaces that are used. -Doctrine Annotations saves all its annotations in a single file, that is -why ``AnnotationRegistry#registerFile`` is used in contrast to -``AnnotationRegistry#registerAutoloadNamespace`` which creates a PSR-0 -compatible loading mechanism for class to file names. - -In the third block, we create the actual ``AnnotationReader`` instance. -Note that we also add ``dummy`` to the global list of ignored -annotations for which we do not throw exceptions. Setting this is -necessary in our example case, otherwise ``@dummy`` would trigger an -exception to be thrown during the parsing of the docblock of -``MyProject\Entities\User#id``. - -Setup and Configuration ------------------------ - -To use the annotations library is simple, you just need to create a new -``AnnotationReader`` instance: - -.. code-block:: php - - $reader = new \Doctrine\Common\Annotations\AnnotationReader(); - -This creates a simple annotation reader with no caching other than in -memory (in php arrays). Since parsing docblocks can be expensive you -should cache this process by using a caching reader. - -To cache annotations, you can create a ``Doctrine\Common\Annotations\PsrCachedReader``. -This reader decorates the original reader and stores all annotations in a PSR-6 -cache: - -.. code-block:: php - - use Doctrine\Common\Annotations\AnnotationReader; - use Doctrine\Common\Annotations\PsrCachedReader; - - $cache = ... // instantiate a PSR-6 Cache pool - - $reader = new PsrCachedReader( - new AnnotationReader(), - $cache, - $debug = true - ); - -The ``debug`` flag is used here as well to invalidate the cache files -when the PHP class with annotations changed and should be used during -development. - -.. warning :: - - The ``AnnotationReader`` works and caches under the - assumption that all annotations of a doc-block are processed at - once. That means that annotation classes that do not exist and - aren't loaded and cannot be autoloaded (using the - AnnotationRegistry) would never be visible and not accessible if a - cache is used unless the cache is cleared and the annotations - requested again, this time with all annotations defined. - -By default the annotation reader returns a list of annotations with -numeric indexes. If you want your annotations to be indexed by their -class name you can wrap the reader in an ``IndexedReader``: - -.. code-block:: php - - use Doctrine\Common\Annotations\AnnotationReader; - use Doctrine\Common\Annotations\IndexedReader; - - $reader = new IndexedReader(new AnnotationReader()); - -.. warning:: - - You should never wrap the indexed reader inside a cached reader, - only the other way around. This way you can re-use the cache with - indexed or numeric keys, otherwise your code may experience failures - due to caching in a numerical or indexed format. - -Registering Annotations -~~~~~~~~~~~~~~~~~~~~~~~ - -As explained in the introduction, Doctrine Annotations uses its own -autoloading mechanism to determine if a given annotation has a -corresponding PHP class that can be autoloaded. For annotation -autoloading you have to configure the -``Doctrine\Common\Annotations\AnnotationRegistry``. There are three -different mechanisms to configure annotation autoloading: - -- Calling ``AnnotationRegistry#registerFile($file)`` to register a file - that contains one or more annotation classes. -- Calling ``AnnotationRegistry#registerNamespace($namespace, $dirs = - null)`` to register that the given namespace contains annotations and - that their base directory is located at the given $dirs or in the - include path if ``NULL`` is passed. The given directories should *NOT* - be the directory where classes of the namespace are in, but the base - directory of the root namespace. The AnnotationRegistry uses a - namespace to directory separator approach to resolve the correct path. -- Calling ``AnnotationRegistry#registerLoader($callable)`` to register - an autoloader callback. The callback accepts the class as first and - only parameter and has to return ``true`` if the corresponding file - was found and included. - -.. note:: - - Loaders have to fail silently, if a class is not found even if it - matches for example the namespace prefix of that loader. Never is a - loader to throw a warning or exception if the loading failed - otherwise parsing doc block annotations will become a huge pain. - -A sample loader callback could look like: - -.. code-block:: php - - use Doctrine\Common\Annotations\AnnotationRegistry; - use Symfony\Component\ClassLoader\UniversalClassLoader; - - AnnotationRegistry::registerLoader(function($class) { - $file = str_replace("\\", DIRECTORY_SEPARATOR, $class) . ".php"; - - if (file_exists("/my/base/path/" . $file)) { - // file_exists() makes sure that the loader fails silently - require "/my/base/path/" . $file; - } - }); - - $loader = new UniversalClassLoader(); - AnnotationRegistry::registerLoader(array($loader, "loadClass")); - - -Ignoring missing exceptions -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -By default an exception is thrown from the ``AnnotationReader`` if an -annotation was found that: - -- is not part of the list of ignored "documentation annotations"; -- was not imported through a use statement; -- is not a fully qualified class that exists. - -You can disable this behavior for specific names if your docblocks do -not follow strict requirements: - -.. code-block:: php - - $reader = new \Doctrine\Common\Annotations\AnnotationReader(); - AnnotationReader::addGlobalIgnoredName('foo'); - -PHP Imports -~~~~~~~~~~~ - -By default the annotation reader parses the use-statement of a php file -to gain access to the import rules and register them for the annotation -processing. Only if you are using PHP Imports can you validate the -correct usage of annotations and throw exceptions if you misspelled an -annotation. This mechanism is enabled by default. - -To ease the upgrade path, we still allow you to disable this mechanism. -Note however that we will remove this in future versions: - -.. code-block:: php - - $reader = new \Doctrine\Common\Annotations\AnnotationReader(); - $reader->setEnabledPhpImports(false); diff --git a/vendor/doctrine/annotations/docs/en/custom.rst b/vendor/doctrine/annotations/docs/en/custom.rst deleted file mode 100644 index 11fbe1a3..00000000 --- a/vendor/doctrine/annotations/docs/en/custom.rst +++ /dev/null @@ -1,443 +0,0 @@ -Custom Annotation Classes -========================= - -If you want to define your own annotations, you just have to group them -in a namespace and register this namespace in the ``AnnotationRegistry``. -Annotation classes have to contain a class-level docblock with the text -``@Annotation``: - -.. code-block:: php - - namespace MyCompany\Annotations; - - /** @Annotation */ - class Bar - { - // some code - } - -Inject annotation values ------------------------- - -The annotation parser checks if the annotation constructor has arguments, -if so then it will pass the value array, otherwise it will try to inject -values into public properties directly: - - -.. code-block:: php - - namespace MyCompany\Annotations; - - /** - * @Annotation - * - * Some Annotation using a constructor - */ - class Bar - { - private $foo; - - public function __construct(array $values) - { - $this->foo = $values['foo']; - } - } - - /** - * @Annotation - * - * Some Annotation without a constructor - */ - class Foo - { - public $bar; - } - -Optional: Constructors with Named Parameters --------------------------------------------- - -Starting with Annotations v1.11 a new annotation instantiation strategy -is available that aims at compatibility of Annotation classes with the PHP 8 -attribute feature. You need to declare a constructor with regular parameter -names that match the named arguments in the annotation syntax. - -To enable this feature, you can tag your annotation class with -``@NamedArgumentConstructor`` (available from v1.12) or implement the -``Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation`` interface -(available from v1.11 and deprecated as of v1.12). -When using the ``@NamedArgumentConstructor`` tag, the first argument of the -constructor is considered as the default one. - - -Usage with the ``@NamedArgumentContrustor`` tag - -.. code-block:: php - - namespace MyCompany\Annotations; - - /** - * @Annotation - * @NamedArgumentConstructor - */ - class Bar implements NamedArgumentConstructorAnnotation - { - private $foo; - - public function __construct(string $foo) - { - $this->foo = $foo; - } - } - - /** Usable with @Bar(foo="baz") */ - /** Usable with @Bar("baz") */ - -In combination with PHP 8's constructor property promotion feature -you can simplify this to: - -.. code-block:: php - - namespace MyCompany\Annotations; - - /** - * @Annotation - * @NamedArgumentConstructor - */ - class Bar implements NamedArgumentConstructorAnnotation - { - public function __construct(private string $foo) {} - } - - -Usage with the -``Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation`` -interface (v1.11, deprecated as of v1.12): -.. code-block:: php - - namespace MyCompany\Annotations; - - use Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation; - - /** @Annotation */ - class Bar implements NamedArgumentConstructorAnnotation - { - private $foo; - - public function __construct(private string $foo) {} - } - - /** Usable with @Bar(foo="baz") */ - -Annotation Target ------------------ - -``@Target`` indicates the kinds of class elements to which an annotation -type is applicable. Then you could define one or more targets: - -- ``CLASS`` Allowed in class docblocks -- ``PROPERTY`` Allowed in property docblocks -- ``METHOD`` Allowed in the method docblocks -- ``FUNCTION`` Allowed in function dockblocks -- ``ALL`` Allowed in class, property, method and function docblocks -- ``ANNOTATION`` Allowed inside other annotations - -If the annotations is not allowed in the current context, an -``AnnotationException`` is thrown. - -.. code-block:: php - - namespace MyCompany\Annotations; - - /** - * @Annotation - * @Target({"METHOD","PROPERTY"}) - */ - class Bar - { - // some code - } - - /** - * @Annotation - * @Target("CLASS") - */ - class Foo - { - // some code - } - -Attribute types ---------------- - -The annotation parser checks the given parameters using the phpdoc -annotation ``@var``, The data type could be validated using the ``@var`` -annotation on the annotation properties or using the ``@Attributes`` and -``@Attribute`` annotations. - -If the data type does not match you get an ``AnnotationException`` - -.. code-block:: php - - namespace MyCompany\Annotations; - - /** - * @Annotation - * @Target({"METHOD","PROPERTY"}) - */ - class Bar - { - /** @var mixed */ - public $mixed; - - /** @var boolean */ - public $boolean; - - /** @var bool */ - public $bool; - - /** @var float */ - public $float; - - /** @var string */ - public $string; - - /** @var integer */ - public $integer; - - /** @var array */ - public $array; - - /** @var SomeAnnotationClass */ - public $annotation; - - /** @var array */ - public $arrayOfIntegers; - - /** @var array */ - public $arrayOfAnnotations; - } - - /** - * @Annotation - * @Target({"METHOD","PROPERTY"}) - * @Attributes({ - * @Attribute("stringProperty", type = "string"), - * @Attribute("annotProperty", type = "SomeAnnotationClass"), - * }) - */ - class Foo - { - public function __construct(array $values) - { - $this->stringProperty = $values['stringProperty']; - $this->annotProperty = $values['annotProperty']; - } - - // some code - } - -Annotation Required -------------------- - -``@Required`` indicates that the field must be specified when the -annotation is used. If it is not used you get an ``AnnotationException`` -stating that this value can not be null. - -Declaring a required field: - -.. code-block:: php - - /** - * @Annotation - * @Target("ALL") - */ - class Foo - { - /** @Required */ - public $requiredField; - } - -Usage: - -.. code-block:: php - - /** @Foo(requiredField="value") */ - public $direction; // Valid - - /** @Foo */ - public $direction; // Required field missing, throws an AnnotationException - - -Enumerated values ------------------ - -- An annotation property marked with ``@Enum`` is a field that accepts a - fixed set of scalar values. -- You should use ``@Enum`` fields any time you need to represent fixed - values. -- The annotation parser checks the given value and throws an - ``AnnotationException`` if the value does not match. - - -Declaring an enumerated property: - -.. code-block:: php - - /** - * @Annotation - * @Target("ALL") - */ - class Direction - { - /** - * @Enum({"NORTH", "SOUTH", "EAST", "WEST"}) - */ - public $value; - } - -Annotation usage: - -.. code-block:: php - - /** @Direction("NORTH") */ - public $direction; // Valid value - - /** @Direction("NORTHEAST") */ - public $direction; // Invalid value, throws an AnnotationException - - -Constants ---------- - -The use of constants and class constants is available on the annotations -parser. - -The following usages are allowed: - -.. code-block:: php - - namespace MyCompany\Entity; - - use MyCompany\Annotations\Foo; - use MyCompany\Annotations\Bar; - use MyCompany\Entity\SomeClass; - - /** - * @Foo(PHP_EOL) - * @Bar(Bar::FOO) - * @Foo({SomeClass::FOO, SomeClass::BAR}) - * @Bar({SomeClass::FOO_KEY = SomeClass::BAR_VALUE}) - */ - class User - { - } - - -Be careful with constants and the cache ! - -.. note:: - - The cached reader will not re-evaluate each time an annotation is - loaded from cache. When a constant is changed the cache must be - cleaned. - - -Usage ------ - -Using the library API is simple. Using the annotations described in the -previous section, you can now annotate other classes with your -annotations: - -.. code-block:: php - - namespace MyCompany\Entity; - - use MyCompany\Annotations\Foo; - use MyCompany\Annotations\Bar; - - /** - * @Foo(bar="foo") - * @Bar(foo="bar") - */ - class User - { - } - -Now we can write a script to get the annotations above: - -.. code-block:: php - - $reflClass = new ReflectionClass('MyCompany\Entity\User'); - $classAnnotations = $reader->getClassAnnotations($reflClass); - - foreach ($classAnnotations AS $annot) { - if ($annot instanceof \MyCompany\Annotations\Foo) { - echo $annot->bar; // prints "foo"; - } else if ($annot instanceof \MyCompany\Annotations\Bar) { - echo $annot->foo; // prints "bar"; - } - } - -You have a complete API for retrieving annotation class instances from a -class, property or method docblock: - - -Reader API -~~~~~~~~~~ - -Access all annotations of a class -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: php - - public function getClassAnnotations(\ReflectionClass $class); - -Access one annotation of a class -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: php - - public function getClassAnnotation(\ReflectionClass $class, $annotationName); - -Access all annotations of a method -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: php - - public function getMethodAnnotations(\ReflectionMethod $method); - -Access one annotation of a method -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: php - - public function getMethodAnnotation(\ReflectionMethod $method, $annotationName); - -Access all annotations of a property -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: php - - public function getPropertyAnnotations(\ReflectionProperty $property); - -Access one annotation of a property -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: php - - public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName); - -Access all annotations of a function -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: php - - public function getFunctionAnnotations(\ReflectionFunction $property); - -Access one annotation of a function -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: php - - public function getFunctionAnnotation(\ReflectionFunction $property, $annotationName); diff --git a/vendor/doctrine/annotations/docs/en/index.rst b/vendor/doctrine/annotations/docs/en/index.rst deleted file mode 100644 index 95476c31..00000000 --- a/vendor/doctrine/annotations/docs/en/index.rst +++ /dev/null @@ -1,101 +0,0 @@ -Introduction -============ - -Doctrine Annotations allows to implement custom annotation -functionality for PHP classes and functions. - -.. code-block:: php - - class Foo - { - /** - * @MyAnnotation(myProperty="value") - */ - private $bar; - } - -Annotations aren't implemented in PHP itself which is why this component -offers a way to use the PHP doc-blocks as a place for the well known -annotation syntax using the ``@`` char. - -Annotations in Doctrine are used for the ORM configuration to build the -class mapping, but it can be used in other projects for other purposes -too. - -Installation -============ - -You can install the Annotation component with composer: - -.. code-block:: - -   $ composer require doctrine/annotations - -Create an annotation class -========================== - -An annotation class is a representation of the later used annotation -configuration in classes. The annotation class of the previous example -looks like this: - -.. code-block:: php - - /** - * @Annotation - */ - final class MyAnnotation - { - public $myProperty; - } - -The annotation class is declared as an annotation by ``@Annotation``. - -:ref:`Read more about custom annotations. ` - -Reading annotations -=================== - -The access to the annotations happens by reflection of the class or function -containing them. There are multiple reader-classes implementing the -``Doctrine\Common\Annotations\Reader`` interface, that can access the -annotations of a class. A common one is -``Doctrine\Common\Annotations\AnnotationReader``: - -.. code-block:: php - - use Doctrine\Common\Annotations\AnnotationReader; - use Doctrine\Common\Annotations\AnnotationRegistry; - - // Deprecated and will be removed in 2.0 but currently needed - AnnotationRegistry::registerLoader('class_exists'); - - $reflectionClass = new ReflectionClass(Foo::class); - $property = $reflectionClass->getProperty('bar'); - - $reader = new AnnotationReader(); - $myAnnotation = $reader->getPropertyAnnotation( - $property, - MyAnnotation::class - ); - - echo $myAnnotation->myProperty; // result: "value" - -Note that ``AnnotationRegistry::registerLoader('class_exists')`` only works -if you already have an autoloader configured (i.e. composer autoloader). -Otherwise, :ref:`please take a look to the other annotation autoload mechanisms `. - -A reader has multiple methods to access the annotations of a class or -function. - -:ref:`Read more about handling annotations. ` - -IDE Support ------------ - -Some IDEs already provide support for annotations: - -- Eclipse via the `Symfony2 Plugin `_ -- PhpStorm via the `PHP Annotations Plugin `_ or the `Symfony Plugin `_ - -.. _Read more about handling annotations.: annotations -.. _Read more about custom annotations.: custom diff --git a/vendor/doctrine/annotations/docs/en/sidebar.rst b/vendor/doctrine/annotations/docs/en/sidebar.rst deleted file mode 100644 index 6f5d13c4..00000000 --- a/vendor/doctrine/annotations/docs/en/sidebar.rst +++ /dev/null @@ -1,6 +0,0 @@ -.. toctree:: - :depth: 3 - - index - annotations - custom diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php deleted file mode 100644 index 750270e4..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php +++ /dev/null @@ -1,59 +0,0 @@ - $data Key-value for properties to be defined in this class. - */ - final public function __construct(array $data) - { - foreach ($data as $key => $value) { - $this->$key = $value; - } - } - - /** - * Error handler for unknown property accessor in Annotation class. - * - * @param string $name Unknown property name. - * - * @throws BadMethodCallException - */ - public function __get($name) - { - throw new BadMethodCallException( - sprintf("Unknown property '%s' on annotation '%s'.", $name, static::class) - ); - } - - /** - * Error handler for unknown property mutator in Annotation class. - * - * @param string $name Unknown property name. - * @param mixed $value Property value. - * - * @throws BadMethodCallException - */ - public function __set($name, $value) - { - throw new BadMethodCallException( - sprintf("Unknown property '%s' on annotation '%s'.", $name, static::class) - ); - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php deleted file mode 100644 index b1f85140..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php +++ /dev/null @@ -1,21 +0,0 @@ - */ - public $value; -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php deleted file mode 100644 index 35d6410b..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php +++ /dev/null @@ -1,69 +0,0 @@ - */ - public $value; - - /** - * Literal target declaration. - * - * @var mixed[] - */ - public $literal; - - /** - * @throws InvalidArgumentException - * - * @phpstan-param array{literal?: mixed[], value: list} $values - */ - public function __construct(array $values) - { - if (! isset($values['literal'])) { - $values['literal'] = []; - } - - foreach ($values['value'] as $var) { - if (! is_scalar($var)) { - throw new InvalidArgumentException(sprintf( - '@Enum supports only scalar values "%s" given.', - is_object($var) ? get_class($var) : gettype($var) - )); - } - } - - foreach ($values['literal'] as $key => $var) { - if (! in_array($key, $values['value'])) { - throw new InvalidArgumentException(sprintf( - 'Undefined enumerator value "%s" for literal "%s".', - $key, - $var - )); - } - } - - $this->value = $values['value']; - $this->literal = $values['literal']; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php deleted file mode 100644 index ae60f7d5..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php +++ /dev/null @@ -1,43 +0,0 @@ - */ - public $names; - - /** - * @throws RuntimeException - * - * @phpstan-param array{value: string|list} $values - */ - public function __construct(array $values) - { - if (is_string($values['value'])) { - $values['value'] = [$values['value']]; - } - - if (! is_array($values['value'])) { - throw new RuntimeException(sprintf( - '@IgnoreAnnotation expects either a string name, or an array of strings, but got %s.', - json_encode($values['value']) - )); - } - - $this->names = $values['value']; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php deleted file mode 100644 index 16906010..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php +++ /dev/null @@ -1,13 +0,0 @@ - */ - private static $map = [ - 'ALL' => self::TARGET_ALL, - 'CLASS' => self::TARGET_CLASS, - 'METHOD' => self::TARGET_METHOD, - 'PROPERTY' => self::TARGET_PROPERTY, - 'FUNCTION' => self::TARGET_FUNCTION, - 'ANNOTATION' => self::TARGET_ANNOTATION, - ]; - - /** @phpstan-var list */ - public $value; - - /** - * Targets as bitmask. - * - * @var int - */ - public $targets; - - /** - * Literal target declaration. - * - * @var string - */ - public $literal; - - /** - * @throws InvalidArgumentException - * - * @phpstan-param array{value?: string|list} $values - */ - public function __construct(array $values) - { - if (! isset($values['value'])) { - $values['value'] = null; - } - - if (is_string($values['value'])) { - $values['value'] = [$values['value']]; - } - - if (! is_array($values['value'])) { - throw new InvalidArgumentException( - sprintf( - '@Target expects either a string value, or an array of strings, "%s" given.', - is_object($values['value']) ? get_class($values['value']) : gettype($values['value']) - ) - ); - } - - $bitmask = 0; - foreach ($values['value'] as $literal) { - if (! isset(self::$map[$literal])) { - throw new InvalidArgumentException( - sprintf( - 'Invalid Target "%s". Available targets: [%s]', - $literal, - implode(', ', array_keys(self::$map)) - ) - ); - } - - $bitmask |= self::$map[$literal]; - } - - $this->targets = $bitmask; - $this->value = $values['value']; - $this->literal = implode(', ', $this->value); - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php deleted file mode 100644 index b1ea64e6..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php +++ /dev/null @@ -1,171 +0,0 @@ - $available - */ - public static function enumeratorError($attributeName, $annotationName, $context, $available, $given) - { - return new self(sprintf( - '[Enum Error] Attribute "%s" of @%s declared on %s accepts only [%s], but got %s.', - $attributeName, - $annotationName, - $context, - implode(', ', $available), - is_object($given) ? get_class($given) : $given - )); - } - - /** - * @return AnnotationException - */ - public static function optimizerPlusSaveComments() - { - return new self( - 'You have to enable opcache.save_comments=1 or zend_optimizerplus.save_comments=1.' - ); - } - - /** - * @return AnnotationException - */ - public static function optimizerPlusLoadComments() - { - return new self( - 'You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.' - ); - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php deleted file mode 100644 index 1f538ee5..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php +++ /dev/null @@ -1,389 +0,0 @@ - - */ - private static $globalImports = [ - 'ignoreannotation' => Annotation\IgnoreAnnotation::class, - ]; - - /** - * A list with annotations that are not causing exceptions when not resolved to an annotation class. - * - * The names are case sensitive. - * - * @var array - */ - private static $globalIgnoredNames = ImplicitlyIgnoredAnnotationNames::LIST; - - /** - * A list with annotations that are not causing exceptions when not resolved to an annotation class. - * - * The names are case sensitive. - * - * @var array - */ - private static $globalIgnoredNamespaces = []; - - /** - * Add a new annotation to the globally ignored annotation names with regard to exception handling. - * - * @param string $name - */ - public static function addGlobalIgnoredName($name) - { - self::$globalIgnoredNames[$name] = true; - } - - /** - * Add a new annotation to the globally ignored annotation namespaces with regard to exception handling. - * - * @param string $namespace - */ - public static function addGlobalIgnoredNamespace($namespace) - { - self::$globalIgnoredNamespaces[$namespace] = true; - } - - /** - * Annotations parser. - * - * @var DocParser - */ - private $parser; - - /** - * Annotations parser used to collect parsing metadata. - * - * @var DocParser - */ - private $preParser; - - /** - * PHP parser used to collect imports. - * - * @var PhpParser - */ - private $phpParser; - - /** - * In-memory cache mechanism to store imported annotations per class. - * - * @psalm-var array<'class'|'function', array>> - */ - private $imports = []; - - /** - * In-memory cache mechanism to store ignored annotations per class. - * - * @psalm-var array<'class'|'function', array>> - */ - private $ignoredAnnotationNames = []; - - /** - * Initializes a new AnnotationReader. - * - * @throws AnnotationException - */ - public function __construct(?DocParser $parser = null) - { - if ( - extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.save_comments') === '0' || - ini_get('opcache.save_comments') === '0') - ) { - throw AnnotationException::optimizerPlusSaveComments(); - } - - if (extension_loaded('Zend OPcache') && ini_get('opcache.save_comments') === 0) { - throw AnnotationException::optimizerPlusSaveComments(); - } - - // Make sure that the IgnoreAnnotation annotation is loaded - class_exists(IgnoreAnnotation::class); - - $this->parser = $parser ?: new DocParser(); - - $this->preParser = new DocParser(); - - $this->preParser->setImports(self::$globalImports); - $this->preParser->setIgnoreNotImportedAnnotations(true); - $this->preParser->setIgnoredAnnotationNames(self::$globalIgnoredNames); - - $this->phpParser = new PhpParser(); - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotations(ReflectionClass $class) - { - $this->parser->setTarget(Target::TARGET_CLASS); - $this->parser->setImports($this->getImports($class)); - $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); - $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); - - return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotation(ReflectionClass $class, $annotationName) - { - $annotations = $this->getClassAnnotations($class); - - foreach ($annotations as $annotation) { - if ($annotation instanceof $annotationName) { - return $annotation; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotations(ReflectionProperty $property) - { - $class = $property->getDeclaringClass(); - $context = 'property ' . $class->getName() . '::$' . $property->getName(); - - $this->parser->setTarget(Target::TARGET_PROPERTY); - $this->parser->setImports($this->getPropertyImports($property)); - $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); - $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); - - return $this->parser->parse($property->getDocComment(), $context); - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) - { - $annotations = $this->getPropertyAnnotations($property); - - foreach ($annotations as $annotation) { - if ($annotation instanceof $annotationName) { - return $annotation; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotations(ReflectionMethod $method) - { - $class = $method->getDeclaringClass(); - $context = 'method ' . $class->getName() . '::' . $method->getName() . '()'; - - $this->parser->setTarget(Target::TARGET_METHOD); - $this->parser->setImports($this->getMethodImports($method)); - $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); - $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); - - return $this->parser->parse($method->getDocComment(), $context); - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotation(ReflectionMethod $method, $annotationName) - { - $annotations = $this->getMethodAnnotations($method); - - foreach ($annotations as $annotation) { - if ($annotation instanceof $annotationName) { - return $annotation; - } - } - - return null; - } - - /** - * Gets the annotations applied to a function. - * - * @phpstan-return list An array of Annotations. - */ - public function getFunctionAnnotations(ReflectionFunction $function): array - { - $context = 'function ' . $function->getName(); - - $this->parser->setTarget(Target::TARGET_FUNCTION); - $this->parser->setImports($this->getImports($function)); - $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($function)); - $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); - - return $this->parser->parse($function->getDocComment(), $context); - } - - /** - * Gets a function annotation. - * - * @return object|null The Annotation or NULL, if the requested annotation does not exist. - */ - public function getFunctionAnnotation(ReflectionFunction $function, string $annotationName) - { - $annotations = $this->getFunctionAnnotations($function); - - foreach ($annotations as $annotation) { - if ($annotation instanceof $annotationName) { - return $annotation; - } - } - - return null; - } - - /** - * Returns the ignored annotations for the given class or function. - * - * @param ReflectionClass|ReflectionFunction $reflection - * - * @return array - */ - private function getIgnoredAnnotationNames($reflection): array - { - $type = $reflection instanceof ReflectionClass ? 'class' : 'function'; - $name = $reflection->getName(); - - if (isset($this->ignoredAnnotationNames[$type][$name])) { - return $this->ignoredAnnotationNames[$type][$name]; - } - - $this->collectParsingMetadata($reflection); - - return $this->ignoredAnnotationNames[$type][$name]; - } - - /** - * Retrieves imports for a class or a function. - * - * @param ReflectionClass|ReflectionFunction $reflection - * - * @return array - */ - private function getImports($reflection): array - { - $type = $reflection instanceof ReflectionClass ? 'class' : 'function'; - $name = $reflection->getName(); - - if (isset($this->imports[$type][$name])) { - return $this->imports[$type][$name]; - } - - $this->collectParsingMetadata($reflection); - - return $this->imports[$type][$name]; - } - - /** - * Retrieves imports for methods. - * - * @return array - */ - private function getMethodImports(ReflectionMethod $method) - { - $class = $method->getDeclaringClass(); - $classImports = $this->getImports($class); - - $traitImports = []; - - foreach ($class->getTraits() as $trait) { - if ( - ! $trait->hasMethod($method->getName()) - || $trait->getFileName() !== $method->getFileName() - ) { - continue; - } - - $traitImports = array_merge($traitImports, $this->phpParser->parseUseStatements($trait)); - } - - return array_merge($classImports, $traitImports); - } - - /** - * Retrieves imports for properties. - * - * @return array - */ - private function getPropertyImports(ReflectionProperty $property) - { - $class = $property->getDeclaringClass(); - $classImports = $this->getImports($class); - - $traitImports = []; - - foreach ($class->getTraits() as $trait) { - if (! $trait->hasProperty($property->getName())) { - continue; - } - - $traitImports = array_merge($traitImports, $this->phpParser->parseUseStatements($trait)); - } - - return array_merge($classImports, $traitImports); - } - - /** - * Collects parsing metadata for a given class or function. - * - * @param ReflectionClass|ReflectionFunction $reflection - */ - private function collectParsingMetadata($reflection): void - { - $type = $reflection instanceof ReflectionClass ? 'class' : 'function'; - $name = $reflection->getName(); - - $ignoredAnnotationNames = self::$globalIgnoredNames; - $annotations = $this->preParser->parse($reflection->getDocComment(), $type . ' ' . $name); - - foreach ($annotations as $annotation) { - if (! ($annotation instanceof IgnoreAnnotation)) { - continue; - } - - foreach ($annotation->names as $annot) { - $ignoredAnnotationNames[$annot] = true; - } - } - - $this->imports[$type][$name] = array_merge( - self::$globalImports, - $this->phpParser->parseUseStatements($reflection), - [ - '__NAMESPACE__' => $reflection->getNamespaceName(), - 'self' => $name, - ] - ); - - $this->ignoredAnnotationNames[$type][$name] = $ignoredAnnotationNames; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php deleted file mode 100644 index 259d497d..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php +++ /dev/null @@ -1,190 +0,0 @@ -|null $dirs - */ - public static function registerAutoloadNamespace(string $namespace, $dirs = null): void - { - self::$autoloadNamespaces[$namespace] = $dirs; - } - - /** - * Registers multiple namespaces. - * - * Loading of this namespaces will be done with a PSR-0 namespace loading algorithm. - * - * @deprecated This method is deprecated and will be removed in - * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0. - * - * @param string[][]|string[]|null[] $namespaces indexed by namespace name - */ - public static function registerAutoloadNamespaces(array $namespaces): void - { - self::$autoloadNamespaces = array_merge(self::$autoloadNamespaces, $namespaces); - } - - /** - * Registers an autoloading callable for annotations, much like spl_autoload_register(). - * - * NOTE: These class loaders HAVE to be silent when a class was not found! - * IMPORTANT: Loaders have to return true if they loaded a class that could contain the searched annotation class. - * - * @deprecated This method is deprecated and will be removed in - * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0. - */ - public static function registerLoader(callable $callable): void - { - // Reset our static cache now that we have a new loader to work with - self::$failedToAutoload = []; - self::$loaders[] = $callable; - } - - /** - * Registers an autoloading callable for annotations, if it is not already registered - * - * @deprecated This method is deprecated and will be removed in - * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0. - */ - public static function registerUniqueLoader(callable $callable): void - { - if (in_array($callable, self::$loaders, true)) { - return; - } - - self::registerLoader($callable); - } - - /** - * Autoloads an annotation class silently. - */ - public static function loadAnnotationClass(string $class): bool - { - if (class_exists($class, false)) { - return true; - } - - if (array_key_exists($class, self::$failedToAutoload)) { - return false; - } - - foreach (self::$autoloadNamespaces as $namespace => $dirs) { - if (strpos($class, $namespace) !== 0) { - continue; - } - - $file = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; - - if ($dirs === null) { - $path = stream_resolve_include_path($file); - if ($path) { - require $path; - - return true; - } - } else { - foreach ((array) $dirs as $dir) { - if (is_file($dir . DIRECTORY_SEPARATOR . $file)) { - require $dir . DIRECTORY_SEPARATOR . $file; - - return true; - } - } - } - } - - foreach (self::$loaders as $loader) { - if ($loader($class) === true) { - return true; - } - } - - if ( - self::$loaders === [] && - self::$autoloadNamespaces === [] && - self::$registerFileUsed === false && - class_exists($class) - ) { - return true; - } - - self::$failedToAutoload[$class] = null; - - return false; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php deleted file mode 100644 index c036b2da..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php +++ /dev/null @@ -1,268 +0,0 @@ -> */ - private $loadedAnnotations = []; - - /** @var int[] */ - private $loadedFilemtimes = []; - - /** - * @param bool $debug - */ - public function __construct(Reader $reader, Cache $cache, $debug = false) - { - $this->delegate = $reader; - $this->cache = $cache; - $this->debug = (bool) $debug; - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotations(ReflectionClass $class) - { - $cacheKey = $class->getName(); - - if (isset($this->loadedAnnotations[$cacheKey])) { - return $this->loadedAnnotations[$cacheKey]; - } - - $annots = $this->fetchFromCache($cacheKey, $class); - if ($annots === false) { - $annots = $this->delegate->getClassAnnotations($class); - $this->saveToCache($cacheKey, $annots); - } - - return $this->loadedAnnotations[$cacheKey] = $annots; - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotation(ReflectionClass $class, $annotationName) - { - foreach ($this->getClassAnnotations($class) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotations(ReflectionProperty $property) - { - $class = $property->getDeclaringClass(); - $cacheKey = $class->getName() . '$' . $property->getName(); - - if (isset($this->loadedAnnotations[$cacheKey])) { - return $this->loadedAnnotations[$cacheKey]; - } - - $annots = $this->fetchFromCache($cacheKey, $class); - if ($annots === false) { - $annots = $this->delegate->getPropertyAnnotations($property); - $this->saveToCache($cacheKey, $annots); - } - - return $this->loadedAnnotations[$cacheKey] = $annots; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) - { - foreach ($this->getPropertyAnnotations($property) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotations(ReflectionMethod $method) - { - $class = $method->getDeclaringClass(); - $cacheKey = $class->getName() . '#' . $method->getName(); - - if (isset($this->loadedAnnotations[$cacheKey])) { - return $this->loadedAnnotations[$cacheKey]; - } - - $annots = $this->fetchFromCache($cacheKey, $class); - if ($annots === false) { - $annots = $this->delegate->getMethodAnnotations($method); - $this->saveToCache($cacheKey, $annots); - } - - return $this->loadedAnnotations[$cacheKey] = $annots; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotation(ReflectionMethod $method, $annotationName) - { - foreach ($this->getMethodAnnotations($method) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } - - /** - * Clears loaded annotations. - * - * @return void - */ - public function clearLoadedAnnotations() - { - $this->loadedAnnotations = []; - $this->loadedFilemtimes = []; - } - - /** - * Fetches a value from the cache. - * - * @param string $cacheKey The cache key. - * - * @return mixed The cached value or false when the value is not in cache. - */ - private function fetchFromCache($cacheKey, ReflectionClass $class) - { - $data = $this->cache->fetch($cacheKey); - if ($data !== false) { - if (! $this->debug || $this->isCacheFresh($cacheKey, $class)) { - return $data; - } - } - - return false; - } - - /** - * Saves a value to the cache. - * - * @param string $cacheKey The cache key. - * @param mixed $value The value. - * - * @return void - */ - private function saveToCache($cacheKey, $value) - { - $this->cache->save($cacheKey, $value); - if (! $this->debug) { - return; - } - - $this->cache->save('[C]' . $cacheKey, time()); - } - - /** - * Checks if the cache is fresh. - * - * @param string $cacheKey - * - * @return bool - */ - private function isCacheFresh($cacheKey, ReflectionClass $class) - { - $lastModification = $this->getLastModification($class); - if ($lastModification === 0) { - return true; - } - - return $this->cache->fetch('[C]' . $cacheKey) >= $lastModification; - } - - /** - * Returns the time the class was last modified, testing traits and parents - */ - private function getLastModification(ReflectionClass $class): int - { - $filename = $class->getFileName(); - - if (isset($this->loadedFilemtimes[$filename])) { - return $this->loadedFilemtimes[$filename]; - } - - $parent = $class->getParentClass(); - - $lastModification = max(array_merge( - [$filename ? filemtime($filename) : 0], - array_map(function (ReflectionClass $reflectionTrait): int { - return $this->getTraitLastModificationTime($reflectionTrait); - }, $class->getTraits()), - array_map(function (ReflectionClass $class): int { - return $this->getLastModification($class); - }, $class->getInterfaces()), - $parent ? [$this->getLastModification($parent)] : [] - )); - - assert($lastModification !== false); - - return $this->loadedFilemtimes[$filename] = $lastModification; - } - - private function getTraitLastModificationTime(ReflectionClass $reflectionTrait): int - { - $fileName = $reflectionTrait->getFileName(); - - if (isset($this->loadedFilemtimes[$fileName])) { - return $this->loadedFilemtimes[$fileName]; - } - - $lastModificationTime = max(array_merge( - [$fileName ? filemtime($fileName) : 0], - array_map(function (ReflectionClass $reflectionTrait): int { - return $this->getTraitLastModificationTime($reflectionTrait); - }, $reflectionTrait->getTraits()) - )); - - assert($lastModificationTime !== false); - - return $this->loadedFilemtimes[$fileName] = $lastModificationTime; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php deleted file mode 100644 index f6567c51..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php +++ /dev/null @@ -1,129 +0,0 @@ -= 100 - public const T_IDENTIFIER = 100; - public const T_AT = 101; - public const T_CLOSE_CURLY_BRACES = 102; - public const T_CLOSE_PARENTHESIS = 103; - public const T_COMMA = 104; - public const T_EQUALS = 105; - public const T_FALSE = 106; - public const T_NAMESPACE_SEPARATOR = 107; - public const T_OPEN_CURLY_BRACES = 108; - public const T_OPEN_PARENTHESIS = 109; - public const T_TRUE = 110; - public const T_NULL = 111; - public const T_COLON = 112; - public const T_MINUS = 113; - - /** @var array */ - protected $noCase = [ - '@' => self::T_AT, - ',' => self::T_COMMA, - '(' => self::T_OPEN_PARENTHESIS, - ')' => self::T_CLOSE_PARENTHESIS, - '{' => self::T_OPEN_CURLY_BRACES, - '}' => self::T_CLOSE_CURLY_BRACES, - '=' => self::T_EQUALS, - ':' => self::T_COLON, - '-' => self::T_MINUS, - '\\' => self::T_NAMESPACE_SEPARATOR, - ]; - - /** @var array */ - protected $withCase = [ - 'true' => self::T_TRUE, - 'false' => self::T_FALSE, - 'null' => self::T_NULL, - ]; - - /** - * Whether the next token starts immediately, or if there were - * non-captured symbols before that - */ - public function nextTokenIsAdjacent(): bool - { - return $this->token === null - || ($this->lookahead !== null - && ($this->lookahead['position'] - $this->token['position']) === strlen($this->token['value'])); - } - - /** - * {@inheritdoc} - */ - protected function getCatchablePatterns() - { - return [ - '[a-z_\\\][a-z0-9_\:\\\]*[a-z_][a-z0-9_]*', - '(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?', - '"(?:""|[^"])*+"', - ]; - } - - /** - * {@inheritdoc} - */ - protected function getNonCatchablePatterns() - { - return ['\s+', '\*+', '(.)']; - } - - /** - * {@inheritdoc} - */ - protected function getType(&$value) - { - $type = self::T_NONE; - - if ($value[0] === '"') { - $value = str_replace('""', '"', substr($value, 1, strlen($value) - 2)); - - return self::T_STRING; - } - - if (isset($this->noCase[$value])) { - return $this->noCase[$value]; - } - - if ($value[0] === '_' || $value[0] === '\\' || ctype_alpha($value[0])) { - return self::T_IDENTIFIER; - } - - $lowerValue = strtolower($value); - - if (isset($this->withCase[$lowerValue])) { - return $this->withCase[$lowerValue]; - } - - // Checking numeric value - if (is_numeric($value)) { - return strpos($value, '.') !== false || stripos($value, 'e') !== false - ? self::T_FLOAT : self::T_INTEGER; - } - - return $type; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php deleted file mode 100644 index ae530c50..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php +++ /dev/null @@ -1,1459 +0,0 @@ - - */ - private static $classIdentifiers = [ - DocLexer::T_IDENTIFIER, - DocLexer::T_TRUE, - DocLexer::T_FALSE, - DocLexer::T_NULL, - ]; - - /** - * The lexer. - * - * @var DocLexer - */ - private $lexer; - - /** - * Current target context. - * - * @var int - */ - private $target; - - /** - * Doc parser used to collect annotation target. - * - * @var DocParser - */ - private static $metadataParser; - - /** - * Flag to control if the current annotation is nested or not. - * - * @var bool - */ - private $isNestedAnnotation = false; - - /** - * Hashmap containing all use-statements that are to be used when parsing - * the given doc block. - * - * @var array - */ - private $imports = []; - - /** - * This hashmap is used internally to cache results of class_exists() - * look-ups. - * - * @var array - */ - private $classExists = []; - - /** - * Whether annotations that have not been imported should be ignored. - * - * @var bool - */ - private $ignoreNotImportedAnnotations = false; - - /** - * An array of default namespaces if operating in simple mode. - * - * @var string[] - */ - private $namespaces = []; - - /** - * A list with annotations that are not causing exceptions when not resolved to an annotation class. - * - * The names must be the raw names as used in the class, not the fully qualified - * - * @var bool[] indexed by annotation name - */ - private $ignoredAnnotationNames = []; - - /** - * A list with annotations in namespaced format - * that are not causing exceptions when not resolved to an annotation class. - * - * @var bool[] indexed by namespace name - */ - private $ignoredAnnotationNamespaces = []; - - /** @var string */ - private $context = ''; - - /** - * Hash-map for caching annotation metadata. - * - * @var array - */ - private static $annotationMetadata = [ - Annotation\Target::class => [ - 'is_annotation' => true, - 'has_constructor' => true, - 'has_named_argument_constructor' => false, - 'properties' => [], - 'targets_literal' => 'ANNOTATION_CLASS', - 'targets' => Target::TARGET_CLASS, - 'default_property' => 'value', - 'attribute_types' => [ - 'value' => [ - 'required' => false, - 'type' => 'array', - 'array_type' => 'string', - 'value' => 'array', - ], - ], - ], - Annotation\Attribute::class => [ - 'is_annotation' => true, - 'has_constructor' => false, - 'has_named_argument_constructor' => false, - 'targets_literal' => 'ANNOTATION_ANNOTATION', - 'targets' => Target::TARGET_ANNOTATION, - 'default_property' => 'name', - 'properties' => [ - 'name' => 'name', - 'type' => 'type', - 'required' => 'required', - ], - 'attribute_types' => [ - 'value' => [ - 'required' => true, - 'type' => 'string', - 'value' => 'string', - ], - 'type' => [ - 'required' => true, - 'type' => 'string', - 'value' => 'string', - ], - 'required' => [ - 'required' => false, - 'type' => 'boolean', - 'value' => 'boolean', - ], - ], - ], - Annotation\Attributes::class => [ - 'is_annotation' => true, - 'has_constructor' => false, - 'has_named_argument_constructor' => false, - 'targets_literal' => 'ANNOTATION_CLASS', - 'targets' => Target::TARGET_CLASS, - 'default_property' => 'value', - 'properties' => ['value' => 'value'], - 'attribute_types' => [ - 'value' => [ - 'type' => 'array', - 'required' => true, - 'array_type' => Annotation\Attribute::class, - 'value' => 'array<' . Annotation\Attribute::class . '>', - ], - ], - ], - Annotation\Enum::class => [ - 'is_annotation' => true, - 'has_constructor' => true, - 'has_named_argument_constructor' => false, - 'targets_literal' => 'ANNOTATION_PROPERTY', - 'targets' => Target::TARGET_PROPERTY, - 'default_property' => 'value', - 'properties' => ['value' => 'value'], - 'attribute_types' => [ - 'value' => [ - 'type' => 'array', - 'required' => true, - ], - 'literal' => [ - 'type' => 'array', - 'required' => false, - ], - ], - ], - Annotation\NamedArgumentConstructor::class => [ - 'is_annotation' => true, - 'has_constructor' => false, - 'has_named_argument_constructor' => false, - 'targets_literal' => 'ANNOTATION_CLASS', - 'targets' => Target::TARGET_CLASS, - 'default_property' => null, - 'properties' => [], - 'attribute_types' => [], - ], - ]; - - /** - * Hash-map for handle types declaration. - * - * @var array - */ - private static $typeMap = [ - 'float' => 'double', - 'bool' => 'boolean', - // allow uppercase Boolean in honor of George Boole - 'Boolean' => 'boolean', - 'int' => 'integer', - ]; - - /** - * Constructs a new DocParser. - */ - public function __construct() - { - $this->lexer = new DocLexer(); - } - - /** - * Sets the annotation names that are ignored during the parsing process. - * - * The names are supposed to be the raw names as used in the class, not the - * fully qualified class names. - * - * @param bool[] $names indexed by annotation name - * - * @return void - */ - public function setIgnoredAnnotationNames(array $names) - { - $this->ignoredAnnotationNames = $names; - } - - /** - * Sets the annotation namespaces that are ignored during the parsing process. - * - * @param bool[] $ignoredAnnotationNamespaces indexed by annotation namespace name - * - * @return void - */ - public function setIgnoredAnnotationNamespaces($ignoredAnnotationNamespaces) - { - $this->ignoredAnnotationNamespaces = $ignoredAnnotationNamespaces; - } - - /** - * Sets ignore on not-imported annotations. - * - * @param bool $bool - * - * @return void - */ - public function setIgnoreNotImportedAnnotations($bool) - { - $this->ignoreNotImportedAnnotations = (bool) $bool; - } - - /** - * Sets the default namespaces. - * - * @param string $namespace - * - * @return void - * - * @throws RuntimeException - */ - public function addNamespace($namespace) - { - if ($this->imports) { - throw new RuntimeException('You must either use addNamespace(), or setImports(), but not both.'); - } - - $this->namespaces[] = $namespace; - } - - /** - * Sets the imports. - * - * @param array $imports - * - * @return void - * - * @throws RuntimeException - */ - public function setImports(array $imports) - { - if ($this->namespaces) { - throw new RuntimeException('You must either use addNamespace(), or setImports(), but not both.'); - } - - $this->imports = $imports; - } - - /** - * Sets current target context as bitmask. - * - * @param int $target - * - * @return void - */ - public function setTarget($target) - { - $this->target = $target; - } - - /** - * Parses the given docblock string for annotations. - * - * @param string $input The docblock string to parse. - * @param string $context The parsing context. - * - * @throws AnnotationException - * @throws ReflectionException - * - * @phpstan-return list Array of annotations. If no annotations are found, an empty array is returned. - */ - public function parse($input, $context = '') - { - $pos = $this->findInitialTokenPosition($input); - if ($pos === null) { - return []; - } - - $this->context = $context; - - $this->lexer->setInput(trim(substr($input, $pos), '* /')); - $this->lexer->moveNext(); - - return $this->Annotations(); - } - - /** - * Finds the first valid annotation - * - * @param string $input The docblock string to parse - */ - private function findInitialTokenPosition($input): ?int - { - $pos = 0; - - // search for first valid annotation - while (($pos = strpos($input, '@', $pos)) !== false) { - $preceding = substr($input, $pos - 1, 1); - - // if the @ is preceded by a space, a tab or * it is valid - if ($pos === 0 || $preceding === ' ' || $preceding === '*' || $preceding === "\t") { - return $pos; - } - - $pos++; - } - - return null; - } - - /** - * Attempts to match the given token with the current lookahead token. - * If they match, updates the lookahead token; otherwise raises a syntax error. - * - * @param int $token Type of token. - * - * @return bool True if tokens match; false otherwise. - * - * @throws AnnotationException - */ - private function match(int $token): bool - { - if (! $this->lexer->isNextToken($token)) { - throw $this->syntaxError($this->lexer->getLiteral($token)); - } - - return $this->lexer->moveNext(); - } - - /** - * Attempts to match the current lookahead token with any of the given tokens. - * - * If any of them matches, this method updates the lookahead token; otherwise - * a syntax error is raised. - * - * @throws AnnotationException - * - * @phpstan-param list $tokens - */ - private function matchAny(array $tokens): bool - { - if (! $this->lexer->isNextTokenAny($tokens)) { - throw $this->syntaxError(implode(' or ', array_map([$this->lexer, 'getLiteral'], $tokens))); - } - - return $this->lexer->moveNext(); - } - - /** - * Generates a new syntax error. - * - * @param string $expected Expected string. - * @param mixed[]|null $token Optional token. - */ - private function syntaxError(string $expected, ?array $token = null): AnnotationException - { - if ($token === null) { - $token = $this->lexer->lookahead; - } - - $message = sprintf('Expected %s, got ', $expected); - $message .= $this->lexer->lookahead === null - ? 'end of string' - : sprintf("'%s' at position %s", $token['value'], $token['position']); - - if (strlen($this->context)) { - $message .= ' in ' . $this->context; - } - - $message .= '.'; - - return AnnotationException::syntaxError($message); - } - - /** - * Attempts to check if a class exists or not. This never goes through the PHP autoloading mechanism - * but uses the {@link AnnotationRegistry} to load classes. - * - * @param class-string $fqcn - */ - private function classExists(string $fqcn): bool - { - if (isset($this->classExists[$fqcn])) { - return $this->classExists[$fqcn]; - } - - // first check if the class already exists, maybe loaded through another AnnotationReader - if (class_exists($fqcn, false)) { - return $this->classExists[$fqcn] = true; - } - - // final check, does this class exist? - return $this->classExists[$fqcn] = AnnotationRegistry::loadAnnotationClass($fqcn); - } - - /** - * Collects parsing metadata for a given annotation class - * - * @param class-string $name The annotation name - * - * @throws AnnotationException - * @throws ReflectionException - */ - private function collectAnnotationMetadata(string $name): void - { - if (self::$metadataParser === null) { - self::$metadataParser = new self(); - - self::$metadataParser->setIgnoreNotImportedAnnotations(true); - self::$metadataParser->setIgnoredAnnotationNames($this->ignoredAnnotationNames); - self::$metadataParser->setImports([ - 'enum' => Enum::class, - 'target' => Target::class, - 'attribute' => Attribute::class, - 'attributes' => Attributes::class, - 'namedargumentconstructor' => NamedArgumentConstructor::class, - ]); - - // Make sure that annotations from metadata are loaded - class_exists(Enum::class); - class_exists(Target::class); - class_exists(Attribute::class); - class_exists(Attributes::class); - class_exists(NamedArgumentConstructor::class); - } - - $class = new ReflectionClass($name); - $docComment = $class->getDocComment(); - - // Sets default values for annotation metadata - $constructor = $class->getConstructor(); - $metadata = [ - 'default_property' => null, - 'has_constructor' => $constructor !== null && $constructor->getNumberOfParameters() > 0, - 'constructor_args' => [], - 'properties' => [], - 'property_types' => [], - 'attribute_types' => [], - 'targets_literal' => null, - 'targets' => Target::TARGET_ALL, - 'is_annotation' => strpos($docComment, '@Annotation') !== false, - ]; - - $metadata['has_named_argument_constructor'] = $metadata['has_constructor'] - && $class->implementsInterface(NamedArgumentConstructorAnnotation::class); - - // verify that the class is really meant to be an annotation - if ($metadata['is_annotation']) { - self::$metadataParser->setTarget(Target::TARGET_CLASS); - - foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) { - if ($annotation instanceof Target) { - $metadata['targets'] = $annotation->targets; - $metadata['targets_literal'] = $annotation->literal; - - continue; - } - - if ($annotation instanceof NamedArgumentConstructor) { - $metadata['has_named_argument_constructor'] = $metadata['has_constructor']; - if ($metadata['has_named_argument_constructor']) { - // choose the first argument as the default property - $metadata['default_property'] = $constructor->getParameters()[0]->getName(); - } - } - - if (! ($annotation instanceof Attributes)) { - continue; - } - - foreach ($annotation->value as $attribute) { - $this->collectAttributeTypeMetadata($metadata, $attribute); - } - } - - // if not has a constructor will inject values into public properties - if ($metadata['has_constructor'] === false) { - // collect all public properties - foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { - $metadata['properties'][$property->name] = $property->name; - - $propertyComment = $property->getDocComment(); - if ($propertyComment === false) { - continue; - } - - $attribute = new Attribute(); - - $attribute->required = (strpos($propertyComment, '@Required') !== false); - $attribute->name = $property->name; - $attribute->type = (strpos($propertyComment, '@var') !== false && - preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches)) - ? $matches[1] - : 'mixed'; - - $this->collectAttributeTypeMetadata($metadata, $attribute); - - // checks if the property has @Enum - if (strpos($propertyComment, '@Enum') === false) { - continue; - } - - $context = 'property ' . $class->name . '::$' . $property->name; - - self::$metadataParser->setTarget(Target::TARGET_PROPERTY); - - foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { - if (! $annotation instanceof Enum) { - continue; - } - - $metadata['enum'][$property->name]['value'] = $annotation->value; - $metadata['enum'][$property->name]['literal'] = (! empty($annotation->literal)) - ? $annotation->literal - : $annotation->value; - } - } - - // choose the first property as default property - $metadata['default_property'] = reset($metadata['properties']); - } elseif ($metadata['has_named_argument_constructor']) { - foreach ($constructor->getParameters() as $parameter) { - $metadata['constructor_args'][$parameter->getName()] = [ - 'position' => $parameter->getPosition(), - 'default' => $parameter->isOptional() ? $parameter->getDefaultValue() : null, - ]; - } - } - } - - self::$annotationMetadata[$name] = $metadata; - } - - /** - * Collects parsing metadata for a given attribute. - * - * @param mixed[] $metadata - */ - private function collectAttributeTypeMetadata(array &$metadata, Attribute $attribute): void - { - // handle internal type declaration - $type = self::$typeMap[$attribute->type] ?? $attribute->type; - - // handle the case if the property type is mixed - if ($type === 'mixed') { - return; - } - - // Evaluate type - $pos = strpos($type, '<'); - if ($pos !== false) { - // Checks if the property has array - $arrayType = substr($type, $pos + 1, -1); - $type = 'array'; - - if (isset(self::$typeMap[$arrayType])) { - $arrayType = self::$typeMap[$arrayType]; - } - - $metadata['attribute_types'][$attribute->name]['array_type'] = $arrayType; - } else { - // Checks if the property has type[] - $pos = strrpos($type, '['); - if ($pos !== false) { - $arrayType = substr($type, 0, $pos); - $type = 'array'; - - if (isset(self::$typeMap[$arrayType])) { - $arrayType = self::$typeMap[$arrayType]; - } - - $metadata['attribute_types'][$attribute->name]['array_type'] = $arrayType; - } - } - - $metadata['attribute_types'][$attribute->name]['type'] = $type; - $metadata['attribute_types'][$attribute->name]['value'] = $attribute->type; - $metadata['attribute_types'][$attribute->name]['required'] = $attribute->required; - } - - /** - * Annotations ::= Annotation {[ "*" ]* [Annotation]}* - * - * @throws AnnotationException - * @throws ReflectionException - * - * @phpstan-return list - */ - private function Annotations(): array - { - $annotations = []; - - while ($this->lexer->lookahead !== null) { - if ($this->lexer->lookahead['type'] !== DocLexer::T_AT) { - $this->lexer->moveNext(); - continue; - } - - // make sure the @ is preceded by non-catchable pattern - if ( - $this->lexer->token !== null && - $this->lexer->lookahead['position'] === $this->lexer->token['position'] + strlen( - $this->lexer->token['value'] - ) - ) { - $this->lexer->moveNext(); - continue; - } - - // make sure the @ is followed by either a namespace separator, or - // an identifier token - $peek = $this->lexer->glimpse(); - if ( - ($peek === null) - || ($peek['type'] !== DocLexer::T_NAMESPACE_SEPARATOR && ! in_array( - $peek['type'], - self::$classIdentifiers, - true - )) - || $peek['position'] !== $this->lexer->lookahead['position'] + 1 - ) { - $this->lexer->moveNext(); - continue; - } - - $this->isNestedAnnotation = false; - $annot = $this->Annotation(); - if ($annot === false) { - continue; - } - - $annotations[] = $annot; - } - - return $annotations; - } - - /** - * Annotation ::= "@" AnnotationName MethodCall - * AnnotationName ::= QualifiedName | SimpleName - * QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName - * NameSpacePart ::= identifier | null | false | true - * SimpleName ::= identifier | null | false | true - * - * @return object|false False if it is not a valid annotation. - * - * @throws AnnotationException - * @throws ReflectionException - */ - private function Annotation() - { - $this->match(DocLexer::T_AT); - - // check if we have an annotation - $name = $this->Identifier(); - - if ( - $this->lexer->isNextToken(DocLexer::T_MINUS) - && $this->lexer->nextTokenIsAdjacent() - ) { - // Annotations with dashes, such as "@foo-" or "@foo-bar", are to be discarded - return false; - } - - // only process names which are not fully qualified, yet - // fully qualified names must start with a \ - $originalName = $name; - - if ($name[0] !== '\\') { - $pos = strpos($name, '\\'); - $alias = ($pos === false) ? $name : substr($name, 0, $pos); - $found = false; - $loweredAlias = strtolower($alias); - - if ($this->namespaces) { - foreach ($this->namespaces as $namespace) { - if ($this->classExists($namespace . '\\' . $name)) { - $name = $namespace . '\\' . $name; - $found = true; - break; - } - } - } elseif (isset($this->imports[$loweredAlias])) { - $namespace = ltrim($this->imports[$loweredAlias], '\\'); - $name = ($pos !== false) - ? $namespace . substr($name, $pos) - : $namespace; - $found = $this->classExists($name); - } elseif ( - ! isset($this->ignoredAnnotationNames[$name]) - && isset($this->imports['__NAMESPACE__']) - && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name) - ) { - $name = $this->imports['__NAMESPACE__'] . '\\' . $name; - $found = true; - } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { - $found = true; - } - - if (! $found) { - if ($this->isIgnoredAnnotation($name)) { - return false; - } - - throw AnnotationException::semanticalError(sprintf( - <<<'EXCEPTION' -The annotation "@%s" in %s was never imported. Did you maybe forget to add a "use" statement for this annotation? -EXCEPTION - , - $name, - $this->context - )); - } - } - - $name = ltrim($name, '\\'); - - if (! $this->classExists($name)) { - throw AnnotationException::semanticalError(sprintf( - 'The annotation "@%s" in %s does not exist, or could not be auto-loaded.', - $name, - $this->context - )); - } - - // at this point, $name contains the fully qualified class name of the - // annotation, and it is also guaranteed that this class exists, and - // that it is loaded - - // collects the metadata annotation only if there is not yet - if (! isset(self::$annotationMetadata[$name])) { - $this->collectAnnotationMetadata($name); - } - - // verify that the class is really meant to be an annotation and not just any ordinary class - if (self::$annotationMetadata[$name]['is_annotation'] === false) { - if ($this->isIgnoredAnnotation($originalName) || $this->isIgnoredAnnotation($name)) { - return false; - } - - throw AnnotationException::semanticalError(sprintf( - <<<'EXCEPTION' -The class "%s" is not annotated with @Annotation. -Are you sure this class can be used as annotation? -If so, then you need to add @Annotation to the _class_ doc comment of "%s". -If it is indeed no annotation, then you need to add @IgnoreAnnotation("%s") to the _class_ doc comment of %s. -EXCEPTION - , - $name, - $name, - $originalName, - $this->context - )); - } - - //if target is nested annotation - $target = $this->isNestedAnnotation ? Target::TARGET_ANNOTATION : $this->target; - - // Next will be nested - $this->isNestedAnnotation = true; - - //if annotation does not support current target - if ((self::$annotationMetadata[$name]['targets'] & $target) === 0 && $target) { - throw AnnotationException::semanticalError( - sprintf( - <<<'EXCEPTION' -Annotation @%s is not allowed to be declared on %s. You may only use this annotation on these code elements: %s. -EXCEPTION - , - $originalName, - $this->context, - self::$annotationMetadata[$name]['targets_literal'] - ) - ); - } - - $arguments = $this->MethodCall(); - $values = $this->resolvePositionalValues($arguments, $name); - - if (isset(self::$annotationMetadata[$name]['enum'])) { - // checks all declared attributes - foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) { - // checks if the attribute is a valid enumerator - if (isset($values[$property]) && ! in_array($values[$property], $enum['value'])) { - throw AnnotationException::enumeratorError( - $property, - $name, - $this->context, - $enum['literal'], - $values[$property] - ); - } - } - } - - // checks all declared attributes - foreach (self::$annotationMetadata[$name]['attribute_types'] as $property => $type) { - if ( - $property === self::$annotationMetadata[$name]['default_property'] - && ! isset($values[$property]) && isset($values['value']) - ) { - $property = 'value'; - } - - // handle a not given attribute or null value - if (! isset($values[$property])) { - if ($type['required']) { - throw AnnotationException::requiredError( - $property, - $originalName, - $this->context, - 'a(n) ' . $type['value'] - ); - } - - continue; - } - - if ($type['type'] === 'array') { - // handle the case of a single value - if (! is_array($values[$property])) { - $values[$property] = [$values[$property]]; - } - - // checks if the attribute has array type declaration, such as "array" - if (isset($type['array_type'])) { - foreach ($values[$property] as $item) { - if (gettype($item) !== $type['array_type'] && ! $item instanceof $type['array_type']) { - throw AnnotationException::attributeTypeError( - $property, - $originalName, - $this->context, - 'either a(n) ' . $type['array_type'] . ', or an array of ' . $type['array_type'] . 's', - $item - ); - } - } - } - } elseif (gettype($values[$property]) !== $type['type'] && ! $values[$property] instanceof $type['type']) { - throw AnnotationException::attributeTypeError( - $property, - $originalName, - $this->context, - 'a(n) ' . $type['value'], - $values[$property] - ); - } - } - - if (self::$annotationMetadata[$name]['has_named_argument_constructor']) { - if (PHP_VERSION_ID >= 80000) { - return new $name(...$values); - } - - $positionalValues = []; - foreach (self::$annotationMetadata[$name]['constructor_args'] as $property => $parameter) { - $positionalValues[$parameter['position']] = $parameter['default']; - } - - foreach ($values as $property => $value) { - if (! isset(self::$annotationMetadata[$name]['constructor_args'][$property])) { - throw AnnotationException::creationError(sprintf( - <<<'EXCEPTION' -The annotation @%s declared on %s does not have a property named "%s" -that can be set through its named arguments constructor. -Available named arguments: %s -EXCEPTION - , - $originalName, - $this->context, - $property, - implode(', ', array_keys(self::$annotationMetadata[$name]['constructor_args'])) - )); - } - - $positionalValues[self::$annotationMetadata[$name]['constructor_args'][$property]['position']] = $value; - } - - return new $name(...$positionalValues); - } - - // check if the annotation expects values via the constructor, - // or directly injected into public properties - if (self::$annotationMetadata[$name]['has_constructor'] === true) { - return new $name($values); - } - - $instance = new $name(); - - foreach ($values as $property => $value) { - if (! isset(self::$annotationMetadata[$name]['properties'][$property])) { - if ($property !== 'value') { - throw AnnotationException::creationError(sprintf( - <<<'EXCEPTION' -The annotation @%s declared on %s does not have a property named "%s". -Available properties: %s -EXCEPTION - , - $originalName, - $this->context, - $property, - implode(', ', self::$annotationMetadata[$name]['properties']) - )); - } - - // handle the case if the property has no annotations - $property = self::$annotationMetadata[$name]['default_property']; - if (! $property) { - throw AnnotationException::creationError(sprintf( - 'The annotation @%s declared on %s does not accept any values, but got %s.', - $originalName, - $this->context, - json_encode($values) - )); - } - } - - $instance->{$property} = $value; - } - - return $instance; - } - - /** - * MethodCall ::= ["(" [Values] ")"] - * - * @return mixed[] - * - * @throws AnnotationException - * @throws ReflectionException - */ - private function MethodCall(): array - { - $values = []; - - if (! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { - return $values; - } - - $this->match(DocLexer::T_OPEN_PARENTHESIS); - - if (! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { - $values = $this->Values(); - } - - $this->match(DocLexer::T_CLOSE_PARENTHESIS); - - return $values; - } - - /** - * Values ::= Array | Value {"," Value}* [","] - * - * @return mixed[] - * - * @throws AnnotationException - * @throws ReflectionException - */ - private function Values(): array - { - $values = [$this->Value()]; - - while ($this->lexer->isNextToken(DocLexer::T_COMMA)) { - $this->match(DocLexer::T_COMMA); - - if ($this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { - break; - } - - $token = $this->lexer->lookahead; - $value = $this->Value(); - - $values[] = $value; - } - - $namedArguments = []; - $positionalArguments = []; - foreach ($values as $k => $value) { - if (is_object($value) && $value instanceof stdClass) { - $namedArguments[$value->name] = $value->value; - } else { - $positionalArguments[$k] = $value; - } - } - - return ['named_arguments' => $namedArguments, 'positional_arguments' => $positionalArguments]; - } - - /** - * Constant ::= integer | string | float | boolean - * - * @return mixed - * - * @throws AnnotationException - */ - private function Constant() - { - $identifier = $this->Identifier(); - - if (! defined($identifier) && strpos($identifier, '::') !== false && $identifier[0] !== '\\') { - [$className, $const] = explode('::', $identifier); - - $pos = strpos($className, '\\'); - $alias = ($pos === false) ? $className : substr($className, 0, $pos); - $found = false; - $loweredAlias = strtolower($alias); - - switch (true) { - case ! empty($this->namespaces): - foreach ($this->namespaces as $ns) { - if (class_exists($ns . '\\' . $className) || interface_exists($ns . '\\' . $className)) { - $className = $ns . '\\' . $className; - $found = true; - break; - } - } - - break; - - case isset($this->imports[$loweredAlias]): - $found = true; - $className = ($pos !== false) - ? $this->imports[$loweredAlias] . substr($className, $pos) - : $this->imports[$loweredAlias]; - break; - - default: - if (isset($this->imports['__NAMESPACE__'])) { - $ns = $this->imports['__NAMESPACE__']; - - if (class_exists($ns . '\\' . $className) || interface_exists($ns . '\\' . $className)) { - $className = $ns . '\\' . $className; - $found = true; - } - } - - break; - } - - if ($found) { - $identifier = $className . '::' . $const; - } - } - - /** - * Checks if identifier ends with ::class and remove the leading backslash if it exists. - */ - if ( - $this->identifierEndsWithClassConstant($identifier) && - ! $this->identifierStartsWithBackslash($identifier) - ) { - return substr($identifier, 0, $this->getClassConstantPositionInIdentifier($identifier)); - } - - if ($this->identifierEndsWithClassConstant($identifier) && $this->identifierStartsWithBackslash($identifier)) { - return substr($identifier, 1, $this->getClassConstantPositionInIdentifier($identifier) - 1); - } - - if (! defined($identifier)) { - throw AnnotationException::semanticalErrorConstants($identifier, $this->context); - } - - return constant($identifier); - } - - private function identifierStartsWithBackslash(string $identifier): bool - { - return $identifier[0] === '\\'; - } - - private function identifierEndsWithClassConstant(string $identifier): bool - { - return $this->getClassConstantPositionInIdentifier($identifier) === strlen($identifier) - strlen('::class'); - } - - /** - * @return int|false - */ - private function getClassConstantPositionInIdentifier(string $identifier) - { - return stripos($identifier, '::class'); - } - - /** - * Identifier ::= string - * - * @throws AnnotationException - */ - private function Identifier(): string - { - // check if we have an annotation - if (! $this->lexer->isNextTokenAny(self::$classIdentifiers)) { - throw $this->syntaxError('namespace separator or identifier'); - } - - $this->lexer->moveNext(); - - $className = $this->lexer->token['value']; - - while ( - $this->lexer->lookahead !== null && - $this->lexer->lookahead['position'] === ($this->lexer->token['position'] + - strlen($this->lexer->token['value'])) && - $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR) - ) { - $this->match(DocLexer::T_NAMESPACE_SEPARATOR); - $this->matchAny(self::$classIdentifiers); - - $className .= '\\' . $this->lexer->token['value']; - } - - return $className; - } - - /** - * Value ::= PlainValue | FieldAssignment - * - * @return mixed - * - * @throws AnnotationException - * @throws ReflectionException - */ - private function Value() - { - $peek = $this->lexer->glimpse(); - - if ($peek['type'] === DocLexer::T_EQUALS) { - return $this->FieldAssignment(); - } - - return $this->PlainValue(); - } - - /** - * PlainValue ::= integer | string | float | boolean | Array | Annotation - * - * @return mixed - * - * @throws AnnotationException - * @throws ReflectionException - */ - private function PlainValue() - { - if ($this->lexer->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) { - return $this->Arrayx(); - } - - if ($this->lexer->isNextToken(DocLexer::T_AT)) { - return $this->Annotation(); - } - - if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) { - return $this->Constant(); - } - - switch ($this->lexer->lookahead['type']) { - case DocLexer::T_STRING: - $this->match(DocLexer::T_STRING); - - return $this->lexer->token['value']; - - case DocLexer::T_INTEGER: - $this->match(DocLexer::T_INTEGER); - - return (int) $this->lexer->token['value']; - - case DocLexer::T_FLOAT: - $this->match(DocLexer::T_FLOAT); - - return (float) $this->lexer->token['value']; - - case DocLexer::T_TRUE: - $this->match(DocLexer::T_TRUE); - - return true; - - case DocLexer::T_FALSE: - $this->match(DocLexer::T_FALSE); - - return false; - - case DocLexer::T_NULL: - $this->match(DocLexer::T_NULL); - - return null; - - default: - throw $this->syntaxError('PlainValue'); - } - } - - /** - * FieldAssignment ::= FieldName "=" PlainValue - * FieldName ::= identifier - * - * @throws AnnotationException - * @throws ReflectionException - */ - private function FieldAssignment(): stdClass - { - $this->match(DocLexer::T_IDENTIFIER); - $fieldName = $this->lexer->token['value']; - - $this->match(DocLexer::T_EQUALS); - - $item = new stdClass(); - $item->name = $fieldName; - $item->value = $this->PlainValue(); - - return $item; - } - - /** - * Array ::= "{" ArrayEntry {"," ArrayEntry}* [","] "}" - * - * @return mixed[] - * - * @throws AnnotationException - * @throws ReflectionException - */ - private function Arrayx(): array - { - $array = $values = []; - - $this->match(DocLexer::T_OPEN_CURLY_BRACES); - - // If the array is empty, stop parsing and return. - if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) { - $this->match(DocLexer::T_CLOSE_CURLY_BRACES); - - return $array; - } - - $values[] = $this->ArrayEntry(); - - while ($this->lexer->isNextToken(DocLexer::T_COMMA)) { - $this->match(DocLexer::T_COMMA); - - // optional trailing comma - if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) { - break; - } - - $values[] = $this->ArrayEntry(); - } - - $this->match(DocLexer::T_CLOSE_CURLY_BRACES); - - foreach ($values as $value) { - [$key, $val] = $value; - - if ($key !== null) { - $array[$key] = $val; - } else { - $array[] = $val; - } - } - - return $array; - } - - /** - * ArrayEntry ::= Value | KeyValuePair - * KeyValuePair ::= Key ("=" | ":") PlainValue | Constant - * Key ::= string | integer | Constant - * - * @throws AnnotationException - * @throws ReflectionException - * - * @phpstan-return array{mixed, mixed} - */ - private function ArrayEntry(): array - { - $peek = $this->lexer->glimpse(); - - if ( - $peek['type'] === DocLexer::T_EQUALS - || $peek['type'] === DocLexer::T_COLON - ) { - if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) { - $key = $this->Constant(); - } else { - $this->matchAny([DocLexer::T_INTEGER, DocLexer::T_STRING]); - $key = $this->lexer->token['value']; - } - - $this->matchAny([DocLexer::T_EQUALS, DocLexer::T_COLON]); - - return [$key, $this->PlainValue()]; - } - - return [null, $this->Value()]; - } - - /** - * Checks whether the given $name matches any ignored annotation name or namespace - */ - private function isIgnoredAnnotation(string $name): bool - { - if ($this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$name])) { - return true; - } - - foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { - $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; - - if (stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace) === 0) { - return true; - } - } - - return false; - } - - /** - * Resolve positional arguments (without name) to named ones - * - * @param array $arguments - * - * @return array - */ - private function resolvePositionalValues(array $arguments, string $name): array - { - $positionalArguments = $arguments['positional_arguments'] ?? []; - $values = $arguments['named_arguments'] ?? []; - - if ( - self::$annotationMetadata[$name]['has_named_argument_constructor'] - && self::$annotationMetadata[$name]['default_property'] !== null - ) { - // We must ensure that we don't have positional arguments after named ones - $positions = array_keys($positionalArguments); - $lastPosition = null; - foreach ($positions as $position) { - if ( - ($lastPosition === null && $position !== 0) || - ($lastPosition !== null && $position !== $lastPosition + 1) - ) { - throw $this->syntaxError('Positional arguments after named arguments is not allowed'); - } - - $lastPosition = $position; - } - - foreach (self::$annotationMetadata[$name]['constructor_args'] as $property => $parameter) { - $position = $parameter['position']; - if (isset($values[$property]) || ! isset($positionalArguments[$position])) { - continue; - } - - $values[$property] = $positionalArguments[$position]; - } - } else { - if (count($positionalArguments) > 0 && ! isset($values['value'])) { - if (count($positionalArguments) === 1) { - $value = array_pop($positionalArguments); - } else { - $value = array_values($positionalArguments); - } - - $values['value'] = $value; - } - } - - return $values; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php deleted file mode 100644 index 6c6c22c3..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php +++ /dev/null @@ -1,315 +0,0 @@ -> */ - private $loadedAnnotations = []; - - /** @var array */ - private $classNameHashes = []; - - /** @var int */ - private $umask; - - /** - * @param string $cacheDir - * @param bool $debug - * @param int $umask - * - * @throws InvalidArgumentException - */ - public function __construct(Reader $reader, $cacheDir, $debug = false, $umask = 0002) - { - if (! is_int($umask)) { - throw new InvalidArgumentException(sprintf( - 'The parameter umask must be an integer, was: %s', - gettype($umask) - )); - } - - $this->reader = $reader; - $this->umask = $umask; - - if (! is_dir($cacheDir) && ! @mkdir($cacheDir, 0777 & (~$this->umask), true)) { - throw new InvalidArgumentException(sprintf( - 'The directory "%s" does not exist and could not be created.', - $cacheDir - )); - } - - $this->dir = rtrim($cacheDir, '\\/'); - $this->debug = $debug; - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotations(ReflectionClass $class) - { - if (! isset($this->classNameHashes[$class->name])) { - $this->classNameHashes[$class->name] = sha1($class->name); - } - - $key = $this->classNameHashes[$class->name]; - - if (isset($this->loadedAnnotations[$key])) { - return $this->loadedAnnotations[$key]; - } - - $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; - if (! is_file($path)) { - $annot = $this->reader->getClassAnnotations($class); - $this->saveCacheFile($path, $annot); - - return $this->loadedAnnotations[$key] = $annot; - } - - $filename = $class->getFilename(); - if ( - $this->debug - && $filename !== false - && filemtime($path) < filemtime($filename) - ) { - @unlink($path); - - $annot = $this->reader->getClassAnnotations($class); - $this->saveCacheFile($path, $annot); - - return $this->loadedAnnotations[$key] = $annot; - } - - return $this->loadedAnnotations[$key] = include $path; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotations(ReflectionProperty $property) - { - $class = $property->getDeclaringClass(); - if (! isset($this->classNameHashes[$class->name])) { - $this->classNameHashes[$class->name] = sha1($class->name); - } - - $key = $this->classNameHashes[$class->name] . '$' . $property->getName(); - - if (isset($this->loadedAnnotations[$key])) { - return $this->loadedAnnotations[$key]; - } - - $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; - if (! is_file($path)) { - $annot = $this->reader->getPropertyAnnotations($property); - $this->saveCacheFile($path, $annot); - - return $this->loadedAnnotations[$key] = $annot; - } - - $filename = $class->getFilename(); - if ( - $this->debug - && $filename !== false - && filemtime($path) < filemtime($filename) - ) { - @unlink($path); - - $annot = $this->reader->getPropertyAnnotations($property); - $this->saveCacheFile($path, $annot); - - return $this->loadedAnnotations[$key] = $annot; - } - - return $this->loadedAnnotations[$key] = include $path; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotations(ReflectionMethod $method) - { - $class = $method->getDeclaringClass(); - if (! isset($this->classNameHashes[$class->name])) { - $this->classNameHashes[$class->name] = sha1($class->name); - } - - $key = $this->classNameHashes[$class->name] . '#' . $method->getName(); - - if (isset($this->loadedAnnotations[$key])) { - return $this->loadedAnnotations[$key]; - } - - $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; - if (! is_file($path)) { - $annot = $this->reader->getMethodAnnotations($method); - $this->saveCacheFile($path, $annot); - - return $this->loadedAnnotations[$key] = $annot; - } - - $filename = $class->getFilename(); - if ( - $this->debug - && $filename !== false - && filemtime($path) < filemtime($filename) - ) { - @unlink($path); - - $annot = $this->reader->getMethodAnnotations($method); - $this->saveCacheFile($path, $annot); - - return $this->loadedAnnotations[$key] = $annot; - } - - return $this->loadedAnnotations[$key] = include $path; - } - - /** - * Saves the cache file. - * - * @param string $path - * @param mixed $data - * - * @return void - */ - private function saveCacheFile($path, $data) - { - if (! is_writable($this->dir)) { - throw new InvalidArgumentException(sprintf( - <<<'EXCEPTION' -The directory "%s" is not writable. Both the webserver and the console user need access. -You can manage access rights for multiple users with "chmod +a". -If your system does not support this, check out the acl package., -EXCEPTION - , - $this->dir - )); - } - - $tempfile = tempnam($this->dir, uniqid('', true)); - - if ($tempfile === false) { - throw new RuntimeException(sprintf('Unable to create tempfile in directory: %s', $this->dir)); - } - - @chmod($tempfile, 0666 & (~$this->umask)); - - $written = file_put_contents( - $tempfile, - 'umask)); - - if (rename($tempfile, $path) === false) { - @unlink($tempfile); - - throw new RuntimeException(sprintf('Unable to rename %s to %s', $tempfile, $path)); - } - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotation(ReflectionClass $class, $annotationName) - { - $annotations = $this->getClassAnnotations($class); - - foreach ($annotations as $annotation) { - if ($annotation instanceof $annotationName) { - return $annotation; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotation(ReflectionMethod $method, $annotationName) - { - $annotations = $this->getMethodAnnotations($method); - - foreach ($annotations as $annotation) { - if ($annotation instanceof $annotationName) { - return $annotation; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) - { - $annotations = $this->getPropertyAnnotations($property); - - foreach ($annotations as $annotation) { - if ($annotation instanceof $annotationName) { - return $annotation; - } - } - - return null; - } - - /** - * Clears loaded annotations. - * - * @return void - */ - public function clearLoadedAnnotations() - { - $this->loadedAnnotations = []; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php deleted file mode 100644 index 2efeb1d2..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php +++ /dev/null @@ -1,177 +0,0 @@ - true, - 'Attribute' => true, - 'Attributes' => true, - /* Can we enable this? 'Enum' => true, */ - 'Required' => true, - 'Target' => true, - 'NamedArgumentConstructor' => true, - ]; - - private const WidelyUsedNonStandard = [ - 'fix' => true, - 'fixme' => true, - 'override' => true, - ]; - - private const PhpDocumentor1 = [ - 'abstract' => true, - 'access' => true, - 'code' => true, - 'deprec' => true, - 'endcode' => true, - 'exception' => true, - 'final' => true, - 'ingroup' => true, - 'inheritdoc' => true, - 'inheritDoc' => true, - 'magic' => true, - 'name' => true, - 'private' => true, - 'static' => true, - 'staticvar' => true, - 'staticVar' => true, - 'toc' => true, - 'tutorial' => true, - 'throw' => true, - ]; - - private const PhpDocumentor2 = [ - 'api' => true, - 'author' => true, - 'category' => true, - 'copyright' => true, - 'deprecated' => true, - 'example' => true, - 'filesource' => true, - 'global' => true, - 'ignore' => true, - /* Can we enable this? 'index' => true, */ - 'internal' => true, - 'license' => true, - 'link' => true, - 'method' => true, - 'package' => true, - 'param' => true, - 'property' => true, - 'property-read' => true, - 'property-write' => true, - 'return' => true, - 'see' => true, - 'since' => true, - 'source' => true, - 'subpackage' => true, - 'throws' => true, - 'todo' => true, - 'TODO' => true, - 'usedby' => true, - 'uses' => true, - 'var' => true, - 'version' => true, - ]; - - private const PHPUnit = [ - 'author' => true, - 'after' => true, - 'afterClass' => true, - 'backupGlobals' => true, - 'backupStaticAttributes' => true, - 'before' => true, - 'beforeClass' => true, - 'codeCoverageIgnore' => true, - 'codeCoverageIgnoreStart' => true, - 'codeCoverageIgnoreEnd' => true, - 'covers' => true, - 'coversDefaultClass' => true, - 'coversNothing' => true, - 'dataProvider' => true, - 'depends' => true, - 'doesNotPerformAssertions' => true, - 'expectedException' => true, - 'expectedExceptionCode' => true, - 'expectedExceptionMessage' => true, - 'expectedExceptionMessageRegExp' => true, - 'group' => true, - 'large' => true, - 'medium' => true, - 'preserveGlobalState' => true, - 'requires' => true, - 'runTestsInSeparateProcesses' => true, - 'runInSeparateProcess' => true, - 'small' => true, - 'test' => true, - 'testdox' => true, - 'testWith' => true, - 'ticket' => true, - 'uses' => true, - ]; - - private const PhpCheckStyle = ['SuppressWarnings' => true]; - - private const PhpStorm = ['noinspection' => true]; - - private const PEAR = ['package_version' => true]; - - private const PlainUML = [ - 'startuml' => true, - 'enduml' => true, - ]; - - private const Symfony = ['experimental' => true]; - - private const PhpCodeSniffer = [ - 'codingStandardsIgnoreStart' => true, - 'codingStandardsIgnoreEnd' => true, - ]; - - private const SlevomatCodingStandard = ['phpcsSuppress' => true]; - - private const Phan = ['suppress' => true]; - - private const Rector = ['noRector' => true]; - - private const StaticAnalysis = [ - // PHPStan, Psalm - 'extends' => true, - 'implements' => true, - 'template' => true, - 'use' => true, - - // Psalm - 'pure' => true, - 'immutable' => true, - ]; - - public const LIST = self::Reserved - + self::WidelyUsedNonStandard - + self::PhpDocumentor1 - + self::PhpDocumentor2 - + self::PHPUnit - + self::PhpCheckStyle - + self::PhpStorm - + self::PEAR - + self::PlainUML - + self::Symfony - + self::SlevomatCodingStandard - + self::PhpCodeSniffer - + self::Phan - + self::Rector - + self::StaticAnalysis; - - private function __construct() - { - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php deleted file mode 100644 index 42e70765..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php +++ /dev/null @@ -1,100 +0,0 @@ -delegate = $reader; - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotations(ReflectionClass $class) - { - $annotations = []; - foreach ($this->delegate->getClassAnnotations($class) as $annot) { - $annotations[get_class($annot)] = $annot; - } - - return $annotations; - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotation(ReflectionClass $class, $annotation) - { - return $this->delegate->getClassAnnotation($class, $annotation); - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotations(ReflectionMethod $method) - { - $annotations = []; - foreach ($this->delegate->getMethodAnnotations($method) as $annot) { - $annotations[get_class($annot)] = $annot; - } - - return $annotations; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotation(ReflectionMethod $method, $annotation) - { - return $this->delegate->getMethodAnnotation($method, $annotation); - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotations(ReflectionProperty $property) - { - $annotations = []; - foreach ($this->delegate->getPropertyAnnotations($property) as $annot) { - $annotations[get_class($annot)] = $annot; - } - - return $annotations; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotation(ReflectionProperty $property, $annotation) - { - return $this->delegate->getPropertyAnnotation($property, $annotation); - } - - /** - * Proxies all methods to the delegate. - * - * @param string $method - * @param mixed[] $args - * - * @return mixed - */ - public function __call($method, $args) - { - return call_user_func_array([$this->delegate, $method], $args); - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php deleted file mode 100644 index 8af224c0..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php +++ /dev/null @@ -1,14 +0,0 @@ -ReflectionClass object. - * - * @return array A list with use statements in the form (Alias => FQN). - */ - public function parseClass(ReflectionClass $class) - { - return $this->parseUseStatements($class); - } - - /** - * Parse a class or function for use statements. - * - * @param ReflectionClass|ReflectionFunction $reflection - * - * @psalm-return array a list with use statements in the form (Alias => FQN). - */ - public function parseUseStatements($reflection): array - { - if (method_exists($reflection, 'getUseStatements')) { - return $reflection->getUseStatements(); - } - - $filename = $reflection->getFileName(); - - if ($filename === false) { - return []; - } - - $content = $this->getFileContent($filename, $reflection->getStartLine()); - - if ($content === null) { - return []; - } - - $namespace = preg_quote($reflection->getNamespaceName()); - $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content); - $tokenizer = new TokenParser('parseUseStatements($reflection->getNamespaceName()); - } - - /** - * Gets the content of the file right up to the given line number. - * - * @param string $filename The name of the file to load. - * @param int $lineNumber The number of lines to read from file. - * - * @return string|null The content of the file or null if the file does not exist. - */ - private function getFileContent($filename, $lineNumber) - { - if (! is_file($filename)) { - return null; - } - - $content = ''; - $lineCnt = 0; - $file = new SplFileObject($filename); - while (! $file->eof()) { - if ($lineCnt++ === $lineNumber) { - break; - } - - $content .= $file->fgets(); - } - - return $content; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php deleted file mode 100644 index a7099d57..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php +++ /dev/null @@ -1,232 +0,0 @@ -> */ - private $loadedAnnotations = []; - - /** @var int[] */ - private $loadedFilemtimes = []; - - public function __construct(Reader $reader, CacheItemPoolInterface $cache, bool $debug = false) - { - $this->delegate = $reader; - $this->cache = $cache; - $this->debug = (bool) $debug; - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotations(ReflectionClass $class) - { - $cacheKey = $class->getName(); - - if (isset($this->loadedAnnotations[$cacheKey])) { - return $this->loadedAnnotations[$cacheKey]; - } - - $annots = $this->fetchFromCache($cacheKey, $class, 'getClassAnnotations', $class); - - return $this->loadedAnnotations[$cacheKey] = $annots; - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotation(ReflectionClass $class, $annotationName) - { - foreach ($this->getClassAnnotations($class) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotations(ReflectionProperty $property) - { - $class = $property->getDeclaringClass(); - $cacheKey = $class->getName() . '$' . $property->getName(); - - if (isset($this->loadedAnnotations[$cacheKey])) { - return $this->loadedAnnotations[$cacheKey]; - } - - $annots = $this->fetchFromCache($cacheKey, $class, 'getPropertyAnnotations', $property); - - return $this->loadedAnnotations[$cacheKey] = $annots; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) - { - foreach ($this->getPropertyAnnotations($property) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotations(ReflectionMethod $method) - { - $class = $method->getDeclaringClass(); - $cacheKey = $class->getName() . '#' . $method->getName(); - - if (isset($this->loadedAnnotations[$cacheKey])) { - return $this->loadedAnnotations[$cacheKey]; - } - - $annots = $this->fetchFromCache($cacheKey, $class, 'getMethodAnnotations', $method); - - return $this->loadedAnnotations[$cacheKey] = $annots; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotation(ReflectionMethod $method, $annotationName) - { - foreach ($this->getMethodAnnotations($method) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } - - public function clearLoadedAnnotations(): void - { - $this->loadedAnnotations = []; - $this->loadedFilemtimes = []; - } - - /** @return mixed[] */ - private function fetchFromCache( - string $cacheKey, - ReflectionClass $class, - string $method, - Reflector $reflector - ): array { - $cacheKey = rawurlencode($cacheKey); - - $item = $this->cache->getItem($cacheKey); - if (($this->debug && ! $this->refresh($cacheKey, $class)) || ! $item->isHit()) { - $this->cache->save($item->set($this->delegate->{$method}($reflector))); - } - - return $item->get(); - } - - /** - * Used in debug mode to check if the cache is fresh. - * - * @return bool Returns true if the cache was fresh, or false if the class - * being read was modified since writing to the cache. - */ - private function refresh(string $cacheKey, ReflectionClass $class): bool - { - $lastModification = $this->getLastModification($class); - if ($lastModification === 0) { - return true; - } - - $item = $this->cache->getItem('[C]' . $cacheKey); - if ($item->isHit() && $item->get() >= $lastModification) { - return true; - } - - $this->cache->save($item->set(time())); - - return false; - } - - /** - * Returns the time the class was last modified, testing traits and parents - */ - private function getLastModification(ReflectionClass $class): int - { - $filename = $class->getFileName(); - - if (isset($this->loadedFilemtimes[$filename])) { - return $this->loadedFilemtimes[$filename]; - } - - $parent = $class->getParentClass(); - - $lastModification = max(array_merge( - [$filename ? filemtime($filename) : 0], - array_map(function (ReflectionClass $reflectionTrait): int { - return $this->getTraitLastModificationTime($reflectionTrait); - }, $class->getTraits()), - array_map(function (ReflectionClass $class): int { - return $this->getLastModification($class); - }, $class->getInterfaces()), - $parent ? [$this->getLastModification($parent)] : [] - )); - - assert($lastModification !== false); - - return $this->loadedFilemtimes[$filename] = $lastModification; - } - - private function getTraitLastModificationTime(ReflectionClass $reflectionTrait): int - { - $fileName = $reflectionTrait->getFileName(); - - if (isset($this->loadedFilemtimes[$fileName])) { - return $this->loadedFilemtimes[$fileName]; - } - - $lastModificationTime = max(array_merge( - [$fileName ? filemtime($fileName) : 0], - array_map(function (ReflectionClass $reflectionTrait): int { - return $this->getTraitLastModificationTime($reflectionTrait); - }, $reflectionTrait->getTraits()) - )); - - assert($lastModificationTime !== false); - - return $this->loadedFilemtimes[$fileName] = $lastModificationTime; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php deleted file mode 100644 index 0663ffda..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php +++ /dev/null @@ -1,80 +0,0 @@ - An array of Annotations. - */ - public function getClassAnnotations(ReflectionClass $class); - - /** - * Gets a class annotation. - * - * @param ReflectionClass $class The ReflectionClass of the class from which - * the class annotations should be read. - * @param class-string $annotationName The name of the annotation. - * - * @return T|null The Annotation or NULL, if the requested annotation does not exist. - * - * @template T - */ - public function getClassAnnotation(ReflectionClass $class, $annotationName); - - /** - * Gets the annotations applied to a method. - * - * @param ReflectionMethod $method The ReflectionMethod of the method from which - * the annotations should be read. - * - * @return array An array of Annotations. - */ - public function getMethodAnnotations(ReflectionMethod $method); - - /** - * Gets a method annotation. - * - * @param ReflectionMethod $method The ReflectionMethod to read the annotations from. - * @param class-string $annotationName The name of the annotation. - * - * @return T|null The Annotation or NULL, if the requested annotation does not exist. - * - * @template T - */ - public function getMethodAnnotation(ReflectionMethod $method, $annotationName); - - /** - * Gets the annotations applied to a property. - * - * @param ReflectionProperty $property The ReflectionProperty of the property - * from which the annotations should be read. - * - * @return array An array of Annotations. - */ - public function getPropertyAnnotations(ReflectionProperty $property); - - /** - * Gets a property annotation. - * - * @param ReflectionProperty $property The ReflectionProperty to read the annotations from. - * @param class-string $annotationName The name of the annotation. - * - * @return T|null The Annotation or NULL, if the requested annotation does not exist. - * - * @template T - */ - public function getPropertyAnnotation(ReflectionProperty $property, $annotationName); -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php deleted file mode 100644 index 8a78c119..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php +++ /dev/null @@ -1,114 +0,0 @@ -parser = new DocParser(); - $this->parser->setIgnoreNotImportedAnnotations(true); - } - - /** - * Adds a namespace in which we will look for annotations. - * - * @param string $namespace - * - * @return void - */ - public function addNamespace($namespace) - { - $this->parser->addNamespace($namespace); - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotations(ReflectionClass $class) - { - return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotations(ReflectionMethod $method) - { - return $this->parser->parse( - $method->getDocComment(), - 'method ' . $method->getDeclaringClass()->name . '::' . $method->getName() . '()' - ); - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotations(ReflectionProperty $property) - { - return $this->parser->parse( - $property->getDocComment(), - 'property ' . $property->getDeclaringClass()->name . '::$' . $property->getName() - ); - } - - /** - * {@inheritDoc} - */ - public function getClassAnnotation(ReflectionClass $class, $annotationName) - { - foreach ($this->getClassAnnotations($class) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getMethodAnnotation(ReflectionMethod $method, $annotationName) - { - foreach ($this->getMethodAnnotations($method) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) - { - foreach ($this->getPropertyAnnotations($property) as $annot) { - if ($annot instanceof $annotationName) { - return $annot; - } - } - - return null; - } -} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php deleted file mode 100644 index 9605fb8d..00000000 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php +++ /dev/null @@ -1,208 +0,0 @@ - - */ - private $tokens; - - /** - * The number of tokens. - * - * @var int - */ - private $numTokens; - - /** - * The current array pointer. - * - * @var int - */ - private $pointer = 0; - - /** - * @param string $contents - */ - public function __construct($contents) - { - $this->tokens = token_get_all($contents); - - // The PHP parser sets internal compiler globals for certain things. Annoyingly, the last docblock comment it - // saw gets stored in doc_comment. When it comes to compile the next thing to be include()d this stored - // doc_comment becomes owned by the first thing the compiler sees in the file that it considers might have a - // docblock. If the first thing in the file is a class without a doc block this would cause calls to - // getDocBlock() on said class to return our long lost doc_comment. Argh. - // To workaround, cause the parser to parse an empty docblock. Sure getDocBlock() will return this, but at least - // it's harmless to us. - token_get_all("numTokens = count($this->tokens); - } - - /** - * Gets the next non whitespace and non comment token. - * - * @param bool $docCommentIsComment If TRUE then a doc comment is considered a comment and skipped. - * If FALSE then only whitespace and normal comments are skipped. - * - * @return mixed[]|string|null The token if exists, null otherwise. - */ - public function next($docCommentIsComment = true) - { - for ($i = $this->pointer; $i < $this->numTokens; $i++) { - $this->pointer++; - if ( - $this->tokens[$i][0] === T_WHITESPACE || - $this->tokens[$i][0] === T_COMMENT || - ($docCommentIsComment && $this->tokens[$i][0] === T_DOC_COMMENT) - ) { - continue; - } - - return $this->tokens[$i]; - } - - return null; - } - - /** - * Parses a single use statement. - * - * @return array A list with all found class names for a use statement. - */ - public function parseUseStatement() - { - $groupRoot = ''; - $class = ''; - $alias = ''; - $statements = []; - $explicitAlias = false; - while (($token = $this->next())) { - if (! $explicitAlias && $token[0] === T_STRING) { - $class .= $token[1]; - $alias = $token[1]; - } elseif ($explicitAlias && $token[0] === T_STRING) { - $alias = $token[1]; - } elseif ( - PHP_VERSION_ID >= 80000 && - ($token[0] === T_NAME_QUALIFIED || $token[0] === T_NAME_FULLY_QUALIFIED) - ) { - $class .= $token[1]; - - $classSplit = explode('\\', $token[1]); - $alias = $classSplit[count($classSplit) - 1]; - } elseif ($token[0] === T_NS_SEPARATOR) { - $class .= '\\'; - $alias = ''; - } elseif ($token[0] === T_AS) { - $explicitAlias = true; - $alias = ''; - } elseif ($token === ',') { - $statements[strtolower($alias)] = $groupRoot . $class; - $class = ''; - $alias = ''; - $explicitAlias = false; - } elseif ($token === ';') { - $statements[strtolower($alias)] = $groupRoot . $class; - break; - } elseif ($token === '{') { - $groupRoot = $class; - $class = ''; - } elseif ($token === '}') { - continue; - } else { - break; - } - } - - return $statements; - } - - /** - * Gets all use statements. - * - * @param string $namespaceName The namespace name of the reflected class. - * - * @return array A list with all found use statements. - */ - public function parseUseStatements($namespaceName) - { - $statements = []; - while (($token = $this->next())) { - if ($token[0] === T_USE) { - $statements = array_merge($statements, $this->parseUseStatement()); - continue; - } - - if ($token[0] !== T_NAMESPACE || $this->parseNamespace() !== $namespaceName) { - continue; - } - - // Get fresh array for new namespace. This is to prevent the parser to collect the use statements - // for a previous namespace with the same name. This is the case if a namespace is defined twice - // or if a namespace with the same name is commented out. - $statements = []; - } - - return $statements; - } - - /** - * Gets the namespace. - * - * @return string The found namespace. - */ - public function parseNamespace() - { - $name = ''; - while ( - ($token = $this->next()) && ($token[0] === T_STRING || $token[0] === T_NS_SEPARATOR || ( - PHP_VERSION_ID >= 80000 && - ($token[0] === T_NAME_QUALIFIED || $token[0] === T_NAME_FULLY_QUALIFIED) - )) - ) { - $name .= $token[1]; - } - - return $name; - } - - /** - * Gets the class name. - * - * @return string The found class name. - */ - public function parseClass() - { - // Namespaces and class names are tokenized the same: T_STRINGs - // separated by T_NS_SEPARATOR so we can use one function to provide - // both. - return $this->parseNamespace(); - } -} diff --git a/vendor/doctrine/lexer/LICENSE b/vendor/doctrine/lexer/LICENSE deleted file mode 100644 index e8fdec4a..00000000 --- a/vendor/doctrine/lexer/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2006-2018 Doctrine Project - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/doctrine/lexer/README.md b/vendor/doctrine/lexer/README.md deleted file mode 100644 index e1b419a6..00000000 --- a/vendor/doctrine/lexer/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Doctrine Lexer - -Build Status: [![Build Status](https://travis-ci.org/doctrine/lexer.svg?branch=master)](https://travis-ci.org/doctrine/lexer) - -Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers. - -This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL). - -https://www.doctrine-project.org/projects/lexer.html diff --git a/vendor/doctrine/lexer/composer.json b/vendor/doctrine/lexer/composer.json deleted file mode 100644 index 3432bae4..00000000 --- a/vendor/doctrine/lexer/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "doctrine/lexer", - "type": "library", - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "keywords": [ - "php", - "parser", - "lexer", - "annotations", - "docblock" - ], - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "license": "MIT", - "authors": [ - {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, - {"name": "Roman Borschel", "email": "roman@code-factory.org"}, - {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} - ], - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" - }, - "autoload": { - "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } - }, - "autoload-dev": { - "psr-4": { "Doctrine\\Tests\\": "tests/Doctrine" } - }, - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "config": { - "sort-packages": true - } -} diff --git a/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php b/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php deleted file mode 100644 index 385643a4..00000000 --- a/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php +++ /dev/null @@ -1,328 +0,0 @@ -input = $input; - $this->tokens = []; - - $this->reset(); - $this->scan($input); - } - - /** - * Resets the lexer. - * - * @return void - */ - public function reset() - { - $this->lookahead = null; - $this->token = null; - $this->peek = 0; - $this->position = 0; - } - - /** - * Resets the peek pointer to 0. - * - * @return void - */ - public function resetPeek() - { - $this->peek = 0; - } - - /** - * Resets the lexer position on the input to the given position. - * - * @param int $position Position to place the lexical scanner. - * - * @return void - */ - public function resetPosition($position = 0) - { - $this->position = $position; - } - - /** - * Retrieve the original lexer's input until a given position. - * - * @param int $position - * - * @return string - */ - public function getInputUntilPosition($position) - { - return substr($this->input, 0, $position); - } - - /** - * Checks whether a given token matches the current lookahead. - * - * @param int|string $token - * - * @return bool - */ - public function isNextToken($token) - { - return $this->lookahead !== null && $this->lookahead['type'] === $token; - } - - /** - * Checks whether any of the given tokens matches the current lookahead. - * - * @param array $tokens - * - * @return bool - */ - public function isNextTokenAny(array $tokens) - { - return $this->lookahead !== null && in_array($this->lookahead['type'], $tokens, true); - } - - /** - * Moves to the next token in the input string. - * - * @return bool - */ - public function moveNext() - { - $this->peek = 0; - $this->token = $this->lookahead; - $this->lookahead = isset($this->tokens[$this->position]) - ? $this->tokens[$this->position++] : null; - - return $this->lookahead !== null; - } - - /** - * Tells the lexer to skip input tokens until it sees a token with the given value. - * - * @param string $type The token type to skip until. - * - * @return void - */ - public function skipUntil($type) - { - while ($this->lookahead !== null && $this->lookahead['type'] !== $type) { - $this->moveNext(); - } - } - - /** - * Checks if given value is identical to the given token. - * - * @param mixed $value - * @param int|string $token - * - * @return bool - */ - public function isA($value, $token) - { - return $this->getType($value) === $token; - } - - /** - * Moves the lookahead token forward. - * - * @return array|null The next token or NULL if there are no more tokens ahead. - */ - public function peek() - { - if (isset($this->tokens[$this->position + $this->peek])) { - return $this->tokens[$this->position + $this->peek++]; - } - - return null; - } - - /** - * Peeks at the next token, returns it and immediately resets the peek. - * - * @return array|null The next token or NULL if there are no more tokens ahead. - */ - public function glimpse() - { - $peek = $this->peek(); - $this->peek = 0; - - return $peek; - } - - /** - * Scans the input string for tokens. - * - * @param string $input A query string. - * - * @return void - */ - protected function scan($input) - { - if (! isset($this->regex)) { - $this->regex = sprintf( - '/(%s)|%s/%s', - implode(')|(', $this->getCatchablePatterns()), - implode('|', $this->getNonCatchablePatterns()), - $this->getModifiers() - ); - } - - $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE; - $matches = preg_split($this->regex, $input, -1, $flags); - - if ($matches === false) { - // Work around https://bugs.php.net/78122 - $matches = [[$input, 0]]; - } - - foreach ($matches as $match) { - // Must remain before 'value' assignment since it can change content - $type = $this->getType($match[0]); - - $this->tokens[] = [ - 'value' => $match[0], - 'type' => $type, - 'position' => $match[1], - ]; - } - } - - /** - * Gets the literal for a given token. - * - * @param int|string $token - * - * @return int|string - */ - public function getLiteral($token) - { - $className = static::class; - $reflClass = new ReflectionClass($className); - $constants = $reflClass->getConstants(); - - foreach ($constants as $name => $value) { - if ($value === $token) { - return $className . '::' . $name; - } - } - - return $token; - } - - /** - * Regex modifiers - * - * @return string - */ - protected function getModifiers() - { - return 'iu'; - } - - /** - * Lexical catchable patterns. - * - * @return array - */ - abstract protected function getCatchablePatterns(); - - /** - * Lexical non-catchable patterns. - * - * @return array - */ - abstract protected function getNonCatchablePatterns(); - - /** - * Retrieve token type. Also processes the token value if necessary. - * - * @param string $value - * - * @return int|string|null - */ - abstract protected function getType(&$value); -} diff --git a/vendor/eaglewu/swoole-ide-helper/.gitignore b/vendor/eaglewu/swoole-ide-helper/.gitignore deleted file mode 100644 index c9388d82..00000000 --- a/vendor/eaglewu/swoole-ide-helper/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/.idea/ - -/vendor/ diff --git a/vendor/eaglewu/swoole-ide-helper/LICENSE.md b/vendor/eaglewu/swoole-ide-helper/LICENSE.md deleted file mode 100644 index 11d9261e..00000000 --- a/vendor/eaglewu/swoole-ide-helper/LICENSE.md +++ /dev/null @@ -1,69 +0,0 @@ -# The MIT License (MIT) - -Copyright (c) Eaglewu - -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - - -Copyright (c) - -996 License Version 1.0 (Draft) - -Permission is hereby granted to any individual or legal entity -obtaining a copy of this licensed work (including the source code, -documentation and/or related items, hereinafter collectively referred -to as the "licensed work"), free of charge, to deal with the licensed -work for any purpose, including without limitation, the rights to use, -reproduce, modify, prepare derivative works of, distribute, publish -and sublicense the licensed work, subject to the following conditions: - -1. The individual or the legal entity must conspicuously display, -without modification, this License and the notice on each redistributed -or derivative copy of the Licensed Work. - -2. The individual or the legal entity must strictly comply with all -applicable laws, regulations, rules and standards of the jurisdiction -relating to labor and employment where the individual is physically -located or where the individual was born or naturalized; or where the -legal entity is registered or is operating (whichever is stricter). In -case that the jurisdiction has no such laws, regulations, rules and -standards or its laws, regulations, rules and standards are -unenforceable, the individual or the legal entity are required to -comply with Core International Labor Standards. - -3. The individual or the legal entity shall not induce or force its -employee(s), whether full-time or part-time, or its independent -contractor(s), in any methods, to agree in oral or written form, to -directly or indirectly restrict, weaken or relinquish his or her -rights or remedies under such laws, regulations, rules and standards -relating to labor and employment as mentioned above, no matter whether -such written or oral agreement are enforceable under the laws of the -said jurisdiction, nor shall such individual or the legal entity -limit, in any methods, the rights of its employee(s) or independent -contractor(s) from reporting or complaining to the copyright holder or -relevant authorities monitoring the compliance of the license about -its violation(s) of the said license. - -THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION WITH THE -LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK. \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/README.md b/vendor/eaglewu/swoole-ide-helper/README.md deleted file mode 100644 index 1b07cb22..00000000 --- a/vendor/eaglewu/swoole-ide-helper/README.md +++ /dev/null @@ -1,43 +0,0 @@ -Swoole IDE Helper -==================== - -[![Software License][ico-license]](LICENSE.md) -[![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE) -[![Total Downloads][ico-downloads]][link-downloads] - -Auto completion, trigger suggest and view docs for [Swoole](https://github.com/swoole/swoole-src) in editor. - -The purpose of avoid the tips of undefined and improve work efficiency. - -## Usage -### Composer (recommended): - - composer require --dev "eaglewu/swoole-ide-helper:dev-master" - -### Text editor: - -Put the source code in your project. - -### IDE - -Put the source code path into `Include Path` in IDE. - -### Demo screenshots: - -![demo1](./imgs/img-01.png "demo1") - -![demo2](./imgs/img-02.png "demo2") - -![demo3](./imgs/img-03.png "demo3") - -![demo4](./imgs/img-04.png "demo4") - - -### Have fun :) - - - -[ico-downloads]: https://img.shields.io/packagist/dt/eaglewu/swoole-ide-helper.svg?style=flat-square -[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square - -[link-downloads]: https://packagist.org/packages/eaglewu/swoole-ide-helper diff --git a/vendor/eaglewu/swoole-ide-helper/composer.json b/vendor/eaglewu/swoole-ide-helper/composer.json deleted file mode 100644 index 590643b2..00000000 --- a/vendor/eaglewu/swoole-ide-helper/composer.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "eaglewu/swoole-ide-helper", - "description": "Swoole IDE Helper, to improve auto-completion", - "type": "library", - "license": "MIT", - "keywords": ["swoole", "autocomplete", "ide", "helper", "phpstorm", "netbeans", "sublime", "codeintel", "phpdoc"], - "authors": [ - { - "name": "eagle", - "email": "eaglewudi@gmail.com", - "role": "lead" - } - ], - "autoload-dev": { - "psr-4": { - "Swoole\\": "src" - } - } -} diff --git a/vendor/eaglewu/swoole-ide-helper/imgs/img-01.png b/vendor/eaglewu/swoole-ide-helper/imgs/img-01.png deleted file mode 100644 index 2d996e9b..00000000 Binary files a/vendor/eaglewu/swoole-ide-helper/imgs/img-01.png and /dev/null differ diff --git a/vendor/eaglewu/swoole-ide-helper/imgs/img-02.png b/vendor/eaglewu/swoole-ide-helper/imgs/img-02.png deleted file mode 100644 index 31ce0daa..00000000 Binary files a/vendor/eaglewu/swoole-ide-helper/imgs/img-02.png and /dev/null differ diff --git a/vendor/eaglewu/swoole-ide-helper/imgs/img-03.png b/vendor/eaglewu/swoole-ide-helper/imgs/img-03.png deleted file mode 100644 index b994f83f..00000000 Binary files a/vendor/eaglewu/swoole-ide-helper/imgs/img-03.png and /dev/null differ diff --git a/vendor/eaglewu/swoole-ide-helper/imgs/img-04.png b/vendor/eaglewu/swoole-ide-helper/imgs/img-04.png deleted file mode 100644 index a4fd3c14..00000000 Binary files a/vendor/eaglewu/swoole-ide-helper/imgs/img-04.png and /dev/null differ diff --git a/vendor/eaglewu/swoole-ide-helper/src/.phpstorm.meta.php b/vendor/eaglewu/swoole-ide-helper/src/.phpstorm.meta.php deleted file mode 100644 index e81f4a79..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/.phpstorm.meta.php +++ /dev/null @@ -1,34 +0,0 @@ - true, - * )); - * - * DNS随机 - * swoole_async_set(array( - * 'dns_lookup_random' => true, - * )); - * - * 指定DNS服务器 - * swoole_async_set(array( - * 'dns_server' => '114.114.114.114', - * )); - * - * @param string $domain - * @param mixed $callback - */ - public static function dnsLookup(string $domain, mixed $callback) - { - } - - /** - * 异步执行Shell命令。相当于shell_exec函数,执行后底层会fork一个子进程,并执行对应的command命令。 - * - * $command为执行的终端指令,如ls - * 执行成功后返回子进程的PID - * 命令执行完毕子进程退出后会回调指定的$callback函数,回调函数接收2个参数,第一个参数为命令执行后的屏幕输出内容$result,第二个参数为进程退出的状态信息$status - * - * 注意事项 - * fork创建子进程的操作代价是非常昂贵的,系统无法支撑过大的并发量 - * 使用exec时,请勿使用pcntl_signal或swoole_process::signal注册SIGCHLD函数,执行wait操作,否则在命令回调函数中,状态信息$status将为false - * 此函数在1.9.22或更高版本可用 - * - * 使用实例 - * $pid = Swoole\Async::exec("ps aux", function ($result, $status) { - * var_dump(strlen($result), $status); - * }); - * var_dump($pid); - * - * @param string $command - * @param callable $callback - */ - public static function exec(string $command, callable $callback) - { - } -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Atomic.php b/vendor/eaglewu/swoole-ide-helper/src/Atomic.php deleted file mode 100644 index 61fd7824..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Atomic.php +++ /dev/null @@ -1,68 +0,0 @@ -start前创建才能在Worker进程中使用 - */ -class Atomic -{ - /** - * @param int $init_value - */ - public function __construct($init_value) - { - } - - /** - * 增加计数 - * - * @param $add_value - * @return int - */ - public function add($add_value) - { - } - - /** - * 减少计数 - * - * @param $sub_value - * @return int - */ - public function sub($sub_value) - { - } - - /** - * 获取当前计数的值 - * @return int - */ - public function get() - { - } - - /** - * 将当前值设置为指定的数字 - * - * @param $value - */ - public function set($value) - { - } - - /** - * 如果当前数值等于参数1,则将当前数值设置为参数2 - * - * @param int $cmp_value - * @param int $set_value - */ - public function cmpset($cmp_value, $set_value) - { - } -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Buffer.php b/vendor/eaglewu/swoole-ide-helper/src/Buffer.php deleted file mode 100644 index 088e4719..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Buffer.php +++ /dev/null @@ -1,100 +0,0 @@ - 10, - * "queue_bytes" => 161, - * ); - * - * @return array - */ - public function stats(): array - { - - } - - /** - * 关闭通道。并唤醒所有等待读写的协程。 - * - * 唤醒所有生产者协程,push方法返回false - * 唤醒所有消费者协程,pop方法返回false - */ - public function close() - { - - } - - /** - * 通道读写检测。类似于socket_select和stream_select可以检测channel是否可进行读写。 - * - * 当$read或$write数组中有部分channel对象处于可读或可写状态,select会立即返回,不会产生协程调度。当数组中没有任何channel可读或可写时,将挂起当前协程,并设置定时器。当其中一个通道可读或可写时,将重新唤醒当前协程。 - * - * select操作只检测channel列表的可读或可写状态,但并不会读写channel,在select调用返回后,可遍历$read和$write数组,执行pop和push方法,完成通道读写操作。 - * - * 参数 - * $read 数组引用类型,元素为channel对象,读操作检测,可以为null - * $write 数组引用类型,元素为channel对象,写操作检测,可以为null - * $timeout 浮点型,超时设置,单位为秒,最小粒度为0.001秒,即1ms。默认为0,表示永不超时。 - * - * 返回值 - * 成功返回true,底层会修改$read、$write数组,$read和$write中的元素,即是可读或可写的channel - * 超时或传入的参数错误,如$read和$write中有非channel对象,底层返回false - * - * @param array $read - * @param array $write - * @param float $timeout - * - * @return bool - */ - public static function select(array &$read, array &$write, float $timeout = 0): bool - { - - } - -} - diff --git a/vendor/eaglewu/swoole-ide-helper/src/Client.php b/vendor/eaglewu/swoole-ide-helper/src/Client.php deleted file mode 100644 index 2a19d49a..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Client.php +++ /dev/null @@ -1,176 +0,0 @@ - - * Date: 2016/02/17 - */ -class Client -{ - - /** - * 函数执行错误会设置该变量 - * - * @var - */ - public $errCode; - - /** - * socket的文件描述符 - * - * PHP代码中可以使用: - * $sock = fopen("php://fd/".$swoole_client->sock); - * - * 将swoole_client的socket转换成一个stream socket。可以调用fread/fwrite/fclose等函数进程操作。 - * swoole_server中的$fd不能用此方法转换,因为$fd只是一个数字,$fd文件描述符属于主进程 - * $swoole_client->sock可以转换成int作为数组的key. - * - * @var int - */ - public $sock; - - /** - * swoole_client构造函数 - * - * @param int $sock_type 指定socket的类型,支持TCP/UDP、TCP6/UDP64种 - * @param int $sync_type SWOOLE_SOCK_SYNC/SWOOLE_SOCK_ASYNC 同步/异步 - * @param string $connectionKey 链接的编号,用于长连接复用 - */ - public function __construct($sock_type, $sync_type = SWOOLE_SOCK_SYNC, $connectionKey = '') - { - } - - /** - * 连接到远程服务器 - * - * @param string $host 是远程服务器的地址 v1.6.10+ 支持填写域名 Swoole会自动进行DNS查询 - * @param int $port 是远程服务器端口 - * @param float $timeout 是网络IO的超时,单位是s,支持浮点数。默认为0.1s,即100ms - * @param int $flag 参数在UDP类型时表示是否启用udp_connect。设定此选项后将绑定$host与$port,此UDP将会丢弃非指定host/port的数据包。 - * 在send/recv前必须使用swoole_client_select来检测是否完成了连接 - * @return bool - */ - public function connect($host, $port, $timeout = 0.1, $flag = 0) - { - } - - /** - * 向远程服务器发送数据 - * - * 参数为字符串,支持二进制数据。 - * 成功发送返回的已发数据长度 - * 失败返回false,并设置$swoole_client->errCode - * - * @param string $data - * @return bool - */ - public function send($data) - { - } - - /** - * 向任意IP:PORT的服务器发送数据包,仅支持UDP/UDP6的client - * @param $ip - * @param $port - * @param $data - * @return bool - */ - function sendto($ip, $port, $data) - { - - } - - /** - * 从服务器端接收数据 - * - * 如果设定了$waitall就必须设定准确的$size,否则会一直等待,直到接收的数据长度达到$size - * 如果设置了错误的$size,会导致recv超时,返回 false - * 调用成功返回结果字符串,失败返回 false,并设置$swoole_client->errCode属性 - * - * @param int $size 接收数据的最大长度 - * @param bool $waitall 是否等待所有数据到达后返回 - * @return string - */ - public function recv($size = 65535, $waitall = false) - { - } - - /** - * 关闭远程连接 - * - * swoole_client对象在析构时会自动close - * - * @return bool - */ - public function close() - { - } - - /** - * 注册异步事件回调函数 - * - * @param $event_name - * @param callable $callback_function - * @return bool - */ - public function on($event_name, $callback_function) - { - } - - /** - * 判断是否连接到服务器 - * @return bool - */ - public function isConnected() - { - } - - /** - * 获取客户端socket的host:port信息 - * @return bool | array - */ - public function getsockname() - { - } - - /** - * 获取远端socket的host:port信息,仅用于UDP/UDP6协议 - * UDP发送数据到服务器后,可能会由其他的Server进行回复 - * @return bool | array - */ - public function getpeername() - { - } - - /** - * 设置客户端参数 - * @param array $setting - */ - public function set(array $setting) - { - } - - /** - * 睡眠,停止接收数据 - */ - public function sleep() - { - } - - /** - * 唤醒,开始接收数据 - */ - public function wakeup() - { - } - - /** - * @param $file string file with path - * @return bool|mixed false if file not exist - */ - public function sendfile($file) - { - } -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Connection/Iterator.php b/vendor/eaglewu/swoole-ide-helper/src/Connection/Iterator.php deleted file mode 100644 index 5f4463cd..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Connection/Iterator.php +++ /dev/null @@ -1,141 +0,0 @@ - - * An offset to check for. - *

- * @return boolean true on success or false on failure. - *

- *

- * The return value will be casted to boolean if non-boolean was returned. - * @since 5.0.0 - */ - public function offsetExists($offset) - { - // TODO: Implement offsetExists() method. - } - - /** - * Offset to retrieve - * @link http://php.net/manual/en/arrayaccess.offsetget.php - * @param mixed $offset

- * The offset to retrieve. - *

- * @return mixed Can return all value types. - * @since 5.0.0 - */ - public function offsetGet($offset) - { - // TODO: Implement offsetGet() method. - } - - /** - * Offset to set - * @link http://php.net/manual/en/arrayaccess.offsetset.php - * @param mixed $offset

- * The offset to assign the value to. - *

- * @param mixed $value

- * The value to set. - *

- * @return void - * @since 5.0.0 - */ - public function offsetSet($offset, $value) - { - // TODO: Implement offsetSet() method. - } - - /** - * Offset to unset - * @link http://php.net/manual/en/arrayaccess.offsetunset.php - * @param mixed $offset

- * The offset to unset. - *

- * @return void - * @since 5.0.0 - */ - public function offsetUnset($offset) - { - // TODO: Implement offsetUnset() method. - } - - /** - * Count elements of an object - * @link http://php.net/manual/en/countable.count.php - * @return int The custom count as an integer. - *

- *

- * The return value is cast to an integer. - * @since 5.1.0 - */ - public function count() - { - // TODO: Implement count() method. - } -} - -# end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Constants.php b/vendor/eaglewu/swoole-ide-helper/src/Constants.php deleted file mode 100644 index 69297e67..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Constants.php +++ /dev/null @@ -1,151 +0,0 @@ - - * Datetime: 09/11/2017 - */ - -namespace Swoole; - -class Coroutine -{ - /** - * max_coroutine - * 设置最大协程数,超过限制后底层将无法创建新的协程。 - * - * stack_size - * 设置单个协程初始栈的内存尺寸,默认为8192 - * - * @param array $options - */ - public static function set(array $options) - { - - } - - /** - * 创建一个新的协程,并立即执行 - * - * @param callable $function 协程执行的代码 - * @return bool - */ - public static function create(callable $function) - { - return true; - } - - /** - * 恢复某个协程,使其继续运行 - * 当前协程处于挂起状态时,另外的协程中可以使用resume再次唤醒当前协程 - * @link https://wiki.swoole.com/wiki/page/772.html - * @param string $coroutineId 为要恢复的协程ID,在协程内可以使用getuid获取到协程的ID - */ - public static function resume($coroutineId) - { - - } - - /** - * 挂起当前协程 - * @link https://wiki.swoole.com/wiki/page/773.html - */ - public static function suspend() - { - - } - - /** - * 获取当前协程的唯一id 返回值: * 成功时返回当前协程ID(int) * 如果当前不在协程环境中,则返回-1 - * - * @return integer - */ - public static function getuid() - { - return 1; - } - - /** - * 协程版反射调用函数 - * - * @param callable $callback - * @param array $param_arr - * @return mixed - */ - public static function call_user_func_array(callable $callback, array $param_arr) - { - - } - - /** - * 协程版反射调用函数 - * - * @param callable $callback - * @param null $parameter [optional] - * @param null $_ [optional] - * @return mixed - */ - public static function call_user_func(callable $callback, $parameter = null, $_ = null) - { - - } - - /** - * 根据主机名获取IP地址 - * - * @param string $domain - * @param int $family - * - * @return string - */ - public static function getHostByName($domain, $family = AF_INET): string - { - } - - /** - * 读文件,从fopen打开的句柄中 - * - * @param int $fp - * - * @return string - */ - public static function fread(int $fp): string - { - } - - /** - * 获取协程状态 - * 需要4.0.1或更高版本 - * - * @return array - */ - public static function stats(): array - { - } - - /** - * 协程方式向文件写入数据。 - * - * $handle文件句柄,必须是fopen打开的文件类型stream资源 - * $data要写入的数据内容,可以是文本或二进制数据 - * $length写入的长度,默认为0,表示写入$data的全部内容,$length必须小于$data的长度 - * @param resource $handle - * @param string $data - * @param int $length - * - * @return int 写入成功返回数据长度,失败返回false - */ - public static function fwrite($handle, $data, $length = 0): int - { - } - - /** - * 进入等待状态。相当于PHP的sleep函数, - * 不同的是Coroutine::sleep是协程调度器实现的, - * 底层会yield当前协程,让出时间片,并添加一个异步定时器, - * 当超时时间到达时重新resume当前协程,恢复运行。 - * 使用sleep接口可以方便地实现超时等待功能。 - * - * @param float $seconds 必须大于0,最大不得超过一天时间(86400秒) - */ - public static function sleep(float $seconds): void - { - } - - /** - * 协程方式读取文件。 - * - * 需要2.1.2或更高版本 - * - * 参数 - * $filename文件名 - * 返回值 - * 读取成功返回字符串内容,读取失败返回false - * readFile方法没有尺寸限制,读取的内容会存放在内存中,因此读取超大文件时可能会占用过多内存 - * - * @param string $filename - * - * @return string|bool - */ - public static function readFile(string $filename): string - { - } - - /** - * 协程方式写入文件。 - * - * 需要2.1.2或更高版本 - * - * 参数 - * $filename为文件的名称,必须有可写权限,文件不存在会自动创建。打开文件失败会立即返回false - * $fileContent为要写入到文件的内容,最大可写入4M - * $flags为写入的选项,可以使用FILE_APPEND表示追加到文件末尾,默认会清空当前文件内容 - * - * 返回值 - * 写入成功返回true,写入失败返回false - * - * @param string $filename - * @param string $fileContent - * @param int $flags - * @return bool - */ - public static function writeFile(string $filename, string $fileContent, int $flags): bool - { - - } - - /** - * 执行一条shell指令。底层自动进行协程调度。 - * - * 参数 - * $cmd 要执行的shell指令 - * - * 返回值 - * 执行失败返回false,执行成功返回数组,包含了进程退出的状态码、信号、输出内容。 - * - * array( - * 'code' => 0, - * 'signal' => 0, - * 'output' => '', - * ); - * 使用实例 - * go(function() { - * $ret = Co::exec("md5sum ".__FILE__); - * }); - * - * @param string $cmd - * @return array|bool - */ - public static function exec(string $cmd): array - { - - } - - /** - * - * 进行DNS解析,查询域名对应的IP地址,与gethostbyname不同,getaddrinfo支持更多参数设置,而且会返回多个IP结果。 - * - * $domain 域名,如www.baidu.com - * $family 默认为AF_INET表示返回IPv4地址,使用AF_INET6时返回IPv6地址 - * 其他参数设置请参考man getaddrinfo 文档 - * 成功返回多个IP地址组成的数组,失败返回false - * - * @param string $domain - * @param int $family - * @param int $socktype - * @param int $protocol - * @param string|null $service - * @return array|bool - */ - public static function getAddrInfo( - $domain, - $family = AF_INET, - $socktype = SOCK_STREAM, - $protocol = STREAM_IPPROTO_TCP, - $service = null - ) { - - } - -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Channel.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Channel.php deleted file mode 100644 index c01c2fc8..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Channel.php +++ /dev/null @@ -1,136 +0,0 @@ - - * Datetime: 20/07/2017 - */ - -namespace Swoole\Coroutine; - - -class Client -{ - const MSG_OOB = 1; - const MSG_PEEK = 2; - const MSG_DONTWAIT = 128; - const MSG_WAITALL = 64; - - public $errCode; - public $sock; - public $type; - public $setting; - public $connected; - - /** - * @param $type - * @return mixed - */ - public function __construct($type){} - - /** - * 连接到远程服务器 - * connect操作会有一次协程切换开销,connect发起时yield,完成时resume - * @link https://wiki.swoole.com/wiki/page/588.html - * - * @param string $host 远程服务器的地址 - * @param int $port 远程服务器端口 - * @param float $timeout 是网络IO的超时,包括connect/send/recv,单位是s,支持浮点数。默认为0.1s,即100ms,超时发生时,连接会被自动close掉 - * @return bool - */ - public function connect($host, $port, $timeout = 0.1) - { - return true; - } - - /** - * 发送数据 - * @link https://wiki.swoole.com/wiki/page/660.html - * - * @param string $data 发送的数据,必须为字符串类型,支持二进制数据 - * @return bool - */ - public function send($data) - { - return true; - } - - /** - * 从服务器端接收数据 - * - * 底层会自动yield,等待数据接收完成后自动切换到当前协程。 - * @link https://wiki.swoole.com/wiki/page/661.html - * - * @return string - */ - public function recv($timeout = -1) - { - return ; - } - - /** - * 向任意IP:PORT的服务器发送数据包,仅支持UDP/UDP6的client - * @param $ip - * @param $port - * @param $data - * @return bool - */ - function sendto($ip, $port, $data) - { - - } - - /** - * 判断是否连接到服务器 - * @return bool - */ - public function isConnected() - { - } - - /** - * 获取客户端socket的host:port信息 - * @return bool | array - */ - public function getsockname() - { - } - - /** - * 获取远端socket的host:port信息,仅用于UDP/UDP6协议 - * UDP发送数据到服务器后,可能会由其他的Server进行回复 - * @return bool | array - */ - public function getpeername() - { - } - - /** - * 设置客户端参数 - * @param array $setting - */ - public function set(array $setting) - { - } - - /** - * @param $file string file with path - * @return bool|mixed false if file not exist - */ - public function sendfile($file) - { - } - - /** - * 关闭连接 - * 不存在阻塞,会立即返回 - * @link https://wiki.swoole.com/wiki/page/662.html - * - * @return bool 执行成功返回true,失败返回false - */ - public function close() - { - return true; - } - -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http/Client.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http/Client.php deleted file mode 100644 index cb1f93e8..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http/Client.php +++ /dev/null @@ -1,184 +0,0 @@ - - * Datetime: 20/07/2017 - */ - -namespace Swoole\Coroutine\Http; - - -class Client extends \Swoole\Http\Client -{ - - public function __construct($host, $port, $ssl = false) - { - return $this; - } - - /** - * 发起 GET 请求 - * - * @link https://wiki.swoole.com/wiki/page/582.html - * - * @param string $path 设置URL路径,如/index.html,注意这里不能传入http://domain - */ - public function get($path) - { - - } - - /** - * 发起 POST 请求 - * - * @link https://wiki.swoole.com/wiki/page/583.html - * - * @param string $path 设置URL路径,如/index.html,注意这里不能传入http://domain - * @param mixed $data 请求的包体数据,如果 $data 为数组底层自动会打包为 x-www-form-urlencoded 格式的 POST 内容, - * 并设置 Content-Type 为 application/x-www-form-urlencoded - */ - public function post($path, $data) - { - - } - - /** - * 升级为WebSocket连接。 - * - * 失败返回false,成功返回true - * 升级成功后可以使用push方法向服务器端推送消息,也可以调用recv接收消息 - * upgrade会产生一次协程调度 - * - * @param string $path - * - * @return bool - */ - public function upgrade($path): bool - { - - } - - /** - * 向WebSocket服务器推送消息。 - * - * push方法必须在upgrade成功之后才能执行 - * push方法不会产生协程调度,写入发送缓存区后会立即返回 - * - * 参数 - * $data 要发送的数据内容,默认为UTF-8文本格式,如果为其他格式编码或二进制数据,请使用WEBSOCKET_OPCODE_BINARY - * $opcode操作类型,默认为WEBSOCKET_OPCODE_TEXT表示发送文本 - * $opcode必须为合法的WebSocket OPCODE,否则会返回失败,并打印错误信息opcode max 10 - * - * 返回值 - * 发送成功,返回true - * 连接不存在、已关闭、未完成WebSocket,发送失败返回false - * - * 错误码 - * 8502:错误的OPCODE - * 8503:未连接到服务器或连接已被关闭 - * 8504:握手失败 - * - * @param string $data - * @param int $opcode - * @param bool $finish - * - * @return bool - */ - public function push(string $data, int $opcode = WEBSOCKET_OPCODE_TEXT, bool $finish = true): bool - { - - } - - /** - * 延迟收包 - * - * @param bool $bool - */ - public function setDefer(bool $bool = true) - { - - } - - /** - * 更底层的Http请求方法,需要代码中调用setMethod和setData等接口设置请求的方法和数据。 - * - * @param string $path - */ - public function execute(string $path) - { - - } - - /** - * 通过Http下载文件。download仅使用小量内存,就可以完成超大文件的下载。 - * - * 参数: - * $path 下载的链接,URL路径 - * $filename 指定下载内容写入的文件路径,会自动写入到downloadFile属性 - * $offset 指定写入文件的偏移量,此选项可用于支持断点续传,可配合Http头Range:bytes=$offset-实现 - * $offset为0时若文件已存在,底层会自动清空此文件 - * - * 返回值 - * 执行成功返回true - * 打开文件失败或feek失败返回false - * - * @param string $path - * @param string $filename - * @param int $offset - * - * @return bool - */ - public function download(string $path, string $filename, int $offset = 0) - { - - } - - /** - * 添加POST文件 (注意,此方法参数3,4位置与async-http-client不同 - * - * $path 文件的路径,必选参数,不能为空文件或者不存在的文件 - * $name 表单的名称,必选参数,FILES参数中的key - * $mimeType 文件的MIME格式,可选参数,底层会根据文件的扩展名自动推断 - * $filename 文件名称,可选参数,默认为basename($path) - * $offset 上传文件的偏移量,可以指定从文件的中间部分开始传输数据。此特性可用于支持断点续传。 - * $length 发送数据的尺寸,默认为整个文件的尺寸 - * 使用addFile会自动将POST的Content-Type将变更为form-data。addFile底层基于sendfile,可支持异步发送超大文件。 - * - * addFile在1.8.9或更高版本可用 - * $offset, $length 参数在1.9.11或更高版本可用 - * - * @param $file - */ - public function addFile( - string $path, - string $name, - string $mimeType = null, - string $filename = null, - int $offset = 0, - int $length = -1 - ) { - - } - - /** - * 接收消息。与setDefer或upgrade配合使用。 - * - * $timeout 设置超时,优先使用指定的参数,其次使用set方法中传入的timeout配置 - * 未设置任何超时,将持续等待 - * - * @return string|bool|\Swoole\WebSocket\Frame - */ - public function recv(float $timeout = -1) - { - - } - - /** - * @return bool - */ - public function close() - { - return true; - } - -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http2/Client.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http2/Client.php deleted file mode 100644 index 223efc54..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http2/Client.php +++ /dev/null @@ -1,114 +0,0 @@ - - * Date: 2018/4/5 下午9:06 - */ - -namespace Swoole\Coroutine\Http2; - -/** - * Class Client - * @package Swoole\Coroutine\Http2 - * - * 实例 - * use Swoole\Coroutine as co; - * co::create(function () - * { - * $cli = new co\Http2\Client('127.0.0.1', 9518); - * $cli->set([ 'timeout' => 1]); - * $cli->connect(); - * - * $req = new co\Http2\Request; - * $req->path = "/index.html"; - * $req->headers = [ - * 'host' => "localhost", - * "user-agent" => 'Chrome/49.0.2587.3', - * 'accept' => 'text/html,application/xhtml+xml,application/xml', - * 'accept-encoding' => 'gzip', - * ]; - * $req->cookies = ['name' => 'rango', 'email' => '1234@qq.com']; - * var_dump($cli->send($req)); - * $resp = $cli->recv(); - * var_dump($resp); - * }); - */ -class Client -{ - - /** - * $host 目标主机的IP地址,$host如果为域名底层需要进行一次DNS查询 - * $port 目标端口,Http一般为80端口,Https一般为443端口 - * $ssl 是否开启TLS/SSL隧道加密,https网站必须设置为true - * 默认超时时间为500ms,如果你需要请求外网URL请修改timeout为更大的数值 - * $ssl需要依赖openssl,必须在编译swoole时启用--enable-openssl - * - * @param string $host - * @param int $port - * @param bool $ssl - */ - public function __construct(string $host, int $port, bool $ssl = false) { } - - /** - * 设置客户端参数 - * - * @link https://wiki.swoole.com/wiki/page/p-client_setting.html - * @param array $options - */ - public function set(array $options) { } - - /** - * 连接到目标服务器。此方法没有任何参数。 - * 发起connect后,底层会自动进行协程调度,当连接成功或失败时connect会返回。 - * 连接建立后可以调用send方法向服务器发送请求。 - * - * 连接成功,返回true - * 连接失败,返回false,请检查errCode属性获取错误码 - * - * @return bool - */ - public function connect(): bool { } - - /** - * 向服务器发送请求,底层会自动建立一个Http2的stream。可以同时发起多个请求。 - * - * 接受Swoole\Coroutine\Http2\Request类的对象作为参数 - * 成功返回流的编号,编号为从1开始自增的奇数 - * 失败返回false - * - * @param Request $request - * @return int|false - */ - public function send(\Swoole\Coroutine\Http2\Request $request) { } - - /** - * 向服务器发送更多数据帧,可以多次调用write向同一个stream写入数据帧。 - * - * $streamId 流编号,由send方法返回 - * $data数据帧的内容,可以为字符串或数组 - * $end 是否关闭流 - * - * 注意事项 - * 如果要使用write分段发送数据帧,必须在send请求时将$request->pipeline设置为true - * 当发送end为true的数据帧之后,流将关闭。之后不能再调用write向此stream发送数据 - * - * @param int $streamId - * @param mixed $data - * @param bool $end - */ - public function write(int $streamId, mixed $data, bool $end = false) { } - - /** - * 接受请求,调用此方法时会yield让出协程控制权,服务器返回响应内容后resume当前协程。 - * - * 成功后返回 Http2\Response 对象。 - * - * @return Response - */ - public function recv(): \Swoole\Http2\Response { } - - /** - * 关闭连接 - */ - public function close() { } -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http2/Request.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http2/Request.php deleted file mode 100644 index 7bfcafc1..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Http2/Request.php +++ /dev/null @@ -1,36 +0,0 @@ - - * Date: 2018/4/5 下午9:13 - */ - -namespace Swoole\Coroutine\Http; - -class Request -{ - /** - * Swoole\Coroutine\Http2\Request对象没有任何方法,通过设置对象属性来写入请求相关的信息。 - * - * headers 数组,HTTP头 - * method 字符串,设置请求方法,如GET、POST - * path 字符串,设置URL路径,如/index.php?a=1&b=2,必须以/作为开始 - * cookies 数组,设置COOKIES - * data 设置请求的body,如果为字符串时将直接作为RAW form-data进行发送 - * data 为数组时,底层自动会打包为x-www-form-urlencoded格式的POST内容,并设置Content-Type为application/x-www-form-urlencoded - * pipeline 布尔型,如果设置为true,发送完$request后,不关闭stream,可以继续写入数据内容 - * - * PIPELINE - * 默认send方法在发送请求之后,会结束当前的Http2 Stream,启用PIPELINE后,底层会保持stream流,可以多次调用write方法,向服务器发送数据帧,请参考write方法。 - */ - - public $method = 'GET'; - public $header = []; - public $path = ''; - public $cookies = []; - /**@var string|array */ - public $data = ''; - public $pipeline = false; - public $files = null; - -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/MySQL.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/MySQL.php deleted file mode 100644 index 27bf3176..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/MySQL.php +++ /dev/null @@ -1,162 +0,0 @@ - - * Datetime: 20/07/2017 - */ - -namespace Swoole\Coroutine; - -use Swoole\Coroutine\Mysql\Statement; - -/** - * Class Mysql - * 需要在编译swoole时增加--enable-coroutine来开启此功能 - * @link https://wiki.swoole.com/wiki/page/p-coroutine_mysql.html - * - * @package Swoole\Coroutine - */ -class MySQL -{ - - /** @var array 连接信息,保存的是传递给构造函数的数组 */ - public $serverInfo; - - /** @var integer 连接使用的文件描述符 */ - public $sock; - - /** @var bool 是否连接上了MySQL服务器 */ - public $connected; - - /** @var string 发生在sock上的连接错误信息 */ - public $connect_error; - /** @var integer 发生在sock上的连接错误码 */ - public $connect_errno; - - /** @var string MySQL服务器返回的错误信息 */ - public $error; - /** @var integer MySQL服务器返回的错误代码 */ - public $errno; - - /** @var integer 影响的行数 */ - public $affected_rows; - - /** @var integer 最后一个插入的记录id */ - public $insert_id; - - /** - * 建立 MySQL 连接 - * - * @link https://wiki.swoole.com/wiki/page/595.html - * - * @param array $serverInfo [ - * 'host' => 'MySQL IP地址', - * 'user' => '数据用户', - * 'password' => '数据库密码', - * 'database' => '数据库名', - * 'port' => 'MySQL端口 默认3306 可选参数', - * 'timeout' => '建立连接超时时间', - * 'charset' => '字符集' - * ] - * - * @return bool - */ - public function connect(array $serverInfo) - { - return true; - } - - /** - * 执行SQL语句 - * - * @link https://wiki.swoole.com/wiki/page/596.html - * - * @param string $sql - * @param double $timeout 超时时间,超时的话会断开MySQL连接,0表示不设置超时时间。 - * - * @return array|bool 超时/出错返回 false,否则以数组形式返回查询结果 - */ - public function query($sql, $timeout = 0.0) - { - - } - - /** - * use mysqlnd to escape the string - * use --enable-mysqlnd when compile - * - * @param string $str - * - * @return string - */ - public function escape($str) - { - - } - - /** - * start a new transaction - * one link only one transaction, if already exist, then exception - * function callback(\Swoole\Mysql $link, mixed $result) {} - * - */ - public function begin() - { - - } - - /** - * commit transaction - * if not exist, then exception - * function callback(\Swoole\Mysql $link, mixed $result) {} - * - */ - public function commit() - { - - } - - /** - * rollback transaction - * if not exist, then exception - * function callback(\Swoole\Mysql $link, mixed $result) {} - * - */ - public function rollback() - { - - } - - /** - * close the connection - */ - public function close() - { - - } - - /** - * 延迟收包 - * - * @param bool $bool - */ - public function setDefer($bool = true) - { - - } - - /** - * 向MySQL服务器发送SQL预处理请求。 - * prepare必须与execute配合使用。 - * 预处理请求成功后,调用execute方法向MySQL服务器发送数据参数。 - * - * @param string $sql - * - * @return Statement - */ - public function prepare($sql) - { - - } - -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Mysql/Statement.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Mysql/Statement.php deleted file mode 100644 index f01d21de..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Mysql/Statement.php +++ /dev/null @@ -1,46 +0,0 @@ - - * Date: 2018/3/10 下午5:27 - */ - -namespace Swoole\Coroutine\Mysql; - -Class Statement -{ - - /** @var string MySQL服务器返回的错误信息 */ - public $error; - /** @var integer MySQL服务器返回的错误代码 */ - public $errno; - - /** @var integer 影响的行数 */ - public $affected_rows; - - /** @var integer 最后一个插入的记录id */ - public $insert_id; - - /** - * 向MySQL服务器发送SQL预处理数据参数。 - * execute必须与prepare配合使用,调用execute之前必须先调用prepare发起预处理请求。 - * execute方法可以重复调用。 - * - * $params 预处理数据参数,必须与prepare语句的参数个数相同。 - * $params必须为数字索引的数组,参数的顺序与prepare语句相同 - * - * @param array $params - * - * @param float $timeout 执行超时时间 - * - * 成功返回数据集数组 - * 失败返回false,可检查$db->error和$db->errno判断错误原因 - * - * @return bool|array - */ - function execute(array $params = [], float $timeout = -1) - { - return []; - } - -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/PostgreSQL.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/PostgreSQL.php deleted file mode 100644 index 5361abfb..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/PostgreSQL.php +++ /dev/null @@ -1,138 +0,0 @@ - - * Datetime: 2018/10/10 10:49 - */ - -namespace Swoole\Coroutine; - - -class PostgreSQL -{ - - /** - * 建立postgresql 非阻塞的协程连接 - * - * @link https://wiki.swoole.com/wiki/page/884.html - * @param string $connection_string - * @return resource - */ - public function connect(string $connection_string) - { - - } - - /** - * 发送异步非阻塞 协程命令 - * - * @param resource $connection - * @return $this - */ - public function query($connection) - { - - } - - /** - * 提取结果中所有行作为一个数组 - * - * @link https://wiki.swoole.com/wiki/page/886.html - * @param resource $query - * @return array - */ - public function fetchAll($query) - { - - } - - /** - * 返回受影响的记录数目 - * - * @link https://wiki.swoole.com/wiki/page/887.html - * @param resource $queryResult - * @return int - */ - public function affectedRows($queryResult) - { - - } - - /** - * 返回行的数目 - * - * @link https://wiki.swoole.com/wiki/page/888.html - * @param resource $queryResult - * @return int - */ - public function numRows($queryResult) - { - - } - - /** - * 提取一行作为对象 - * - * @link https://wiki.swoole.com/wiki/page/889.html - * @param resource $queryResult - * @param int $row - * @return object - */ - public function fetchObject($queryResult, $row = 0) - { - - } - - /** - * 提取一行作为关联数组 - * - * @link https://wiki.swoole.com/wiki/page/890.html - * @param resource $queryResult - * @param int $row - * @return array - */ - public function fetchAssoc($queryResult, $row = 0) - { - - } - - /** - * 提取一行作为数组 - * - * @link https://wiki.swoole.com/wiki/page/891.html - * @param resource $queryResult - * @param int $row - * @return array - */ - public function fetchArray($queryResult, $row = 0) - { - - } - - /** - * 根据指定的 result 资源提取一行数据(记录)作为数组返回 - * - * @link https://wiki.swoole.com/wiki/page/892.html - * @param resource $queryResult - * @param int $row - * @return array - */ - public function fetchRow($queryResult, $row = 0) - { - - } - - /** - * 查看表的元数据 异步非阻塞协程版 - * - * @link https://wiki.swoole.com/wiki/page/893.html - * @param string $tableName - * @return array - */ - public function metaData($tableName) - { - - } - -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Redis.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Redis.php deleted file mode 100644 index 93be5dd4..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Redis.php +++ /dev/null @@ -1,26 +0,0 @@ - - * Datetime: 20/07/2017 - */ - -namespace Swoole\Coroutine; - -// 用于multi($mode)方法,默认为SWOOLE_REDIS_MODE_MULTI模式: -define('SWOOLE_REDIS_MODE_MULTI', 1); -define('SWOOLE_REDIS_MODE_PIPELINE', 1); - -// 用于判断 type() 命令的返回值 -define('SWOOLE_REDIS_TYPE_NOT_FOUND', 1); -define('SWOOLE_REDIS_TYPE_STRING', 1); -define('SWOOLE_REDIS_TYPE_SET', 1); -define('SWOOLE_REDIS_TYPE_LIST', 1); -define('SWOOLE_REDIS_TYPE_ZSET', 1); -define('SWOOLE_REDIS_TYPE_HASH', 1); - -class Redis extends \Redis -{ - public $errCode; - public $errMsg; -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Server.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Server.php deleted file mode 100644 index 10a4e65e..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Server.php +++ /dev/null @@ -1,62 +0,0 @@ - - * Datetime: 20/07/2017 - */ - -namespace Swoole\Coroutine; - - -class Server -{ - /** - * @link https://wiki.swoole.com/wiki/page/606.html - * @return bool - */ - public function getDefer() - { - return true; - } - - - /** - * @link https://wiki.swoole.com/wiki/page/607.html - * @param bool $is_defer - */ - public function setDefer($is_defer = true) - { - - } - - /** - * 获取延迟收包的结果 - * @link https://wiki.swoole.com/wiki/page/608.html - * @return mixed 当没有进行延迟收包或者收包超时,返回false。 - */ - public function recv() - { - - } - - /** - * 创新协程 - * @link https://wiki.swoole.com/wiki/page/687.html - * @param callable $function - */ - public static function create(callable $function) - { - - } - - /** - * 获取当前协程的ID - * @link https://wiki.swoole.com/wiki/page/688.html - * @return string 是一个20字节长的随机字符串 - */ - public function getuid() - { - - } - -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Socket.php b/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Socket.php deleted file mode 100644 index b24ec93d..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Coroutine/Socket.php +++ /dev/null @@ -1,234 +0,0 @@ - - * Datetime: 2018/10/10 10:19 - */ - -namespace Swoole\Coroutine; - - -/** - * Class Socket - * - * @since 2.2.0 - * @package Swoole\Coroutine - */ -class Socket -{ - - /** - * Socket constructor. - * - * 构造方法会调用socket系统调用创建一个socket句柄。 - * 调用失败时会抛出Swoole\Coroutine\Socket\Exception异常。 - * 并设置$socket->errCode属性。可根据该属性的值得到系统调用失败的原因。 - * - * @link https://wiki.swoole.com/wiki/page/913.html - * - * @param int $domain 协议域,可使用AF_INET、AF_INET6、AF_UNIX - * @param int $type 类型,可使用SOCK_STREAM、SOCK_DGRAM、SOCK_RAW - * @param int $protocol 协议,IPPROTO_TCP、IPPROTO_UDP、IPPROTO_STCP、IPPROTO_TIPC,可设置为0 - */ - public function __construct($domain, $type, $protocol) - { - - } - - /** - * 绑定地址和端口。 - * 此方法没有IO操作,不会引起协程切换 - * - * @link https://wiki.swoole.com/wiki/page/914.html - * @param string $address 绑定的地址,如0.0.0.0、127.0.0.1 - * @param int $port 绑定的端口,默认为0,系统会随机绑定一个可用端口,可使用getsockname方法得到系统分配的port - * @return bool - */ - public function bind($address, $port = 0) - { - - } - - /** - * 监听Socket - * - * 此方法没有IO操作,不会引起协程切换 - * - * @link https://wiki.swoole.com/wiki/page/915.html - * @param int $backlog 监听队列的长度,默认为0,系统底层使用epoll实现了异步IO,不存在阻塞,因此backlog的重要程度并不高 - * @return bool - */ - public function listen($backlog = 0) - { - - } - - /** - * 接受客户端发起的连接 - * - * 调用此方法会立即挂起当前协程,并加入EventLoop监听可读事件。 - * 当Socket可读有到来的连接时自动唤醒该协程。并返回对应客户端连接的Socket对象。 - * - * 该方法必须在使用listen方法后使用,适用于Server端。 - * - * 超时或accept系统调用报错时返回false,可使用errCode属性获取错误码,其中超时错误码为ETIMEDOUT - * 成功返回客户端连接的socket,类型同样为Swoole\Coroutine\Socket对象。可对其执行send、recv、close等操作 - * - * @link https://wiki.swoole.com/wiki/page/916.html - * @param double $timeout 设置超时,默认为-1表示永不超时。设置超时参数后,底层会设置定时器,在规定的时间没有客户端连接到来,accept方法将返回false - * @return Coroutine\Socket|false - */ - public function accept($timeout = -1) - { - - } - - /** - * 连接到目标服务器 - * - * 调用此方法会发起异步的connect系统调用,并挂起当前协程,底层会监听可写,当连接完成或失败后,恢复该协程。 - * 该方法适用于Client端,支持IPv4、IPv6、UnixSocket。 - * - * @link https://wiki.swoole.com/wiki/page/917.html - * @param string $host - * @param int $port - * @param double $timeout - * @return bool - */ - public function connect($host, $port = 0, $timeout = -1) - { - - } - - /** - * 向对端发送数据 - * - * send方法会立即执行send系统调用发送数据,当send系统调用返回错误EAGAIN时, - * 底层将自动监听可写事件,并挂起当前协程,等待可写事件触发时,重新执行send系统调用发送数据。并唤醒该协程。 - * - * @link https://wiki.swoole.com/wiki/page/918.html - * @param string $data 要发送的数据内容,可以为文本或二进制数据 - * @param double $timeout 设置超时时间,默认为-1表示永不超时 - * @return int|false - */ - public function send($data, $timeout = -1) - { - - } - - /** - * 向对端发送数据 - * - * 与send方法不同的是, sendAll会尽可能完整地发送数据, 直到成功发送全部数据或遇到错误中止。 - * - * @since 4.3.0 - * @link https://wiki.swoole.com/wiki/page/1069.html - * @param string $data 要发送的数据内容,可以为文本或二进制数据 - * @param double $timeout 设置超时时间,默认为-1表示永不超时 - * @return int|false - */ - public function sendAll($data, $timeout = - 1) - { - - } - - /** - * 接收数据 - * - * @link https://wiki.swoole.com/wiki/page/919.html - * @param int $length 接收数据的预期长度,返回值长度不一定等于预期长度 - * @param double $timeout 设置超时时间,默认为-1表示永不超时 - * @return string|false - */ - public function recv($length = 65535, $timeout = -1) - { - - } - - /** - * 接收数据 - * 与recv不同的是, recvAll会尽可能完整地接收响应长度的数据, 直到接收完成或遇到错误失败。 - * - * @since 4.3.0 - * @link https://wiki.swoole.com/wiki/page/1070.html - * @param int $length 需要接收的长度 - * @param double $timeout 设置超时时间,默认为-1表示永不超时 - * @return string|false - */ - public function recvAll($length = 65535, $timeout = -1) - { - - } - - /** - * 向指定的地址和端口发送数据。用于SOCK_DGRAM类型的socket - * - * 此方法没有协程调度,底层会立即调用sendto向目标主机发送数据。 - * 此方法不会监听可写,sendto可能会因为缓存区已满而返会false,需要自行处理。或者使用send方法 - * - * @link https://wiki.swoole.com/wiki/page/921.html - * @param string $address - * @param int $port - * @param string $data - * @return int|false - */ - public function sendto($address, $port, $data) - { - - } - - /** - * 接收数据,并设置来源主机的地址和端口。用于SOCK_DGRAM类型的socket。 - * - * @link https://wiki.swoole.com/wiki/page/922.html - * @param array $peer - * @param double $timeout - * @return string|false - */ - public function recvfrom(array &$peer, $timeout = -1) - { - - } - - /** - * 获取socket的地址和端口信息。此方法没有协程调度开销。 - * - * 调用成功返回,包含address和port的数组 - * 调用失败返回false,并设置errCode属性 - * - * @link https://wiki.swoole.com/wiki/page/923.html - * @return array - */ - public function getsockname() - { - - } - - /** - * 获取socket的对端地址和端口信息,仅用于SOCK_STREAM类型有连接的socket。此方法没有协程调度开销。 - * - * 调用成功返回,包含address和port的数组 - * 调用失败返回false,并设置errCode属性 - * - * @link https://wiki.swoole.com/wiki/page/924.html - * @return array - */ - public function getpeername() - { - - } - - /** - * 关闭Socket - * Co\Socket 对象析构时如果会自动执行 close - * - * @link https://wiki.swoole.com/wiki/page/920.html - * @return bool - */ - public function close() - { - - } - -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Event.php b/vendor/eaglewu/swoole-ide-helper/src/Event.php deleted file mode 100644 index 5390f887..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Event.php +++ /dev/null @@ -1,68 +0,0 @@ -/plugins/php/lib/php.jar 文件 - * 复制 swoole.php 到路径:com\jetbrains\php\lang\psi\stubs\data\ - * 保存文件,重启Phpstorm. - * - * PS:替换前请备份php.jar 若发生错误便于恢复 :) - * - * Author: Eagle - * Date: 2014/01/17 - * - */ - - -/** - * swoole_server_set函数用于设置swoole_server运行时的各项参数 - * - * @param \swoole_server $serv - * @param $arguments - */ -function swoole_server_set($serv, array $arguments) -{ -} - - -/** - * 创建一个swoole server资源对象 - * - * @param string $host 参数用来指定监听的ip地址,如127.0.0.1,或者外网地址,或者0.0.0.0监听全部地址 - * @param int $port 监听的端口,如9501,监听小于1024端口需要root权限,如果此端口被占用server-start时会失败 - * @param int $mode 运行的模式,swoole提供了3种运行模式,默认为多进程模式 - * @param int $sock_type 指定socket的类型,支持TCP/UDP、TCP6/UDP64种 - */ -function swoole_server_create($host, $port, $mode = SWOOLE_PROCESS, $sock_type = SWOOLE_SOCK_TCP) -{ -} - - -/** - * 增加监听的端口 - * - * 您可以混合使用UDP/TCP,同时监听内网和外网端口 - * 业务代码中可以通过调用swoole_connection_info来获取某个连接来自于哪个端口 - * - * @param \swoole_server $serv - * @param string $host - * @param int $port - * - * @return void - */ -function swoole_server_addlisten($serv, $host = '127.0.0.1', $port = 9502) -{ -} - - -/** - * 设置定时器 - * - * 第二个参数是定时器的间隔时间,单位为毫秒。 - * swoole定时器的最小颗粒是1毫秒,支持多个定时器。 - * 此函数可以用于worker进程中。或者通过swoole_server_set设置timer_interval来调整定时器最小间隔。 - * - * 增加定时器后需要为Server设置onTimer回调函数,否则会造成严重错误。 - * 多个定时器都会回调此函数。 - * 在这个函数内需要自行switch,根据interval的值来判断是来自于哪个定时器。 - * - * @param \swoole_server $serv - * @param int $interval - * - * @return bool - */ -function swoole_server_addtimer($serv, $interval) -{ -} - - -/** - * 设置Server的事件回调函数 - * - * 第一个参数是swoole的资源对象 - * 第二个参数是回调的名称, 大小写不敏感,具体内容参考回调函数列表 - * 第三个函数是回调的PHP函数,可以是字符串,数组,匿名函数。 - * - * 设置成功后返回true。如果$event_name填写错误将返回false。 - * - * onConnect/onClose/onReceive 这3个回调函数必须设置,其他事件回调函数可选。 - * 如果设定了timer定时器,onTimer事件回调函数也必须设置 - * - * @param \swoole_server $serv - * @param string $event_name - * @param callable $event_callback_function - * - * @return bool - */ -function swoole_server_handler($serv, $event_name, $event_callback_function) -{ -} - - -/** - * 启动server,监听所有TCP/UDP端口 - * - * 启动成功后会创建worker_num+2个进程。主进程+Manager进程+n*Worker进程。 - * 启动失败扩展内会抛出致命错误,请检查php error_log的相关信息。errno={number}是标准的Linux Errno,可参考相关文档。 - * 如果开启了log_file设置,信息会打印到指定的Log文件中。 - * - * 如果想要在开机启动时,自动运行你的Server,可以在/etc/rc.local文件中加入: - * - * /usr/bin/php /data/webroot/www.swoole.com/server.php - * - * 常见的错误有及拍错方法: - * - * 1、bind端口失败,原因是其他进程已占用了此端口 - * 2、未设置必选回调函数,启动失败 - * 3、php有代码致命错误,请检查php的错误信息 - * 4、执行ulimit -c unlimited,打开core dump,查看是否有段错误 - * 5、关闭daemonize,关闭log,使错误信息可以打印到屏幕 - * - * @param \swoole_server $serv - * - * @return bool - */ -function swoole_server_start($serv) -{ -} - - -/** - * 平滑重启Server - * - * 一台繁忙的后端服务器随时都在处理请求,如果管理员通过kill进程方式来终止/重启服务器程序,可能导致刚好代码执行到一半终止。 - * 这种情况下会产生数据的不一致。如交易系统中,支付逻辑的下一段是发货,假设在支付逻辑之后进程被终止了。 - * 会导致用户支付了货币,但并没有发货,后果非常严重。 - * - * Swoole提供了柔性终止/重启的机制,管理员只需要向SwooleServer发送特定的信号,Server的worker进程可以安全的结束。 - * - * SIGTREM: 向主进程发送此信号服务器将安全终止 - * SIGUSR1: 向管理进程发送SIGUSR1信号,将平稳地restart所有worker进程,在PHP代码中可以调用swoole_server_reload($serv)完成此操作 - * - * @param \swoole_server $serv - * - * @return void - */ -function swoole_server_reload($serv) -{ -} - - -/** - * 关闭客户端连接 - * - * Server主动close连接,也一样会触发onClose事件。 - * 不要在close之后写清理逻辑,应当放置到onClose回调中处理。 - * - * @param \swoole_server $serv - * @param int $fd - * @param int $from_id - * - * @return bool - */ -function swoole_server_close($serv, $fd, $from_id = 0) -{ -} - - -/** - * 向客户端发送数据 - * - * $data的长度可以是任意的。扩展函数内会进行切分。 - * 如果是UDP协议,会直接在worker进程内发送数据包。 - * 发送成功会返回true,如果连接已被关闭或发送失败会返回false. - * - * @param \swoole_server $serv - * @param int $fd - * @param string $data - * @param int $from_id - * - * @return bool - */ -function swoole_server_send($serv, $fd, $data, $from_id = 0) -{ -} - - -/** - * 获取客户端连接的信息 - * - * 返回数组含义: - * from_id 来自哪个poll线程 - * from_fd 来自哪个server socket - * from_port 来自哪个Server端口 - * remote_port 客户端连接的端口 - * remote_ip 客户端连接的ip - * - * 以下 v1.6.10 增加 - * connect_time 连接时间 - * last_time 最后一次发送数据的时间 - * - * @param \swoole_server $serv - * @param int $fd - * - * @return array on success or false on failure. - */ -function swoole_connection_info($serv, $fd) -{ -} - - -/** - * 遍历当前Server所有的客户端连接 - * - * 此函数接受3个参数,第一个参数是server的资源对象,第二个参数是起始fd,第三个参数是每页取多少条,最大不得超过100。 - * 调用成功将返回一个数字索引数组,元素是取到的$fd。 - * 数组会按从小到大排序,最后一个$fd作为新的start_fd再次尝试获取。 - * - * @param \swoole_server $serv - * @param int $start_fd - * @param int $pagesize - * - * @return array on success or false on failure - */ -function swoole_connection_list($serv, $start_fd = 0, $pagesize = 10) -{ -} - - -/** - * 设置进程的名称 - * - * 修改进程名称后,通过ps命令看到的将不再是php your_file.php。而是设定的字符串。 - * 此函数接受一个字符串参数。 - * 此函数与PHP5.5提供的cli_set_process_title功能是相同的,但swoole_set_process_name可用于PHP5.2之上的任意版本。 - * - * @param string $name - * - * @return void - */ -function swoole_set_process_name($name) -{ -} - - -/** - * 将Socket加入到swoole的reactor事件监听中 - * - * 此函数可以用在Server或Client模式下 - * - * 参数1为socket的文件描述符; - * 参数2为回调函数,可以是字符串函数名、对象+方法、类静态方法或匿名函数,当此socket可读是回调制定的函数。 - * - * Server程序中会增加到server socket的reactor中。 - * Client程序中,如果是第一次调用此函数会自动创建一个reactor,并添加此socket,程序将在此处进行wait。 - * swoole_event_add函数之后的代码不会执行。当调用swoole_event_exit才会停止wait,程序继续向下执行。 - * 第二次调用只增加此socket到reactor中,开始监听事件 - * - * @param int $sock - * @param \\is_callable $callback - * @param $write_callback - * @param $flag - * - * @return bool - */ -function swoole_event_add($sock, $read_callback = null, $write_callback = null, $flag = null) -{ -} - -/** - * 修改socket的事件设置 - * 可以修改可读/可写事件的回调设置和监听的事件类型 - * - * @param $sock - * @param $read_callback - * @param null $write_callback - * @param null $flag - */ -function swoole_event_set($sock, $read_callback = null, $write_callback = null, $flag = null) -{ -} - -/** - * 从reactor中移除监听的Socket - * - * swoole_event_del应当与 swoole_event_add 成对使用 - * - * @param int $sock - * - * @return bool - */ -function swoole_event_del($sock) -{ -} - - -/** - * 退出事件轮询 - * - * @return void - */ -function swoole_event_exit() -{ -} - -/** - * 异步写 - * - * @param mixed $socket - * @param string $data - */ -function swoole_event_write($socket, $data) -{ - -} - -/** - * 获取MySQLi的socket文件描述符 - * - * 可将mysql的socket增加到swoole中,执行异步MySQL查询。 - * 如果想要使用异步MySQL,需要在编译swoole时制定--enable-async-mysql - * swoole_get_mysqli_sock仅支持mysqlnd驱动,php5.4以下版本不支持此特性 - * - * @param mysqli $db - * - * @return int - */ -function swoole_get_mysqli_sock(\mysqli $db) -{ -} - -/** - * 异步执行SQL - * - * @param $db - * @param $sql - */ -function swoole_mysql_query($db, $sql, $callback) -{ - -} - -/** - * 投递异步任务到task_worker池中 - * - * 此函数会立即返回,worker进程可以继续处理新的请求。 - * 此功能用于将慢速的任务异步地去执行,比如一个聊天室服务器,可以用它来进行发送广播。 - * 当任务完成时,在task_worker中调用swoole_server_finish($serv, "finish"); - * 告诉worker进程此任务已完成。当然swoole_server_finish是可选的。 - * - * 发送的$data必须为字符串,如果是数组或对象,请在业务代码中进行serialize处理,并在onTask/onFinish中进行unserialize。 - * $data可以为二进制数据,最大长度为8K。字符串可以使用gzip进行压缩。 - * - * 使用swoole_server_task必须为Server设置onTask和onFinish回调, - * 否则swoole_server_start会失败。此回调函数会在task_worker进程中被调用。 - * - * 函数会返回一个$task_id数字,表示此任务的ID。如果有finish回应,onFinish回调中会携带$task_id参数。 - * - * task_worker的数量在swoole_server_set参数中调整,如task_worker_num => 64,表示启动64个进程来接收异步任务。 - * swoole_server_task和swoole_server_finish可发送$data的长度最大不得超过8K,此参数受SW_BUFFER_SIZE宏控制。 - * - * @param \swoole_server $serv - * @param string $data - * - * @return int $task_id - */ -function swoole_server_task($serv, $data) -{ -} - - -/** - * task_worker进程中通知worker进程,投递的任务已完成 - * - * 此函数可以传递结果数据给worker进程 - * 使用swoole_server_finish函数必须为Server设置onFinish回调函数。此函数只可用于task_worker进程的onTask回调中 - * swoole_server_finish是可选的。如果worker进程不关心任务执行的结果,可以不调用此函数 - * - * @param \swoole_server $serv - * @param string $response - * - * @return void - */ -function swoole_server_finish($serv, $response) -{ -} - - -/** - * 删除定时器 - * - * $interval 参数为定时器的间隔时间 - * 根据定时器时间区分不同的定时器 - * - * @param \swoole_server $serv - * @param int $interval - * - * @return void - */ -function swoole_server_deltimer($serv, $interval) -{ -} - - -/** - * 关闭服务器 - * - * 此函数可以用在worker进程内。 - * - * @param \swoole_server $serv - * - * @return void - */ -function swoole_server_shutdown($serv) -{ -} - - -/** - * 投递堵塞任务到task进程池 - * - * taskwait与task方法作用相同,用于投递一个异步的任务到task进程池去执行。 - * 与task不同的是taskwait是阻塞等待的,直到任务完成或者超时返回。 - * $result为任务执行的结果,由$serv->finish函数发出。如果此任务超时,这里会返回false。 - * - * taskwait是阻塞接口,如果你的Server是全异步的请不要使用它 - * - * @param string $task_data - * @param float $timeout - * - * @return string - */ -function swoole_server_taskwait($task_data, $timeout = 0.5) -{ -} - -/** - * 进行事件轮询 - * - * PHP5.4之前的版本没有在ZendAPI中加入注册shutdown函数。所以swoole无法在脚本结尾处自动进行事件轮询。 - * 低于5.4的版本,需要在你的PHP脚本结尾处加swoole_event_wait函数,使脚本开始进行事件轮询。 - * - * 5.4或更高版本不需要加此函数。 - * - * @return void - */ -function swoole_event_wait() -{ -} - -/** - * 添加定时器,可用于客户端环境和fpm中 - * - * @param $interval - * @param callable $callback - * - * @return int - */ -function swoole_timer_add($interval, $callback) -{ -} - -/** - * 单次定时器,在N毫秒后执行回调函数 - * - * @param $ms - * @param callable $callback function ($user_param){} - * @param $user_param - * - * @return int - */ -function swoole_timer_after($ms, $callback, $user_param = null) -{ -} - -/** - * 删除定时器 - * - * @param $interval - */ -function swoole_timer_del($interval) -{ -} - -/** - * 删除定时器 - * - * @param $timer_id - * - * @return bool - */ -function swoole_timer_clear($timer_id) -{ -} - -/** - * 添加TICK定时器 - * - * @param $ms - * @param callable $callback function($timmerID, $params){} - * @param null $params - * - * @return int - */ -function swoole_timer_tick($ms, $callback, $params = null) -{ - -} - -/** - * 获取swoole扩展的版本号,如1.6.10 - * - * @return string - */ -function swoole_version() -{ -} - -/** - * 将标准的Unix Errno错误码转换成错误信息 - * - * @param int $errno - */ -function swoole_strerror($errno) -{ -} - -/** - * 获取最近一次系统调用的错误码,等同于C/C++的errno变量。 - * - * @return int - */ -function swoole_errno() -{ -} - - -/** - * 此函数用于获取本机所有网络接口的IP地址, - * 目前只返回IPv4地址,返回结果会过滤掉本地loop地址127.0.0.1。 - * 结果数组是以interface名称为key的关联数组。 - * 比如 array("eth0" => "192.168.1.100") - * - * @return array - */ -function swoole_get_local_ip() -{ -} - - -/** - * 异步读取文件内容 - * 此函数调用后会马上返回,当文件读取完毕时会回调制定的callback函数。 - * callback( $filename, $content ) - * - * swoole_async_readfile会将文件内容全部复制到内存,所以不能用于大文件的读取 - * 如果要读取超大文件,请使用swoole_async_read函数 - * swoole_async_readfile最大可读取4M的文件,受限于SW_AIO_MAX_FILESIZE宏 - * - * @param string $filename - * @param mixed $callback - */ -function swoole_async_readfile($filename, $callback) -{ -} - -/** - * 异步写文件,调用此函数后会立即返回, 当写入完成时会自动回调指定的callback函数 - * callback($filename) - * - * swoole_async_writefile最大可写入4M的文件 - * swoole_async_writefile可以不指定回调函数 - * - * @param string $filename - * @param string $content - * @param callback $callback - * @param int $flags (在 1.9.1 或更高版本可用) - */ -function swoole_async_writefile($filename, $content, $callback, $flags = 0) -{ -} - -/** - * 异步读文件 - * - * 使用此函数读取文件是非阻塞的,当读操作完成时会自动回调制定的函数 - * 此函数与swoole_async_readfile不同,它是分段读取,可以用于读取超大文件。 - * 每次只读 $trunk_size 个字节,不会占用太多内存 - * - * callback($filename, $content) - * callback函数,可以通过return true/false,来控制是否继续读下一个trunk - * return true,继续读取 - * return false,停止读取并关闭文件 - * - * @param string $filename - * @param mixed $callback - * @param int $trunk_size - * @param int $offset (在 1.7.13 或更高版本可用) - * - * @return bool - */ -function swoole_async_read($filename, $callback, $trunk_size = 8192, $offset = 0) -{ -} - -/** - * 设置异步相关的参数 - * - * @param array $setting - */ -function swoole_async_set(array $setting) -{ - -} - -/** - * 异步写文件 - * - * 与swoole_async_writefile不同,write是分段读写的。 - * 不需要一次性将要写的内容放到内存里,所以只占用少量内存。 - * swoole_async_write通过传入的offset参数来确定写入的位置 - * - * callback($filename) - * - * @param string $filename - * @param string $content - * @param int $offset - * @param mixed $callback - * - * @return bool - */ -function swoole_async_write($filename, $content, $offset = -1, $callback = null) -{ -} - -/** - * 将域名解析为IP地址 - * 调用此函数会立即返回,当DNS查询完成时,自动回调指定的callback函数 - * - * callback($host, $ip) - * - * @param string $domain - * @param callback $callback - */ -function swoole_async_dns_lookup($domain, $callback) -{ -} - -/** - * IO事件循环 - * - * - * swoole_client的并行处理中用了select来做IO事件循环。为什么要用select呢? - * 因为client一般不会有太多连接,而且大部分socket会很快接收到响应数据。 - * 在少量连接的情况下select比epoll性能更好,另外select更简单。 - * - * $read,$write,$error分别是可读/可写/错误的文件描述符。 - * 这3个参数必须是数组变量的引用。数组的元素必须为swoole_client对象。 - * $timeout参数是select的超时时间,单位为秒,接受浮点数。 - * - * 调用成功后,会返回事件的数量,并修改$read/$write/$error数组。 - * 使用foreach遍历数组,然后执行$item->recv/$item->send来收发数据。 - * 或者调用$item->close()或unset($item)来关闭socket。 - * - * - * @param array $read 可读 - * @param array $write 可写 - * @param array $error 错误 - * @param float $timeout - * - * @return int - */ -function swoole_client_select(array &$read, array &$write, array &$error, $timeout) -{ -} - - -class swoole_http_client extends Swoole\Http\Client -{ - -} - -class swoole_http_request extends Swoole\Http\Request -{ - -} - -class swoole_http_response extends Swoole\Http\Response -{ - -} - -class swoole_http_server extends Swoole\Http\Server -{ - -} - -class swoole_atomic extends Swoole\Atomic -{ - -} - -class swoole_buffer extends Swoole\Buffer -{ - -} - -class swoole_client extends Swoole\Client -{ - -} - -class swoole_server extends Swoole\Server -{ - -} - -class swoole_lock extends Swoole\Lock -{ - -} - -class swoole_redis extends Swoole\Redis -{ - -} - -class swoole_process extends Swoole\Process -{ - -} - -class swoole_table extends Swoole\Table -{ - -} - -class swoole_channel extends Swoole\Channel -{ - -} - -class swoole_redis_server extends Swoole\Redis\Server -{ - -} - -/** - * @desc 内置 Websocket 服务器 - * - * $server = new swoole_websocket_server("0.0.0.0", 11521); - * $server->on("open", function(swoole_websocket_server $server, $request){ - * $request->fd 客户端的socket id - * }); - * $server->on("message", function(swoole_websocket_server $server, swoole_websocket_frame $frame){ - * $frame->fd 客户端的socket id,使用$server->push推送数据时需要用到 - * $frame->data 数据内容,可以是文本内容也可以是二进制数据,可以通过opcode的值来判断 - * $frame->opcode WebSocket的OpCode类型,可以参考WebSocket协议标准文档 - * $frame->finish 表示数据帧是否完整,一个WebSocket请求可能会分成多个数据帧进行发送 - * }); - * $server->on("close", function(){ - * $fd 客户端的socket id,使用$server->push推送数据时需要用到 - * }); - */ -class swoole_websocket_server extends Swoole\WebSocket\Server -{ - -} - -/** - * @property $fd 客户端的socket id,使用$server->push推送数据时需要用到 - * @property $data 数据内容,可以是文本内容也可以是二进制数据,可以通过opcode的值来判断 - * @property $opcode WebSocket的OpCode类型,可以参考WebSocket协议标准文档 - * @property $finish 表示数据帧是否完整,一个WebSocket请求可能会分成多个数据帧进行发送 - */ -class swoole_websocket_frame extends Swoole\WebSocket\Frame -{ - -} -class swoole_mySQL extends \Swoole\MySQL -{ - -} -class swoole_http2_client extends \Swoole\Http2\Client -{ - -} -class swoole_mysql_exception extends \Swoole\Mysql\Exception -{ - -} -class swoole_serialize extends \Swoole\Serialize -{ - -} - -/**==================短名API==================*/ - -/** - * Class Co - * Coroutine的短名API - */ -class Co extends \Swoole\Coroutine -{ - -} - -class Chan extends \Swoole\Coroutine\Channel -{ - -} - -/** - * 创建一个协程 - * go(function () {}); - * go("test"); - * go([$object, "method"]); - * - * @param callable|string|array $function - */ -function go($function) -{ -} - -/** - * 延迟执行 - * defer(function () use ($db) { - * $db->close(); - * }); - * @param callable $function - */ -function defer($function) -{ -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Http/Client.php b/vendor/eaglewu/swoole-ide-helper/src/Http/Client.php deleted file mode 100644 index 5cee79d6..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Http/Client.php +++ /dev/null @@ -1,204 +0,0 @@ - - * Date: 2016/02/17 - */ -class Client -{ - public $host; - public $port; - public $type; - public $setting; - public $cookies; - public $headers; - /** - * 存储上次请求的返回包体 - * - * @link https://wiki.swoole.com/wiki/page/578.html - * - * @var string - */ - public $body; - public $uploadFiles; - - public $requestMehod; - public $requestHeaders; - public $requestBody; - - public $statusCode; // -1 连接服务器超时 -2 服务器响应超时 - public $set_headers; - public $connected = false; - - /** - * 错误码 - * - * @link https://wiki.swoole.com/wiki/page/578.html - * - * @var integer - */ - public $errCode = 0; - - /** - * @var string[] 存储上次请求返回的set-cookie头 - */ - public $set_cookie_headers; - - - /** - * swoole_http_client constructor. - * @param string $host - * @param integer $port - */ - public function __construct($host, $port) - { - - } - - /** - * @param $setting - * @return true - */ - public function set($setting) - { - } - - /** - * @param string $method - */ - public function setMethod(string $method) - { - - } - - /** - * @param $headers - * @return true - */ - public function setHeaders($headers) - { - - } - - /** - * @param $cookies - * @return true - */ - public function setCookies($cookies) - { - - } - - /** - * @param $data - * @return true - */ - public function setData($data) - { - - } - - /** - * 更底层的Http请求方法,需要代码中调用setMethod和setData等接口设置请求的方法和数据。 - * - * @param string $path - * @param callable $callback - */ - public function execute(string $path, callable $callback) - { - - } - - /** - * @param $data - * @param int $opcode - * @param int $fin - */ - public function push($data, $opcode = WEBSOCKET_OPCODE_TEXT, $fin = 1) - { - - } - - /** - * @return boolean - */ - public function isConnected() - { - - } - - /** - * @return bool - */ - public function close() - { - - } - - /** - * @param string $name - * @param mixed $callback - */ - public function on($name, $callback) - { - - } - - /** - * @param string $uri - * @param mixed $finish - */ - public function get($uri, $finish) - { - - } - - /** - * @param string $uri - * @param mixed $post - * @param mixed $finish - */ - public function post($uri, $post, $finish) - { - - } - - /** - * @param string $uri - * @param mixed $finish - */ - public function upgrade($uri, $finish) - { - - } - - /** - * 添加POST文件 - * - * $path 文件的路径,必选参数,不能为空文件或者不存在的文件 - * $name 表单的名称,必选参数,FILES参数中的key - * $filename 文件名称,可选参数,默认为basename($path) - * $mimeType 文件的MIME格式,可选参数,底层会根据文件的扩展名自动推断 - * $offset 上传文件的偏移量,可以指定从文件的中间部分开始传输数据。此特性可用于支持断点续传。 - * $length 发送数据的尺寸,默认为整个文件的尺寸 - * 使用addFile会自动将POST的Content-Type将变更为form-data。addFile底层基于sendfile,可支持异步发送超大文件。 - * - * addFile在1.8.9或更高版本可用 - * $offset, $length 参数在1.9.11或更高版本可用 - * - * @param $file - */ - public function addFile($path, $name, $filename = null, $mimeType = null, $offset = 0, $length = 0) - { - - } - - public function __destruct() - { - - } -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Http/Request.php b/vendor/eaglewu/swoole-ide-helper/src/Http/Request.php deleted file mode 100644 index e066a940..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Http/Request.php +++ /dev/null @@ -1,50 +0,0 @@ - - * Date: 2017/3/1 - * Time: 18:17 - * @link https://github.com/lscgzwd - * @copyright Copyright (c) 2017 Lu Shun Cheng (https://github.com/lscgzwd) - * @licence http://www.apache.org/licenses/LICENSE-2.0 - * @author Lu Shun Cheng (lscgzwd@gmail.com) - * - * - * @package Swoole\Http2 - * @version 1.0 - */ -namespace Swoole\Http2; - - -class Client -{ - /** - * Client constructor. - * @param string $host - * @param int $port - * @param bool $useSSL - */ - public function __construct(string $host, int $port, bool $useSSL = false) - { - } - - /** - * @param array $haders ['key' => 'value'] - */ - public function setHeaders(array $haders) - { - - } - - /** - * @param array $cookies ['key'=>'value'] - */ - public function setCookies(array $cookies) - { - - } - - /** - * @param string $uri - * @param callable $callback - * @return bool|void - */ - public function get(string $uri, callable $callback) { - - } - - /** - * @param string $uri - * @param callable $callback - * @param mixed $data - * @return void|bool - */ - public function post(string $uri, callable $callback, mixed $data) - { - - } - - /** - * @param string $uri - * @param callable $callback - * @return int|bool|void return the stream id when success - */ - public function openStream(string $uri, callable $callback) - { - - } - - /** - * push data to server - * @param int $streamID - * @param mixed $data - * @return bool - */ - public function push(int $streamID, mixed $data) - { - - } - - /** - * @param int $streamID - */ - public function closeStream(int $streamID) { - - } -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Http2/Response.php b/vendor/eaglewu/swoole-ide-helper/src/Http2/Response.php deleted file mode 100644 index 61c3d829..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Http2/Response.php +++ /dev/null @@ -1,28 +0,0 @@ - - * Date: 2018/4/5 下午9:21 - */ - -namespace Swoole\Http2; - -class Response -{ - /** - * cookie 服务器设置的COOKIE信息 - * header 服务器发送的Header信息 - * server 底层连接与协议相关的信息 - * body 服务器发送的响应包体 - * statusCode 服务器发送的Http状态码,如200、502等 - */ - - public $errCode = 0; - public $statusCode = 0; - public $body = ''; - public $streamId = 0; - public $header = []; - public $server = []; - public $cookie = []; - -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Lock.php b/vendor/eaglewu/swoole-ide-helper/src/Lock.php deleted file mode 100644 index 8908ad1d..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Lock.php +++ /dev/null @@ -1,86 +0,0 @@ -lock_read()。 - * 另外除文件锁外,其他类型的锁必须在父进程内创建,这样fork出的子进程之间才可以互相争抢锁。 - */ - public function __construct($type, $lockfile = NULL) - { - } - - - /** - * 加锁操作 - * - * 如果有其他进程持有锁,那这里将进入阻塞,直到持有锁的进程unlock。 - * @return boolean - */ - public function lock() - { - } - - - /** - * 加锁操作 - * - * 与lock方法不同的是,trylock()不会阻塞,它会立即返回。 - * 当返回false时表示抢锁失败,有其他进程持有锁。返回true时表示加锁成功,此时可以修改共享变量。 - * - * SWOOlE_SEM 信号量没有trylock方法 - * @return boolean - */ - public function trylock() - { - } - - - /** - * 释放锁 - * @return boolean - */ - public function unlock() - { - } - - - /** - * 阻塞加锁 - * - * lock_read方法仅可用在读写锁(SWOOLE_RWLOCK)和文件锁(SWOOLE_FILELOCK)中,表示仅仅锁定读。 - * 在持有读锁的过程中,其他进程依然可以获得读锁,可以继续发生读操作。但不能$lock->lock()或$lock->trylock(),这两个方法是获取独占锁的。 - * - * 当另外一个进程获得了独占锁(调用$lock->lock/$lock->trylock)时,$lock->lock_read()会发生阻塞,直到持有锁的进程释放。 - */ - public function lock_read() - { - } - - - /** - * 非阻塞加锁 - * - * 此方法与lock_read相同,但是非阻塞的。调用会立即返回,必须检测返回值以确定是否拿到了锁。 - */ - public function trylock_read() - { - } - - /** - * @param float $timeout - * @return void - */ - public function lockwait($timeout = 1.0) - { - } - -} - diff --git a/vendor/eaglewu/swoole-ide-helper/src/MySQL.php b/vendor/eaglewu/swoole-ide-helper/src/MySQL.php deleted file mode 100644 index 596678c6..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/MySQL.php +++ /dev/null @@ -1,157 +0,0 @@ - - * Date: 2017/3/1 - * Time: 18:17 - * @link https://github.com/lscgzwd - * @copyright Copyright (c) 2017 Lu Shun Cheng (https://github.com/lscgzwd) - * @licence http://www.apache.org/licenses/LICENSE-2.0 - * @author Lu Shun Cheng (lscgzwd@gmail.com) - * - * - * @package Swoole - * @version 1.0 - */ - -namespace Swoole; -/** - * Class Mysql - * @package Swoole - * @property $connect_errno - * @property $connect_error - * @property $errno - * @property $error - * @property $insert_id - * @property $affected_rows - */ -class MySQL -{ - /** - * @var string the connect error number - */ - public $connect_errno; - /** - * @var string the connect error information - */ - public $connect_error; - /** - * @var string the error number when query fail - */ - public $errno; - /** - * @var string the error information when query fail - */ - public $error; - /** - * @var int the last insert id when query execute success - */ - public $insert_id; - /** - * @var int the affected rows when query execute success - */ - public $affected_rows; - - public function __construct() - { - } - - /** - * set the event callback, current just support close - * function callback(\Swoole\Mysql $db){} - * @param string $eventName - * @param callable $callback - */ - public function on(string $eventName, callable $callback) - { - - } - - /** - * $config = array( - * 'host' => '192.168.56.102', // the host for mysql server ,support ipv4,ipv6 or unix sock. - * 'user' => 'test', // mysql user name - * 'password' => 'test', // password for mysql - * 'database' => 'test', // the database - * 'charset' => 'utf8', // choice, if not given, the server charset used - * ); - * function callback(\Swoole\Mysql $db, bool $result) { - * } - * @param array $config - * @param callable $callback - * @throws \Swoole\Mysql\Exception $e - */ - public function connect(array $config, callable $callback) - { - - } - - /** - * use mysqlnd to escape the string - * use --enable-mysqlnd when compile - * @param string $str - * @return string - */ - public function escape(string $str): string - { - - } - - /** - * function callback(\Swoole\Mysql $link, mixed $result) {} - * when execute fail, the result return false, you can use $link->error and $link->errno to get - * the error information. - * success: - * if query result sql, the result is the query result - * otherwise the result is true, you can use $link->insert_id, $link->affected_rows - * @param string $sql - * @param callable $callback - */ - public function query(string $sql, callable $callback) - { - - } - - /** - * start a new transaction - * one link only one transaction, if already exist, then exception - * function callback(\Swoole\Mysql $link, mixed $result) {} - * @param callable $callback - * @throws \Swoole\Mysql\Exception $e - */ - public function begin(callable $callback) - { - - } - /** - * commit transaction - * if not exist, then exception - * function callback(\Swoole\Mysql $link, mixed $result) {} - * @param callable $callback - * @throws \Swoole\Mysql\Exception $e - */ - public function commit(callable $callback) - { - - } - /** - * rollback transaction - * if not exist, then exception - * function callback(\Swoole\Mysql $link, mixed $result) {} - * @param callable $callback - * @throws \Swoole\Mysql\Exception $e - */ - public function rollback(callable $callback) - { - - } - - /** - * close the connection - */ - public function close() - { - - } -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Mysql/Exception.php b/vendor/eaglewu/swoole-ide-helper/src/Mysql/Exception.php deleted file mode 100644 index f21c38cd..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Mysql/Exception.php +++ /dev/null @@ -1,24 +0,0 @@ - - * Date: 2017/3/1 - * Time: 18:17 - * @link https://github.com/lscgzwd - * @copyright Copyright (c) 2017 Lu Shun Cheng (https://github.com/lscgzwd) - * @licence http://www.apache.org/licenses/LICENSE-2.0 - * @author Lu Shun Cheng (lscgzwd@gmail.com) - * - * - * @package Swoole\Mysql - * @version 1.0 - */ - -namespace Swoole\Mysql; - - -class Exception extends \Exception -{ - -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Port.php b/vendor/eaglewu/swoole-ide-helper/src/Port.php deleted file mode 100644 index 9d702df7..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Port.php +++ /dev/null @@ -1,34 +0,0 @@ - 0, 'pid' => 15001),失败返回false - * - * @param bool $blocking 是否阻塞等待 - * @return false | array - */ - static function wait($blocking = true) - { - } - - /** - * 守护进程化 - * @param bool $nochdir - * @param bool $noclose - */ - static function daemon($nochdir = false, $noclose = false) - { - - } - - /** - * 创建消息队列 - * @param int $msgkey 消息队列KEY - * @param int $mode 模式 - * - * 将队列设置为非阻塞 - * $process->useQueue($key, $mode | swoole_process::IPC_NOWAIT); - */ - function useQueue($msgkey = -1, $mode = 2) - { - - } - - /** - * 向消息队列推送数据 - * @param $data - */ - function push($data) - { - - } - - /** - * 从消息队列中提取数据 - * @param int $maxsize - * @return string - */ - function pop($maxsize = 8192) - { - - } - - /** - * 向某个进程发送信号 - * - * @param $pid - * @param int $sig - * @return bool - */ - static function kill($pid, $sig = SIGTERM) - { - } - - /** - * 注册信号处理函数 - * require swoole 1.7.9+ - * @param int $signo - * @param mixed $callback - */ - static function signal($signo, $callback) - { - } - - /** - * 启动子进程 - * - * @return int - */ - function start() - { - } - - /** - * 为工作进程重命名 - * @param $process_name - */ - function name($process_name) - { - - } -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Process/Pool.php b/vendor/eaglewu/swoole-ide-helper/src/Process/Pool.php deleted file mode 100644 index ef18ded8..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Process/Pool.php +++ /dev/null @@ -1,73 +0,0 @@ - - * Datetime: 2018/10/10 10:47 - */ - -namespace Swoole; - - -class Runtime -{ - - /** - * 运行时动态将基于php_stream实现的扩展、PHP网络客户端代码一键协程化 - * - * @since 4.1.0 - * - * 4.1 版本仅支持tcp和 unix两种stream类型 - * 4.2 版本增加了对 udp、udg、unix、ssl、tls 类型的支持 - * - * @link https://wiki.swoole.com/wiki/page/965.html - * @param bool $enable - * @param int $flags - */ - public static function enableCoroutine($enable = true, $flags = SWOOLE_HOOK_ALL) - { - - } - -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Serialize.php b/vendor/eaglewu/swoole-ide-helper/src/Serialize.php deleted file mode 100644 index e73b5492..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Serialize.php +++ /dev/null @@ -1,32 +0,0 @@ - - * Date: 2016/02/17 - * @property string $host 服务器地址 - * @property int $port 服务器端口 - */ -class Server -{ - /** - * 当前服务器管理进程的Settings - * - * swoole_server::set()函数所设置的参数会保存到$setting属性上。 - * 在回调函数中可以访问运行参数的值。 - * 配置选项 https://wiki.swoole.com/wiki/page/274.html - * - * swoole-1.6.11+可用 - * - * @var array - */ - public $setting; - - /** - * 主进程PID - * - * @var int - */ - public $master_pid; - - /** - * 当前服务器管理进程的PID - * - * !! 只能在onStart/onWorkerStart之后获取到 - * - * @var int - */ - public $manager_pid; - - /** - * 当前Worker进程的编号 - * - * 这个属性与onWorkerStart时的$worker_id是相同的。 - * - * * Worker进程ID范围是[0, $serv->setting['worker_num']) - * * task进程ID范围是[$serv->setting['worker_num'], $serv->setting['worker_num'] + $serv->setting['task_worker_num']) - * - * 工作进程重启后worker_id的值是不变的 - * - * @var int - */ - public $worker_id; - - /** - * 当前Worker进程的ID,0 - ($serv->setting[worker_num]-1) - * @var int - */ - public $worker_pid; - - /** - * 是否 Task 工作进程 - * - * true 表示当前的进程是Task工作进程 - * false 表示当前的进程是Worker进程 - * - * @var bool - */ - public $taskworker; - - /** - * TCP连接迭代器,可以使用foreach遍历服务器当前所有的连接,此属性的功能与swoole_server->connnection_list是一致的,但是更加友好。遍历的元素为单个连接的fd - * - * 连接迭代器依赖pcre库,未安装pcre库无法使用此功能 - * - * foreach($server->connections as $fd) - * { - * $server->send($fd, "hello"); - * } - * - * echo "当前服务器共有 ".count($server->connections). " 个连接\n"; - * - * @var \Swoole\Connection\Iterator - */ - public $connections; - - /** - * @var \Swoole\Server\Port[] $ports - - */ - public $ports; - - /** - * 注册事件回调函数,与swoole_server->on相同。swoole_http_server->on的不同之处是: - * - * * swoole_http_server->on不接受onConnect/onReceive回调设置 - * * swoole_http_server->on 额外接受1种新的事件类型onRequest - * - * 事件列表 - * - * * onStart - * * onShutdown - * * onWorkerStart - * * onWorkerStop - * * onTimer - * * onConnect - * * onReceive - * * onClose - * * onTask - * * onFinish - * * onPipeMessage - * * onWorkerError - * * onManagerStart - * * onManagerStop - * WebSocket - * * onOpen - * * onHandshake - * * onMessage - * - * - * $http_server->on('request', function(swoole_http_request $request, swoole_http_response $response) { - * $response->end("

hello swoole

"); - * }) - * - * - * 在收到一个完整的Http请求后,会回调此函数。回调函数共有2个参数: - * - * * $request,Http请求信息对象,包含了header/get/post/cookie等相关信息 - * * $response,Http响应对象,支持cookie/header/status等Http操作 - * - * - * !! $response/$request 对象传递给其他函数时,不要加&引用符号 - * - * @param string $event - * @param callable $callback - */ - public function on($event, $callback) - { - } - - /** - * 设置运行时参数 - * - * swoole_server->set函数用于设置swoole_server运行时的各项参数。服务器启动后通过$serv->setting来访问set函数设置的参数数组。 - * - * @param array $setting - */ - public function set(array $setting) - { - } - - /** - * swoole_server 构造函数 https://wiki.swoole.com/wiki/page/14.html - * - * @param string $host - * ipv4: 本机 127.0.0.1 全部地址 0.0.0.0 - * ipv6: 本机 ::1 全部地址 :: - * - * @param int $port - * $sock_type 为 UnixSocket Stream/Dgram,此参数将被忽略 - * 监听 1024 以下的端口需要 root 权限 - * 0 随机可用端口 - * - * @param int $mode - * swoole_server的3种运行模式介绍 https://wiki.swoole.com/wiki/page/353.html - * - * @param int $sock_type - * swoole 支持的 Socket 类型 https://wiki.swoole.com/wiki/page/16.html - * $sock_type | SWOOLE_SSL 可以启用 SSL 隧道加密 - */ - function __construct($host, $port, $mode = SWOOLE_PROCESS, $sock_type = SWOOLE_SOCK_TCP) - { - } - - /** - * 启动server,监听所有TCP/UDP端口 https://wiki.swoole.com/wiki/page/19.html - * - * 启动成功后会创建worker_num+2个进程。主进程+Manager进程+worker_num个Worker进程 - * - * @return bool - */ - public function start(){} - - /** - * 向客户端发送数据 https://wiki.swoole.com/wiki/page/p-server/send.html - * - * * $data,发送的数据。TCP协议最大不得超过2M,UDP协议不得超过64K - * * 发送成功会返回true,如果连接已被关闭或发送失败会返回false - * - * TCP服务器 - * - * * send操作具有原子性,多个进程同时调用send向同一个连接发送数据,不会发生数据混杂 - * * 如果要发送超过2M的数据,可以将数据写入临时文件,然后通过sendfile接口进行发送 - * - * swoole-1.6以上版本不需要$from_id - * - * UDP服务器 - * - * * send操作会直接在worker进程内发送数据包,不会再经过主进程转发 - * * 使用fd保存客户端IP,from_id保存from_fd和port - * * 如果在onReceive后立即向客户端发送数据,可以不传$from_id - * * 如果向其他UDP客户端发送数据,必须要传入from_id - * * 在外网服务中发送超过64K的数据会分成多个传输单元进行发送,如果其中一个单元丢包,会导致整个包被丢弃。所以外网服务,建议发送1.5K以下的数据包 - * - * @param int $fd - * @param string $data - * @param int $from_id - * @return bool - */ - public function send($fd, $data, $from_id = 0){} - - /** - * 向任意的客户端IP:PORT发送UDP数据包 https://wiki.swoole.com/wiki/page/381.html - * - * * $ip为IPv4字符串,如192.168.1.102。如果IP不合法会返回错误 - * * $port为 1-65535的网络端口号,如果端口错误发送会失败 - * * $data要发送的数据内容,可以是文本或者二进制内容 - * * $ipv6 是否为IPv6地址,可选参数,默认为false - * - * 示例 - * - * //向IP地址为220.181.57.216主机的9502端口发送一个hello world字符串。 - * $server->sendto('220.181.57.216', 9502, "hello world"); - * //向IPv6服务器发送UDP数据包 - * $server->sendto('2600:3c00::f03c:91ff:fe73:e98f', 9501, "hello world", true); - * - * server必须监听了UDP的端口,才可以使用swoole_server->sendto - * server必须监听了UDP6的端口,才可以使用swoole_server->sendto向IPv6地址发送数据 - * - * @param string $ip - * @param int $port - * @param string $data - * @param int $server_socket 服务器可能会同时监听多个UDP端口,此参数可以指定使用哪个端口发送数据包 - * @return bool - */ - public function sendto($ip, $port, $data, $server_socket = -1){} - - /** - * 阻塞地向客户端发送数据 https://wiki.swoole.com/wiki/page/434.html - * sendwait目前仅可用于SWOOLE_BASE模式 - * - * @param int $fd - * @param string $send_data - */ - public function sendwait($fd, $send_data){} - - /** - * 关闭客户端连接 https://wiki.swoole.com/wiki/page/p-server/close.html - * - * !! swoole-1.6以上版本不需要$from_id swoole-1.5.8以下的版本,务必要传入正确的$from_id,否则可能会导致连接泄露 - * - * 操作成功返回true,失败返回false. - * - * Server主动close连接,也一样会触发onClose事件。不要在close之后写清理逻辑。应当放置到onClose回调中处理。 - * - * @param int $fd - * @param bool $reset true 会强制关闭连接,丢弃发送队列中的数据 - * @return bool - */ - public function close($fd, $reset = false) - { - } - - /** - * taskwait与task方法作用相同,用于投递一个异步的任务到task进程池去执行。 - * 与task不同的是taskwait是阻塞等待的,直到任务完成或者超时返回 - * - * $result为任务执行的结果,由$serv->finish函数发出。如果此任务超时,这里会返回false。 - * - * taskwait是阻塞接口,如果你的Server是全异步的请使用swoole_server::task和swoole_server::finish,不要使用taskwait - * 第3个参数可以制定要给投递给哪个task进程,传入ID即可,范围是0 - serv->task_worker_num - * $dst_worker_id在1.6.11+后可用,默认为随机投递 - * taskwait方法不能在task进程中调用 - * - * @param mixed $task_data - * @param float $timeout - * @param int $dst_worker_id - * @return string - */ - public function taskwait($task_data, $timeout = 0.5, $dst_worker_id = -1) - { - } - - /** - * 投递一个异步任务到task_worker池中。此函数会立即返回。worker进程可以继续处理新的请求 - * - * * $data要投递的任务数据,可以为除资源类型之外的任意PHP变量 - * * $dst_worker_id可以制定要给投递给哪个task进程,传入ID即可,范围是0 - serv->task_worker_num - * * 返回值为整数($task_id),表示此任务的ID。如果有finish回应,onFinish回调中会携带$task_id参数 - * - * 此功能用于将慢速的任务异步地去执行,比如一个聊天室服务器,可以用它来进行发送广播。当任务完成时,在task进程中调用$serv->finish("finish")告诉worker进程此任务已完成。当然swoole_server->finish是可选的。 - * - * * AsyncTask功能在1.6.4版本增加,默认不启动task功能,需要在手工设置task_worker_num来启动此功能 - * * task_worker的数量在swoole_server::set参数中调整,如task_worker_num => 64,表示启动64个进程来接收异步任务 - * - * - * 注意事项 - * - * * 使用swoole_server_task必须为Server设置onTask和onFinish回调,否则swoole_server->start会失败 - * * task操作的次数必须小于onTask处理速度,如果投递容量超过处理能力,task会塞满缓存区,导致worker进程发生阻塞。worker进程将无法接收新的请求 - * - * @param mixed $data - * @param int $dst_worker_id - * @param callable $callback onFinish函数,如果任务设置了回调函数,Task返回结果时会直接执行指定的回调函数,不再执行Server的onFinish回调 - * @return int|false 调用成功返回任务编号,失败(比如没启用task进程)返回false - */ - public function task($data, $dst_worker_id = -1, $callback = null) - { - } - - /** - * finish - * 此函数用于在task进程中通知worker进程,投递的任务已完成。此函数可以传递结果数据给worker进程。 - * finish方法可以连续多次调用,Worker进程会多次触发onFinish事件 - * 在onTask回调函数中调用过finish方法后,return数据依然会触发onFinish事件 - * @param string $data - * @return void - * @note 使用swoole_server::finish函数必须为Server设置onFinish回调函数。此函数只可用于task进程的onTask回调中 - */ - public function finish(string $data) - { - } - - /** - * 此函数可以向任意worker进程或者task进程发送消息。在非主进程和管理进程中可调用。收到消息的进程会触发onPipeMessage事件 https://wiki.swoole.com/wiki/page/363.html - * - * * $message为发送的消息数据内容 - * * $dst_worker_id为目标进程的ID,范围是0 ~ (worker_num + task_worker_num - 1) - * - * !! 使用sendMessage必须注册onPipeMessage事件回调函数 - * - * $serv = new swoole_server("0.0.0.0", 9501); - * $serv->set(array( - * 'worker_num' => 2, - * 'task_worker_num' => 2, - * )); - * $serv->on('pipeMessage', function($serv, $src_worker_id, $data) { - * echo "#{$serv->worker_id} message from #$src_worker_id: $data\n"; - * }); - * $serv->on('task', function ($serv, $task_id, $from_id, $data){ - * var_dump($task_id, $from_id, $data); - * }); - * $serv->on('finish', function ($serv, $fd, $from_id){ - * - * }); - * $serv->on('receive', function (swoole_server $serv, $fd, $from_id, $data) { - * if (trim($data) == 'task') - * { - * $serv->task("async task coming"); - * } - * else - * { - * $worker_id = 1 - $serv->worker_id; - * $serv->sendMessage("hello task process", $worker_id); - * } - * }); - * - * $serv->start(); - * - * @param mixed $message - * @param int $dst_worker_id - * @return bool - */ - public function sendMessage($message, $dst_worker_id = -1){} - - /** - * 次函数已废弃 https://wiki.swoole.com/wiki/page/223.html - */ -// public function finish($task_data){} - - /** - * 检测服务器所有连接,并找出已经超过约定时间的连接。 - * 如果指定if_close_connection,则自动关闭超时的连接。未指定仅返回连接的fd数组' - * - * * $if_close_connection是否关闭超时的连接,默认为true - * * 调用成功将返回一个连续数组,元素是已关闭的$fd。 - * * 调用失败返回false - * - * @param bool $if_close_connection - * @return array - */ - public function heartbeat($if_close_connection = true) - { - } - - /** - * 获取连接的信息 https://wiki.swoole.com/wiki/page/p-connection_info.html - * - * connection_info可用于UDP服务器,但需要传入from_id参数 - * - * array ( - * 'from_id' => 0, - * 'from_fd' => 12, - * 'connect_time' => 1392895129, - * 'last_time' => 1392895137, - * 'from_port' => 9501, - * 'remote_port' => 48918, - * 'remote_ip' => '127.0.0.1', - * ) - * - * * $udp_client = $serv->connection_info($fd, $from_id); - * * var_dump($udp_client); - * * from_id 来自哪个reactor线程 - * * server_fd 来自哪个server socket 这里不是客户端连接的fd - * * server_port 来自哪个Server端口 - * * remote_port 客户端连接的端口 - * * remote_ip 客户端连接的ip - * * connect_time 连接到Server的时间,单位秒 - * * last_time 最后一次发送数据的时间,单位秒 - * - * @param int $fd - * @param int $from_id - * @param bool $ignore_close - * @return array | bool - */ - public function connection_info($fd, $from_id = -1, $ignore_close = false) - { - } - - /** - * 用来遍历当前Server所有的客户端连接,connection_list方法是基于共享内存的,不存在IOWait,遍历的速度很快。另外connection_list会返回所有TCP连接,而不仅仅是当前worker进程的TCP连接 - * - * 示例: - * - * $start_fd = 0; - * while(true) - * { - * $conn_list = $serv->connection_list($start_fd, 10); - * if($conn_list===false or count($conn_list) === 0) - * { - * echo "finish\n"; - * break; - * } - * $start_fd = end($conn_list); - * var_dump($conn_list); - * foreach($conn_list as $fd) - * { - * $serv->send($fd, "broadcast"); - * } - * } - * - * @param int $start_fd - * @param int $pagesize - * @return array | bool - */ - public function connection_list($start_fd = -1, $pagesize = 10){} - - /** - * 重启所有worker进程 https://wiki.swoole.com/wiki/page/p-server/reload.html - * - * 一台繁忙的后端服务器随时都在处理请求,如果管理员通过kill进程方式来终止/重启服务器程序,可能导致刚好代码执行到一半终止。 这种情况下会产生数据的不一致。如交易系统中,支付逻辑的下一段是发货,假设在支付逻辑之后进程被终止了。会导致用户支付了货币,但并没有发货,后果非常严重。 - * - * Swoole提供了柔性终止/重启的机制,管理员只需要向SwooleServer发送特定的信号,Server的worker进程可以安全的结束。 - * - * * SIGTERM: 向主进程发送此信号服务器将安全终止 - * * 在PHP代码中可以调用$serv->shutdown()完成此操作 - * * SIGUSR1: 向管理进程发送SIGUSR1信号,将平稳地restart所有worker进程 - * * 在PHP代码中可以调用$serv->reload()完成此操作 - * * swoole的reload有保护机制,当一次reload正在进行时,收到新的重启信号会丢弃 - * - * #重启所有worker进程 - * kill -USR1 主进程PID - * - * 仅重启task_worker的功能。只需向服务器发送SIGUSR2即可。 - * - * #仅重启task进程 - * kill -USR2 主进程PID - * 平滑重启只对onWorkerStart或onReceive等在Worker进程中include/require的PHP文件有效,Server启动前就已经include/require的PHP文件,不能通过平滑重启重新加载 - * 对于Server的配置即$serv->set()中传入的参数设置,必须关闭/重启整个Server才可以重新加载 - * Server可以监听一个内网端口,然后可以接收远程的控制命令,去重启所有worker - * - * @return bool - */ - public function reload() - { - } - - /** - * 使当前worker进程停止运行,并立即触发onWorkerStop回调函数 https://wiki.swoole.com/wiki/page/547.html - * @param int $worker_id - * @param bool $waitEvent - */ - public function stop($worker_id = -1, $waitEvent = false) - { - } - - /** - * 关闭服务器 - * - * 此函数可以用在worker进程内。向主进程发送SIGTERM也可以实现关闭服务器。 - * - * kill -15 主进程PID - * @return bool - */ - public function shutdown() - { - } - - /** - * Swoole提供了swoole_server::addListener来增加监听的端口。业务代码中可以通过调用swoole_server::connection_info来获取某个连接来自于哪个端口 - * - * * SWOOLE_TCP/SWOOLE_SOCK_TCP tcp ipv4 socket - * * SWOOLE_TCP6/SWOOLE_SOCK_TCP6 tcp ipv6 socket - * * SWOOLE_UDP/SWOOLE_SOCK_UDP udp ipv4 socket - * * SWOOLE_UDP6/SWOOLE_SOCK_UDP6 udp ipv6 socket - * * SWOOLE_UNIX_DGRAM unix socket dgram - * * SWOOLE_UNIX_STREAM unix socket stream - * - * - * 可以混合使用UDP/TCP,同时监听内网和外网端口。 示例: - * - * $serv->addlistener("127.0.0.1", 9502, SWOOLE_SOCK_TCP); - * $serv->addlistener("192.168.1.100", 9503, SWOOLE_SOCK_TCP); - * $serv->addlistener("0.0.0.0", 9504, SWOOLE_SOCK_UDP); - * $serv->addlistener("/var/run/myserv.sock", 0, SWOOLE_UNIX_STREAM); - * - * @param string $host - * @param int $port - * @param int $type - * - * @return \swoole_server_port|bool 如果成功,1.8.0以上版本返回swoole_server_port,以下返回TRUE;如果失败返回FALSE - */ - public function addListener($host, $port, $type = SWOOLE_SOCK_TCP) - { - } - - /** - * 得到当前Server的活动TCP连接数,启动时间,accpet/close的总次数等信息 https://wiki.swoole.com/wiki/page/288.html - * - * array ( - * 'start_time' => 1409831644, - * 'connection_num' => 1, - * 'accept_count' => 1, - * 'close_count' => 0, - * ); - * - * * start_time 服务器启动的时间 - * * connection_num 当前连接的数量 - * * accept_count 接受了多少个连接 - * * close_count 关闭的连接数量 - * * tasking_num 当前正在排队的任务数 - * - * @return array - */ - function stats() - { - } - - /** - * 在指定的时间后执行函数 https://wiki.swoole.com/wiki/page/320.html - * - * swoole_server::after函数是一个一次性定时器,执行完成后就会销毁。 - * - * $after_time_ms 指定时间,单位为毫秒 - * $callback_function 时间到期后所执行的函数,必须是可以调用的。callback函数不接受任何参数 - * $after_time_ms 最大不得超过 86400000 - * 此方法是swoole_timer_after函数的别名 - * - * @param int $after_time_ms - * @param mixed $callback_function - * @param mixed $param - * @return int $timerId - */ - public function after($after_time_ms, $callback_function, $param = null) - { - } - - /** - * 增加监听端口,addListener 的别名 - * @param $host - * @param $port - * @param $type - * @return \Swoole\Server\Port|bool 如果成功,1.8.0以上版本返回swoole_server_port,以下返回TRUE;如果失败返回FALSE - */ - public function listen($host, $port, $type = SWOOLE_SOCK_TCP) - { - } - - /** - * - * 添加一个用户自定义的工作进程 https://wiki.swoole.com/wiki/page/390.html - * - * * $process 为swoole_process对象,注意不需要执行start。在swoole_server启动时会自动创建进程,并执行指定的子进程函数 - * * 创建的子进程可以调用$server对象提供的各个方法,如connection_list/connection_info/stats - * * 在worker进程中可以调用$process提供的方法与子进程进行通信 - * * 此函数通常用于创建一个特殊的工作进程,用于监控、上报或者其他特殊的任务。 - * - * 子进程会托管到Manager进程,如果发生致命错误,manager进程会重新创建一个 - * - * @param swoole_process|Process $process - */ - public function addProcess(swoole_process $process) - { - } - - /** - * 设置定时器。1.6.12版本前此函数不能用在消息队列模式下,1.6.12后消息队列IPC模式也可以使用定时器 - * - * 第二个参数是定时器的间隔时间,单位为毫秒。swoole定时器的最小颗粒是1毫秒。支持多个定时器。此函数可以用于worker进程中。 - * - * * swoole1.6.5之前支持的单位是秒,所以1.6.5之前传入的参数为1,那在1.6.5后需要传入1000 - * * swoole1.6.5之后,addtimer必须在onStart/onWorkerStart/onConnect/onReceive/onClose等回调函数中才可以使用,否则会抛出错误。并且定时器无效 - * * 注意不能存在2个相同间隔时间的定时器 - * * 即使在代码中多次添加一个定时器,也只会有1个生效 - * - * - * 增加定时器后需要为Server设置onTimer回调函数,否则Server将无法启动。多个定时器都会回调此函数。在这个函数内需要自行switch,根据interval的值来判断是来自于哪个定时器。 - * - * // 面向对象风格 - * $serv->addtimer(1000); //1s - * $serv->addtimer(20); //20ms - * - * @param int $interval - * @return bool - */ - public function addtimer($interval) - { - } - - /** - * 删除定时器 - * - * @param $interval - */ - public function deltimer($interval) - { - } - - /** - * 增加tick定时器 https://wiki.swoole.com/wiki/page/414.html - * - * 可以自定义回调函数。此函数是 swoole_timer_tick 的别名 - * - * worker进程结束运行后,所有定时器都会自动销毁 - * - * 设置一个间隔时钟定时器,与after定时器不同的是tick定时器会持续触发,直到调用swoole_timer_clear清除。与swoole_timer_add不同的是tick定时器可以存在多个相同间隔时间的定时器。 - * - * @param int $interval_ms - * @param mixed $callback - * @param mixed $param - * @return int $timerId - */ - public function tick($interval_ms, $callback, $param = null) - { - } - - /** - * 清除tick/after定时器,此函数是 swoole_timer_clear 的别名 - * @param int $id - */ - function clearTimer($id) - { - } - - /** - * 设置Server的事件回调函数 - * - * 第一个参数是swoole的资源对象 - * 第二个参数是回调的名称, 大小写不敏感,具体内容参考回调函数列表 - * 第三个函数是回调的PHP函数,可以是字符串,数组,匿名函数。比如 - * handler/on/set 方法只能在swoole_server::start前调用 - * - * - * $serv->handler('onStart', 'my_onStart'); - * $serv->handler('onStart', array($this, 'my_onStart')); - * $serv->handler('onStart', 'myClass::onStart'); - * - * @param string $event_name - * @param mixed $event_callback_function - * @return bool - */ - public function handler($event_name, $event_callback_function) - { - } - - /** - * 发送文件到TCP客户端连接 https://wiki.swoole.com/wiki/page/187.html - * - * sendfile函数调用OS提供的sendfile系统调用,由操作系统直接读取文件并写入socket。sendfile只有2次内存拷贝,使用此函数可以降低发送大量文件时操作系统的CPU和内存占用。 - * - * $filename 要发送的文件路径,如果文件不存在会返回false - * 操作成功返回true,失败返回false - * 此函数与swoole_server->send都是向客户端发送数据,不同的是sendfile的数据来自于指定的文件。 - * - * @param int $fd - * @param string $filename 文件绝对路径 - * @param int $offset - * @param int $length - * @return bool - */ - public function sendfile($fd, $filename, $offset =0, $length = 0){} - - /** - * 将连接绑定一个用户定义的ID,可以设置dispatch_mode=5设置已此ID值进行hash固定分配。可以保证某一个UID的连接全部会分配到同一个Worker进程 https://wiki.swoole.com/wiki/page/369.html - * - * 在默认的dispatch_mode=2设置下,server会按照socket fd来分配连接数据到不同的worker。 - * 因为fd是不稳定的,一个客户端断开后重新连接,fd会发生改变。这样这个客户端的数据就会被分配到别的Worker。 - * 使用bind之后就可以按照用户定义的ID进行分配。即使断线重连,相同uid的TCP连接数据会被分配相同的Worker进程。 - * - * * $fd 连接的文件描述符 - * * $uid 指定UID - * - * 同一个连接只能被bind一次,如果已经绑定了uid,再次调用bind会返回false - * 可以使用$serv->connection_info($fd) 查看连接所绑定uid的值 - * - * @param int $fd - * @param int $uid - * @return bool - */ - public function bind($fd, $uid) - { - } - - /** - * 根据监听的端口号获取ServerSocket,返回一个sockets资源 - * @param $port - * @return resource - */ - public function getSocket($port = 0) - { - - } - - /** - * 判断 fd 对应的连接是否存在 https://wiki.swoole.com/wiki/page/454.html - * - * @param int $fd - * @return bool - */ - public function exist($fd){} - - /** - * 停止接收数据 https://wiki.swoole.com/wiki/page/613.html - * - * @param int $fd - */ - public function pause($fd){} - - /** - * 恢复数据接收 https://wiki.swoole.com/wiki/page/614.html - * - * @param int $fd - */ - public function resume($fd){} - - /** - * 延后执行一个PHP函数 https://wiki.swoole.com/wiki/page/516.html - * @param callable $callback - */ - public function defer(callable $callback) - { - } - - /** - * @param int $fd - * @return bool | array - */ - function getClientInfo($fd) - { - - } - - /** - * 并发执行多个Task - * - * 执行成功返回一个结果数据,数组的key与传入的$tasks一致 - * 某个任务执行超时不会影响其他任务,返回的结果数据中将不包含超时的任务 - * - * @param array $tasks 必须为数字索引数组,不支持关联索引数组,底层会遍历$tasks将任务逐个投递到Task进程 - * @param double $timeout 为浮点型,单位为秒 - * @return array - */ - function taskWaitMulti(array $tasks, $timeout) - { - - } -} diff --git a/vendor/eaglewu/swoole-ide-helper/src/Server/Port.php b/vendor/eaglewu/swoole-ide-helper/src/Server/Port.php deleted file mode 100644 index fdcf5047..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Server/Port.php +++ /dev/null @@ -1,40 +0,0 @@ - - * Date: 2016/02/17 - */ - -namespace Swoole; - -/** - * Class Timer - * - * 异步定时器 - * - * @package Swoole - */ -class Timer -{ - /** - * 设置一个间隔时钟定时器,与after定时器不同的是tick定时器会持续触发,直到调用swoole_timer_clear清除。与swoole_timer_add不同的是tick定时器可以存在多个相同间隔时间的定时器。 - * - * @param int $ms 指定时间,单位为毫秒 - * @param callable $callback 时间到期后所执行的函数,必须是可以调用的。callback函数不接受任何参数 - * @param mixed $param 回调参数 - * @return int $timerId 定时器ID - */ - static function tick($ms, callable $callback, $param = null) - { - - } - - /** - * 在指定的时间后执行函数,需要swoole-1.7.7以上版本 - * - * @param int $ms 指定时间,单位为毫秒 - * @param callable $callback 时间到期后所执行的函数,必须是可以调用的。callback函数不接受任何参数 - * @return int $timerId 定时器ID - */ - static function after($ms, callable $callback) - { - - } - - /** - * 使用定时器ID来删除定时器 - * - * @param int $timerId 定时器ID,调用swoole_timer_add/swoole_timer_after 后会返回一个整数的ID - */ - static function clear($timerId) - { - - } -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Websocket/Frame.php b/vendor/eaglewu/swoole-ide-helper/src/Websocket/Frame.php deleted file mode 100644 index 6d6d5b90..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Websocket/Frame.php +++ /dev/null @@ -1,33 +0,0 @@ - - * Date: 2016/02/17 - */ - -namespace Swoole\WebSocket; - - -class Frame -{ - /** - * @var int - */ - public $fd; - - /** - * @var bool - */ - public $finish; - - /** - * @var string - */ - public $opcode; - - /** - * @var string - */ - public $data; -} \ No newline at end of file diff --git a/vendor/eaglewu/swoole-ide-helper/src/Websocket/Server.php b/vendor/eaglewu/swoole-ide-helper/src/Websocket/Server.php deleted file mode 100644 index 333c4ad1..00000000 --- a/vendor/eaglewu/swoole-ide-helper/src/Websocket/Server.php +++ /dev/null @@ -1,52 +0,0 @@ - - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/guzzlehttp/command/README.md b/vendor/guzzlehttp/command/README.md deleted file mode 100644 index e68772ce..00000000 --- a/vendor/guzzlehttp/command/README.md +++ /dev/null @@ -1,134 +0,0 @@ -# Guzzle Commands - -[![License](https://poser.pugx.org/guzzlehttp/command/license)](https://packagist.org/packages/guzzlehttp/command) -[![Build Status](https://travis-ci.org/guzzle/command.svg?branch=master)](https://travis-ci.org/guzzle/command) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/guzzle/command/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/guzzle/command/?branch=master) -[![Code Coverage](https://scrutinizer-ci.com/g/guzzle/command/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/guzzle/command/?branch=master) -[![SensioLabsInsight](https://insight.sensiolabs.com/projects/7a93338e-50cd-42f7-9299-17c44d92148f/mini.png)](https://insight.sensiolabs.com/projects/7a93338e-50cd-42f7-9299-17c44d92148f) -[![Latest Stable Version](https://poser.pugx.org/guzzlehttp/command/v/stable)](https://packagist.org/packages/guzzlehttp/command) -[![Latest Unstable Version](https://poser.pugx.org/guzzlehttp/command/v/unstable)](https://packagist.org/packages/guzzlehttp/command) -[![Total Downloads](https://poser.pugx.org/guzzlehttp/command/downloads)](https://packagist.org/packages/guzzlehttp/command) - -This library uses Guzzle (``guzzlehttp/guzzle``, version 6.x) and provides the -foundations to create fully-featured web service clients by abstracting Guzzle -HTTP **requests** and **responses** into higher-level **commands** and -**results**. A **middleware** system, analogous to — but separate from — the one -in the HTTP layer may be used to customize client behavior when preparing -commands into requests and processing responses into results. - -### Commands - -Key-value pair objects representing an operation of a web service. Commands have a name and a set of parameters. - -### Results - -Key-value pair objects representing the processed result of executing an operation of a web service. - -## Installing - -This project can be installed using Composer: - -``composer require guzzlehttp/command`` - -For **Guzzle 5**, use ``composer require guzzlehttp/command:0.8.*``. The source -code for the Guzzle 5 version is available on the -`0.8 branch `_. - -**Note:** If Composer is not -`installed globally `_, -then you may need to run the preceding Composer commands using -``php composer.phar`` (where ``composer.phar`` is the path to your copy of -Composer), instead of just ``composer``. - -## Service Clients - -Service Clients are web service clients that implement the -``GuzzleHttp\Command\ServiceClientInterface`` and use an underlying Guzzle HTTP -client (``GuzzleHttp\Client``) to communicate with the service. Service clients -create and execute **commands** (``GuzzleHttp\Command\CommandInterface``), -which encapsulate operations within the web service, including the operation -name and parameters. This library provides a generic implementation of a service -client: the ``GuzzleHttp\Command\ServiceClient`` class. - -## Instantiating a Service Client - -@TODO Add documentation - -* ``ServiceClient``'s constructor -* Transformer functions (``$commandToRequestTransformer`` and ``$responseToResultTransformer``) -* The ``HandlerStack`` - -## Executing Commands - -Service clients create command objects using the ``getCommand()`` method. - -```php -$commandName = 'foo'; -$arguments = ['baz' => 'bar']; -$command = $client->getCommand($commandName, $arguments); - -``` - -After creating a command, you may execute the command using the ``execute()`` -method of the client. - -```php -$result = $client->execute($command); -``` - -The result of executing a command will be a ``GuzzleHttp\Command\ResultInterface`` -object. Result objects are ``ArrayAccess``-ible and contain the data parsed from -HTTP response. - -Service clients have magic methods that act as shortcuts to executing commands -by name without having to create the ``Command`` object in a separate step -before executing it. - -```php -$result = $client->foo(['baz' => 'bar']); -``` - -## Asynchronous Commands - -@TODO Add documentation - -* ``-Async`` suffix for client methods -* Promises - -```php -// Create and execute an asynchronous command. -$command = $command = $client->getCommand('foo', ['baz' => 'bar']); -$promise = $client->executeAsync($command); - -// Use asynchronous commands with magic methods. -$promise = $client->fooAsync(['baz' => 'bar']); -``` - -@TODO Add documentation - -* ``wait()``-ing on promises. - -```php -$result = $promise->wait(); - -echo $result['fizz']; //> 'buzz' -``` - -## Concurrent Requests - -@TODO Add documentation - -* ``executeAll()`` -* ``executeAllAsync()``. -* Options (``fulfilled``, ``rejected``, ``concurrency``) - -## Middleware: Extending the Client - -Middleware can be added to the service client or underlying HTTP client to -implement additional behavior and customize the ``Command``-to-``Result`` and -``Request``-to-``Response`` lifecycles, respectively. - -## Todo - -* Middleware system and command vs request layers -* The ``HandlerStack`` diff --git a/vendor/guzzlehttp/command/composer.json b/vendor/guzzlehttp/command/composer.json deleted file mode 100644 index 3886e324..00000000 --- a/vendor/guzzlehttp/command/composer.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "guzzlehttp/command", - "description": "Provides the foundation for building command-based web service clients", - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - } - ], - "require": { - "php": ">=5.5.0", - "guzzlehttp/guzzle": "^6.2", - "guzzlehttp/promises": "~1.3", - "guzzlehttp/psr7": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Command\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "0.9-dev" - } - } -} diff --git a/vendor/guzzlehttp/command/src/Command.php b/vendor/guzzlehttp/command/src/Command.php deleted file mode 100644 index cff70a2b..00000000 --- a/vendor/guzzlehttp/command/src/Command.php +++ /dev/null @@ -1,55 +0,0 @@ -name = $name; - $this->data = $args; - $this->handlerStack = $handlerStack; - } - - public function getHandlerStack() - { - return $this->handlerStack; - } - - public function getName() - { - return $this->name; - } - - public function hasParam($name) - { - return array_key_exists($name, $this->data); - } - - public function __clone() - { - if ($this->handlerStack) { - $this->handlerStack = clone $this->handlerStack; - } - } -} diff --git a/vendor/guzzlehttp/command/src/CommandInterface.php b/vendor/guzzlehttp/command/src/CommandInterface.php deleted file mode 100644 index 5d23c993..00000000 --- a/vendor/guzzlehttp/command/src/CommandInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -getCommand()) { - return $prev; - } - - // If the exception is a RequestException, get the Request and Response. - $request = $response = null; - if ($prev instanceof RequestException) { - $request = $prev->getRequest(); - $response = $prev->getResponse(); - } - - // Throw a more specific exception for 4XX or 5XX responses. - $class = self::class; - $statusCode = $response ? $response->getStatusCode() : 0; - if ($statusCode >= 400 && $statusCode < 500) { - $class = CommandClientException::class; - } elseif ($statusCode >= 500 && $statusCode < 600) { - $class = CommandServerException::class; - } - - // Prepare the message. - $message = 'There was an error executing the ' . $command->getName() - . ' command: ' . $prev->getMessage(); - - // Create the exception. - return new $class($message, $command, $prev, $request, $response); - } - - /** - * @param string $message Exception message - * @param CommandInterface $command - * @param \Exception $previous Previous exception (if any) - * @param RequestInterface $request - * @param ResponseInterface $response - */ - public function __construct( - $message, - CommandInterface $command, - \Exception $previous = null, - RequestInterface $request = null, - ResponseInterface $response = null - ) { - $this->command = $command; - $this->request = $request; - $this->response = $response; - parent::__construct($message, 0, $previous); - } - - /** - * Gets the command that failed. - * - * @return CommandInterface - */ - public function getCommand() - { - return $this->command; - } - - /** - * Gets the request that caused the exception - * - * @return RequestInterface|null - */ - public function getRequest() - { - return $this->request; - } - - /** - * Gets the associated response - * - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/vendor/guzzlehttp/command/src/Exception/CommandServerException.php b/vendor/guzzlehttp/command/src/Exception/CommandServerException.php deleted file mode 100644 index 22356b52..00000000 --- a/vendor/guzzlehttp/command/src/Exception/CommandServerException.php +++ /dev/null @@ -1,7 +0,0 @@ -data; - } - - public function offsetExists($offset) - { - return array_key_exists($offset, $this->data); - } - - public function offsetGet($offset) - { - return isset($this->data[$offset]) ? $this->data[$offset] : null; - } - - public function offsetSet($offset, $value) - { - $this->data[$offset] = $value; - } - - public function offsetUnset($offset) - { - unset($this->data[$offset]); - } - - public function count() - { - return count($this->data); - } - - public function getIterator() - { - return new \ArrayIterator($this->data); - } - - public function toArray() - { - return $this->data; - } -} diff --git a/vendor/guzzlehttp/command/src/Result.php b/vendor/guzzlehttp/command/src/Result.php deleted file mode 100644 index 3041caf2..00000000 --- a/vendor/guzzlehttp/command/src/Result.php +++ /dev/null @@ -1,18 +0,0 @@ -data = $data; - } -} diff --git a/vendor/guzzlehttp/command/src/ResultInterface.php b/vendor/guzzlehttp/command/src/ResultInterface.php deleted file mode 100644 index 4ae49a8d..00000000 --- a/vendor/guzzlehttp/command/src/ResultInterface.php +++ /dev/null @@ -1,9 +0,0 @@ -httpClient = $httpClient; - $this->commandToRequestTransformer = $commandToRequestTransformer; - $this->responseToResultTransformer = $responseToResultTransformer; - $this->handlerStack = $commandHandlerStack ?: new HandlerStack(); - $this->handlerStack->setHandler($this->createCommandHandler()); - } - - public function getHttpClient() - { - return $this->httpClient; - } - - public function getHandlerStack() - { - return $this->handlerStack; - } - - public function getCommand($name, array $params = []) - { - return new Command($name, $params, clone $this->handlerStack); - } - - public function execute(CommandInterface $command) - { - return $this->executeAsync($command)->wait(); - } - - public function executeAsync(CommandInterface $command) - { - $stack = $command->getHandlerStack() ?: $this->handlerStack; - $handler = $stack->resolve(); - - return $handler($command); - } - - public function executeAll($commands, array $options = []) - { - // Modify provided callbacks to track results. - $results = []; - $options['fulfilled'] = function ($v, $k) use (&$results, $options) { - if (isset($options['fulfilled'])) { - $options['fulfilled']($v, $k); - } - $results[$k] = $v; - }; - $options['rejected'] = function ($v, $k) use (&$results, $options) { - if (isset($options['rejected'])) { - $options['rejected']($v, $k); - } - $results[$k] = $v; - }; - - // Execute multiple commands synchronously, then sort and return the results. - return $this->executeAllAsync($commands, $options) - ->then(function () use (&$results) { - ksort($results); - return $results; - }) - ->wait(); - } - - public function executeAllAsync($commands, array $options = []) - { - // Apply default concurrency. - if (!isset($options['concurrency'])) { - $options['concurrency'] = 25; - } - - // Convert the iterator of commands to a generator of promises. - $commands = Promise\iter_for($commands); - $promises = function () use ($commands) { - foreach ($commands as $key => $command) { - if (!$command instanceof CommandInterface) { - throw new \InvalidArgumentException('The iterator must ' - . 'yield instances of ' . CommandInterface::class); - } - yield $key => $this->executeAsync($command); - } - }; - - // Execute the commands using a pool. - return (new Promise\EachPromise($promises(), $options))->promise(); - } - - /** - * Creates and executes a command for an operation by name. - * - * @param string $name Name of the command to execute. - * @param array $args Arguments to pass to the getCommand method. - * - * @return ResultInterface|PromiseInterface - * @see \GuzzleHttp\Command\ServiceClientInterface::getCommand - */ - public function __call($name, array $args) - { - $args = isset($args[0]) ? $args[0] : []; - if (substr($name, -5) === 'Async') { - $command = $this->getCommand(substr($name, 0, -5), $args); - return $this->executeAsync($command); - } else { - return $this->execute($this->getCommand($name, $args)); - } - } - - /** - * Defines the main handler for commands that uses the HTTP client. - * - * @return callable - */ - private function createCommandHandler() - { - return function (CommandInterface $command) { - return Promise\coroutine(function () use ($command) { - // Prepare the HTTP options. - $opts = $command['@http'] ?: []; - unset($command['@http']); - - try { - // Prepare the request from the command and send it. - $request = $this->transformCommandToRequest($command); - $promise = $this->httpClient->sendAsync($request, $opts); - - // Create a result from the response. - $response = (yield $promise); - yield $this->transformResponseToResult($response, $request, $command); - } catch (\Exception $e) { - throw CommandException::fromPrevious($command, $e); - } - }); - }; - } - - /** - * Transforms a Command object into a Request object. - * - * @param CommandInterface $command - * @return RequestInterface - */ - private function transformCommandToRequest(CommandInterface $command) - { - $transform = $this->commandToRequestTransformer; - - return $transform($command); - } - - - /** - * Transforms a Response object, also using data from the Request object, - * into a Result object. - * - * @param ResponseInterface $response - * @param RequestInterface $request - * @param CommandInterface $command - * @return ResultInterface - */ - private function transformResponseToResult( - ResponseInterface $response, - RequestInterface $request, - CommandInterface $command - ) { - $transform = $this->responseToResultTransformer; - - return $transform($response, $request, $command); - } -} diff --git a/vendor/guzzlehttp/command/src/ServiceClientInterface.php b/vendor/guzzlehttp/command/src/ServiceClientInterface.php deleted file mode 100644 index 1f418377..00000000 --- a/vendor/guzzlehttp/command/src/ServiceClientInterface.php +++ /dev/null @@ -1,92 +0,0 @@ -getConfig\('defaults'\) [\#84](https://github.com/guzzle/guzzle-services/pull/84) ([fuhry](https://github.com/fuhry)) - -- Fixing issue \#82 to address regression for handling elements with the sa... [\#83](https://github.com/guzzle/guzzle-services/pull/83) ([sprak3000](https://github.com/sprak3000)) - -- Fix for specified property but no value in json \(notice for undefined in... [\#76](https://github.com/guzzle/guzzle-services/pull/76) ([rfink](https://github.com/rfink)) - -- Add ErrorHandler subscriber [\#67](https://github.com/guzzle/guzzle-services/pull/67) ([bakura10](https://github.com/bakura10)) - -- Fix combine base url and command uri [\#108](https://github.com/guzzle/guzzle-services/pull/108) ([vlastv](https://github.com/vlastv)) - -- Fixing JsonLocation::visit\(\) not returning a request \#106 [\#107](https://github.com/guzzle/guzzle-services/pull/107) ([Pinolo](https://github.com/Pinolo)) - -- Fix call to undefined method "GuzzleHttp\Psr7\Uri::combine" [\#105](https://github.com/guzzle/guzzle-services/pull/105) ([horrorin](https://github.com/horrorin)) - -- fix description for get request example [\#87](https://github.com/guzzle/guzzle-services/pull/87) ([snoek09](https://github.com/snoek09)) - -- Allow raw values \(non array/object\) for root model definitions [\#74](https://github.com/guzzle/guzzle-services/pull/74) ([rfink](https://github.com/rfink)) - -- Allow shortened definition of properties by assigning them directly to a type [\#72](https://github.com/guzzle/guzzle-services/pull/72) ([rfink](https://github.com/rfink)) - -## [0.5.0](https://github.com/guzzle/guzzle-services/tree/0.5.0) (2014-12-23) - -[Full Changelog](https://github.com/guzzle/guzzle-services/compare/0.4.0...0.5.0) - -**Closed issues:** - -- Does it supports custom class instantiate to define an operation using a service description [\#62](https://github.com/guzzle/guzzle-services/issues/62) - -- Tag version 0.4.0 [\#61](https://github.com/guzzle/guzzle-services/issues/61) - -- XmlLocation not adding attributes to non-leaf child nodes [\#52](https://github.com/guzzle/guzzle-services/issues/52) - -- XmlLocation response not handling multiple tags of the same name correctly [\#51](https://github.com/guzzle/guzzle-services/issues/51) - -- Validation Bug [\#47](https://github.com/guzzle/guzzle-services/issues/47) - -- CommandException doesn't contain response data [\#44](https://github.com/guzzle/guzzle-services/issues/44) - -- \[Fix included\] XmlLocation requires text value to have attributes [\#37](https://github.com/guzzle/guzzle-services/issues/37) - -- Question: Mocking a Response does not throw exception [\#35](https://github.com/guzzle/guzzle-services/issues/35) - -- allow default 'location' on Model [\#26](https://github.com/guzzle/guzzle-services/issues/26) - -- create mock subscriber requests from descriptions [\#25](https://github.com/guzzle/guzzle-services/issues/25) - -**Merged pull requests:** - -- Documentation: Add 'boolean-string' as a supported "format" value [\#63](https://github.com/guzzle/guzzle-services/pull/63) ([jwcobb](https://github.com/jwcobb)) - -## [0.4.0](https://github.com/guzzle/guzzle-services/tree/0.4.0) (2014-11-03) - -[Full Changelog](https://github.com/guzzle/guzzle-services/compare/0.3.0...0.4.0) - -**Closed issues:** - -- Exceptions Thrown From Subscribers Are Ignored? [\#58](https://github.com/guzzle/guzzle-services/issues/58) - -- Totally Broken With Guzzle 5 [\#57](https://github.com/guzzle/guzzle-services/issues/57) - -- GuzzleHTTP/Command Dependency fail [\#50](https://github.com/guzzle/guzzle-services/issues/50) - -- Request parameter PathLocation [\#46](https://github.com/guzzle/guzzle-services/issues/46) - -- Requesting a new version tag [\#45](https://github.com/guzzle/guzzle-services/issues/45) - -- CommandException expects second parameter to be CommandTransaction instance [\#43](https://github.com/guzzle/guzzle-services/issues/43) - -- Cannot add Autorization header to my requests [\#39](https://github.com/guzzle/guzzle-services/issues/39) - -- Resouce Itterators [\#36](https://github.com/guzzle/guzzle-services/issues/36) - -- Question [\#33](https://github.com/guzzle/guzzle-services/issues/33) - -- query location array can be comma separated [\#31](https://github.com/guzzle/guzzle-services/issues/31) - -- Automatically returns array from command? [\#30](https://github.com/guzzle/guzzle-services/issues/30) - -- Arrays nested under objects in JSON response broken? [\#27](https://github.com/guzzle/guzzle-services/issues/27) - -- Question? [\#23](https://github.com/guzzle/guzzle-services/issues/23) - -**Merged pull requests:** - -- Bump the version in the readme [\#60](https://github.com/guzzle/guzzle-services/pull/60) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Bump the next version to 0.4 [\#56](https://github.com/guzzle/guzzle-services/pull/56) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Fixed the guzzlehttp/command version constraint [\#55](https://github.com/guzzle/guzzle-services/pull/55) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Work with latest Guzzle 5 and Command updates [\#54](https://github.com/guzzle/guzzle-services/pull/54) ([mtdowling](https://github.com/mtdowling)) - -- Addressing Issue \#51 & Issue \#52 [\#53](https://github.com/guzzle/guzzle-services/pull/53) ([sprak3000](https://github.com/sprak3000)) - -- added description interface to extend it [\#49](https://github.com/guzzle/guzzle-services/pull/49) ([danieledangeli](https://github.com/danieledangeli)) - -- Update readme to improve documentation \(\#46\) [\#48](https://github.com/guzzle/guzzle-services/pull/48) ([bonndan](https://github.com/bonndan)) - -- Fixed the readme version constraint [\#42](https://github.com/guzzle/guzzle-services/pull/42) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Update .travis.yml [\#41](https://github.com/guzzle/guzzle-services/pull/41) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Added a branch alias [\#40](https://github.com/guzzle/guzzle-services/pull/40) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Fixes Response\XmlLocation requires text value [\#38](https://github.com/guzzle/guzzle-services/pull/38) ([magnetik](https://github.com/magnetik)) - -- Removing unnecessary \(\) from docblock [\#32](https://github.com/guzzle/guzzle-services/pull/32) ([jamiehannaford](https://github.com/jamiehannaford)) - -- Fix JSON response location so that both is supported: arrays nested unde... [\#28](https://github.com/guzzle/guzzle-services/pull/28) ([ukautz](https://github.com/ukautz)) - -- Throw Any Exceptions On Process [\#59](https://github.com/guzzle/guzzle-services/pull/59) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Allow extension to work recursively over models [\#34](https://github.com/guzzle/guzzle-services/pull/34) ([jamiehannaford](https://github.com/jamiehannaford)) - -- A custom class can be configured for command instances. [\#29](https://github.com/guzzle/guzzle-services/pull/29) ([robinvdvleuten](https://github.com/robinvdvleuten)) - -- \[WIP\] doing some experimentation [\#24](https://github.com/guzzle/guzzle-services/pull/24) ([cordoval](https://github.com/cordoval)) - -## [0.3.0](https://github.com/guzzle/guzzle-services/tree/0.3.0) (2014-06-01) - -[Full Changelog](https://github.com/guzzle/guzzle-services/compare/0.2.0...0.3.0) - -**Closed issues:** - -- Testing Guzzle Services doesn't work [\#19](https://github.com/guzzle/guzzle-services/issues/19) - -- Description factory [\#18](https://github.com/guzzle/guzzle-services/issues/18) - -- support to load service description from file [\#15](https://github.com/guzzle/guzzle-services/issues/15) - -- Update dependency on guzzlehttp/command [\#11](https://github.com/guzzle/guzzle-services/issues/11) - -**Merged pull requests:** - -- Add license file [\#22](https://github.com/guzzle/guzzle-services/pull/22) ([siwinski](https://github.com/siwinski)) - -- Fix 'Invalid argument supplied for foreach\(\)' [\#21](https://github.com/guzzle/guzzle-services/pull/21) ([Olden](https://github.com/Olden)) - -- Fixed string zero \('0'\) values not being filtered in XML. [\#20](https://github.com/guzzle/guzzle-services/pull/20) ([dragonwize](https://github.com/dragonwize)) - -- baseUrl can be a string or an uri template [\#16](https://github.com/guzzle/guzzle-services/pull/16) ([robinvdvleuten](https://github.com/robinvdvleuten)) - -## [0.2.0](https://github.com/guzzle/guzzle-services/tree/0.2.0) (2014-03-30) - -[Full Changelog](https://github.com/guzzle/guzzle-services/compare/0.1.0...0.2.0) - -**Closed issues:** - -- please remove wiki [\#13](https://github.com/guzzle/guzzle-services/issues/13) - -- Parameter validation fails for union types [\#12](https://github.com/guzzle/guzzle-services/issues/12) - -- question on integration with Guzzle4 [\#8](https://github.com/guzzle/guzzle-services/issues/8) - -- typehints for operations property [\#6](https://github.com/guzzle/guzzle-services/issues/6) - -- improve exception message [\#5](https://github.com/guzzle/guzzle-services/issues/5) - -**Merged pull requests:** - -- Update composer.json [\#14](https://github.com/guzzle/guzzle-services/pull/14) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Update composer.json [\#9](https://github.com/guzzle/guzzle-services/pull/9) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- some fixes [\#4](https://github.com/guzzle/guzzle-services/pull/4) ([cordoval](https://github.com/cordoval)) - -- Fix the CommandException path used in ValidateInput [\#2](https://github.com/guzzle/guzzle-services/pull/2) ([mookle](https://github.com/mookle)) - -- Minor improvements [\#1](https://github.com/guzzle/guzzle-services/pull/1) ([GrahamCampbell](https://github.com/GrahamCampbell)) - -- Use latest guzzlehttp/command to fix dependencies [\#10](https://github.com/guzzle/guzzle-services/pull/10) ([sbward](https://github.com/sbward)) - -- some collaboration using Gush :\) [\#3](https://github.com/guzzle/guzzle-services/pull/3) ([cordoval](https://github.com/cordoval)) - -## [0.1.0](https://github.com/guzzle/guzzle-services/tree/0.1.0) (2014-03-15) - - - -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/vendor/guzzlehttp/guzzle-services/LICENSE b/vendor/guzzlehttp/guzzle-services/LICENSE deleted file mode 100644 index 71d3b783..00000000 --- a/vendor/guzzlehttp/guzzle-services/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/guzzlehttp/guzzle-services/Makefile b/vendor/guzzlehttp/guzzle-services/Makefile deleted file mode 100644 index cfb82e45..00000000 --- a/vendor/guzzlehttp/guzzle-services/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -all: clean test - -test: - vendor/bin/phpunit - -coverage: - vendor/bin/phpunit --coverage-html=artifacts/coverage - -view-coverage: - open artifacts/coverage/index.html - -clean: - rm -rf artifacts/* - -.PHONY: coverage diff --git a/vendor/guzzlehttp/guzzle-services/README.md b/vendor/guzzlehttp/guzzle-services/README.md deleted file mode 100644 index 196c8a9b..00000000 --- a/vendor/guzzlehttp/guzzle-services/README.md +++ /dev/null @@ -1,129 +0,0 @@ -# Guzzle Services - -[![License](https://poser.pugx.org/guzzlehttp/guzzle-services/license)](https://packagist.org/packages/guzzlehttp/guzzle-services) -[![Build Status](https://travis-ci.org/guzzle/guzzle-services.svg?branch=master)](https://travis-ci.org/guzzle/guzzle-services) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/guzzle/guzzle-services/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/guzzle/guzzle-services/?branch=master) -[![Code Coverage](https://scrutinizer-ci.com/g/guzzle/guzzle-services/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/guzzle/guzzle-services/?branch=master) -[![SensioLabsInsight](https://insight.sensiolabs.com/projects/b08be676-b209-40b7-a6df-b6d13e8dff62/mini.png)](https://insight.sensiolabs.com/projects/b08be676-b209-40b7-a6df-b6d13e8dff62) -[![Latest Stable Version](https://poser.pugx.org/guzzlehttp/guzzle-services/v/stable)](https://packagist.org/packages/guzzlehttp/guzzle-services) -[![Latest Unstable Version](https://poser.pugx.org/guzzlehttp/guzzle-services/v/unstable)](https://packagist.org/packages/guzzlehttp/guzzle-services) -[![Total Downloads](https://poser.pugx.org/guzzlehttp/guzzle-services/downloads)](https://packagist.org/packages/guzzlehttp/guzzle-services) - -Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures. - -```php -use GuzzleHttp\Client; -use GuzzleHttp\Command\Guzzle\GuzzleClient; -use GuzzleHttp\Command\Guzzle\Description; - -$client = new Client(); -$description = new Description([ - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'testing' => [ - 'httpMethod' => 'GET', - 'uri' => '/get{?foo}', - 'responseModel' => 'getResponse', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'location' => 'uri' - ], - 'bar' => [ - 'type' => 'string', - 'location' => 'query' - ] - ] - ] - ], - 'models' => [ - 'getResponse' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'location' => 'json' - ] - ] - ] -]); - -$guzzleClient = new GuzzleClient($client, $description); - -$result = $guzzleClient->testing(['foo' => 'bar']); -echo $result['args']['foo']; -// bar -``` - -## Installing - -This project can be installed using Composer: - -``composer require guzzlehttp/guzzle-services`` - -For **Guzzle 5**, use ``composer require guzzlehttp/guzzle-services:0.6``. - -**Note:** If Composer is not installed [globally](https://getcomposer.org/doc/00-intro.md#globally) then you may need to run the preceding Composer commands using ``php composer.phar`` (where ``composer.phar`` is the path to your copy of Composer), instead of just ``composer``. - -## Plugins - -* Load Service description from file [https://github.com/gimler/guzzle-description-loader] - -## Transition guide from Guzzle 5.0 to 6.0 - -### Change regarding PostField and PostFile - -The request locations `postField` and `postFile` were removed in favor of `formParam` and `multipart`. If your description looks like - -```php -[ - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'testing' => [ - 'httpMethod' => 'GET', - 'uri' => '/get{?foo}', - 'responseModel' => 'getResponse', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'location' => 'postField' - ], - 'bar' => [ - 'type' => 'string', - 'location' => 'postFile' - ] - ] - ] - ], -] -``` - -you need to change `postField` to `formParam` and `postFile` to `multipart`. - -More documentation coming soon. - -## Cookbook - -### Changing the way query params are serialized - -By default, query params are serialized using strict RFC3986 rules, using `http_build_query` method. With this, array params are serialized this way: - -```php -$client->myMethod(['foo' => ['bar', 'baz']]); - -// Query params will be foo[0]=bar&foo[1]=baz -``` - -However, a lot of APIs in the wild require the numeric indices to be removed, so that the query params end up being `foo[]=bar&foo[]=baz`. You -can easily change the behaviour by creating your own serializer and overriding the "query" request location: - -```php -use GuzzleHttp\Command\Guzzle\GuzzleClient; -use GuzzleHttp\Command\Guzzle\RequestLocation\QueryLocation; -use GuzzleHttp\Command\Guzzle\QuerySerializer\Rfc3986Serializer; -use GuzzleHttp\Command\Guzzle\Serializer; - -$queryLocation = new QueryLocation('query', new Rfc3986Serializer(true)); -$serializer = new Serializer($description, ['query' => $queryLocation]); -$guzzleClient = new GuzzleClient($client, $description, $serializer); -``` - -You can also create your own serializer if you have specific needs. \ No newline at end of file diff --git a/vendor/guzzlehttp/guzzle-services/composer.json b/vendor/guzzlehttp/guzzle-services/composer.json deleted file mode 100644 index 645e44b2..00000000 --- a/vendor/guzzlehttp/guzzle-services/composer.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "guzzlehttp/guzzle-services", - "description": "Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - }, - { - "name": "Stefano Kowalke", - "email": "blueduck@mail.org", - "homepage": "https://github.com/konafets" - } - ], - "require": { - "php": ">=5.5", - "guzzlehttp/guzzle": "^6.2", - "guzzlehttp/command": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Command\\Guzzle\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\Tests\\Command\\Guzzle\\": "tests/" - } - }, - "suggest": { - "gimler/guzzle-description-loader": "^0.0.4" - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/vendor/guzzlehttp/guzzle-services/phpunit.xml.dist b/vendor/guzzlehttp/guzzle-services/phpunit.xml.dist deleted file mode 100644 index 994e1584..00000000 --- a/vendor/guzzlehttp/guzzle-services/phpunit.xml.dist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - tests - - - - - src - - - diff --git a/vendor/guzzlehttp/guzzle-services/src/Description.php b/vendor/guzzlehttp/guzzle-services/src/Description.php deleted file mode 100644 index b8d060ea..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/Description.php +++ /dev/null @@ -1,265 +0,0 @@ -{$key} = $config[$key]; - } - } - - // Set the baseUri - // Account for the old style of using baseUrl - if (isset($config['baseUrl'])) { - $config['baseUri'] = $config['baseUrl']; - } - $this->baseUri = isset($config['baseUri']) ? new Uri($config['baseUri']) : new Uri(); - - // Ensure that the models and operations properties are always arrays - $this->models = (array) $this->models; - $this->operations = (array) $this->operations; - - // We want to add operations differently than adding the other properties - $defaultKeys[] = 'operations'; - - // Create operations for each operation - if (isset($config['operations'])) { - foreach ($config['operations'] as $name => $operation) { - if (!is_array($operation)) { - throw new \InvalidArgumentException('Operations must be arrays'); - } - $this->operations[$name] = $operation; - } - } - - // Get all of the additional properties of the service description and - // store them in a data array - foreach (array_diff(array_keys($config), $defaultKeys) as $key) { - $this->extraData[$key] = $config[$key]; - } - - // Configure the schema formatter - if (isset($options['formatter'])) { - $this->formatter = $options['formatter']; - } else { - static $defaultFormatter; - if (!$defaultFormatter) { - $defaultFormatter = new SchemaFormatter(); - } - $this->formatter = $defaultFormatter; - } - } - - /** - * Get the basePath/baseUri of the description - * - * @return Uri - */ - public function getBaseUri() - { - return $this->baseUri; - } - - /** - * Get the API operations of the service - * - * @return Operation[] Returns an array of {@see Operation} objects - */ - public function getOperations() - { - return $this->operations; - } - - /** - * Check if the service has an operation by name - * - * @param string $name Name of the operation to check - * - * @return bool - */ - public function hasOperation($name) - { - return isset($this->operations[$name]); - } - - /** - * Get an API operation by name - * - * @param string $name Name of the command - * - * @return Operation - * @throws \InvalidArgumentException if the operation is not found - */ - public function getOperation($name) - { - if (!$this->hasOperation($name)) { - throw new \InvalidArgumentException("No operation found named $name"); - } - - // Lazily create operations as they are retrieved - if (!($this->operations[$name] instanceof Operation)) { - $this->operations[$name]['name'] = $name; - $this->operations[$name] = new Operation($this->operations[$name], $this); - } - - return $this->operations[$name]; - } - - /** - * Get a shared definition structure. - * - * @param string $id ID/name of the model to retrieve - * - * @return Parameter - * @throws \InvalidArgumentException if the model is not found - */ - public function getModel($id) - { - if (!$this->hasModel($id)) { - throw new \InvalidArgumentException("No model found named $id"); - } - - // Lazily create models as they are retrieved - if (!($this->models[$id] instanceof Parameter)) { - $this->models[$id] = new Parameter( - $this->models[$id], - ['description' => $this] - ); - } - - return $this->models[$id]; - } - - /** - * Get all models of the service description. - * - * @return array - */ - public function getModels() - { - $models = []; - foreach ($this->models as $name => $model) { - $models[$name] = $this->getModel($name); - } - - return $models; - } - - /** - * Check if the service description has a model by name. - * - * @param string $id Name/ID of the model to check - * - * @return bool - */ - public function hasModel($id) - { - return isset($this->models[$id]); - } - - /** - * Get the API version of the service - * - * @return string - */ - public function getApiVersion() - { - return $this->apiVersion; - } - - /** - * Get the name of the API - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Get a summary of the purpose of the API - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Format a parameter using named formats. - * - * @param string $format Format to convert it to - * @param mixed $input Input string - * - * @return mixed - */ - public function format($format, $input) - { - return $this->formatter->format($format, $input); - } - - /** - * Get arbitrary data from the service description that is not part of the - * Guzzle service description specification. - * - * @param string $key Data key to retrieve or null to retrieve all extra - * - * @return null|mixed - */ - public function getData($key = null) - { - if ($key === null) { - return $this->extraData; - } elseif (isset($this->extraData[$key])) { - return $this->extraData[$key]; - } else { - return null; - } - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/DescriptionInterface.php b/vendor/guzzlehttp/guzzle-services/src/DescriptionInterface.php deleted file mode 100644 index 6b3adba6..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/DescriptionInterface.php +++ /dev/null @@ -1,107 +0,0 @@ - new BodyLocation(), - 'header' => new HeaderLocation(), - 'reasonPhrase' => new ReasonPhraseLocation(), - 'statusCode' => new StatusCodeLocation(), - 'xml' => new XmlLocation(), - 'json' => new JsonLocation(), - ]; - } - - $this->responseLocations = $responseLocations + $defaultResponseLocations; - $this->description = $description; - $this->process = $process; - } - - /** - * Deserialize the response into the specified result representation - * - * @param ResponseInterface $response - * @param RequestInterface|null $request - * @param CommandInterface $command - * @return Result|ResultInterface|void|ResponseInterface - */ - public function __invoke(ResponseInterface $response, RequestInterface $request, CommandInterface $command) - { - // If the user don't want to process the result, just return the plain response here - if ($this->process === false) { - return $response; - } - - $name = $command->getName(); - $operation = $this->description->getOperation($name); - - $this->handleErrorResponses($response, $request, $command, $operation); - - // Add a default Model as the result if no matching schema was found - if (!($modelName = $operation->getResponseModel())) { - // Not sure if this should be empty or contains the response. - // Decided to do it how it was in the old version for now. - return new Result(); - } - - $model = $operation->getServiceDescription()->getModel($modelName); - if (!$model) { - throw new \RuntimeException("Unknown model: {$modelName}"); - } - - return $this->visit($model, $response); - } - - /** - * Handles visit() and after() methods of the Response locations - * - * @param Parameter $model - * @param ResponseInterface $response - * @return Result|ResultInterface|void - */ - protected function visit(Parameter $model, ResponseInterface $response) - { - $result = new Result(); - $context = ['visitors' => []]; - - if ($model->getType() === 'object') { - $result = $this->visitOuterObject($model, $result, $response, $context); - } elseif ($model->getType() === 'array') { - $result = $this->visitOuterArray($model, $result, $response, $context); - } else { - throw new \InvalidArgumentException('Invalid response model: ' . $model->getType()); - } - - // Call the after() method of each found visitor - /** @var ResponseLocationInterface $visitor */ - foreach ($context['visitors'] as $visitor) { - $result = $visitor->after($result, $response, $model); - } - - return $result; - } - - /** - * Handles the before() method of Response locations - * - * @param string $location - * @param Parameter $model - * @param ResultInterface $result - * @param ResponseInterface $response - * @param array $context - * @return ResultInterface - */ - private function triggerBeforeVisitor( - $location, - Parameter $model, - ResultInterface $result, - ResponseInterface $response, - array &$context - ) { - if (!isset($this->responseLocations[$location])) { - throw new \RuntimeException("Unknown location: $location"); - } - - $context['visitors'][$location] = $this->responseLocations[$location]; - - $result = $this->responseLocations[$location]->before( - $result, - $response, - $model - ); - - return $result; - } - - /** - * Visits the outer object - * - * @param Parameter $model - * @param ResultInterface $result - * @param ResponseInterface $response - * @param array $context - * @return ResultInterface - */ - private function visitOuterObject( - Parameter $model, - ResultInterface $result, - ResponseInterface $response, - array &$context - ) { - $parentLocation = $model->getLocation(); - - // If top-level additionalProperties is a schema, then visit it - $additional = $model->getAdditionalProperties(); - if ($additional instanceof Parameter) { - // Use the model location if none set on additionalProperties. - $location = $additional->getLocation() ?: $parentLocation; - $result = $this->triggerBeforeVisitor($location, $model, $result, $response, $context); - } - - // Use 'location' from all individual defined properties, but fall back - // to the model location if no per-property location is set. Collect - // the properties that need to be visited into an array. - $visitProperties = []; - foreach ($model->getProperties() as $schema) { - $location = $schema->getLocation() ?: $parentLocation; - if ($location) { - $visitProperties[] = [$location, $schema]; - // Trigger the before method on each unique visitor location - if (!isset($context['visitors'][$location])) { - $result = $this->triggerBeforeVisitor($location, $model, $result, $response, $context); - } - } - } - - // Actually visit each response element - foreach ($visitProperties as $property) { - $result = $this->responseLocations[$property[0]]->visit($result, $response, $property[1]); - } - - return $result; - } - - /** - * Visits the outer array - * - * @param Parameter $model - * @param ResultInterface $result - * @param ResponseInterface $response - * @param array $context - * @return ResultInterface|void - */ - private function visitOuterArray( - Parameter $model, - ResultInterface $result, - ResponseInterface $response, - array &$context - ) { - // Use 'location' defined on the top of the model - if (!($location = $model->getLocation())) { - return; - } - - // Trigger the before method on each unique visitor location - if (!isset($context['visitors'][$location])) { - $result = $this->triggerBeforeVisitor($location, $model, $result, $response, $context); - } - - // Visit each item in the response - $result = $this->responseLocations[$location]->visit($result, $response, $model); - - return $result; - } - - /** - * Reads the "errorResponses" from commands, and trigger appropriate exceptions - * - * In order for the exception to be properly triggered, all your exceptions must be instance - * of "GuzzleHttp\Command\Exception\CommandException". If that's not the case, your exceptions will be wrapped - * around a CommandException - * - * @param ResponseInterface $response - * @param RequestInterface $request - * @param CommandInterface $command - * @param Operation $operation - */ - protected function handleErrorResponses( - ResponseInterface $response, - RequestInterface $request, - CommandInterface $command, - Operation $operation - ) { - $errors = $operation->getErrorResponses(); - - // We iterate through each errors in service description. If the descriptor contains both a phrase and - // status code, there must be an exact match of both. Otherwise, a match of status code is enough - $bestException = null; - - foreach ($errors as $error) { - $code = (int) $error['code']; - - if ($response->getStatusCode() !== $code) { - continue; - } - - if (isset($error['phrase']) && ! ($error['phrase'] === $response->getReasonPhrase())) { - continue; - } - - $bestException = $error['class']; - - // If there is an exact match of phrase + code, then we cannot find a more specialized exception in - // the array, so we can break early instead of iterating the remaining ones - if (isset($error['phrase'])) { - break; - } - } - - if (null !== $bestException) { - throw new $bestException($response->getReasonPhrase(), $command, null, $request, $response); - } - - // If we reach here, no exception could be match from descriptor, and Guzzle exception will propagate if - // option "http_errors" is set to true, which is the default setting. - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/GuzzleClient.php b/vendor/guzzlehttp/guzzle-services/src/GuzzleClient.php deleted file mode 100644 index f419b54e..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/GuzzleClient.php +++ /dev/null @@ -1,169 +0,0 @@ -config = $config; - $this->description = $description; - $serializer = $this->getSerializer($commandToRequestTransformer); - $deserializer = $this->getDeserializer($responseToResultTransformer); - - parent::__construct($client, $serializer, $deserializer, $commandHandlerStack); - $this->processConfig($config); - } - - /** - * Returns the command if valid; otherwise an Exception - * @param string $name - * @param array $args - * @return CommandInterface - * @throws \InvalidArgumentException - */ - public function getCommand($name, array $args = []) - { - if (!$this->description->hasOperation($name)) { - $name = ucfirst($name); - if (!$this->description->hasOperation($name)) { - throw new \InvalidArgumentException( - "No operation found named {$name}" - ); - } - } - - // Merge in default command options - $args += $this->getConfig('defaults'); - - return parent::getCommand($name, $args); - } - - /** - * Return the description - * - * @return DescriptionInterface - */ - public function getDescription() - { - return $this->description; - } - - /** - * Returns the passed Serializer when set, a new instance otherwise - * - * @param callable|null $commandToRequestTransformer - * @return \GuzzleHttp\Command\Guzzle\Serializer - */ - private function getSerializer($commandToRequestTransformer) - { - return $commandToRequestTransformer ==! null - ? $commandToRequestTransformer - : new Serializer($this->description); - } - - /** - * Returns the passed Deserializer when set, a new instance otherwise - * - * @param callable|null $responseToResultTransformer - * @return \GuzzleHttp\Command\Guzzle\Deserializer - */ - private function getDeserializer($responseToResultTransformer) - { - $process = (! isset($this->config['process']) || $this->config['process'] === true); - - return $responseToResultTransformer ==! null - ? $responseToResultTransformer - : new Deserializer($this->description, $process); - } - - /** - * Get the config of the client - * - * @param array|string $option - * @return mixed - */ - public function getConfig($option = null) - { - return $option === null - ? $this->config - : (isset($this->config[$option]) ? $this->config[$option] : []); - } - - /** - * @param $option - * @param $value - */ - public function setConfig($option, $value) - { - $this->config[$option] = $value; - } - - /** - * Prepares the client based on the configuration settings of the client. - * - * @param array $config Constructor config as an array - */ - protected function processConfig(array $config) - { - // set defaults as an array if not provided - if (!isset($config['defaults'])) { - $config['defaults'] = []; - } - - // Add the handlers based on the configuration option - $stack = $this->getHandlerStack(); - - if (!isset($config['validate']) || $config['validate'] === true) { - $stack->push(new ValidatedDescriptionHandler($this->description), 'validate_description'); - } - - if (!isset($config['process']) || $config['process'] === true) { - // TODO: This belongs to the Deserializer and should be handled there. - // Question: What is the result when the Deserializer is bypassed? - // Possible answer: The raw response. - } - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/Handler/ValidatedDescriptionHandler.php b/vendor/guzzlehttp/guzzle-services/src/Handler/ValidatedDescriptionHandler.php deleted file mode 100644 index c5ec2d6e..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/Handler/ValidatedDescriptionHandler.php +++ /dev/null @@ -1,82 +0,0 @@ - - */ -class ValidatedDescriptionHandler -{ - /** @var SchemaValidator $validator */ - private $validator; - - /** @var DescriptionInterface $description */ - private $description; - - /** - * ValidatedDescriptionHandler constructor. - * - * @param DescriptionInterface $description - * @param SchemaValidator|null $schemaValidator - */ - public function __construct(DescriptionInterface $description, SchemaValidator $schemaValidator = null) - { - $this->description = $description; - $this->validator = $schemaValidator ?: new SchemaValidator(); - } - - /** - * @param callable $handler - * @return \Closure - */ - public function __invoke(callable $handler) - { - return function (CommandInterface $command) use ($handler) { - $errors = []; - $operation = $this->description->getOperation($command->getName()); - - foreach ($operation->getParams() as $name => $schema) { - $value = $command[$name]; - - if ($value) { - $value = $schema->filter($value); - } - - if (! $this->validator->validate($schema, $value)) { - $errors = array_merge($errors, $this->validator->getErrors()); - } elseif ($value !== $command[$name]) { - // Update the config value if it changed and no validation errors were encountered. - // This happen when the user extending an operation - // See https://github.com/guzzle/guzzle-services/issues/145 - $command[$name] = $value; - } - } - - if ($params = $operation->getAdditionalParameters()) { - foreach ($command->toArray() as $name => $value) { - // It's only additional if it isn't defined in the schema - if (! $operation->hasParam($name)) { - // Always set the name so that error messages are useful - $params->setName($name); - if (! $this->validator->validate($params, $value)) { - $errors = array_merge($errors, $this->validator->getErrors()); - } elseif ($value !== $command[$name]) { - $command[$name] = $value; - } - } - } - } - - if ($errors) { - throw new CommandException('Validation errors: ' . implode("\n", $errors), $command); - } - - return $handler($command); - }; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/Operation.php b/vendor/guzzlehttp/guzzle-services/src/Operation.php deleted file mode 100644 index 57b75ca2..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/Operation.php +++ /dev/null @@ -1,312 +0,0 @@ - '', - 'httpMethod' => '', - 'uri' => '', - 'responseModel' => null, - 'notes' => '', - 'summary' => '', - 'documentationUrl' => null, - 'deprecated' => false, - 'data' => [], - 'parameters' => [], - 'additionalParameters' => null, - 'errorResponses' => [] - ]; - - $this->description = $description === null ? new Description([]) : $description; - - if (isset($config['extends'])) { - $config = $this->resolveExtends($config['extends'], $config); - } - - $this->config = $config + $defaults; - - // Account for the old style of using responseClass - if (isset($config['responseClass'])) { - $this->config['responseModel'] = $config['responseClass']; - } - - $this->resolveParameters(); - } - - /** - * @return array - */ - public function toArray() - { - return $this->config; - } - - /** - * Get the service description that the operation belongs to - * - * @return Description - */ - public function getServiceDescription() - { - return $this->description; - } - - /** - * Get the params of the operation - * - * @return Parameter[] - */ - public function getParams() - { - return $this->parameters; - } - - /** - * Get additionalParameters of the operation - * - * @return Parameter|null - */ - public function getAdditionalParameters() - { - return $this->additionalParameters; - } - - /** - * Check if the operation has a specific parameter by name - * - * @param string $name Name of the param - * - * @return bool - */ - public function hasParam($name) - { - return isset($this->parameters[$name]); - } - - /** - * Get a single parameter of the operation - * - * @param string $name Parameter to retrieve by name - * - * @return Parameter|null - */ - public function getParam($name) - { - return isset($this->parameters[$name]) - ? $this->parameters[$name] - : null; - } - - /** - * Get the HTTP method of the operation - * - * @return string|null - */ - public function getHttpMethod() - { - return $this->config['httpMethod']; - } - - /** - * Get the name of the operation - * - * @return string|null - */ - public function getName() - { - return $this->config['name']; - } - - /** - * Get a short summary of what the operation does - * - * @return string|null - */ - public function getSummary() - { - return $this->config['summary']; - } - - /** - * Get a longer text field to explain the behavior of the operation - * - * @return string|null - */ - public function getNotes() - { - return $this->config['notes']; - } - - /** - * Get the documentation URL of the operation - * - * @return string|null - */ - public function getDocumentationUrl() - { - return $this->config['documentationUrl']; - } - - /** - * Get the name of the model used for processing the response. - * - * @return string - */ - public function getResponseModel() - { - return $this->config['responseModel']; - } - - /** - * Get whether or not the operation is deprecated - * - * @return bool - */ - public function getDeprecated() - { - return $this->config['deprecated']; - } - - /** - * Get the URI that will be merged into the generated request - * - * @return string - */ - public function getUri() - { - return $this->config['uri']; - } - - /** - * Get the errors that could be encountered when executing the operation - * - * @return array - */ - public function getErrorResponses() - { - return $this->config['errorResponses']; - } - - /** - * Get extra data from the operation - * - * @param string $name Name of the data point to retrieve or null to - * retrieve all of the extra data. - * - * @return mixed|null - */ - public function getData($name = null) - { - if ($name === null) { - return $this->config['data']; - } elseif (isset($this->config['data'][$name])) { - return $this->config['data'][$name]; - } else { - return null; - } - } - - /** - * @param $name - * @param array $config - * @return array - */ - private function resolveExtends($name, array $config) - { - if (!$this->description->hasOperation($name)) { - throw new \InvalidArgumentException('No operation named ' . $name); - } - - // Merge parameters together one level deep - $base = $this->description->getOperation($name)->toArray(); - $result = $config + $base; - - if (isset($base['parameters']) && isset($config['parameters'])) { - $result['parameters'] = $config['parameters'] + $base['parameters']; - } - - return $result; - } - - /** - * Process the description and extract the parameter config - * - * @return void - */ - private function resolveParameters() - { - // Parameters need special handling when adding - foreach ($this->config['parameters'] as $name => $param) { - if (!is_array($param)) { - throw new \InvalidArgumentException( - "Parameters must be arrays, {$this->config['name']}.$name is ".gettype($param) - ); - } - $param['name'] = $name; - $this->parameters[$name] = new Parameter( - $param, - ['description' => $this->description] - ); - } - - if ($this->config['additionalParameters']) { - if (is_array($this->config['additionalParameters'])) { - $this->additionalParameters = new Parameter( - $this->config['additionalParameters'], - ['description' => $this->description] - ); - } else { - $this->additionalParameters = $this->config['additionalParameters']; - } - } - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/Parameter.php b/vendor/guzzlehttp/guzzle-services/src/Parameter.php deleted file mode 100644 index 8b3c39f2..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/Parameter.php +++ /dev/null @@ -1,655 +0,0 @@ -originalData = $data; - - if (isset($options['description'])) { - $this->serviceDescription = $options['description']; - if (!($this->serviceDescription instanceof DescriptionInterface)) { - throw new \InvalidArgumentException('description must be a Description'); - } - if (isset($data['$ref'])) { - if ($model = $this->serviceDescription->getModel($data['$ref'])) { - $name = isset($data['name']) ? $data['name'] : null; - $data = $model->toArray() + $data; - if ($name) { - $data['name'] = $name; - } - } - } elseif (isset($data['extends'])) { - // If this parameter extends from another parameter then start - // with the actual data union in the parent's data (e.g. actual - // supersedes parent) - if ($extends = $this->serviceDescription->getModel($data['extends'])) { - $data += $extends->toArray(); - } - } - } - - // Pull configuration data into the parameter - foreach ($data as $key => $value) { - $this->{$key} = $value; - } - - $this->required = (bool) $this->required; - $this->data = (array) $this->data; - - if ($this->filters) { - $this->setFilters((array) $this->filters); - } - - if ($this->type == 'object' && $this->additionalProperties === null) { - $this->additionalProperties = true; - } - } - - /** - * Convert the object to an array - * - * @return array - */ - public function toArray() - { - return $this->originalData; - } - - /** - * Get the default or static value of the command based on a value - * - * @param string $value Value that is currently set - * - * @return mixed Returns the value, a static value if one is present, or a default value - */ - public function getValue($value) - { - if ($this->static || ($this->default !== null && $value === null)) { - return $this->default; - } - - return $value; - } - - /** - * Run a value through the filters OR format attribute associated with the - * parameter. - * - * @param mixed $value Value to filter - * - * @return mixed Returns the filtered value - * @throws \RuntimeException when trying to format when no service - * description is available. - */ - public function filter($value) - { - // Formats are applied exclusively and supersed filters - if ($this->format) { - if (!$this->serviceDescription) { - throw new \RuntimeException('No service description was set so ' - . 'the value cannot be formatted.'); - } - return $this->serviceDescription->format($this->format, $value); - } - - // Convert Boolean values - if ($this->type == 'boolean' && !is_bool($value)) { - $value = filter_var($value, FILTER_VALIDATE_BOOLEAN); - } - - // Apply filters to the value - if ($this->filters) { - foreach ($this->filters as $filter) { - if (is_array($filter)) { - // Convert complex filters that hold value place holders - foreach ($filter['args'] as &$data) { - if ($data == '@value') { - $data = $value; - } elseif ($data == '@api') { - $data = $this; - } - } - $value = call_user_func_array( - $filter['method'], - $filter['args'] - ); - } else { - $value = call_user_func($filter, $value); - } - } - } - - return $value; - } - - /** - * Get the name of the parameter - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Set the name of the parameter - * - * @param string $name Name to set - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Get the key of the parameter, where sentAs will supersede name if it is - * set. - * - * @return string - */ - public function getWireName() - { - return $this->sentAs ?: $this->name; - } - - /** - * Get the type(s) of the parameter - * - * @return string|array - */ - public function getType() - { - return $this->type; - } - - /** - * Get if the parameter is required - * - * @return bool - */ - public function isRequired() - { - return $this->required; - } - - /** - * Get the default value of the parameter - * - * @return string|null - */ - public function getDefault() - { - return $this->default; - } - - /** - * Get the description of the parameter - * - * @return string|null - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the minimum acceptable value for an integer - * - * @return int|null - */ - public function getMinimum() - { - return $this->minimum; - } - - /** - * Get the maximum acceptable value for an integer - * - * @return int|null - */ - public function getMaximum() - { - return $this->maximum; - } - - /** - * Get the minimum allowed length of a string value - * - * @return int - */ - public function getMinLength() - { - return $this->minLength; - } - - /** - * Get the maximum allowed length of a string value - * - * @return int|null - */ - public function getMaxLength() - { - return $this->maxLength; - } - - /** - * Get the maximum allowed number of items in an array value - * - * @return int|null - */ - public function getMaxItems() - { - return $this->maxItems; - } - - /** - * Get the minimum allowed number of items in an array value - * - * @return int - */ - public function getMinItems() - { - return $this->minItems; - } - - /** - * Get the location of the parameter - * - * @return string|null - */ - public function getLocation() - { - return $this->location; - } - - /** - * Get the sentAs attribute of the parameter that used with locations to - * sentAs an attribute when it is being applied to a location. - * - * @return string|null - */ - public function getSentAs() - { - return $this->sentAs; - } - - /** - * Retrieve a known property from the parameter by name or a data property - * by name. When no specific name value is passed, all data properties - * will be returned. - * - * @param string|null $name Specify a particular property name to retrieve - * - * @return array|mixed|null - */ - public function getData($name = null) - { - if (!$name) { - return $this->data; - } elseif (isset($this->data[$name])) { - return $this->data[$name]; - } elseif (isset($this->{$name})) { - return $this->{$name}; - } - - return null; - } - - /** - * Get whether or not the default value can be changed - * - * @return bool - */ - public function isStatic() - { - return $this->static; - } - - /** - * Get an array of filters used by the parameter - * - * @return array - */ - public function getFilters() - { - return $this->filters ?: []; - } - - /** - * Get the properties of the parameter - * - * @return Parameter[] - */ - public function getProperties() - { - if (!$this->propertiesCache) { - $this->propertiesCache = []; - foreach (array_keys($this->properties) as $name) { - $this->propertiesCache[$name] = $this->getProperty($name); - } - } - - return $this->propertiesCache; - } - - /** - * Get a specific property from the parameter - * - * @param string $name Name of the property to retrieve - * - * @return null|Parameter - */ - public function getProperty($name) - { - if (!isset($this->properties[$name])) { - return null; - } - - if (!($this->properties[$name] instanceof self)) { - $this->properties[$name]['name'] = $name; - $this->properties[$name] = new static( - $this->properties[$name], - ['description' => $this->serviceDescription] - ); - } - - return $this->properties[$name]; - } - - /** - * Get the additionalProperties value of the parameter - * - * @return bool|Parameter|null - */ - public function getAdditionalProperties() - { - if (is_array($this->additionalProperties)) { - $this->additionalProperties = new static( - $this->additionalProperties, - ['description' => $this->serviceDescription] - ); - } - - return $this->additionalProperties; - } - - /** - * Get the item data of the parameter - * - * @return Parameter - */ - public function getItems() - { - if (is_array($this->items)) { - $this->items = new static( - $this->items, - ['description' => $this->serviceDescription] - ); - } - - return $this->items; - } - - /** - * Get the enum of strings that are valid for the parameter - * - * @return array|null - */ - public function getEnum() - { - return $this->enum; - } - - /** - * Get the regex pattern that must match a value when the value is a string - * - * @return string - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * Get the format attribute of the schema - * - * @return string - */ - public function getFormat() - { - return $this->format; - } - - /** - * Set the array of filters used by the parameter - * - * @param array $filters Array of functions to use as filters - * - * @return self - */ - private function setFilters(array $filters) - { - $this->filters = []; - foreach ($filters as $filter) { - $this->addFilter($filter); - } - - return $this; - } - - /** - * Add a filter to the parameter - * - * @param string|array $filter Method to filter the value through - * - * @return self - * @throws \InvalidArgumentException - */ - private function addFilter($filter) - { - if (is_array($filter)) { - if (!isset($filter['method'])) { - throw new \InvalidArgumentException( - 'A [method] value must be specified for each complex filter' - ); - } - } - - if (!$this->filters) { - $this->filters = [$filter]; - } else { - $this->filters[] = $filter; - } - - return $this; - } - - /** - * Check if a parameter has a specific variable and if it set. - * - * @param string $var - * @return bool - */ - public function has($var) - { - if (!is_string($var)) { - throw new \InvalidArgumentException('Expected a string. Got: ' . (is_object($var) ? get_class($var) : gettype($var))); - } - return isset($this->{$var}) && !empty($this->{$var}); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/QuerySerializer/QuerySerializerInterface.php b/vendor/guzzlehttp/guzzle-services/src/QuerySerializer/QuerySerializerInterface.php deleted file mode 100644 index ad7fb113..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/QuerySerializer/QuerySerializerInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -removeNumericIndices = $removeNumericIndices; - } - - /** - * {@inheritDoc} - */ - public function aggregate(array $queryParams) - { - $queryString = http_build_query($queryParams, null, '&', PHP_QUERY_RFC3986); - - if ($this->removeNumericIndices) { - $queryString = preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', $queryString); - } - - return $queryString; - } -} \ No newline at end of file diff --git a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/AbstractLocation.php b/vendor/guzzlehttp/guzzle-services/src/RequestLocation/AbstractLocation.php deleted file mode 100644 index 29b484b0..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/AbstractLocation.php +++ /dev/null @@ -1,101 +0,0 @@ -locationName = $locationName; - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Parameter $param - * @return RequestInterface - */ - public function visit( - CommandInterface $command, - RequestInterface $request, - Parameter $param - ) { - return $request; - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Operation $operation - * @return RequestInterface - */ - public function after( - CommandInterface $command, - RequestInterface $request, - Operation $operation - ) { - return $request; - } - - /** - * Prepare (filter and set desired name for request item) the value for - * request. - * - * @param mixed $value - * @param Parameter $param - * - * @return array|mixed - */ - protected function prepareValue($value, Parameter $param) - { - return is_array($value) - ? $this->resolveRecursively($value, $param) - : $param->filter($value); - } - - /** - * Recursively prepare and filter nested values. - * - * @param array $value Value to map - * @param Parameter $param Parameter related to the current key. - * - * @return array Returns the mapped array - */ - protected function resolveRecursively(array $value, Parameter $param) - { - foreach ($value as $name => &$v) { - switch ($param->getType()) { - case 'object': - if ($subParam = $param->getProperty($name)) { - $key = $subParam->getWireName(); - $value[$key] = $this->prepareValue($v, $subParam); - if ($name != $key) { - unset($value[$name]); - } - } elseif ($param->getAdditionalProperties() instanceof Parameter) { - $v = $this->prepareValue($v, $param->getAdditionalProperties()); - } - break; - case 'array': - if ($items = $param->getItems()) { - $v = $this->prepareValue($v, $items); - } - break; - } - } - - return $param->filter($value); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/BodyLocation.php b/vendor/guzzlehttp/guzzle-services/src/RequestLocation/BodyLocation.php deleted file mode 100644 index aef4eb00..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/BodyLocation.php +++ /dev/null @@ -1,49 +0,0 @@ -getBody()->getContents(); - - $value = $command[$param->getName()]; - $value = $param->getName() . '=' . $param->filter($value); - - if ($oldValue !== '') { - $value = $oldValue . '&' . $value; - } - - return $request->withBody(Psr7\stream_for($value)); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/FormParamLocation.php b/vendor/guzzlehttp/guzzle-services/src/RequestLocation/FormParamLocation.php deleted file mode 100644 index 83005366..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/FormParamLocation.php +++ /dev/null @@ -1,84 +0,0 @@ -formParamsData['form_params'][$param->getWireName()] = $this->prepareValue( - $command[$param->getName()], - $param - ); - - return $request; - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Operation $operation - * - * @return RequestInterface - */ - public function after( - CommandInterface $command, - RequestInterface $request, - Operation $operation - ) { - $data = $this->formParamsData; - $this->formParamsData = []; - $modify = []; - - // Add additional parameters to the form_params array - $additional = $operation->getAdditionalParameters(); - if ($additional && $additional->getLocation() == $this->locationName) { - foreach ($command->toArray() as $key => $value) { - if (!$operation->hasParam($key)) { - $data['form_params'][$key] = $this->prepareValue($value, $additional); - } - } - } - - $body = http_build_query($data['form_params'], '', '&'); - $modify['body'] = Psr7\stream_for($body); - $modify['set_headers']['Content-Type'] = $this->contentType; - $request = Psr7\modify_request($request, $modify); - - return $request; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/HeaderLocation.php b/vendor/guzzlehttp/guzzle-services/src/RequestLocation/HeaderLocation.php deleted file mode 100644 index cb067c46..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/HeaderLocation.php +++ /dev/null @@ -1,67 +0,0 @@ -getName()]; - - return $request->withHeader($param->getWireName(), $param->filter($value)); - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Operation $operation - * - * @return RequestInterface - */ - public function after( - CommandInterface $command, - RequestInterface $request, - Operation $operation - ) { - /** @var Parameter $additional */ - $additional = $operation->getAdditionalParameters(); - if ($additional && ($additional->getLocation() === $this->locationName)) { - foreach ($command->toArray() as $key => $value) { - if (!$operation->hasParam($key)) { - $request = $request->withHeader($key, $additional->filter($value)); - } - } - } - - return $request; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/JsonLocation.php b/vendor/guzzlehttp/guzzle-services/src/RequestLocation/JsonLocation.php deleted file mode 100644 index f3a2a52a..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/JsonLocation.php +++ /dev/null @@ -1,85 +0,0 @@ -jsonContentType = $contentType; - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Parameter $param - * - * @return RequestInterface - */ - public function visit( - CommandInterface $command, - RequestInterface $request, - Parameter $param - ) { - $this->jsonData[$param->getWireName()] = $this->prepareValue( - $command[$param->getName()], - $param - ); - - return $request->withBody(Psr7\stream_for(\GuzzleHttp\json_encode($this->jsonData))); - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Operation $operation - * - * @return MessageInterface - */ - public function after( - CommandInterface $command, - RequestInterface $request, - Operation $operation - ) { - $data = $this->jsonData; - $this->jsonData = []; - - // Add additional parameters to the JSON document - $additional = $operation->getAdditionalParameters(); - if ($additional && ($additional->getLocation() === $this->locationName)) { - foreach ($command->toArray() as $key => $value) { - if (!$operation->hasParam($key)) { - $data[$key] = $this->prepareValue($value, $additional); - } - } - } - - // Don't overwrite the Content-Type if one is set - if ($this->jsonContentType && !$request->hasHeader('Content-Type')) { - $request = $request->withHeader('Content-Type', $this->jsonContentType); - } - - return $request->withBody(Psr7\stream_for(\GuzzleHttp\json_encode($data))); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/MultiPartLocation.php b/vendor/guzzlehttp/guzzle-services/src/RequestLocation/MultiPartLocation.php deleted file mode 100644 index 7bde5db4..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/MultiPartLocation.php +++ /dev/null @@ -1,76 +0,0 @@ -multipartData[] = [ - 'name' => $param->getWireName(), - 'contents' => $this->prepareValue($command[$param->getName()], $param) - ]; - - return $request; - } - - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Operation $operation - * @return RequestInterface - */ - public function after( - CommandInterface $command, - RequestInterface $request, - Operation $operation - ) { - $data = $this->multipartData; - $this->multipartData = []; - $modify = []; - - $body = new Psr7\MultipartStream($data); - $modify['body'] = Psr7\stream_for($body); - $request = Psr7\modify_request($request, $modify); - if ($request->getBody() instanceof Psr7\MultipartStream) { - // Use a multipart/form-data POST if a Content-Type is not set. - $request->withHeader('Content-Type', $this->contentType . $request->getBody()->getBoundary()); - } - - return $request; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/QueryLocation.php b/vendor/guzzlehttp/guzzle-services/src/RequestLocation/QueryLocation.php deleted file mode 100644 index 1e7a342f..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/QueryLocation.php +++ /dev/null @@ -1,92 +0,0 @@ -querySerializer = $querySerializer ?: new Rfc3986Serializer(); - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Parameter $param - * - * @return RequestInterface - */ - public function visit( - CommandInterface $command, - RequestInterface $request, - Parameter $param - ) { - $uri = $request->getUri(); - $query = Psr7\parse_query($uri->getQuery()); - - $query[$param->getWireName()] = $this->prepareValue( - $command[$param->getName()], - $param - ); - - $uri = $uri->withQuery($this->querySerializer->aggregate($query)); - - return $request->withUri($uri); - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Operation $operation - * - * @return RequestInterface - */ - public function after( - CommandInterface $command, - RequestInterface $request, - Operation $operation - ) { - $additional = $operation->getAdditionalParameters(); - if ($additional && $additional->getLocation() == $this->locationName) { - foreach ($command->toArray() as $key => $value) { - if (!$operation->hasParam($key)) { - $uri = $request->getUri(); - $query = Psr7\parse_query($uri->getQuery()); - - $query[$key] = $this->prepareValue( - $value, - $additional - ); - - $uri = $uri->withQuery($this->querySerializer->aggregate($query)); - $request = $request->withUri($uri); - } - } - } - - return $request; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/RequestLocationInterface.php b/vendor/guzzlehttp/guzzle-services/src/RequestLocation/RequestLocationInterface.php deleted file mode 100644 index c0350ff3..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/RequestLocation/RequestLocationInterface.php +++ /dev/null @@ -1,44 +0,0 @@ -contentType = $contentType; - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Parameter $param - * - * @return RequestInterface - */ - public function visit( - CommandInterface $command, - RequestInterface $request, - Parameter $param - ) { - // Buffer and order the parameters to visit based on if they are - // top-level attributes or child nodes. - // @link https://github.com/guzzle/guzzle/pull/494 - if ($param->getData('xmlAttribute')) { - array_unshift($this->buffered, $param); - } else { - $this->buffered[] = $param; - } - - return $request; - } - - /** - * @param CommandInterface $command - * @param RequestInterface $request - * @param Operation $operation - * - * @return RequestInterface - */ - public function after( - CommandInterface $command, - RequestInterface $request, - Operation $operation - ) { - foreach ($this->buffered as $param) { - $this->visitWithValue( - $command[$param->getName()], - $param, - $operation - ); - } - - $this->buffered = []; - - $additional = $operation->getAdditionalParameters(); - if ($additional && $additional->getLocation() == $this->locationName) { - foreach ($command->toArray() as $key => $value) { - if (!$operation->hasParam($key)) { - $additional->setName($key); - $this->visitWithValue($value, $additional, $operation); - } - } - $additional->setName(null); - } - - // If data was found that needs to be serialized, then do so - $xml = ''; - if ($this->writer) { - $xml = $this->finishDocument($this->writer); - } elseif ($operation->getData('xmlAllowEmpty')) { - // Check if XML should always be sent for the command - $writer = $this->createRootElement($operation); - $xml = $this->finishDocument($writer); - } - - if ($xml !== '') { - $request = $request->withBody(Psr7\stream_for($xml)); - // Don't overwrite the Content-Type if one is set - if ($this->contentType && !$request->hasHeader('Content-Type')) { - $request = $request->withHeader('Content-Type', $this->contentType); - } - } - - $this->writer = null; - - return $request; - } - - /** - * Create the root XML element to use with a request - * - * @param Operation $operation Operation object - * - * @return \XMLWriter - */ - protected function createRootElement(Operation $operation) - { - static $defaultRoot = ['name' => 'Request']; - // If no root element was specified, then just wrap the XML in 'Request' - $root = $operation->getData('xmlRoot') ?: $defaultRoot; - // Allow the XML declaration to be customized with xmlEncoding - $encoding = $operation->getData('xmlEncoding'); - $writer = $this->startDocument($encoding); - $writer->startElement($root['name']); - - // Create the wrapping element with no namespaces if no namespaces were present - if (!empty($root['namespaces'])) { - // Create the wrapping element with an array of one or more namespaces - foreach ((array) $root['namespaces'] as $prefix => $uri) { - $nsLabel = 'xmlns'; - if (!is_numeric($prefix)) { - $nsLabel .= ':'.$prefix; - } - $writer->writeAttribute($nsLabel, $uri); - } - } - - return $writer; - } - - /** - * Recursively build the XML body - * - * @param \XMLWriter $writer XML to modify - * @param Parameter $param API Parameter - * @param mixed $value Value to add - */ - protected function addXml(\XMLWriter $writer, Parameter $param, $value) - { - $value = $param->filter($value); - $type = $param->getType(); - $name = $param->getWireName(); - $prefix = null; - $namespace = $param->getData('xmlNamespace'); - if (false !== strpos($name, ':')) { - list($prefix, $name) = explode(':', $name, 2); - } - - if ($type == 'object' || $type == 'array') { - if (!$param->getData('xmlFlattened')) { - if ($namespace) { - $writer->startElementNS(null, $name, $namespace); - } else { - $writer->startElement($name); - } - } - if ($param->getType() == 'array') { - $this->addXmlArray($writer, $param, $value); - } elseif ($param->getType() == 'object') { - $this->addXmlObject($writer, $param, $value); - } - if (!$param->getData('xmlFlattened')) { - $writer->endElement(); - } - return; - } - if ($param->getData('xmlAttribute')) { - $this->writeAttribute($writer, $prefix, $name, $namespace, $value); - } else { - $this->writeElement($writer, $prefix, $name, $namespace, $value); - } - } - - /** - * Write an attribute with namespace if used - * - * @param \XMLWriter $writer XMLWriter instance - * @param string $prefix Namespace prefix if any - * @param string $name Attribute name - * @param string $namespace The uri of the namespace - * @param string $value The attribute content - */ - protected function writeAttribute($writer, $prefix, $name, $namespace, $value) - { - if ($namespace) { - $writer->writeAttributeNS($prefix, $name, $namespace, $value); - } else { - $writer->writeAttribute($name, $value); - } - } - - /** - * Write an element with namespace if used - * - * @param \XMLWriter $writer XML writer resource - * @param string $prefix Namespace prefix if any - * @param string $name Element name - * @param string $namespace The uri of the namespace - * @param string $value The element content - */ - protected function writeElement(\XMLWriter $writer, $prefix, $name, $namespace, $value) - { - if ($namespace) { - $writer->startElementNS($prefix, $name, $namespace); - } else { - $writer->startElement($name); - } - if (strpbrk($value, '<>&')) { - $writer->writeCData($value); - } else { - $writer->writeRaw($value); - } - $writer->endElement(); - } - - /** - * Create a new xml writer and start a document - * - * @param string $encoding document encoding - * - * @return \XMLWriter the writer resource - * @throws \RuntimeException if the document cannot be started - */ - protected function startDocument($encoding) - { - $this->writer = new \XMLWriter(); - if (!$this->writer->openMemory()) { - throw new \RuntimeException('Unable to open XML document in memory'); - } - if (!$this->writer->startDocument('1.0', $encoding)) { - throw new \RuntimeException('Unable to start XML document'); - } - - return $this->writer; - } - - /** - * End the document and return the output - * - * @param \XMLWriter $writer - * - * @return string the writer resource - */ - protected function finishDocument($writer) - { - $writer->endDocument(); - - return $writer->outputMemory(); - } - - /** - * Add an array to the XML - * - * @param \XMLWriter $writer - * @param Parameter $param - * @param $value - */ - protected function addXmlArray(\XMLWriter $writer, Parameter $param, &$value) - { - if ($items = $param->getItems()) { - foreach ($value as $v) { - $this->addXml($writer, $items, $v); - } - } - } - - /** - * Add an object to the XML - * - * @param \XMLWriter $writer - * @param Parameter $param - * @param $value - */ - protected function addXmlObject(\XMLWriter $writer, Parameter $param, &$value) - { - $noAttributes = []; - - // add values which have attributes - foreach ($value as $name => $v) { - if ($property = $param->getProperty($name)) { - if ($property->getData('xmlAttribute')) { - $this->addXml($writer, $property, $v); - } else { - $noAttributes[] = ['value' => $v, 'property' => $property]; - } - } - } - - // now add values with no attributes - foreach ($noAttributes as $element) { - $this->addXml($writer, $element['property'], $element['value']); - } - } - - /** - * @param $value - * @param Parameter $param - * @param Operation $operation - */ - private function visitWithValue( - $value, - Parameter $param, - Operation $operation - ) { - if (!$this->writer) { - $this->createRootElement($operation); - } - - $this->addXml($this->writer, $param, $value); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/AbstractLocation.php b/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/AbstractLocation.php deleted file mode 100644 index 97adc72f..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/AbstractLocation.php +++ /dev/null @@ -1,69 +0,0 @@ -locationName = $locationName; - } - - /** - * @param ResultInterface $result - * @param ResponseInterface $response - * @param Parameter $model - * @return ResultInterface - */ - public function before( - ResultInterface $result, - ResponseInterface $response, - Parameter $model - ) { - return $result; - } - - /** - * @param ResultInterface $result - * @param ResponseInterface $response - * @param Parameter $model - * @return ResultInterface - */ - public function after( - ResultInterface $result, - ResponseInterface $response, - Parameter $model - ) { - return $result; - } - - /** - * @param ResultInterface $result - * @param ResponseInterface $response - * @param Parameter $param - * @return ResultInterface - */ - public function visit( - ResultInterface $result, - ResponseInterface $response, - Parameter $param - ) { - return $result; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/BodyLocation.php b/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/BodyLocation.php deleted file mode 100644 index f21d60a8..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/BodyLocation.php +++ /dev/null @@ -1,39 +0,0 @@ -getName()] = $param->filter($response->getBody()); - - return $result; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/HeaderLocation.php b/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/HeaderLocation.php deleted file mode 100644 index d156aff1..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/HeaderLocation.php +++ /dev/null @@ -1,47 +0,0 @@ -getName(); - if ($header = $response->getHeader($param->getWireName())) { - if (is_array($header)) { - $header = array_shift($header); - } - $result[$name] = $param->filter($header); - } - - return $result; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/JsonLocation.php b/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/JsonLocation.php deleted file mode 100644 index f94c7844..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/JsonLocation.php +++ /dev/null @@ -1,176 +0,0 @@ -getBody(); - $body = $body ?: "{}"; - $this->json = \GuzzleHttp\json_decode($body, true); - // relocate named arrays, so that they have the same structure as - // arrays nested in objects and visit can work on them in the same way - if ($model->getType() === 'array' && ($name = $model->getName())) { - $this->json = [$name => $this->json]; - } - - return $result; - } - - /** - * @param ResultInterface $result - * @param ResponseInterface $response - * @param Parameter $model - * @return ResultInterface - */ - public function after( - ResultInterface $result, - ResponseInterface $response, - Parameter $model - ) { - // Handle additional, undefined properties - $additional = $model->getAdditionalProperties(); - if (!($additional instanceof Parameter)) { - return $result; - } - - // Use the model location as the default if one is not set on additional - $addLocation = $additional->getLocation() ?: $model->getLocation(); - if ($addLocation == $this->locationName) { - foreach ($this->json as $prop => $val) { - if (!isset($result[$prop])) { - // Only recurse if there is a type specified - $result[$prop] = $additional->getType() - ? $this->recurse($additional, $val) - : $val; - } - } - } - - $this->json = []; - - return $result; - } - - /** - * @param ResultInterface $result - * @param ResponseInterface $response - * @param Parameter $param - * @return Result|ResultInterface - */ - public function visit( - ResultInterface $result, - ResponseInterface $response, - Parameter $param - ) { - $name = $param->getName(); - $key = $param->getWireName(); - - // Check if the result should be treated as a list - if ($param->getType() == 'array') { - // Treat as javascript array - if ($name) { - // name provided, store it under a key in the array - $subArray = isset($this->json[$key]) ? $this->json[$key] : null; - $result[$name] = $this->recurse($param, $subArray); - } else { - // top-level `array` or an empty name - $result = new Result(array_merge( - $result->toArray(), - $this->recurse($param, $this->json) - )); - } - } elseif (isset($this->json[$key])) { - $result[$name] = $this->recurse($param, $this->json[$key]); - } - - return $result; - } - - /** - * Recursively process a parameter while applying filters - * - * @param Parameter $param API parameter being validated - * @param mixed $value Value to process. - * @return mixed|null - */ - private function recurse(Parameter $param, $value) - { - if (!is_array($value)) { - return $param->filter($value); - } - - $result = []; - $type = $param->getType(); - - if ($type == 'array') { - $items = $param->getItems(); - foreach ($value as $val) { - $result[] = $this->recurse($items, $val); - } - } elseif ($type == 'object' && !isset($value[0])) { - // On the above line, we ensure that the array is associative and - // not numerically indexed - if ($properties = $param->getProperties()) { - foreach ($properties as $property) { - $key = $property->getWireName(); - if (array_key_exists($key, $value)) { - $result[$property->getName()] = $this->recurse( - $property, - $value[$key] - ); - // Remove from the value so that AP can later be handled - unset($value[$key]); - } - } - } - // Only check additional properties if everything wasn't already - // handled - if ($value) { - $additional = $param->getAdditionalProperties(); - if ($additional === null || $additional === true) { - // Merge the JSON under the resulting array - $result += $value; - } elseif ($additional instanceof Parameter) { - // Process all child elements according to the given schema - foreach ($value as $prop => $val) { - $result[$prop] = $this->recurse($additional, $val); - } - } - } - } - - return $param->filter($result); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/ReasonPhraseLocation.php b/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/ReasonPhraseLocation.php deleted file mode 100644 index 1cb590ff..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/ReasonPhraseLocation.php +++ /dev/null @@ -1,41 +0,0 @@ -getName()] = $param->filter( - $response->getReasonPhrase() - ); - - return $result; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/ResponseLocationInterface.php b/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/ResponseLocationInterface.php deleted file mode 100644 index 8669dff8..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/ResponseLocationInterface.php +++ /dev/null @@ -1,61 +0,0 @@ -getName()] = $param->filter($response->getStatusCode()); - - return $result; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/XmlLocation.php b/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/XmlLocation.php deleted file mode 100644 index 94509098..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/XmlLocation.php +++ /dev/null @@ -1,311 +0,0 @@ -xml = simplexml_load_string((string) $response->getBody()); - - return $result; - } - - /** - * @param ResultInterface $result - * @param ResponseInterface $response - * @param Parameter $model - * @return Result|ResultInterface - */ - public function after( - ResultInterface $result, - ResponseInterface $response, - Parameter $model - ) { - // Handle additional, undefined properties - $additional = $model->getAdditionalProperties(); - if ($additional instanceof Parameter && - $additional->getLocation() == $this->locationName - ) { - $result = new Result(array_merge( - $result->toArray(), - self::xmlToArray($this->xml) - )); - } - - $this->xml = null; - - return $result; - } - - /** - * @param ResultInterface $result - * @param ResponseInterface $response - * @param Parameter $param - * @return ResultInterface - */ - public function visit( - ResultInterface $result, - ResponseInterface $response, - Parameter $param - ) { - $sentAs = $param->getWireName(); - $ns = null; - if (strstr($sentAs, ':')) { - list($ns, $sentAs) = explode(':', $sentAs); - } - - // Process the primary property - if (count($this->xml->children($ns, true)->{$sentAs})) { - $result[$param->getName()] = $this->recursiveProcess( - $param, - $this->xml->children($ns, true)->{$sentAs} - ); - } - - return $result; - } - - /** - * Recursively process a parameter while applying filters - * - * @param Parameter $param API parameter being processed - * @param \SimpleXMLElement $node Node being processed - * @return array - */ - private function recursiveProcess( - Parameter $param, - \SimpleXMLElement $node - ) { - $result = []; - $type = $param->getType(); - - if ($type == 'object') { - $result = $this->processObject($param, $node); - } elseif ($type == 'array') { - $result = $this->processArray($param, $node); - } else { - // We are probably handling a flat data node (i.e. string or - // integer), so let's check if it's childless, which indicates a - // node containing plain text. - if ($node->children()->count() == 0) { - // Retrieve text from node - $result = (string) $node; - } - } - - // Filter out the value - if (isset($result)) { - $result = $param->filter($result); - } - - return $result; - } - - /** - * @param Parameter $param - * @param \SimpleXMLElement $node - * @return array - */ - private function processArray(Parameter $param, \SimpleXMLElement $node) - { - // Cast to an array if the value was a string, but should be an array - $items = $param->getItems(); - $sentAs = $items->getWireName(); - $result = []; - $ns = null; - - if (strstr($sentAs, ':')) { - // Get namespace from the wire name - list($ns, $sentAs) = explode(':', $sentAs); - } else { - // Get namespace from data - $ns = $items->getData('xmlNs'); - } - - if ($sentAs === null) { - // A general collection of nodes - foreach ($node as $child) { - $result[] = $this->recursiveProcess($items, $child); - } - } else { - // A collection of named, repeating nodes - // (i.e. ) - $children = $node->children($ns, true)->{$sentAs}; - foreach ($children as $child) { - $result[] = $this->recursiveProcess($items, $child); - } - } - - return $result; - } - - /** - * Process an object - * - * @param Parameter $param API parameter being parsed - * @param \SimpleXMLElement $node Value to process - * @return array - */ - private function processObject(Parameter $param, \SimpleXMLElement $node) - { - $result = $knownProps = $knownAttributes = []; - - // Handle known properties - if ($properties = $param->getProperties()) { - foreach ($properties as $property) { - $name = $property->getName(); - $sentAs = $property->getWireName(); - $knownProps[$sentAs] = 1; - if (strpos($sentAs, ':')) { - list($ns, $sentAs) = explode(':', $sentAs); - } else { - $ns = $property->getData('xmlNs'); - } - - if ($property->getData('xmlAttribute')) { - // Handle XML attributes - $result[$name] = (string) $node->attributes($ns, true)->{$sentAs}; - $knownAttributes[$sentAs] = 1; - } elseif (count($node->children($ns, true)->{$sentAs})) { - // Found a child node matching wire name - $childNode = $node->children($ns, true)->{$sentAs}; - $result[$name] = $this->recursiveProcess( - $property, - $childNode - ); - } - } - } - - // Handle additional, undefined properties - $additional = $param->getAdditionalProperties(); - if ($additional instanceof Parameter) { - // Process all child elements according to the given schema - foreach ($node->children($additional->getData('xmlNs'), true) as $childNode) { - $sentAs = $childNode->getName(); - if (!isset($knownProps[$sentAs])) { - $result[$sentAs] = $this->recursiveProcess( - $additional, - $childNode - ); - } - } - } elseif ($additional === null || $additional === true) { - // Blindly transform the XML into an array preserving as much data - // as possible. Remove processed, aliased properties. - $array = array_diff_key(self::xmlToArray($node), $knownProps); - // Remove @attributes that were explicitly plucked from the - // attributes list. - if (isset($array['@attributes']) && $knownAttributes) { - $array['@attributes'] = array_diff_key($array['@attributes'], $knownProps); - if (!$array['@attributes']) { - unset($array['@attributes']); - } - } - - // Merge it together with the original result - $result = array_merge($array, $result); - } - - return $result; - } - - /** - * Convert an XML document to an array. - * - * @param \SimpleXMLElement $xml - * @param int $nesting - * @param null $ns - * - * @return array - */ - private static function xmlToArray( - \SimpleXMLElement $xml, - $ns = null, - $nesting = 0 - ) { - $result = []; - $children = $xml->children($ns, true); - - foreach ($children as $name => $child) { - $attributes = (array) $child->attributes($ns, true); - if (!isset($result[$name])) { - $childArray = self::xmlToArray($child, $ns, $nesting + 1); - $result[$name] = $attributes - ? array_merge($attributes, $childArray) - : $childArray; - continue; - } - // A child element with this name exists so we're assuming - // that the node contains a list of elements - if (!is_array($result[$name])) { - $result[$name] = [$result[$name]]; - } elseif (!isset($result[$name][0])) { - // Convert the first child into the first element of a numerically indexed array - $firstResult = $result[$name]; - $result[$name] = []; - $result[$name][] = $firstResult; - } - $childArray = self::xmlToArray($child, $ns, $nesting + 1); - if ($attributes) { - $result[$name][] = array_merge($attributes, $childArray); - } else { - $result[$name][] = $childArray; - } - } - - // Extract text from node - $text = trim((string) $xml); - if ($text === '') { - $text = null; - } - - // Process attributes - $attributes = (array) $xml->attributes($ns, true); - if ($attributes) { - if ($text !== null) { - $result['value'] = $text; - } - $result = array_merge($attributes, $result); - } elseif ($text !== null) { - $result = $text; - } - - // Make sure we're always returning an array - if ($nesting == 0 && !is_array($result)) { - $result = [$result]; - } - - return $result; - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/SchemaFormatter.php b/vendor/guzzlehttp/guzzle-services/src/SchemaFormatter.php deleted file mode 100644 index 34f7a884..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/SchemaFormatter.php +++ /dev/null @@ -1,141 +0,0 @@ -formatDateTime($value); - case 'date-time-http': - return $this->formatDateTimeHttp($value); - case 'date': - return $this->formatDate($value); - case 'time': - return $this->formatTime($value); - case 'timestamp': - return $this->formatTimestamp($value); - case 'boolean-string': - return $this->formatBooleanAsString($value); - default: - return $value; - } - } - - /** - * Perform the actual DateTime formatting - * - * @param int|string|\DateTime $dateTime Date time value - * @param string $format Format of the result - * - * @return string - * @throws \InvalidArgumentException - */ - protected function dateFormatter($dateTime, $format) - { - if (is_numeric($dateTime)) { - return gmdate($format, (int) $dateTime); - } - - if (is_string($dateTime)) { - $dateTime = new \DateTime($dateTime); - } - - if ($dateTime instanceof \DateTimeInterface) { - static $utc; - if (!$utc) { - $utc = new \DateTimeZone('UTC'); - } - return $dateTime->setTimezone($utc)->format($format); - } - - throw new \InvalidArgumentException('Date/Time values must be either ' - . 'be a string, integer, or DateTime object'); - } - - /** - * Create a ISO 8601 (YYYY-MM-DDThh:mm:ssZ) formatted date time value in - * UTC time. - * - * @param string|integer|\DateTime $value Date time value - * - * @return string - */ - private function formatDateTime($value) - { - return $this->dateFormatter($value, 'Y-m-d\TH:i:s\Z'); - } - - /** - * Create an HTTP date (RFC 1123 / RFC 822) formatted UTC date-time string - * - * @param string|integer|\DateTime $value Date time value - * - * @return string - */ - private function formatDateTimeHttp($value) - { - return $this->dateFormatter($value, 'D, d M Y H:i:s \G\M\T'); - } - - /** - * Create a YYYY-MM-DD formatted string - * - * @param string|integer|\DateTime $value Date time value - * - * @return string - */ - private function formatDate($value) - { - return $this->dateFormatter($value, 'Y-m-d'); - } - - /** - * Create a hh:mm:ss formatted string - * - * @param string|integer|\DateTime $value Date time value - * - * @return string - */ - private function formatTime($value) - { - return $this->dateFormatter($value, 'H:i:s'); - } - - /** - * Formats a boolean value as a string - * - * @param string|integer|bool $value Value to convert to a boolean - * 'true' / 'false' value - * - * @return string - */ - private function formatBooleanAsString($value) - { - return filter_var($value, FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'; - } - - /** - * Return a UNIX timestamp in the UTC timezone - * - * @param string|integer|\DateTime $value Time value - * - * @return int - */ - private function formatTimestamp($value) - { - return (int) $this->dateFormatter($value, 'U'); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/SchemaValidator.php b/vendor/guzzlehttp/guzzle-services/src/SchemaValidator.php deleted file mode 100644 index 4a2833f3..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/SchemaValidator.php +++ /dev/null @@ -1,297 +0,0 @@ -castIntegerToStringType = $castIntegerToStringType; - } - - /** - * @param Parameter $param - * @param $value - * @return bool - */ - public function validate(Parameter $param, &$value) - { - $this->errors = []; - $this->recursiveProcess($param, $value); - - if (empty($this->errors)) { - return true; - } else { - sort($this->errors); - return false; - } - } - - /** - * Get the errors encountered while validating - * - * @return array - */ - public function getErrors() - { - return $this->errors ?: []; - } - - /** - * From the allowable types, determine the type that the variable matches - * - * @param string|array $type Parameter type - * @param mixed $value Value to determine the type - * - * @return string|false Returns the matching type on - */ - protected function determineType($type, $value) - { - foreach ((array) $type as $t) { - if ($t == 'string' - && (is_string($value) || (is_object($value) && method_exists($value, '__toString'))) - ) { - return 'string'; - } elseif ($t == 'object' && (is_array($value) || is_object($value))) { - return 'object'; - } elseif ($t == 'array' && is_array($value)) { - return 'array'; - } elseif ($t == 'integer' && is_integer($value)) { - return 'integer'; - } elseif ($t == 'boolean' && is_bool($value)) { - return 'boolean'; - } elseif ($t == 'number' && is_numeric($value)) { - return 'number'; - } elseif ($t == 'numeric' && is_numeric($value)) { - return 'numeric'; - } elseif ($t == 'null' && !$value) { - return 'null'; - } elseif ($t == 'any') { - return 'any'; - } - } - - return false; - } - - /** - * Recursively validate a parameter - * - * @param Parameter $param API parameter being validated - * @param mixed $value Value to validate and validate. The value may - * change during this validate. - * @param string $path Current validation path (used for error reporting) - * @param int $depth Current depth in the validation validate - * - * @return bool Returns true if valid, or false if invalid - */ - protected function recursiveProcess( - Parameter $param, - &$value, - $path = '', - $depth = 0 - ) { - // Update the value by adding default or static values - $value = $param->getValue($value); - - $required = $param->isRequired(); - // if the value is null and the parameter is not required or is static, - // then skip any further recursion - if ((null === $value && !$required) || $param->isStatic()) { - return true; - } - - $type = $param->getType(); - // Attempt to limit the number of times is_array is called by tracking - // if the value is an array - $valueIsArray = is_array($value); - // If a name is set then update the path so that validation messages - // are more helpful - if ($name = $param->getName()) { - $path .= "[{$name}]"; - } - - if ($type == 'object') { - // Determine whether or not this "value" has properties and should - // be traversed - $traverse = $temporaryValue = false; - - // Convert the value to an array - if (!$valueIsArray && $value instanceof ToArrayInterface) { - $value = $value->toArray(); - } - - if ($valueIsArray) { - // Ensure that the array is associative and not numerically - // indexed - if (isset($value[0])) { - $this->errors[] = "{$path} must be an array of properties. Got a numerically indexed array."; - return false; - } - $traverse = true; - } elseif ($value === null) { - // Attempt to let the contents be built up by default values if - // possible - $value = []; - $temporaryValue = $valueIsArray = $traverse = true; - } - - if ($traverse) { - if ($properties = $param->getProperties()) { - // if properties were found, validate each property - foreach ($properties as $property) { - $name = $property->getName(); - if (isset($value[$name])) { - $this->recursiveProcess($property, $value[$name], $path, $depth + 1); - } else { - $current = null; - $this->recursiveProcess($property, $current, $path, $depth + 1); - // Only set the value if it was populated - if (null !== $current) { - $value[$name] = $current; - } - } - } - } - - $additional = $param->getAdditionalProperties(); - if ($additional !== true) { - // If additional properties were found, then validate each - // against the additionalProperties attr. - $keys = array_keys($value); - // Determine the keys that were specified that were not - // listed in the properties of the schema - $diff = array_diff($keys, array_keys($properties)); - if (!empty($diff)) { - // Determine which keys are not in the properties - if ($additional instanceof Parameter) { - foreach ($diff as $key) { - $this->recursiveProcess($additional, $value[$key], "{$path}[{$key}]", $depth); - } - } else { - // if additionalProperties is set to false and there - // are additionalProperties in the values, then fail - foreach ($diff as $prop) { - $this->errors[] = sprintf('%s[%s] is not an allowed property', $path, $prop); - } - } - } - } - - // A temporary value will be used to traverse elements that - // have no corresponding input value. This allows nested - // required parameters with default values to bubble up into the - // input. Here we check if we used a temp value and nothing - // bubbled up, then we need to remote the value. - if ($temporaryValue && empty($value)) { - $value = null; - $valueIsArray = false; - } - } - - } elseif ($type == 'array' && $valueIsArray && $param->getItems()) { - foreach ($value as $i => &$item) { - // Validate each item in an array against the items attribute of the schema - $this->recursiveProcess($param->getItems(), $item, $path . "[{$i}]", $depth + 1); - } - } - - // If the value is required and the type is not null, then there is an - // error if the value is not set - if ($required && $value === null && $type != 'null') { - $message = "{$path} is " . ($param->getType() - ? ('a required ' . implode(' or ', (array) $param->getType())) - : 'required'); - if ($param->has('description')) { - $message .= ': ' . $param->getDescription(); - } - $this->errors[] = $message; - return false; - } - - // Validate that the type is correct. If the type is string but an - // integer was passed, the class can be instructed to cast the integer - // to a string to pass validation. This is the default behavior. - if ($type && (!$type = $this->determineType($type, $value))) { - if ($this->castIntegerToStringType - && $param->getType() == 'string' - && is_integer($value) - ) { - $value = (string) $value; - } else { - $this->errors[] = "{$path} must be of type " . implode(' or ', (array) $param->getType()); - } - } - - // Perform type specific validation for strings, arrays, and integers - if ($type == 'string') { - // Strings can have enums which are a list of predefined values - if (($enum = $param->getEnum()) && !in_array($value, $enum)) { - $this->errors[] = "{$path} must be one of " . implode(' or ', array_map(function ($s) { - return '"' . addslashes($s) . '"'; - }, $enum)); - } - // Strings can have a regex pattern that the value must match - if (($pattern = $param->getPattern()) && !preg_match($pattern, $value)) { - $this->errors[] = "{$path} must match the following regular expression: {$pattern}"; - } - - $strLen = null; - if ($min = $param->getMinLength()) { - $strLen = strlen($value); - if ($strLen < $min) { - $this->errors[] = "{$path} length must be greater than or equal to {$min}"; - } - } - if ($max = $param->getMaxLength()) { - if (($strLen ?: strlen($value)) > $max) { - $this->errors[] = "{$path} length must be less than or equal to {$max}"; - } - } - - } elseif ($type == 'array') { - $size = null; - if ($min = $param->getMinItems()) { - $size = count($value); - if ($size < $min) { - $this->errors[] = "{$path} must contain {$min} or more elements"; - } - } - if ($max = $param->getMaxItems()) { - if (($size ?: count($value)) > $max) { - $this->errors[] = "{$path} must contain {$max} or fewer elements"; - } - } - - } elseif ($type == 'integer' || $type == 'number' || $type == 'numeric') { - if (($min = $param->getMinimum()) && $value < $min) { - $this->errors[] = "{$path} must be greater than or equal to {$min}"; - } - if (($max = $param->getMaximum()) && $value > $max) { - $this->errors[] = "{$path} must be less than or equal to {$max}"; - } - } - - return empty($this->errors); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/src/Serializer.php b/vendor/guzzlehttp/guzzle-services/src/Serializer.php deleted file mode 100644 index 160fbc25..00000000 --- a/vendor/guzzlehttp/guzzle-services/src/Serializer.php +++ /dev/null @@ -1,164 +0,0 @@ - new BodyLocation(), - 'query' => new QueryLocation(), - 'header' => new HeaderLocation(), - 'json' => new JsonLocation(), - 'xml' => new XmlLocation(), - 'formParam' => new FormParamLocation(), - 'multipart' => new MultiPartLocation(), - ]; - } - - $this->locations = $requestLocations + $defaultRequestLocations; - $this->description = $description; - } - - /** - * @param CommandInterface $command - * @return RequestInterface - */ - public function __invoke(CommandInterface $command) - { - $request = $this->createRequest($command); - return $this->prepareRequest($command, $request); - } - - /** - * Prepares a request for sending using location visitors - * - * @param CommandInterface $command - * @param RequestInterface $request Request being created - * @return RequestInterface - * @throws \RuntimeException If a location cannot be handled - */ - protected function prepareRequest( - CommandInterface $command, - RequestInterface $request - ) { - $visitedLocations = []; - $operation = $this->description->getOperation($command->getName()); - - // Visit each actual parameter - foreach ($operation->getParams() as $name => $param) { - /* @var Parameter $param */ - $location = $param->getLocation(); - // Skip parameters that have not been set or are URI location - if ($location == 'uri' || !$command->hasParam($name)) { - continue; - } - if (!isset($this->locations[$location])) { - throw new \RuntimeException("No location registered for $name"); - } - $visitedLocations[$location] = true; - $request = $this->locations[$location]->visit($command, $request, $param); - } - - // Ensure that the after() method is invoked for additionalParameters - /** @var Parameter $additional */ - if ($additional = $operation->getAdditionalParameters()) { - $visitedLocations[$additional->getLocation()] = true; - } - - // Call the after() method for each visited location - foreach (array_keys($visitedLocations) as $location) { - $request = $this->locations[$location]->after($command, $request, $operation); - } - - return $request; - } - - /** - * Create a request for the command and operation - * - * @param CommandInterface $command - * - * @return RequestInterface - * @throws \RuntimeException - */ - protected function createRequest(CommandInterface $command) - { - $operation = $this->description->getOperation($command->getName()); - - // If command does not specify a template, assume the client's base URL. - if (null === $operation->getUri()) { - return new Request( - $operation->getHttpMethod(), - $this->description->getBaseUri() - ); - } - - return $this->createCommandWithUri($operation, $command); - } - - /** - * Create a request for an operation with a uri merged onto a base URI - * - * @param \GuzzleHttp\Command\Guzzle\Operation $operation - * @param \GuzzleHttp\Command\CommandInterface $command - * - * @return \GuzzleHttp\Psr7\Request - */ - private function createCommandWithUri( - Operation $operation, - CommandInterface $command - ) { - // Get the path values and use the client config settings - $variables = []; - foreach ($operation->getParams() as $name => $arg) { - /* @var Parameter $arg */ - if ($arg->getLocation() == 'uri') { - if (isset($command[$name])) { - $variables[$name] = $arg->filter($command[$name]); - if (!is_array($variables[$name])) { - $variables[$name] = (string) $variables[$name]; - } - } - } - } - - // Expand the URI template. - $uri = \GuzzleHttp\uri_template($operation->getUri(), $variables); - - return new Request( - $operation->getHttpMethod(), - Uri::resolve($this->description->getBaseUri(), $uri) - ); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/Asset/Exception/CustomCommandException.php b/vendor/guzzlehttp/guzzle-services/tests/Asset/Exception/CustomCommandException.php deleted file mode 100644 index f9dfe6dd..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/Asset/Exception/CustomCommandException.php +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Title - - - - - \ No newline at end of file diff --git a/vendor/guzzlehttp/guzzle-services/tests/DescriptionTest.php b/vendor/guzzlehttp/guzzle-services/tests/DescriptionTest.php deleted file mode 100644 index 9f73cf3d..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/DescriptionTest.php +++ /dev/null @@ -1,184 +0,0 @@ -operations = [ - 'test_command' => [ - 'name' => 'test_command', - 'description' => 'documentationForCommand', - 'httpMethod' => 'DELETE', - 'class' => 'FooModel', - 'parameters' => [ - 'bucket' => ['required' => true], - 'key' => ['required' => true] - ] - ] - ]; - } - - public function testConstructor() - { - $service = new Description(['operations' => $this->operations]); - $this->assertEquals(1, count($service->getOperations())); - $this->assertFalse($service->hasOperation('foobar')); - $this->assertTrue($service->hasOperation('test_command')); - } - - public function testContainsModels() - { - $d = new Description([ - 'operations' => ['foo' => []], - 'models' => [ - 'Tag' => ['type' => 'object'], - 'Person' => ['type' => 'object'] - ] - ]); - $this->assertTrue($d->hasModel('Tag')); - $this->assertTrue($d->hasModel('Person')); - $this->assertFalse($d->hasModel('Foo')); - $this->assertInstanceOf(Parameter::class, $d->getModel('Tag')); - $this->assertEquals(['Tag', 'Person'], array_keys($d->getModels())); - } - - public function testCanUseResponseClass() - { - $d = new Description([ - 'operations' => [ - 'foo' => ['responseClass' => 'Tag'] - ], - 'models' => ['Tag' => ['type' => 'object']] - ]); - $op = $d->getOperation('foo'); - $this->assertNotNull($op->getResponseModel()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testRetrievingMissingModelThrowsException() - { - $d = new Description([]); - $d->getModel('foo'); - } - - public function testHasAttributes() - { - $d = new Description([ - 'operations' => [], - 'name' => 'Name', - 'description' => 'Description', - 'apiVersion' => '1.24' - ]); - - $this->assertEquals('Name', $d->getName()); - $this->assertEquals('Description', $d->getDescription()); - $this->assertEquals('1.24', $d->getApiVersion()); - } - - public function testPersistsCustomAttributes() - { - $data = [ - 'operations' => ['foo' => ['class' => 'foo', 'parameters' => []]], - 'name' => 'Name', - 'description' => 'Test', - 'apiVersion' => '1.24', - 'auth' => 'foo', - 'keyParam' => 'bar' - ]; - $d = new Description($data); - $this->assertEquals('foo', $d->getData('auth')); - $this->assertEquals('bar', $d->getData('keyParam')); - $this->assertEquals(['auth' => 'foo', 'keyParam' => 'bar'], $d->getData()); - $this->assertNull($d->getData('missing')); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testThrowsExceptionForMissingOperation() - { - $s = new Description([]); - $this->assertNull($s->getOperation('foo')); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testValidatesOperationTypes() - { - new Description([ - 'operations' => ['foo' => new \stdClass()] - ]); - } - - public function testHasbaseUrl() - { - $description = new Description(['baseUrl' => 'http://foo.com']); - $this->assertEquals('http://foo.com', $description->getBaseUri()); - } - - public function testHasbaseUri() - { - $description = new Description(['baseUri' => 'http://foo.com']); - $this->assertEquals('http://foo.com', $description->getBaseUri()); - } - - public function testModelsHaveNames() - { - $desc = [ - 'models' => [ - 'date' => ['type' => 'string'], - 'user'=> [ - 'type' => 'object', - 'properties' => [ - 'dob' => ['$ref' => 'date'] - ] - ] - ] - ]; - - $s = new Description($desc); - $this->assertEquals('string', $s->getModel('date')->getType()); - $this->assertEquals('dob', $s->getModel('user')->getProperty('dob')->getName()); - } - - public function testHasOperations() - { - $desc = ['operations' => ['foo' => ['parameters' => ['foo' => [ - 'name' => 'foo' - ]]]]]; - $s = new Description($desc); - $this->assertInstanceOf(Operation::class, $s->getOperation('foo')); - $this->assertSame($s->getOperation('foo'), $s->getOperation('foo')); - } - - public function testHasFormatter() - { - $s = new Description([]); - $this->assertNotEmpty($s->format('date', 'now')); - } - - public function testCanUseCustomFormatter() - { - $formatter = $this->getMockBuilder(SchemaFormatter::class) - ->setMethods(['format']) - ->getMock(); - $formatter->expects($this->once()) - ->method('format'); - $s = new Description([], ['formatter' => $formatter]); - $s->format('time', 'now'); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/DeserializerTest.php b/vendor/guzzlehttp/guzzle-services/tests/DeserializerTest.php deleted file mode 100644 index a44f9802..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/DeserializerTest.php +++ /dev/null @@ -1,386 +0,0 @@ -serviceClient = $this->getMockBuilder(GuzzleClient::class) - ->disableOriginalConstructor() - ->getMock(); - $this->command = $this->getMockBuilder(CommandInterface::class)->getMock(); - } - - protected function prepareErrorResponses($commandName, array $errors = []) - { - $this->command->expects($this->once())->method('getName')->will($this->returnValue($commandName)); - - $description = $this->getMockBuilder(DescriptionInterface::class)->getMock(); - $operation = new Operation(['errorResponses' => $errors], $description); - - $description->expects($this->once()) - ->method('getOperation') - ->with($commandName) - ->will($this->returnValue($operation)); - - $this->serviceClient->expects($this->once()) - ->method('getDescription') - ->will($this->returnValue($description)); - } - - public function testDoNothingIfNoException() - { - $mock = new MockHandler([new Response(200)]); - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org/{foo}', - 'httpMethod' => 'GET', - 'responseModel' => 'j', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => true, - 'location' => 'uri' - ] - ] - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object' - ] - ] - ]); - $httpClient = new HttpClient(['handler' => $mock]); - $client = new GuzzleClient($httpClient, $description); - $client->foo(['bar' => 'baz']); - } - - /** - * @expectedException \GuzzleHttp\Tests\Command\Guzzle\Asset\Exception\CustomCommandException - */ - public function testCreateExceptionWithCode() - { - $response = new Response(404); - $mock = new MockHandler([$response]); - - $description = new Description([ - 'name' => 'Test API', - 'baseUri' => 'http://httpbin.org', - 'operations' => [ - 'foo' => [ - 'uri' => '/{foo}', - 'httpMethod' => 'GET', - 'responseClass' => 'Foo', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'Unique user name (alphanumeric)', - 'location' => 'json' - ], - ], - 'errorResponses' => [ - ['code' => 404, 'class' => CustomCommandException::class] - ] - ] - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'location' => 'json' - ] - ] - ] - ]); - - $httpClient = new HttpClient(['handler' => $mock]); - $client = new GuzzleClient($httpClient, $description); - $client->foo(['bar' => 'baz']); - } - - public function testNotCreateExceptionIfDoesNotMatchCode() - { - $response = new Response(401); - $mock = new MockHandler([$response]); - - $description = new Description([ - 'name' => 'Test API', - 'baseUri' => 'http://httpbin.org', - 'operations' => [ - 'foo' => [ - 'uri' => '/{foo}', - 'httpMethod' => 'GET', - 'responseClass' => 'Foo', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'Unique user name (alphanumeric)', - 'location' => 'json' - ], - ], - 'errorResponses' => [ - ['code' => 404, 'class' => CustomCommandException::class] - ] - ] - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'location' => 'json' - ] - ] - ] - ]); - - $httpClient = new HttpClient(['handler' => $mock]); - $client = new GuzzleClient($httpClient, $description); - $client->foo(['bar' => 'baz']); - } - - /** - * @expectedException \GuzzleHttp\Tests\Command\Guzzle\Asset\Exception\CustomCommandException - */ - public function testCreateExceptionWithExactMatchOfReasonPhrase() - { - $response = new Response(404, [], null, '1.1', 'Bar'); - $mock = new MockHandler([$response]); - - $description = new Description([ - 'name' => 'Test API', - 'baseUri' => 'http://httpbin.org', - 'operations' => [ - 'foo' => [ - 'uri' => '/{foo}', - 'httpMethod' => 'GET', - 'responseClass' => 'Foo', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'Unique user name (alphanumeric)', - 'location' => 'json' - ], - ], - 'errorResponses' => [ - ['code' => 404, 'phrase' => 'Bar', 'class' => CustomCommandException::class] - ] - ] - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'location' => 'json' - ] - ] - ] - ]); - - $httpClient = new HttpClient(['handler' => $mock]); - $client = new GuzzleClient($httpClient, $description); - $client->foo(['bar' => 'baz']); - } - - /** - * @expectedException \GuzzleHttp\Tests\Command\Guzzle\Asset\Exception\OtherCustomCommandException - */ - public function testFavourMostPreciseMatch() - { - $response = new Response(404, [], null, '1.1', 'Bar'); - $mock = new MockHandler([$response]); - - $description = new Description([ - 'name' => 'Test API', - 'baseUri' => 'http://httpbin.org', - 'operations' => [ - 'foo' => [ - 'uri' => '/{foo}', - 'httpMethod' => 'GET', - 'responseClass' => 'Foo', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'Unique user name (alphanumeric)', - 'location' => 'json' - ], - ], - 'errorResponses' => [ - ['code' => 404, 'class' => CustomCommandException::class], - ['code' => 404, 'phrase' => 'Bar', 'class' => OtherCustomCommandException::class], - ] - ] - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'location' => 'json' - ] - ] - ] - ]); - - $httpClient = new HttpClient(['handler' => $mock]); - $client = new GuzzleClient($httpClient, $description); - $client->foo(['bar' => 'baz']); - } - - /** - * @expectedException \GuzzleHttp\Command\Exception\CommandException - * @expectedExceptionMessage 404 - */ - public function testDoesNotAddResultWhenExceptionIsPresent() - { - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org/{foo}', - 'httpMethod' => 'GET', - 'responseModel' => 'j', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => true, - 'location' => 'uri' - ] - ] - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object' - ] - ] - ]); - - $mock = new MockHandler([new Response(404)]); - $stack = HandlerStack::create($mock); - $httpClient = new HttpClient(['handler' => $stack]); - $client = new GuzzleClient($httpClient, $description); - $client->foo(['bar' => 'baz']); - } - - public function testReturnsExpectedResult() - { - $loginResponse = new Response( - 200, - [], - '{ - "LoginResponse":{ - "result":{ - "type":4, - "username":{ - "uid":38664492, - "content":"skyfillers-api-test" - }, - "token":"3FB1F21014D630481D35CBC30CBF4043" - }, - "status":{ - "code":200, - "content":"OK" - } - } - }' - ); - $mock = new MockHandler([$loginResponse]); - - $description = new Description([ - 'name' => 'Test API', - 'baseUri' => 'http://httpbin.org', - 'operations' => [ - 'Login' => [ - 'uri' => '/{foo}', - 'httpMethod' => 'POST', - 'responseClass' => 'LoginResponse', - 'parameters' => [ - 'username' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'Unique user name (alphanumeric)', - 'location' => 'json' - ], - 'password' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'User\'s password', - 'location' => 'json' - ], - 'response' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Determines the response type: xml = result content will be xml formatted (default); plain = result content will be simple text, without structure; json = result content will be json formatted', - 'location' => 'json' - ], - 'token' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Provides the authentication token', - 'location' => 'json' - ] - ] - ] - ], - 'models' => [ - 'LoginResponse' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'location' => 'json' - ] - ] - ] - ]); - - $httpClient = new HttpClient(['handler' => $mock]); - $client = new GuzzleClient($httpClient, $description); - $result = $client->Login([ - 'username' => 'test', - 'password' => 'test', - 'response' => 'json', - ]); - - $expected = [ - 'result' => [ - 'type' => 4, - 'username' => [ - 'uid' => 38664492, - 'content' => 'skyfillers-api-test' - ], - 'token' => '3FB1F21014D630481D35CBC30CBF4043' - ], - 'status' => [ - 'code' => 200, - 'content' => 'OK' - ] - ]; - $this->assertArraySubset($expected, $result['LoginResponse']); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/GuzzleClientTest.php b/vendor/guzzlehttp/guzzle-services/tests/GuzzleClientTest.php deleted file mode 100644 index 0e5c9d9c..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/GuzzleClientTest.php +++ /dev/null @@ -1,1037 +0,0 @@ -getServiceClient( - [ - new Response(200, [], '{"foo":"bar"}'), - new Response(200, [], '{"foofoo":"barbar"}'), - ], - null, - $this->commandToRequestTransformer() - ); - - // Synchronous - $result1 = $client->doThatThingYouDo(['fizz' => 'buzz']); - $this->assertEquals('bar', $result1['foo']); - $this->assertEquals('buzz', $result1['_request']['fizz']); - $this->assertEquals('doThatThingYouDo', $result1['_request']['action']); - - // Asynchronous - $result2 = $client->doThatThingOtherYouDoAsync(['fizz' => 'buzz'])->wait(); - $this->assertEquals('barbar', $result2['foofoo']); - $this->assertEquals('doThatThingOtherYouDo', $result2['_request']['action']); - } - - public function testExecuteWithQueryLocation() - { - $mock = new MockHandler(); - $client = $this->getServiceClient( - [ - new Response(200, [], '{"foo":"bar"}'), - new Response(200, [], '{"foo":"bar"}') - ], - $mock - ); - - $client->doQueryLocation(['foo' => 'Foo']); - $this->assertEquals('foo=Foo', $mock->getLastRequest()->getUri()->getQuery()); - - $client->doQueryLocation([ - 'foo' => 'Foo', - 'bar' => 'Bar', - 'baz' => 'Baz' - ]); - $last = $mock->getLastRequest(); - $this->assertEquals('foo=Foo&bar=Bar&baz=Baz', $last->getUri()->getQuery()); - } - - public function testExecuteWithBodyLocation() - { - $mock = new MockHandler(); - - $client = $this->getServiceClient( - [ - new Response(200, [], '{"foo":"bar"}'), - new Response(200, [], '{"foo":"bar"}') - ], - $mock - ); - - $client->doBodyLocation(['foo' => 'Foo']); - $this->assertEquals('foo=Foo', (string) $mock->getLastRequest()->getBody()); - - $client->doBodyLocation([ - 'foo' => 'Foo', - 'bar' => 'Bar', - 'baz' => 'Baz' - ]); - $this->assertEquals('foo=Foo&bar=Bar&baz=Baz', (string) $mock->getLastRequest()->getBody()); - } - - public function testExecuteWithJsonLocation() - { - $mock = new MockHandler(); - - $client = $this->getServiceClient( - [ - new Response(200, [], '{"foo":"bar"}'), - new Response(200, [], '{"foo":"bar"}') - ], - $mock - ); - - $client->doJsonLocation(['foo' => 'Foo']); - $this->assertEquals('{"foo":"Foo"}', (string) $mock->getLastRequest()->getBody()); - - $client->doJsonLocation([ - 'foo' => 'Foo', - 'bar' => 'Bar', - 'baz' => 'Baz' - ]); - $this->assertEquals('{"foo":"Foo","bar":"Bar","baz":"Baz"}', (string) $mock->getLastRequest()->getBody()); - } - - public function testExecuteWithHeaderLocation() - { - $mock = new MockHandler(); - - $client = $this->getServiceClient( - [ - new Response(200, [], '{"foo":"bar"}'), - new Response(200, [], '{"foo":"bar"}') - ], - $mock - ); - - $client->doHeaderLocation(['foo' => 'Foo']); - $this->assertEquals(['Foo'], $mock->getLastRequest()->getHeader('foo')); - - $client->doHeaderLocation([ - 'foo' => 'Foo', - 'bar' => 'Bar', - 'baz' => 'Baz' - ]); - $this->assertEquals(['Foo'], $mock->getLastRequest()->getHeader('foo')); - $this->assertEquals(['Bar'], $mock->getLastRequest()->getHeader('bar')); - $this->assertEquals(['Baz'], $mock->getLastRequest()->getHeader('baz')); - } - - public function testExecuteWithXmlLocation() - { - $mock = new MockHandler(); - - $client = $this->getServiceClient( - [ - new Response(200, [], '{"foo":"bar"}'), - new Response(200, [], '{"foo":"bar"}') - ], - $mock - ); - - $client->doXmlLocation(['foo' => 'Foo']); - $this->assertEquals( - "\nFoo\n", - (string) $mock->getLastRequest()->getBody() - ); - - $client->doXmlLocation([ - 'foo' => 'Foo', - 'bar' => 'Bar', - 'baz' => 'Baz' - ]); - $this->assertEquals( - "\nFooBarBaz\n", - $mock->getLastRequest()->getBody() - ); - } - - public function testExecuteWithMultiPartLocation() - { - $mock = new MockHandler(); - - $client = $this->getServiceClient( - [ - new Response(200, [], '{"foo":"bar"}'), - new Response(200, [], '{"foo":"bar"}'), - new Response(200, [], '{"foo":"bar"}') - ], - $mock - ); - - $client->doMultiPartLocation(['foo' => 'Foo']); - $multiPartRequestBody = (string) $mock->getLastRequest()->getBody(); - $this->assertContains('name="foo"', $multiPartRequestBody); - $this->assertContains('Foo', $multiPartRequestBody); - - $client->doMultiPartLocation([ - 'foo' => 'Foo', - 'bar' => 'Bar', - 'baz' => 'Baz' - ]); - - $multiPartRequestBody = (string) $mock->getLastRequest()->getBody(); - $this->assertContains('name="foo"', $multiPartRequestBody); - $this->assertContains('Foo', $multiPartRequestBody); - $this->assertContains('name="bar"', $multiPartRequestBody); - $this->assertContains('Bar', $multiPartRequestBody); - $this->assertContains('name="baz"', $multiPartRequestBody); - $this->assertContains('Baz', $multiPartRequestBody); - - $client->doMultiPartLocation([ - 'file' => fopen(dirname(__FILE__) . '/Asset/test.html', 'r'), - ]); - $multiPartRequestBody = (string) $mock->getLastRequest()->getBody(); - $this->assertContains('name="file"', $multiPartRequestBody); - $this->assertContains('filename="test.html"', $multiPartRequestBody); - $this->assertContains('Title', $multiPartRequestBody); - } - - public function testHasConfig() - { - $client = new HttpClient(); - $description = new Description([]); - $guzzle = new GuzzleClient( - $client, - $description, - $this->commandToRequestTransformer(), - $this->responseToResultTransformer(), - null, - ['foo' => 'bar'] - ); - - $this->assertSame($client, $guzzle->getHttpClient()); - $this->assertSame($description, $guzzle->getDescription()); - $this->assertEquals('bar', $guzzle->getConfig('foo')); - $this->assertEquals([], $guzzle->getConfig('defaults')); - $guzzle->setConfig('abc', 'listen'); - $this->assertEquals('listen', $guzzle->getConfig('abc')); - } - - public function testAddsValidateHandlerWhenTrue() - { - $client = new HttpClient(); - $description = new Description([]); - $guzzle = new GuzzleClient( - $client, - $description, - $this->commandToRequestTransformer(), - $this->responseToResultTransformer(), - null, - [ - 'validate' => true, - 'process' => false - ] - ); - - $handlers = explode("\n", $guzzle->getHandlerStack()->__toString()); - $handlers = array_filter($handlers); - $this->assertCount(3, $handlers); - } - - public function testDisablesHandlersWhenFalse() - { - $client = new HttpClient(); - $description = new Description([]); - $guzzle = new GuzzleClient( - $client, - $description, - $this->commandToRequestTransformer(), - $this->responseToResultTransformer(), - null, - [ - 'validate' => false, - 'process' => false - ] - ); - - $handlers = explode("\n", $guzzle->getHandlerStack()->__toString()); - $handlers = array_filter($handlers); - $this->assertCount(1, $handlers); - } - - public function testValidateDescription() - { - $client = new HttpClient(); - $description = new Description( - [ - 'name' => 'Testing API ', - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'Foo' => [ - 'httpMethod' => 'GET', - 'uri' => '/get', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Bar', - 'location' => 'query' - ], - 'baz' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'baz', - 'location' => 'query' - ], - ], - 'responseModel' => 'Foo' - ], - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'properties' => [ - 'id' => [ - 'location' => 'json', - 'type' => 'string' - ], - 'location' => [ - 'location' => 'header', - 'sentAs' => 'Location', - 'type' => 'string' - ], - 'age' => [ - 'location' => 'json', - 'type' => 'integer' - ], - 'statusCode' => [ - 'location' => 'statusCode', - 'type' => 'integer' - ], - ], - ], - ], - ] - ); - - $guzzle = new GuzzleClient( - $client, - $description, - null, - null, - null, - [ - 'validate' => true, - 'process' => false - ] - ); - - $command = $guzzle->getCommand('Foo', ['baz' => 'BAZ']); - /** @var ResponseInterface $response */ - $response = $guzzle->execute($command); - $this->assertInstanceOf(Response::class, $response); - $this->assertEquals(200, $response->getStatusCode()); - } - - /** - * @expectedException \GuzzleHttp\Command\Exception\CommandException - * @expectedExceptionMessage Validation errors: [baz] is a required string: baz - */ - public function testValidateDescriptionFailsDueMissingRequiredParameter() - { - $client = new HttpClient(); - $description = new Description( - [ - 'name' => 'Testing API ', - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'Foo' => [ - 'httpMethod' => 'GET', - 'uri' => '/get', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Bar', - 'location' => 'query' - ], - 'baz' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'baz', - 'location' => 'query' - ], - ], - 'responseModel' => 'Foo' - ], - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'properties' => [ - 'id' => [ - 'location' => 'json', - 'type' => 'string' - ], - 'location' => [ - 'location' => 'header', - 'sentAs' => 'Location', - 'type' => 'string' - ], - 'age' => [ - 'location' => 'json', - 'type' => 'integer' - ], - 'statusCode' => [ - 'location' => 'statusCode', - 'type' => 'integer' - ], - ], - ], - ], - ] - ); - - $guzzle = new GuzzleClient( - $client, - $description, - null, - null, - null, - [ - 'validate' => true, - 'process' => false - ] - ); - - $command = $guzzle->getCommand('Foo'); - /** @var ResultInterface $result */ - $result = $guzzle->execute($command); - $this->assertInstanceOf(Result::class, $result); - $result = $result->toArray(); - $this->assertEquals(200, $result['statusCode']); - } - - /** - * @expectedException \GuzzleHttp\Command\Exception\CommandException - * @expectedExceptionMessage Validation errors: [baz] must be of type integer - */ - public function testValidateDescriptionFailsDueTypeMismatch() - { - $client = new HttpClient(); - $description = new Description( - [ - 'name' => 'Testing API ', - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'Foo' => [ - 'httpMethod' => 'GET', - 'uri' => '/get', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Bar', - 'location' => 'query' - ], - 'baz' => [ - 'type' => 'integer', - 'required' => true, - 'description' => 'baz', - 'location' => 'query' - ], - ], - 'responseModel' => 'Foo' - ], - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'properties' => [ - 'id' => [ - 'location' => 'json', - 'type' => 'string' - ], - 'location' => [ - 'location' => 'header', - 'sentAs' => 'Location', - 'type' => 'string' - ], - 'age' => [ - 'location' => 'json', - 'type' => 'integer' - ], - 'statusCode' => [ - 'location' => 'statusCode', - 'type' => 'integer' - ], - ], - ], - ], - ] - ); - - $guzzle = new GuzzleClient( - $client, - $description, - null, - null, - null, - [ - 'validate' => true, - 'process' => false - ] - ); - - $command = $guzzle->getCommand('Foo', ['baz' => 'Hello']); - /** @var ResultInterface $result */ - $result = $guzzle->execute($command); - $this->assertInstanceOf(Result::class, $result); - $result = $result->toArray(); - $this->assertEquals(200, $result['statusCode']); - } - - public function testValidateDescriptionDoesNotFailWhenSendingIntegerButExpectingString() - { - $client = new HttpClient(); - $description = new Description( - [ - 'name' => 'Testing API ', - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'Foo' => [ - 'httpMethod' => 'GET', - 'uri' => '/get', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Bar', - 'location' => 'query' - ], - 'baz' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'baz', - 'location' => 'query' - ], - ], - 'responseModel' => 'Foo' - ], - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'properties' => [ - 'id' => [ - 'location' => 'json', - 'type' => 'string' - ], - 'location' => [ - 'location' => 'header', - 'sentAs' => 'Location', - 'type' => 'string' - ], - 'age' => [ - 'location' => 'json', - 'type' => 'integer' - ], - 'statusCode' => [ - 'location' => 'statusCode', - 'type' => 'integer' - ], - ], - ], - ], - ] - ); - - $guzzle = new GuzzleClient($client, $description); - - $command = $guzzle->getCommand('Foo', ['baz' => 42]); - /** @var ResultInterface $result */ - $result = $guzzle->execute($command); - $this->assertInstanceOf(Result::class, $result); - $result = $result->toArray(); - $this->assertEquals(200, $result['statusCode']); - } - - public function testMagicMethodExecutesCommands() - { - $client = new HttpClient(); - $description = new Description( - [ - 'name' => 'Testing API ', - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'Foo' => [ - 'httpMethod' => 'GET', - 'uri' => '/get', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Bar', - 'location' => 'query' - ], - 'baz' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'baz', - 'location' => 'query' - ], - ], - 'responseModel' => 'Foo' - ], - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'properties' => [ - 'id' => [ - 'location' => 'json', - 'type' => 'string' - ], - 'location' => [ - 'location' => 'header', - 'sentAs' => 'Location', - 'type' => 'string' - ], - 'age' => [ - 'location' => 'json', - 'type' => 'integer' - ], - 'statusCode' => [ - 'location' => 'statusCode', - 'type' => 'integer' - ], - ], - ], - ], - ] - ); - - $guzzle = $this->getMockBuilder(GuzzleClient::class) - ->setConstructorArgs([ - $client, - $description - ]) - ->setMethods(['execute']) - ->getMock(); - - $guzzle->expects($this->once()) - ->method('execute') - ->will($this->returnValue('foo')); - - $this->assertEquals('foo', $guzzle->foo([])); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage No operation found named Foo - */ - public function testThrowsWhenOperationNotFoundInDescription() - { - $client = new HttpClient(); - $description = new Description([]); - $guzzle = new GuzzleClient( - $client, - $description, - $this->commandToRequestTransformer(), - $this->responseToResultTransformer() - ); - $guzzle->getCommand('foo'); - } - - public function testReturnsProcessedResponse() - { - $client = new HttpClient(); - - $description = new Description( - [ - 'name' => 'Testing API ', - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'Foo' => [ - 'httpMethod' => 'GET', - 'uri' => '/get', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Bar', - 'location' => 'query' - ], - 'baz' => [ - 'type' => 'string', - 'required' => true, - 'description' => 'baz', - 'location' => 'query' - ], - ], - 'responseModel' => 'Foo' - ], - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'properties' => [ - 'id' => [ - 'location' => 'json', - 'type' => 'string' - ], - 'location' => [ - 'location' => 'header', - 'sentAs' => 'Location', - 'type' => 'string' - ], - 'age' => [ - 'location' => 'json', - 'type' => 'integer' - ], - 'statusCode' => [ - 'location' => 'statusCode', - 'type' => 'integer' - ], - ], - ], - ], - ] - ); - - $guzzle = new GuzzleClient($client, $description, null, null); - $command = $guzzle->getCommand('foo', ['baz' => 'BAZ']); - - /** @var ResultInterface $result */ - $result = $guzzle->execute($command); - $this->assertInstanceOf(Result::class, $result); - $result = $result->toArray(); - $this->assertEquals(200, $result['statusCode']); - } - - private function getServiceClient( - array $responses, - MockHandler $mock = null, - callable $commandToRequestTransformer = null - ) { - $mock = $mock ?: new MockHandler(); - - foreach ($responses as $response) { - $mock->append($response); - } - - return new GuzzleClient( - new HttpClient([ - 'handler' => $mock - ]), - $this->getDescription(), - $commandToRequestTransformer, - $this->responseToResultTransformer(), - null, - ['foo' => 'bar'] - ); - } - - private function commandToRequestTransformer() - { - return function (CommandInterface $command) { - $data = $command->toArray(); - $data['action'] = $command->getName(); - - return new Request('POST', '/', [], http_build_query($data)); - }; - } - - private function responseToResultTransformer() - { - return function (ResponseInterface $response, RequestInterface $request, CommandInterface $command) { - $data = \GuzzleHttp\json_decode($response->getBody(), true); - parse_str($request->getBody(), $data['_request']); - - return new Result($data); - }; - } - - private function getDescription() - { - return new Description( - [ - 'name' => 'Testing API ', - 'baseUri' => 'http://httpbin.org/', - 'operations' => [ - 'doThatThingYouDo' => [ - 'responseModel' => 'Bar' - ], - 'doThatThingOtherYouDo' => [ - 'responseModel' => 'Foo' - ], - 'doQueryLocation' => [ - 'httpMethod' => 'GET', - 'uri' => '/queryLocation', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing query request location', - 'location' => 'query' - ], - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing query request location', - 'location' => 'query' - ], - 'baz' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing query request location', - 'location' => 'query' - ] - ], - 'responseModel' => 'QueryResponse' - ], - 'doBodyLocation' => [ - 'httpMethod' => 'GET', - 'uri' => '/bodyLocation', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing body request location', - 'location' => 'body' - ], - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing body request location', - 'location' => 'body' - ], - 'baz' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing body request location', - 'location' => 'body' - ] - ], - 'responseModel' => 'BodyResponse' - ], - 'doJsonLocation' => [ - 'httpMethod' => 'GET', - 'uri' => '/jsonLocation', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing json request location', - 'location' => 'json' - ], - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing json request location', - 'location' => 'json' - ], - 'baz' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing json request location', - 'location' => 'json' - ] - ], - 'responseModel' => 'JsonResponse' - ], - 'doHeaderLocation' => [ - 'httpMethod' => 'GET', - 'uri' => '/headerLocation', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing header request location', - 'location' => 'header' - ], - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing header request location', - 'location' => 'header' - ], - 'baz' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing header request location', - 'location' => 'header' - ] - ], - 'responseModel' => 'HeaderResponse' - ], - 'doXmlLocation' => [ - 'httpMethod' => 'GET', - 'uri' => '/xmlLocation', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing xml request location', - 'location' => 'xml' - ], - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing xml request location', - 'location' => 'xml' - ], - 'baz' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing xml request location', - 'location' => 'xml' - ] - ], - 'responseModel' => 'XmlResponse' - ], - 'doMultiPartLocation' => [ - 'httpMethod' => 'POST', - 'uri' => '/multipartLocation', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing multipart request location', - 'location' => 'multipart' - ], - 'bar' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing multipart request location', - 'location' => 'multipart' - ], - 'baz' => [ - 'type' => 'string', - 'required' => false, - 'description' => 'Testing multipart request location', - 'location' => 'multipart' - ], - 'file' => [ - 'type' => 'any', - 'required' => false, - 'description' => 'Testing multipart request location', - 'location' => 'multipart' - ] - ], - 'responseModel' => 'MultipartResponse' - ], - ], - 'models' => [ - 'Foo' => [ - 'type' => 'object', - 'properties' => [ - 'code' => [ - 'location' => 'statusCode' - ] - ] - ], - 'Bar' => [ - 'type' => 'object', - 'properties' => [ - 'code' => [' - location' => 'statusCode' - ] - ] - ] - ] - ] - ); - } - - public function testDocumentationExampleFromReadme() - { - $client = new HttpClient(); - $description = new Description([ - 'baseUrl' => 'http://httpbin.org/', - 'operations' => [ - 'testing' => [ - 'httpMethod' => 'GET', - 'uri' => '/get{?foo}', - 'responseModel' => 'getResponse', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'location' => 'uri' - ], - 'bar' => [ - 'type' => 'string', - 'location' => 'query' - ] - ] - ] - ], - 'models' => [ - 'getResponse' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'location' => 'json' - ] - ] - ] - ]); - - $guzzle = new GuzzleClient($client, $description); - - $result = $guzzle->testing(['foo' => 'bar']); - $this->assertEquals('bar', $result['args']['foo']); - } - - public function testDescriptionWithExtends() - { - $client = new HttpClient(); - $description = new Description([ - 'baseUrl' => 'http://httpbin.org/', - 'operations' => [ - 'testing' => [ - 'httpMethod' => 'GET', - 'uri' => '/get', - 'responseModel' => 'getResponse', - 'parameters' => [ - 'foo' => [ - 'type' => 'string', - 'default' => 'foo', - 'location' => 'query' - ] - ] - ], - 'testing_extends' => [ - 'extends' => 'testing', - 'responseModel' => 'getResponse', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'location' => 'query' - ] - ] - ], - ], - 'models' => [ - 'getResponse' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'location' => 'json' - ] - ] - ] - ]); - $guzzle = new GuzzleClient($client, $description); - $result = $guzzle->testing_extends(['bar' => 'bar']); - $this->assertEquals('bar', $result['args']['bar']); - $this->assertEquals('foo', $result['args']['foo']); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/Handler/ValidatedDescriptionHandlerTest.php b/vendor/guzzlehttp/guzzle-services/tests/Handler/ValidatedDescriptionHandlerTest.php deleted file mode 100644 index f02396c5..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/Handler/ValidatedDescriptionHandlerTest.php +++ /dev/null @@ -1,112 +0,0 @@ - [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j', - 'parameters' => [ - 'bar' => [ - 'type' => 'string', - 'required' => true - ] - ] - ] - ] - ]); - - $client = new GuzzleClient(new HttpClient(), $description); - $client->foo([]); - } - - public function testSuccessfulValidationDoesNotThrow() - { - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j', - 'parameters' => [] - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object' - ] - ] - ]); - - $client = new GuzzleClient(new HttpClient(), $description); - $client->foo([]); - } - - /** - * @expectedException \GuzzleHttp\Command\Exception\CommandException - * @expectedExceptionMessage Validation errors: [bar] must be of type string - */ - public function testValidatesAdditionalParameters() - { - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j', - 'additionalParameters' => [ - 'type' => 'string' - ] - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object' - ] - ] - ]); - - $client = new GuzzleClient(new HttpClient(), $description); - $client->foo(['bar' => new \stdClass()]); - } - - public function testFilterBeforeValidate() - { - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'parameters' => [ - 'bar' => [ - 'location' => 'uri', - 'type' => 'string', - 'format' => 'date-time', - 'required' => true - ] - ] - ] - ] - ]); - - $client = new GuzzleClient(new HttpClient(), $description); - $client->foo(['bar' => new \DateTimeImmutable()]); // Should not throw any exception - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/OperationTest.php b/vendor/guzzlehttp/guzzle-services/tests/OperationTest.php deleted file mode 100644 index 04313dd7..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/OperationTest.php +++ /dev/null @@ -1,227 +0,0 @@ - 'test', - 'summary' => 'doc', - 'notes' => 'notes', - 'documentationUrl' => 'http://www.example.com', - 'httpMethod' => 'POST', - 'uri' => '/api/v1', - 'responseModel' => 'abc', - 'deprecated' => true, - 'parameters' => [ - 'key' => [ - 'required' => true, - 'type' => 'string', - 'maxLength' => 10, - 'name' => 'key' - ], - 'key_2' => [ - 'required' => true, - 'type' => 'integer', - 'default' => 10, - 'name' => 'key_2' - ] - ] - ]); - - $this->assertEquals('test', $c->getName()); - $this->assertEquals('doc', $c->getSummary()); - $this->assertEquals('http://www.example.com', $c->getDocumentationUrl()); - $this->assertEquals('POST', $c->getHttpMethod()); - $this->assertEquals('/api/v1', $c->getUri()); - $this->assertEquals('abc', $c->getResponseModel()); - $this->assertTrue($c->getDeprecated()); - - $params = array_map(function ($c) { - return $c->toArray(); - }, $c->getParams()); - - $this->assertEquals([ - 'key' => [ - 'required' => true, - 'type' => 'string', - 'maxLength' => 10, - 'name' => 'key' - ], - 'key_2' => [ - 'required' => true, - 'type' => 'integer', - 'default' => 10, - 'name' => 'key_2' - ] - ], $params); - - $this->assertEquals([ - 'required' => true, - 'type' => 'integer', - 'default' => 10, - 'name' => 'key_2' - ], $c->getParam('key_2')->toArray()); - - $this->assertNull($c->getParam('afefwef')); - $this->assertArrayNotHasKey('parent', $c->getParam('key_2')->toArray()); - } - - public function testDeterminesIfHasParam() - { - $command = $this->getTestCommand(); - $this->assertTrue($command->hasParam('data')); - $this->assertFalse($command->hasParam('baz')); - } - - protected function getTestCommand() - { - return new Operation([ - 'parameters' => [ - 'data' => ['type' => 'string'] - ] - ]); - } - - public function testAddsNameToParametersIfNeeded() - { - $command = new Operation(['parameters' => ['foo' => []]]); - $this->assertEquals('foo', $command->getParam('foo')->getName()); - } - - public function testContainsApiErrorInformation() - { - $command = $this->getOperation(); - $this->assertEquals(1, count($command->getErrorResponses())); - } - - public function testHasNotes() - { - $o = new Operation(['notes' => 'foo']); - $this->assertEquals('foo', $o->getNotes()); - } - - public function testHasData() - { - $o = new Operation(['data' => ['foo' => 'baz', 'bar' => 123]]); - $this->assertEquals('baz', $o->getData('foo')); - $this->assertEquals(123, $o->getData('bar')); - $this->assertNull($o->getData('wfefwe')); - $this->assertEquals(['foo' => 'baz', 'bar' => 123], $o->getData()); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMesssage Parameters must be arrays - */ - public function testEnsuresParametersAreArrays() - { - new Operation(['parameters' => ['foo' => true]]); - } - - public function testHasDescription() - { - $s = new Description([]); - $o = new Operation([], $s); - $this->assertSame($s, $o->getServiceDescription()); - } - - public function testHasAdditionalParameters() - { - $o = new Operation([ - 'additionalParameters' => [ - 'type' => 'string', 'name' => 'binks', - ], - 'parameters' => [ - 'foo' => ['type' => 'integer'], - ], - ]); - $this->assertEquals('string', $o->getAdditionalParameters()->getType()); - } - - /** - * @return Operation - */ - protected function getOperation() - { - return new Operation([ - 'name' => 'OperationTest', - 'class' => get_class($this), - 'parameters' => [ - 'test' => ['type' => 'object'], - 'bool_1' => ['default' => true, 'type' => 'boolean'], - 'bool_2' => ['default' => false], - 'float' => ['type' => 'numeric'], - 'int' => ['type' => 'integer'], - 'date' => ['type' => 'string'], - 'timestamp' => ['type' => 'string'], - 'string' => ['type' => 'string'], - 'username' => ['type' => 'string', 'required' => true, 'filters' => 'strtolower'], - 'test_function' => ['type' => 'string', 'filters' => __CLASS__ . '::strtoupper'], - ], - 'errorResponses' => [ - [ - 'code' => 503, - 'reason' => 'InsufficientCapacity', - 'class' => 'Guzzle\\Exception\\RuntimeException', - ], - ], - ]); - } - - public function testCanExtendFromOtherOperations() - { - $d = new Description([ - 'operations' => [ - 'A' => [ - 'parameters' => [ - 'A' => [ - 'type' => 'object', - 'properties' => ['foo' => ['type' => 'string']] - ], - 'B' => ['type' => 'string'] - ], - 'summary' => 'foo' - ], - 'B' => [ - 'extends' => 'A', - 'summary' => 'Bar' - ], - 'C' => [ - 'extends' => 'B', - 'summary' => 'Bar', - 'parameters' => [ - 'B' => ['type' => 'number'] - ] - ] - ] - ]); - - $a = $d->getOperation('A'); - $this->assertEquals('foo', $a->getSummary()); - $this->assertTrue($a->hasParam('A')); - $this->assertEquals('string', $a->getParam('B')->getType()); - - $b = $d->getOperation('B'); - $this->assertTrue($a->hasParam('A')); - $this->assertEquals('Bar', $b->getSummary()); - $this->assertEquals('string', $a->getParam('B')->getType()); - - $c = $d->getOperation('C'); - $this->assertTrue($a->hasParam('A')); - $this->assertEquals('Bar', $c->getSummary()); - $this->assertEquals('number', $c->getParam('B')->getType()); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/ParameterTest.php b/vendor/guzzlehttp/guzzle-services/tests/ParameterTest.php deleted file mode 100644 index 7bc937f3..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/ParameterTest.php +++ /dev/null @@ -1,378 +0,0 @@ - 'foo', - 'type' => 'bar', - 'required' => true, - 'default' => '123', - 'description' => '456', - 'minLength' => 2, - 'maxLength' => 5, - 'location' => 'body', - 'static' => true, - 'filters' => ['trim', 'json_encode'] - ]; - - public function testCreatesParamFromArray() - { - $p = new Parameter($this->data); - $this->assertEquals('foo', $p->getName()); - $this->assertEquals('bar', $p->getType()); - $this->assertTrue($p->isRequired()); - $this->assertEquals('123', $p->getDefault()); - $this->assertEquals('456', $p->getDescription()); - $this->assertEquals(2, $p->getMinLength()); - $this->assertEquals(5, $p->getMaxLength()); - $this->assertEquals('body', $p->getLocation()); - $this->assertTrue($p->isStatic()); - $this->assertEquals(['trim', 'json_encode'], $p->getFilters()); - $p->setName('abc'); - $this->assertEquals('abc', $p->getName()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testValidatesDescription() - { - new Parameter($this->data, ['description' => 'foo']); - } - - public function testCanConvertToArray() - { - $p = new Parameter($this->data); - $this->assertEquals($this->data, $p->toArray()); - } - - public function testUsesStatic() - { - $d = $this->data; - $d['default'] = 'booboo'; - $d['static'] = true; - $p = new Parameter($d); - $this->assertEquals('booboo', $p->getValue('bar')); - } - - public function testUsesDefault() - { - $d = $this->data; - $d['default'] = 'foo'; - $d['static'] = null; - $p = new Parameter($d); - $this->assertEquals('foo', $p->getValue(null)); - } - - public function testReturnsYourValue() - { - $d = $this->data; - $d['static'] = null; - $p = new Parameter($d); - $this->assertEquals('foo', $p->getValue('foo')); - } - - public function testZeroValueDoesNotCauseDefaultToBeReturned() - { - $d = $this->data; - $d['default'] = '1'; - $d['static'] = null; - $p = new Parameter($d); - $this->assertEquals('0', $p->getValue('0')); - } - - public function testFiltersValues() - { - $d = $this->data; - $d['static'] = null; - $d['filters'] = 'strtoupper'; - $p = new Parameter($d); - $this->assertEquals('FOO', $p->filter('foo')); - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage No service description - */ - public function testRequiresServiceDescriptionForFormatting() - { - $d = $this->data; - $d['format'] = 'foo'; - $p = new Parameter($d); - $p->filter('bar'); - } - - public function testConvertsBooleans() - { - $p = new Parameter(['type' => 'boolean']); - $this->assertEquals(true, $p->filter('true')); - $this->assertEquals(false, $p->filter('false')); - } - - public function testUsesArrayByDefaultForFilters() - { - $d = $this->data; - $d['filters'] = null; - $p = new Parameter($d); - $this->assertEquals([], $p->getFilters()); - } - - public function testAllowsSimpleLocationValue() - { - $p = new Parameter(['name' => 'myname', 'location' => 'foo', 'sentAs' => 'Hello']); - $this->assertEquals('foo', $p->getLocation()); - $this->assertEquals('Hello', $p->getSentAs()); - } - - public function testParsesTypeValues() - { - $p = new Parameter(['type' => 'foo']); - $this->assertEquals('foo', $p->getType()); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage A [method] value must be specified for each complex filter - */ - public function testValidatesComplexFilters() - { - $p = new Parameter(['filters' => [['args' => 'foo']]]); - } - - public function testAllowsComplexFilters() - { - $that = $this; - $param = new Parameter([ - 'filters' => [ - [ - 'method' => function ($a, $b, $c, $d) use ($that, &$param) { - $that->assertEquals('test', $a); - $that->assertEquals('my_value!', $b); - $that->assertEquals('bar', $c); - $that->assertSame($param, $d); - return 'abc' . $b; - }, - 'args' => ['test', '@value', 'bar', '@api'] - ] - ] - ]); - - $this->assertEquals('abcmy_value!', $param->filter('my_value!')); - } - - public function testAddsAdditionalProperties() - { - $p = new Parameter([ - 'type' => 'object', - 'additionalProperties' => ['type' => 'string'] - ]); - $this->assertInstanceOf('GuzzleHttp\Command\Guzzle\Parameter', $p->getAdditionalProperties()); - $this->assertNull($p->getAdditionalProperties()->getAdditionalProperties()); - $p = new Parameter(['type' => 'object']); - $this->assertTrue($p->getAdditionalProperties()); - } - - public function testAddsItems() - { - $p = new Parameter([ - 'type' => 'array', - 'items' => ['type' => 'string'] - ]); - $this->assertInstanceOf('GuzzleHttp\Command\Guzzle\Parameter', $p->getItems()); - $out = $p->toArray(); - $this->assertEquals('array', $out['type']); - $this->assertInternalType('array', $out['items']); - } - - public function testCanRetrieveKnownPropertiesUsingDataMethod() - { - $p = new Parameter(['data' => ['name' => 'test'], 'extra' => 'hi!']); - $this->assertEquals('test', $p->getData('name')); - $this->assertEquals(['name' => 'test'], $p->getData()); - $this->assertNull($p->getData('fjnweefe')); - $this->assertEquals('hi!', $p->getData('extra')); - } - - public function testHasPattern() - { - $p = new Parameter(['pattern' => '/[0-9]+/']); - $this->assertEquals('/[0-9]+/', $p->getPattern()); - } - - public function testHasEnum() - { - $p = new Parameter(['enum' => ['foo', 'bar']]); - $this->assertEquals(['foo', 'bar'], $p->getEnum()); - } - - public function testSerializesItems() - { - $p = new Parameter([ - 'type' => 'object', - 'additionalProperties' => ['type' => 'string'] - ]); - $this->assertEquals([ - 'type' => 'object', - 'additionalProperties' => ['type' => 'string'] - ], $p->toArray()); - } - - public function testResolvesRefKeysRecursively() - { - $description = new Description([ - 'models' => [ - 'JarJar' => ['type' => 'string', 'default' => 'Mesa address tha senate!'], - 'Anakin' => ['type' => 'array', 'items' => ['$ref' => 'JarJar']] - ], - ]); - $p = new Parameter(['$ref' => 'Anakin', 'description' => 'added'], ['description' => $description]); - $this->assertEquals([ - 'description' => 'added', - '$ref' => 'Anakin' - ], $p->toArray()); - } - - public function testResolvesExtendsRecursively() - { - $jarJar = ['type' => 'string', 'default' => 'Mesa address tha senate!', 'description' => 'a']; - $anakin = ['type' => 'array', 'items' => ['extends' => 'JarJar', 'description' => 'b']]; - $description = new Description([ - 'models' => ['JarJar' => $jarJar, 'Anakin' => $anakin] - ]); - // Description attribute will be updated, and format added - $p = new Parameter(['extends' => 'Anakin', 'format' => 'date'], ['description' => $description]); - $this->assertEquals([ - 'format' => 'date', - 'extends' => 'Anakin' - ], $p->toArray()); - } - - public function testHasKeyMethod() - { - $p = new Parameter(['name' => 'foo', 'sentAs' => 'bar']); - $this->assertEquals('bar', $p->getWireName()); - } - - public function testIncludesNameInToArrayWhenItemsAttributeHasName() - { - $p = new Parameter([ - 'type' => 'array', - 'name' => 'Abc', - 'items' => [ - 'name' => 'Foo', - 'type' => 'object' - ] - ]); - $result = $p->toArray(); - $this->assertEquals([ - 'type' => 'array', - 'name' => 'Abc', - 'items' => [ - 'name' => 'Foo', - 'type' => 'object' - ] - ], $result); - } - - public function dateTimeProvider() - { - $d = 'October 13, 2012 16:15:46 UTC'; - - return [ - [$d, 'date-time', '2012-10-13T16:15:46Z'], - [$d, 'date', '2012-10-13'], - [$d, 'timestamp', strtotime($d)], - [new \DateTime($d), 'timestamp', strtotime($d)] - ]; - } - - /** - * @dataProvider dateTimeProvider - */ - public function testAppliesFormat($d, $format, $result) - { - $p = new Parameter(['format' => $format], ['description' => new Description([])]); - $this->assertEquals($format, $p->getFormat()); - $this->assertEquals($result, $p->filter($d)); - } - - public function testHasMinAndMax() - { - $p = new Parameter([ - 'minimum' => 2, - 'maximum' => 3, - 'minItems' => 4, - 'maxItems' => 5, - ]); - $this->assertEquals(2, $p->getMinimum()); - $this->assertEquals(3, $p->getMaximum()); - $this->assertEquals(4, $p->getMinItems()); - $this->assertEquals(5, $p->getMaxItems()); - } - - public function testHasProperties() - { - $data = [ - 'type' => 'object', - 'properties' => [ - 'foo' => ['type' => 'string'], - 'bar' => ['type' => 'string'], - ] - ]; - $p = new Parameter($data); - $this->assertInstanceOf('GuzzleHttp\\Command\\Guzzle\\Parameter', $p->getProperty('foo')); - $this->assertSame($p->getProperty('foo'), $p->getProperty('foo')); - $this->assertNull($p->getProperty('wefwe')); - - $properties = $p->getProperties(); - $this->assertInternalType('array', $properties); - foreach ($properties as $prop) { - $this->assertInstanceOf('GuzzleHttp\\Command\\Guzzle\\Parameter', $prop); - } - - $this->assertEquals($data, $p->toArray()); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Expected a string. Got: array - */ - public function testThrowsWhenNotPassString() - { - $emptyParam = new Parameter(); - $this->assertFalse($emptyParam->has([])); - $this->assertFalse($emptyParam->has(new \stdClass())); - $this->assertFalse($emptyParam->has('1')); - $this->assertFalse($emptyParam->has(1)); - } - - public function testHasReturnsFalseForWrongOrEmptyValues() - { - $emptyParam = new Parameter(); - $this->assertFalse($emptyParam->has('')); - $this->assertFalse($emptyParam->has('description')); - $this->assertFalse($emptyParam->has('noExisting')); - } - - public function testHasReturnsTrueForCorrectValues() - { - $p = new Parameter([ - 'minimum' => 2, - 'maximum' => 3, - 'minItems' => 4, - 'maxItems' => 5, - ]); - - $this->assertTrue($p->has('minimum')); - $this->assertTrue($p->has('maximum')); - $this->assertTrue($p->has('minItems')); - $this->assertTrue($p->has('maxItems')); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/QuerySerializer/Rfc3986SerializerTest.php b/vendor/guzzlehttp/guzzle-services/tests/QuerySerializer/Rfc3986SerializerTest.php deleted file mode 100644 index 66ec75f2..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/QuerySerializer/Rfc3986SerializerTest.php +++ /dev/null @@ -1,35 +0,0 @@ - 'bar'], 'foo=bar'], - [['foo' => [1, 2]], 'foo[0]=1&foo[1]=2'], - [['foo' => ['bar' => 'baz', 'bim' => [4, 5]]], 'foo[bar]=baz&foo[bim][0]=4&foo[bim][1]=5'] - ]; - } - - /** - * @dataProvider queryProvider - */ - public function testSerializeQueryParams(array $params, $expectedResult) - { - $serializer = new Rfc3986Serializer(); - $result = $serializer->aggregate($params); - - $this->assertEquals($expectedResult, urldecode($result)); - } - - public function testCanRemoveNumericIndices() - { - $serializer = new Rfc3986Serializer(true); - $result = $serializer->aggregate(['foo' => ['bar', 'baz'], 'bar' => ['bim' => [4, 5]]]); - - $this->assertEquals('foo[]=bar&foo[]=baz&bar[bim][]=4&bar[bim][]=5', urldecode($result)); - } -} \ No newline at end of file diff --git a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/BodyLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/BodyLocationTest.php deleted file mode 100644 index 2a6418e5..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/BodyLocationTest.php +++ /dev/null @@ -1,26 +0,0 @@ - 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $request = $location->visit($command, $request, $param); - $this->assertEquals('foo=bar', $request->getBody()->getContents()); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/FormParamLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/FormParamLocationTest.php deleted file mode 100644 index 016ad6b8..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/FormParamLocationTest.php +++ /dev/null @@ -1,52 +0,0 @@ - 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $request = $location->visit($command, $request, $param); - $operation = new Operation(); - $request = $location->after($command, $request, $operation); - $this->assertEquals('foo=bar', $request->getBody()->getContents()); - $this->assertArraySubset([0 => 'application/x-www-form-urlencoded; charset=utf-8'], $request->getHeader('Content-Type')); - } - - /** - * @group RequestLocation - */ - public function testAddsAdditionalProperties() - { - $location = new FormParamLocation(); - $command = new Command('foo', ['foo' => 'bar']); - $command['add'] = 'props'; - $request = new Request('POST', 'http://httbin.org', []); - $param = new Parameter(['name' => 'foo']); - $request = $location->visit($command, $request, $param); - $operation = new Operation([ - 'additionalParameters' => [ - 'location' => 'formParam' - ] - ]); - $request = $location->after($command, $request, $operation); - $this->assertEquals('foo=bar&add=props', $request->getBody()->getContents()); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/HeaderLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/HeaderLocationTest.php deleted file mode 100644 index 2ebc2835..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/HeaderLocationTest.php +++ /dev/null @@ -1,52 +0,0 @@ - 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $request = $location->visit($command, $request, $param); - - $header = $request->getHeader('foo'); - $this->assertTrue(is_array($header)); - $this->assertArraySubset([0 => 'bar'], $request->getHeader('foo')); - } - - /** - * @group RequestLocation - */ - public function testAddsAdditionalProperties() - { - $location = new HeaderLocation('header'); - $command = new Command('foo', ['foo' => 'bar']); - $command['add'] = 'props'; - $operation = new Operation([ - 'additionalParameters' => [ - 'location' => 'header' - ] - ]); - $request = new Request('POST', 'http://httbin.org'); - $request = $location->after($command, $request, $operation); - - $header = $request->getHeader('add'); - $this->assertTrue(is_array($header)); - $this->assertArraySubset([0 => 'props'], $header); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/JsonLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/JsonLocationTest.php deleted file mode 100644 index 359b7e29..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/JsonLocationTest.php +++ /dev/null @@ -1,91 +0,0 @@ - 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $location->visit($command, $request, $param); - $operation = new Operation(); - $request = $location->after($command, $request, $operation); - $this->assertEquals('{"foo":"bar"}', $request->getBody()->getContents()); - $this->assertArraySubset([0 => 'application/json'], $request->getHeader('Content-Type')); - } - - /** - * @group RequestLocation - */ - public function testVisitsAdditionalProperties() - { - $location = new JsonLocation('json', 'foo'); - $command = new Command('foo', ['foo' => 'bar']); - $command['baz'] = ['bam' => [1]]; - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $location->visit($command, $request, $param); - $operation = new Operation([ - 'additionalParameters' => [ - 'location' => 'json' - ] - ]); - $request = $location->after($command, $request, $operation); - $this->assertEquals('{"foo":"bar","baz":{"bam":[1]}}', $request->getBody()->getContents()); - $this->assertEquals([0 => 'foo'], $request->getHeader('Content-Type')); - } - - /** - * @group RequestLocation - */ - public function testVisitsNestedLocation() - { - $location = new JsonLocation('json'); - $command = new Command('foo', ['foo' => 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'properties' => [ - 'baz' => [ - 'type' => 'array', - 'items' => [ - 'type' => 'string', - 'filters' => ['strtoupper'] - ] - ] - ], - 'additionalProperties' => [ - 'type' => 'array', - 'items' => [ - 'type' => 'string', - 'filters' => ['strtolower'] - ] - ] - ]); - $command['foo'] = [ - 'baz' => ['a', 'b'], - 'bam' => ['A', 'B'], - ]; - $location->visit($command, $request, $param); - $operation = new Operation(); - $request = $location->after($command, $request, $operation); - $this->assertEquals('{"foo":{"baz":["A","B"],"bam":["a","b"]}}', (string) $request->getBody()->getContents()); - $this->assertEquals([0 => 'application/json'], $request->getHeader('Content-Type')); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/MultiPartLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/MultiPartLocationTest.php deleted file mode 100644 index a2e7faf6..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/MultiPartLocationTest.php +++ /dev/null @@ -1,33 +0,0 @@ - 'bar']); - $request = new Request('POST', 'http://httbin.org', []); - $param = new Parameter(['name' => 'foo']); - $request = $location->visit($command, $request, $param); - $operation = new Operation(); - $request = $location->after($command, $request, $operation); - $actual = $request->getBody()->getContents(); - - $this->assertNotFalse(strpos($actual, 'name="foo"')); - $this->assertNotFalse(strpos($actual, 'bar')); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/QueryLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/QueryLocationTest.php deleted file mode 100644 index 7ccfbd8a..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/QueryLocationTest.php +++ /dev/null @@ -1,77 +0,0 @@ - 'bar'], 'foo=bar'], - [['foo' => [1, 2]], 'foo[0]=1&foo[1]=2'], - [['foo' => ['bar' => 'baz', 'bim' => [4, 5]]], 'foo[bar]=baz&foo[bim][0]=4&foo[bim][1]=5'] - ]; - } - - /** - * @group RequestLocation - */ - public function testVisitsLocation() - { - $location = new QueryLocation(); - $command = new Command('foo', ['foo' => 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $request = $location->visit($command, $request, $param); - - $this->assertEquals('foo=bar', urldecode($request->getUri()->getQuery())); - } - - public function testVisitsMultipleLocations() - { - $request = new Request('POST', 'http://httbin.org'); - - // First location - $location = new QueryLocation(); - $command = new Command('foo', ['foo' => 'bar']); - $param = new Parameter(['name' => 'foo']); - $request = $location->visit($command, $request, $param); - - // Second location - $location = new QueryLocation(); - $command = new Command('baz', ['baz' => [6, 7]]); - $param = new Parameter(['name' => 'baz']); - $request = $location->visit($command, $request, $param); - - $this->assertEquals('foo=bar&baz[0]=6&baz[1]=7', urldecode($request->getUri()->getQuery())); - } - - /** - * @group RequestLocation - */ - public function testAddsAdditionalProperties() - { - $location = new QueryLocation(); - $command = new Command('foo', ['foo' => 'bar']); - $command['add'] = 'props'; - $operation = new Operation([ - 'additionalParameters' => [ - 'location' => 'query' - ] - ]); - $request = new Request('POST', 'http://httbin.org'); - $request = $location->after($command, $request, $operation); - - $this->assertEquals('props', Psr7\parse_query($request->getUri()->getQuery())['add']); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/XmlLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/XmlLocationTest.php deleted file mode 100644 index ce789d4e..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/XmlLocationTest.php +++ /dev/null @@ -1,525 +0,0 @@ - 'bar']); - $command['bar'] = 'test'; - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $location->visit($command, $request, $param); - $param = new Parameter(['name' => 'bar']); - $location->visit($command, $request, $param); - $operation = new Operation(); - $request = $location->after($command, $request, $operation); - $xml = $request->getBody()->getContents(); - - $this->assertEquals('' . "\n" - . 'bartest' . "\n", $xml); - $header = $request->getHeader('Content-Type'); - $this->assertArraySubset([0 => 'application/xml'], $header); - } - - /** - * @group RequestLocation - */ - public function testCreatesBodyForEmptyDocument() - { - $location = new XmlLocation(); - $command = new Command('foo', ['foo' => 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $operation = new Operation([ - 'data' => ['xmlAllowEmpty' => true] - ]); - $request = $location->after($command, $request, $operation); - $xml = $request->getBody()->getContents(); - $this->assertEquals('' . "\n" - . '' . "\n", $xml); - - $header = $request->getHeader('Content-Type'); - $this->assertArraySubset([0 => 'application/xml'], $header); - } - - /** - * @group RequestLocation - */ - public function testAddsAdditionalParameters() - { - $location = new XmlLocation('xml', 'test'); - $command = new Command('foo', ['foo' => 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $command['foo'] = 'bar'; - $location->visit($command, $request, $param); - $operation = new Operation([ - 'additionalParameters' => [ - 'location' => 'xml' - ] - ]); - $command['bam'] = 'boo'; - $request = $location->after($command, $request, $operation); - $xml = $request->getBody()->getContents(); - $this->assertEquals('' . "\n" - . 'barbarboo' . "\n", $xml); - $header = $request->getHeader('Content-Type'); - $this->assertArraySubset([0 => 'test'], $header); - } - - /** - * @group RequestLocation - */ - public function testAllowsXmlEncoding() - { - $location = new XmlLocation(); - $operation = new Operation([ - 'data' => ['xmlEncoding' => 'UTF-8'] - ]); - $command = new Command('foo', ['foo' => 'bar']); - $request = new Request('POST', 'http://httbin.org'); - $param = new Parameter(['name' => 'foo']); - $command['foo'] = 'bar'; - $location->visit($command, $request, $param); - $request = $location->after($command, $request, $operation); - $xml = $request->getBody()->getContents(); - $this->assertEquals('' . "\n" - . 'bar' . "\n", $xml); - } - - public function xmlProvider() - { - return [ - [ - [ - 'data' => [ - 'xmlRoot' => [ - 'name' => 'test', - 'namespaces' => 'http://foo.com' - ] - ], - 'parameters' => [ - 'Foo' => [ - 'location' => 'xml', - 'type' => 'string' - ], - 'Baz' => [ - 'location' => 'xml', - 'type' => 'string' - ] - ] - ], - [ - 'Foo' => 'test', - 'Baz' => 'bar' - ], - 'testbar' - ], - // Ensure that the content-type is not added - [ - [ - 'parameters' => [ - 'Foo' => [ - 'location' => 'xml', - 'type' => 'string' - ] - ] - ], - [], - '' - ], - // Test with adding attributes and no namespace - [ - [ - 'data' => [ - 'xmlRoot' => [ - 'name' => 'test' - ] - ], - 'parameters' => [ - 'Foo' => [ - 'location' => 'xml', - 'type' => 'string', - 'data' => ['xmlAttribute' => true] - ] - ] - ], - [ - 'Foo' => 'test', - 'Baz' => 'bar' - ], - '' - ], - // Test adding with an array - [ - [ - 'parameters' => [ - 'Foo' => [ - 'location' => 'xml', - 'type' => 'string' - ], - 'Baz' => [ - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'type' => 'numeric', - 'sentAs' => 'Bar' - ] - ] - ] - ], - ['Foo' => 'test', 'Baz' => [1, 2]], - 'test12' - ], - // Test adding an object - [ - [ - 'parameters' => [ - 'Foo' => ['location' => 'xml', 'type' => 'string'], - 'Baz' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Bar' => ['type' => 'string'], - 'Bam' => [] - ] - ] - ] - ], - [ - 'Foo' => 'test', - 'Baz' => [ - 'Bar' => 'abc', - 'Bam' => 'foo' - ] - ], - 'testabcfoo' - ], - // Add an array that contains an object - [ - [ - 'parameters' => [ - 'Baz' => [ - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Bar', - 'properties' => ['A' => [], 'B' => []] - ] - ] - ] - ], - ['Baz' => [ - [ - 'A' => '1', - 'B' => '2' - ], - [ - 'A' => '3', - 'B' => '4' - ] - ]], - '1234' - ], - // Add an object of attributes - [ - [ - 'parameters' => [ - 'Foo' => [ - 'location' => 'xml', - 'type' => 'string' - ], - 'Baz' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Bar' => [ - 'type' => 'string', - 'data' => [ - 'xmlAttribute' => true - ] - ], - 'Bam' => [] - ] - ] - ] - ], - [ - 'Foo' => 'test', - 'Baz' => [ - 'Bar' => 'abc', - 'Bam' => 'foo' - ] - ], - 'testfoo' - ], - // Check order doesn't matter - [ - [ - 'parameters' => [ - 'Foo' => [ - 'location' => 'xml', - 'type' => 'string' - ], - 'Baz' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Bar' => [ - 'type' => 'string', - 'data' => [ - 'xmlAttribute' => true - ] - ], - 'Bam' => [] - ] - ] - ] - ], - [ - 'Foo' => 'test', - 'Baz' => [ - 'Bam' => 'foo', - 'Bar' => 'abc' - ] - ], - 'testfoo' - ], - // Add values with custom namespaces - [ - [ - 'parameters' => [ - 'Foo' => [ - 'location' => 'xml', - 'type' => 'string', - 'data' => [ - 'xmlNamespace' => 'http://foo.com' - ] - ] - ] - ], - ['Foo' => 'test'], - 'test' - ], - // Add attributes with custom namespace prefix - [ - [ - 'parameters' => [ - 'Wrap' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Foo' => [ - 'type' => 'string', - 'sentAs' => 'xsi:baz', - 'data' => [ - 'xmlNamespace' => 'http://foo.com', - 'xmlAttribute' => true - ] - ] - ] - ], - ] - ], - ['Wrap' => [ - 'Foo' => 'test' - ]], - '' - ], - // Add nodes with custom namespace prefix - [ - [ - 'parameters' => [ - 'Wrap' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Foo' => [ - 'type' => 'string', - 'sentAs' => 'xsi:Foo', - 'data' => [ - 'xmlNamespace' => 'http://foobar.com' - ] - ] - ] - ], - ] - ], - ['Wrap' => [ - 'Foo' => 'test' - ]], - 'test' - ], - [ - [ - 'parameters' => [ - 'Foo' => [ - 'location' => 'xml', - 'type' => 'string', - 'data' => [ - 'xmlNamespace' => 'http://foo.com' - ] - ] - ] - ], - ['Foo' => '

This is a title

'], - 'This is a title]]>' - ], - // Flat array at top level - [ - [ - 'parameters' => [ - 'Bars' => [ - 'type' => 'array', - 'data' => ['xmlFlattened' => true], - 'location' => 'xml', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Bar', - 'properties' => [ - 'A' => [], - 'B' => [] - ] - ] - ], - 'Boos' => [ - 'type' => 'array', - 'data' => ['xmlFlattened' => true], - 'location' => 'xml', - 'items' => [ - 'sentAs' => 'Boo', - 'type' => 'string' - ] - ] - ] - ], - [ - 'Bars' => [ - ['A' => '1', 'B' => '2'], - ['A' => '3', 'B' => '4'] - ], - 'Boos' => ['test', '123'] - ], - '1234test123' - ], - // Nested flat arrays - [ - [ - 'parameters' => [ - 'Delete' => [ - 'type' => 'object', - 'location' => 'xml', - 'properties' => [ - 'Items' => [ - 'type' => 'array', - 'data' => ['xmlFlattened' => true], - 'items' => [ - 'type' => 'object', - 'sentAs' => 'Item', - 'properties' => [ - 'A' => [], - 'B' => [] - ] - ] - ] - ] - ] - ] - ], - [ - 'Delete' => [ - 'Items' => [ - ['A' => '1', 'B' => '2'], - ['A' => '3', 'B' => '4'] - ] - ] - ], - '1234' - ], - // Test adding root node attributes after nodes - [ - [ - 'data' => [ - 'xmlRoot' => [ - 'name' => 'test' - ] - ], - 'parameters' => [ - 'Foo' => ['location' => 'xml', 'type' => 'string'], - 'Baz' => ['location' => 'xml', 'type' => 'string', 'data' => ['xmlAttribute' => true]], - ] - ], - ['Foo' => 'test', 'Baz' => 'bar'], - 'test' - ], - ]; - } - - /** - * @param array $operation - * @param array $input - * @param string $xml - * @dataProvider xmlProvider - * @group RequestLocation - */ - public function testSerializesXml(array $operation, array $input, $xml) - { - $container = []; - $history = Middleware::history($container); - $mock = new MockHandler([new Response(200)]); - - $stack = new HandlerStack($mock); - $stack->push($history); - $operation['uri'] = 'http://httpbin.org'; - $client = new GuzzleClient( - new Client(['handler' => $stack]), - new Description([ - 'operations' => [ - 'foo' => $operation - ] - ]) - ); - - $command = $client->getCommand('foo', $input); - - $client->execute($command); - - $this->assertCount(1, $container); - - foreach ($container as $transaction) { - /** @var Request $request */ - $request = $transaction['request']; - if (empty($input)) { - if ($request->hasHeader('Content-Type')) { - $this->assertArraySubset([0 => ''], $request->getHeader('Content-Type')); - } - } else { - $this->assertArraySubset([0 => 'application/xml'], $request->getHeader('Content-Type')); - } - - $body = str_replace(["\n", ""], '', (string) $request->getBody()); - $this->assertEquals($xml, $body); - } - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/BodyLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/BodyLocationTest.php deleted file mode 100644 index 36eda588..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/BodyLocationTest.php +++ /dev/null @@ -1,30 +0,0 @@ - 'val', - 'filters' => ['strtoupper'] - ]); - $response = new Response(200, [], 'foo'); - $result = new Result(); - $result = $location->visit($result, $response, $parameter); - $this->assertEquals('FOO', $result['val']); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/HeaderLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/HeaderLocationTest.php deleted file mode 100644 index 763af38a..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/HeaderLocationTest.php +++ /dev/null @@ -1,31 +0,0 @@ - 'val', - 'sentAs' => 'X-Foo', - 'filters' => ['strtoupper'] - ]); - $response = new Response(200, ['X-Foo' => 'bar']); - $result = new Result(); - $result = $location->visit($result, $response, $parameter); - $this->assertEquals('BAR', $result['val']); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/JsonLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/JsonLocationTest.php deleted file mode 100644 index 52a44a8d..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/JsonLocationTest.php +++ /dev/null @@ -1,581 +0,0 @@ - 'val', - 'sentAs' => 'vim', - 'filters' => ['strtoupper'] - ]); - $response = new Response(200, [], '{"vim":"bar"}'); - $result = new Result(); - $result = $location->before($result, $response, $parameter); - $result = $location->visit($result, $response, $parameter); - $this->assertEquals('BAR', $result['val']); - } - /** - * @group ResponseLocation - * @param $name - * @param $expected - */ - public function testVisitsWiredArray() - { - $json = ['car_models' => ['ferrari', 'aston martin']]; - $body = \GuzzleHttp\json_encode($json); - $response = new Response(200, ['Content-Type' => 'application/json'], $body); - $mock = new MockHandler([$response]); - - $guzzle = new Client(['handler' => $mock]); - - $description = new Description([ - 'operations' => [ - 'getCars' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'Cars' - ] - ], - 'models' => [ - 'Cars' => [ - 'type' => 'object', - 'location' => 'json', - 'properties' => [ - 'cars' => [ - 'type' => 'array', - 'sentAs' => 'car_models', - 'items' => [ - 'type' => 'object', - ] - ] - ], - ] - ] - ]); - - $guzzle = new GuzzleClient($guzzle, $description); - $result = $guzzle->getCars(); - - $this->assertEquals(['cars' => ['ferrari', 'aston martin']], $result->toArray()); - } - - /** - * @group ResponseLocation - */ - public function testVisitsAdditionalProperties() - { - $location = new JsonLocation(); - $parameter = new Parameter(); - $model = new Parameter(['additionalProperties' => ['location' => 'json']]); - $response = new Response(200, [], '{"vim":"bar","qux":[1,2]}'); - $result = new Result(); - $result = $location->before($result, $response, $parameter); - $result = $location->visit($result, $response, $parameter); - $result = $location->after($result, $response, $model); - $this->assertEquals('bar', $result['vim']); - $this->assertEquals([1, 2], $result['qux']); - } - - /** - * @group ResponseLocation - */ - public function testVisitsAdditionalPropertiesWithEmptyResponse() - { - $location = new JsonLocation(); - $parameter = new Parameter(); - $model = new Parameter(['additionalProperties' => ['location' => 'json']]); - $response = new Response(204); - $result = new Result(); - $result = $location->before($result, $response, $parameter); - $result = $location->visit($result, $response, $parameter); - $result = $location->after($result, $response, $model); - $this->assertEquals([], $result->toArray()); - } - - public function jsonProvider() - { - return [ - [null, [['foo' => 'BAR'], ['baz' => 'BAM']]], - ['under_me', ['under_me' => [['foo' => 'BAR'], ['baz' => 'BAM']]]], - ]; - } - - /** - * @dataProvider jsonProvider - * @group ResponseLocation - * @param $name - * @param $expected - */ - public function testVisitsTopLevelArrays($name, $expected) - { - $json = [ - ['foo' => 'bar'], - ['baz' => 'bam'], - ]; - $body = \GuzzleHttp\json_encode($json); - $response = new Response(200, ['Content-Type' => 'application/json'], $body); - $mock = new MockHandler([$response]); - - $guzzle = new Client(['handler' => $mock]); - - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j' - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'array', - 'location' => 'json', - 'name' => $name, - 'items' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'type' => 'string', - 'filters' => ['strtoupper'] - ] - ] - ] - ] - ]); - $guzzle = new GuzzleClient($guzzle, $description); - /** @var ResultInterface $result */ - $result = $guzzle->foo(); - $this->assertEquals($expected, $result->toArray()); - } - - /** - * @group ResponseLocation - */ - public function testVisitsNestedArrays() - { - $json = [ - 'scalar' => 'foo', - 'nested' => [ - 'bar', - 'baz' - ] - ]; - $body = \GuzzleHttp\json_encode($json); - $response = new Response(200, ['Content-Type' => 'application/json'], $body); - $mock = new MockHandler([$response]); - - $httpClient = new Client(['handler' => $mock]); - - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j' - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object', - 'location' => 'json', - 'properties' => [ - 'scalar' => ['type' => 'string'], - 'nested' => [ - 'type' => 'array', - 'items' => ['type' => 'string'] - ] - ] - ] - ] - ]); - $guzzle = new GuzzleClient($httpClient, $description); - /** @var ResultInterface $result */ - $result = $guzzle->foo(); - $expected = [ - 'scalar' => 'foo', - 'nested' => [ - 'bar', - 'baz' - ] - ]; - $this->assertEquals($expected, $result->toArray()); - } - - public function nestedProvider() - { - return [ - [ - [ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j' - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object', - 'properties' => [ - 'nested' => [ - 'location' => 'json', - 'type' => 'object', - 'properties' => [ - 'foo' => ['type' => 'string'], - 'bar' => ['type' => 'number'], - 'bam' => [ - 'type' => 'object', - 'properties' => [ - 'abc' => [ - 'type' => 'number' - ] - ] - ] - ] - ] - ], - 'additionalProperties' => [ - 'location' => 'json', - 'type' => 'string', - 'filters' => ['strtoupper'] - ] - ] - ] - ] - ], - [ - [ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j' - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object', - 'location' => 'json', - 'properties' => [ - 'nested' => [ - 'type' => 'object', - 'properties' => [ - 'foo' => ['type' => 'string'], - 'bar' => ['type' => 'number'], - 'bam' => [ - 'type' => 'object', - 'properties' => [ - 'abc' => [ - 'type' => 'number' - ] - ] - ] - ] - ] - ], - 'additionalProperties' => [ - 'type' => 'string', - 'filters' => ['strtoupper'] - ] - ] - ] - ] - ] - ]; - } - - /** - * @dataProvider nestedProvider - * @group ResponseLocation - */ - public function testVisitsNestedProperties($desc) - { - $json = [ - 'nested' => [ - 'foo' => 'abc', - 'bar' => 123, - 'bam' => [ - 'abc' => 456 - ] - ], - 'baz' => 'boo' - ]; - $body = \GuzzleHttp\json_encode($json); - $response = new Response(200, ['Content-Type' => 'application/json'], $body); - $mock = new MockHandler([$response]); - - $httpClient = new Client(['handler' => $mock]); - - $description = new Description($desc); - $guzzle = new GuzzleClient($httpClient, $description); - /** @var ResultInterface $result */ - $result = $guzzle->foo(); - $expected = [ - 'nested' => [ - 'foo' => 'abc', - 'bar' => 123, - 'bam' => [ - 'abc' => 456 - ] - ], - 'baz' => 'BOO' - ]; - - $this->assertEquals($expected, $result->toArray()); - } - - /** - * @group ResponseLocation - */ - public function testVisitsNullResponseProperties() - { - - $json = [ - 'data' => [ - 'link' => null - ] - ]; - - $body = \GuzzleHttp\json_encode($json); - $response = new Response(200, ['Content-Type' => 'application/json'], $body); - $mock = new MockHandler([$response]); - - $httpClient = new Client(['handler' => $mock]); - - $description = new Description( - [ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j' - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object', - 'location' => 'json', - 'properties' => [ - 'scalar' => ['type' => 'string'], - 'data' => [ - 'type' => 'object', - 'location' => 'json', - 'properties' => [ - 'link' => [ - 'name' => 'val', - 'type' => 'string', - 'location' => 'json' - ], - ], - 'additionalProperties' => false - ] - ] - ] - ] - ] - ); - $guzzle = new GuzzleClient($httpClient, $description); - /** @var ResultInterface $result */ - $result = $guzzle->foo(); - - $expected = [ - 'data' => [ - 'link' => null - ] - ]; - - $this->assertEquals($expected, $result->toArray()); - } - - /** - * @group ResponseLocation - */ - public function testVisitsNestedArrayOfArrays() - { - $json = [ - 'scalar' => 'foo', - 'nested' => [ - [ - 'bar' => 123, - 'baz' => false, - ], - [ - 'bar' => 345, - 'baz' => true, - ], - [ - 'bar' => 678, - 'baz' => true, - ], - ] - ]; - - $body = \GuzzleHttp\json_encode($json); - $response = new Response(200, ['Content-Type' => 'application/json'], $body); - $mock = new MockHandler([$response]); - - $httpClient = new Client(['handler' => $mock]); - - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j' - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object', - 'properties' => [ - 'scalar' => [ - // for some reason (probably because location is also set on array of arrays) - // array of arrays sibling elements must have location set to `json` - // otherwise JsonLocation ignores them - 'location' => 'json', - 'type' => 'string' - ], - 'nested' => [ - // array of arrays type must be set to `array` - // without that JsonLocation throws an exception - 'type' => 'array', - // for array of arrays `location` must be set to `json` - // otherwise JsonLocation returns an empty array - 'location' => 'json', - 'items' => [ - // although this is array of arrays, array items type - // must be set as `object` - 'type' => 'object', - 'properties' => [ - 'bar' => [ - 'type' => 'integer', - ], - 'baz' => [ - 'type' => 'boolean', - ], - ], - ] - ] - ] - ] - ] - ]); - - $guzzle = new GuzzleClient($httpClient, $description); - /** @var ResultInterface $result */ - $result = $guzzle->foo(); - $expected = [ - 'scalar' => 'foo', - 'nested' => [ - [ - 'bar' => 123, - 'baz' => false, - ], - [ - 'bar' => 345, - 'baz' => true, - ], - [ - 'bar' => 678, - 'baz' => true, - ], - ] - ]; - - $this->assertEquals($expected, $result->toArray()); - } - - /** - * @group ResponseLocation - */ - public function testVisitsNestedArrayOfObjects() - { - $json = json_decode('{"scalar":"foo","nested":[{"bar":123,"baz":false},{"bar":345,"baz":true},{"bar":678,"baz":true}]}'); - - $body = \GuzzleHttp\json_encode($json); - $response = new Response(200, ['Content-Type' => 'application/json'], $body); - $mock = new MockHandler([$response]); - - $httpClient = new Client(['handler' => $mock]); - - $description = new Description([ - 'operations' => [ - 'foo' => [ - 'uri' => 'http://httpbin.org', - 'httpMethod' => 'GET', - 'responseModel' => 'j' - ] - ], - 'models' => [ - 'j' => [ - 'type' => 'object', - 'location' => 'json', - 'properties' => [ - 'scalar' => [ - 'type' => 'string' - ], - 'nested' => [ - // array of objects type must be set to `array` - // without that JsonLocation throws an exception - 'type' => 'array', - 'items' => [ - // array elements type must be set to `object` - 'type' => 'object', - 'properties' => [ - 'bar' => [ - 'type' => 'integer', - ], - 'baz' => [ - 'type' => 'boolean', - ], - ], - ] - ] - ] - ] - ] - ]); - - $guzzle = new GuzzleClient($httpClient, $description); - /** @var ResultInterface $result */ - $result = $guzzle->foo(); - $expected = [ - 'scalar' => 'foo', - 'nested' => [ - [ - 'bar' => 123, - 'baz' => false, - ], - [ - 'bar' => 345, - 'baz' => true, - ], - [ - 'bar' => 678, - 'baz' => true, - ], - ] - ]; - $this->assertEquals($expected, $result->toArray()); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/ReasonPhraseLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/ReasonPhraseLocationTest.php deleted file mode 100644 index bfe77172..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/ReasonPhraseLocationTest.php +++ /dev/null @@ -1,30 +0,0 @@ - 'val', - 'filters' => ['strtolower'] - ]); - $response = new Response(200); - $result = new Result(); - $result = $location->visit($result, $response, $parameter); - $this->assertEquals('ok', $result['val']); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/StatusCodeLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/StatusCodeLocationTest.php deleted file mode 100644 index 1946e62b..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/StatusCodeLocationTest.php +++ /dev/null @@ -1,27 +0,0 @@ - 'val']); - $response = new Response(200); - $result = new Result(); - $result = $location->visit($result, $response, $parameter); - $this->assertEquals(200, $result['val']); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/XmlLocationTest.php b/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/XmlLocationTest.php deleted file mode 100644 index 4e398ba9..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/ResponseLocation/XmlLocationTest.php +++ /dev/null @@ -1,795 +0,0 @@ - 'val', - 'sentAs' => 'vim', - 'filters' => ['strtoupper'] - ]); - $model = new Parameter(); - $response = new Response(200, [], \GuzzleHttp\Psr7\stream_for('bar')); - $result = new Result(); - $result = $location->before($result, $response, $model); - $result = $location->visit($result, $response, $parameter); - $result = $location->after($result, $response, $model); - $this->assertEquals('BAR', $result['val']); - } - - /** - * @group ResponseLocation - */ - public function testVisitsAdditionalProperties() - { - $location = new XmlLocation(); - $parameter = new Parameter(); - $model = new Parameter(['additionalProperties' => ['location' => 'xml']]); - $response = new Response(200, [], \GuzzleHttp\Psr7\stream_for('bar')); - $result = new Result(); - $result = $location->before($result, $response, $parameter); - $result = $location->visit($result, $response, $parameter); - $result = $location->after($result, $response, $model); - $this->assertEquals('bar', $result['vim']); - } - - /** - * @group ResponseLocation - */ - public function testEnsuresFlatArraysAreFlat() - { - $param = new Parameter([ - 'location' => 'xml', - 'name' => 'foo', - 'type' => 'array', - 'items' => ['type' => 'string'], - ]); - - $xml = 'barbaz'; - $this->xmlTest($param, $xml, ['foo' => ['bar', 'baz']]); - $this->xmlTest($param, 'bar', ['foo' => ['bar']]); - } - - public function xmlDataProvider() - { - $param = new Parameter([ - 'location' => 'xml', - 'name' => 'Items', - 'type' => 'array', - 'items' => [ - 'type' => 'object', - 'name' => 'Item', - 'properties' => [ - 'Bar' => ['type' => 'string'], - 'Baz' => ['type' => 'string'], - ], - ], - ]); - - return [ - [$param, '12', [ - 'Items' => [ - ['Bar' => 1], - ['Bar' => 2], - ], - ]], - [$param, '1', [ - 'Items' => [ - ['Bar' => 1], - ] - ]], - [$param, '', [ - 'Items' => [], - ]] - ]; - } - - /** - * @dataProvider xmlDataProvider - * @group ResponseLocation - */ - public function testEnsuresWrappedArraysAreInCorrectLocations($param, $xml, $expected) - { - $location = new XmlLocation(); - $model = new Parameter(); - $response = new Response(200, [], \GuzzleHttp\Psr7\stream_for($xml)); - $result = new Result(); - $result = $location->before($result, $response, $param); - $result = $location->visit($result, $response, $param); - $result = $location->after($result, $response, $model); - $this->assertEquals($expected, $result->toArray()); - } - - /** - * @group ResponseLocation - */ - public function testCanRenameValues() - { - $param = new Parameter([ - 'name' => 'TerminatingInstances', - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'instancesSet', - 'items' => [ - 'name' => 'item', - 'type' => 'object', - 'sentAs' => 'item', - 'properties' => [ - 'InstanceId' => [ - 'type' => 'string', - 'sentAs' => 'instanceId', - ], - 'CurrentState' => [ - 'type' => 'object', - 'sentAs' => 'currentState', - 'properties' => [ - 'Code' => [ - 'type' => 'numeric', - 'sentAs' => 'code', - ], - 'Name' => [ - 'type' => 'string', - 'sentAs' => 'name', - ], - ], - ], - 'PreviousState' => [ - 'type' => 'object', - 'sentAs' => 'previousState', - 'properties' => [ - 'Code' => [ - 'type' => 'numeric', - 'sentAs' => 'code', - ], - 'Name' => [ - 'type' => 'string', - 'sentAs' => 'name', - ], - ], - ], - ], - ] - ]); - - $xml = ' - - - - i-3ea74257 - - 32 - shutting-down - - - 16 - running - - - - - '; - - $this->xmlTest($param, $xml, [ - 'TerminatingInstances' => [ - [ - 'InstanceId' => 'i-3ea74257', - 'CurrentState' => [ - 'Code' => '32', - 'Name' => 'shutting-down', - ], - 'PreviousState' => [ - 'Code' => '16', - 'Name' => 'running', - ], - ], - ], - ]); - } - - /** - * @group ResponseLocation - */ - public function testCanRenameAttributes() - { - $param = new Parameter([ - 'name' => 'RunningQueues', - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'type' => 'object', - 'sentAs' => 'item', - 'properties' => [ - 'QueueId' => [ - 'type' => 'string', - 'sentAs' => 'queue_id', - 'data' => [ - 'xmlAttribute' => true, - ], - ], - 'CurrentState' => [ - 'type' => 'object', - 'properties' => [ - 'Code' => [ - 'type' => 'numeric', - 'sentAs' => 'code', - 'data' => [ - 'xmlAttribute' => true, - ], - ], - 'Name' => [ - 'sentAs' => 'name', - 'data' => [ - 'xmlAttribute' => true, - ], - ], - ], - ], - 'PreviousState' => [ - 'type' => 'object', - 'properties' => [ - 'Code' => [ - 'type' => 'numeric', - 'sentAs' => 'code', - 'data' => [ - 'xmlAttribute' => true, - ], - ], - 'Name' => [ - 'sentAs' => 'name', - 'data' => [ - 'xmlAttribute' => true, - ], - ], - ], - ], - ], - ] - ]); - - $xml = ' - - - - - - - - '; - - $this->xmlTest($param, $xml, [ - 'RunningQueues' => [ - [ - 'QueueId' => 'q-3ea74257', - 'CurrentState' => [ - 'Code' => '32', - 'Name' => 'processing', - ], - 'PreviousState' => [ - 'Code' => '16', - 'Name' => 'wait', - ], - ], - ], - ]); - } - - /** - * @group ResponseLocation - */ - public function testAddsEmptyArraysWhenValueIsMissing() - { - $param = new Parameter([ - 'name' => 'Foo', - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'type' => 'object', - 'properties' => [ - 'Baz' => ['type' => 'array'], - 'Bar' => [ - 'type' => 'object', - 'properties' => [ - 'Baz' => ['type' => 'array'], - ], - ], - ], - ], - ]); - - $xml = ''; - - $this->xmlTest($param, $xml, [ - 'Foo' => [ - [ - 'Bar' => [], - ] - ], - ]); - } - - /** - * @group issue-399, ResponseLocation - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testDiscardingUnknownProperties() - { - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => [ - 'bar' => [ - 'type' => 'string', - 'name' => 'bar', - ], - ], - ]); - - $xml = ' - - - 15 - discard me - - - '; - - $this->xmlTest($param, $xml, [ - 'foo' => [ - 'bar' => 15 - ] - ]); - } - - /** - * @group issue-399, ResponseLocation - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testDiscardingUnknownPropertiesWithAliasing() - { - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => [ - 'bar' => [ - 'name' => 'bar', - 'sentAs' => 'baz', - ], - ], - ]); - - $xml = ' - - - 15 - discard me - - - '; - - $this->xmlTest($param, $xml, [ - 'foo' => [ - 'bar' => 15, - ], - ]); - } - - /** - * @group ResponseLocation - */ - public function testProcessingOfNestedAdditionalProperties() - { - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => true, - 'properties' => [ - 'bar' => [ - 'name' => 'bar', - 'sentAs' => 'baz', - ], - 'nestedNoAdditional' => [ - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => [ - 'id' => [ - 'type' => 'integer', - ], - ], - ], - 'nestedWithAdditional' => [ - 'type' => 'object', - 'additionalProperties' => true, - ], - 'nestedWithAdditionalSchema' => [ - 'type' => 'object', - 'additionalProperties' => [ - 'type' => 'array', - 'items' => [ - 'type' => 'string', - ], - ], - ], - ], - ]); - - $xml = ' - - - 15 - include me - - 15 - discard me - - - 15 - include me - - - - 1 - 2 - 3 - - - A - B - C - - - - - '; - - $this->xmlTest($param, $xml, [ - 'foo' => [ - 'bar' => '15', - 'additional' => 'include me', - 'nestedNoAdditional' => [ - 'id' => '15', - ], - 'nestedWithAdditional' => [ - 'id' => '15', - 'additional' => 'include me', - ], - 'nestedWithAdditionalSchema' => [ - 'arrayA' => ['1', '2', '3'], - 'arrayB' => ['A', 'B', 'C'], - ], - ], - ]); - } - - /** - * @group ResponseLocation - */ - public function testConvertsMultipleAssociativeElementsToArray() - { - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => true, - ]); - - $xml = ' - - - 15 - 25 - hi - test - - - - '; - - $this->xmlTest($param, $xml, [ - 'foo' => [ - 'baz' => ['15', '25'], - 'bar' => 'hi', - 'bam' => [ - 'test', - ['@attributes' => ['attr' => 'hi']] - ] - ] - ]); - } - - /** - * @group ResponseLocation - */ - public function testUnderstandsNamespaces() - { - $param = new Parameter([ - 'name' => 'nstest', - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'name' => 'item', - 'type' => 'object', - 'sentAs' => 'item', - 'properties' => [ - 'id' => [ - 'type' => 'string', - ], - 'isbn:number' => [ - 'type' => 'string', - ], - 'meta' => [ - 'type' => 'object', - 'sentAs' => 'abstract:meta', - 'properties' => [ - 'foo' => [ - 'type' => 'numeric', - ], - 'bar' => [ - 'type' => 'object', - 'properties' =>[ - 'attribute' => [ - 'type' => 'string', - 'data' => [ - 'xmlAttribute' => true, - 'xmlNs' => 'abstract', - ], - ], - ], - ], - ], - ], - 'gamma' => [ - 'type' => 'object', - 'data' => [ - 'xmlNs' => 'abstract', - ], - 'additionalProperties' => true, - ], - 'nonExistent' => [ - 'type' => 'object', - 'data' => [ - 'xmlNs' => 'abstract', - ], - 'additionalProperties' => true, - ], - 'nonExistent2' => [ - 'type' => 'object', - 'additionalProperties' => true, - ], - ], - ], - ]); - - $xml = ' - - - - 101 - 1568491379 - - 10 - - - - bar - - - - 102 - 1568491999 - - 20 - - - - baz - - - - - '; - - $this->xmlTest($param, $xml, [ - 'nstest' => [ - [ - 'id' => '101', - 'isbn:number' => 1568491379, - 'meta' => [ - 'foo' => 10, - 'bar' => [ - 'attribute' => 'foo', - ], - ], - 'gamma' => [ - 'foo' => 'bar', - ], - ], - [ - 'id' => '102', - 'isbn:number' => 1568491999, - 'meta' => [ - 'foo' => 20, - 'bar' => [ - 'attribute' => 'bar' - ], - ], - 'gamma' => [ - 'foo' => 'baz', - ], - ], - ], - ]); - } - - /** - * @group ResponseLocation - */ - public function testCanWalkUndefinedPropertiesWithNamespace() - { - $param = new Parameter([ - 'name' => 'nstest', - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'name' => 'item', - 'type' => 'object', - 'sentAs' => 'item', - 'additionalProperties' => [ - 'type' => 'object', - 'data' => [ - 'xmlNs' => 'abstract' - ], - ], - 'properties' => [ - 'id' => [ - 'type' => 'string', - ], - 'isbn:number' => [ - 'type' => 'string', - ], - ], - ], - ]); - - $xml = ' - - - - 101 - 1568491379 - - 10 - baz - - - - 102 - 1568491999 - - 20 - foo - - - - - '; - - $this->xmlTest($param, $xml, [ - 'nstest' => [ - [ - 'id' => '101', - 'isbn:number' => 1568491379, - 'meta' => [ - 'foo' => 10, - 'bar' => 'baz', - ], - ], - [ - 'id' => '102', - 'isbn:number' => 1568491999, - 'meta' => [ - 'foo' => 20, - 'bar' => 'foo', - ], - ], - ] - ]); - } - - /** - * @group ResponseLocation - */ - public function testCanWalkSimpleArrayWithNamespace() - { - $param = new Parameter([ - 'name' => 'nstest', - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'type' => 'string', - 'sentAs' => 'number', - 'data' => [ - 'xmlNs' => 'isbn' - ], - ], - ]); - - $xml = ' - - - 1568491379 - 1568491999 - 1568492999 - - - '; - - $this->xmlTest($param, $xml, [ - 'nstest' => [ - 1568491379, - 1568491999, - 1568492999, - ], - ]); - } - - /** - * @group ResponseLocation - */ - public function testCanWalkSimpleArrayWithNamespace2() - { - $param = new Parameter([ - 'name' => 'nstest', - 'type' => 'array', - 'location' => 'xml', - 'items' => [ - 'type' => 'string', - 'sentAs' => 'isbn:number', - ] - ]); - - $xml = ' - - - 1568491379 - 1568491999 - 1568492999 - - - '; - - $this->xmlTest($param, $xml, [ - 'nstest' => [ - 1568491379, - 1568491999, - 1568492999, - ], - ]); - } - - private function xmlTest(Parameter $param, $xml, $expected) - { - $location = new XmlLocation(); - $model = new Parameter(); - $response = new Response(200, [], \GuzzleHttp\Psr7\stream_for($xml)); - $result = new Result(); - $result = $location->before($result, $response, $param); - $result = $location->visit($result, $response, $param); - $result = $location->after($result, $response, $model); - $this->assertEquals($expected, $result->toArray()); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/SchemaFormatterTest.php b/vendor/guzzlehttp/guzzle-services/tests/SchemaFormatterTest.php deleted file mode 100644 index a8e051ac..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/SchemaFormatterTest.php +++ /dev/null @@ -1,60 +0,0 @@ -assertEquals($result, (new SchemaFormatter)->format($format, $value)); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testValidatesDateTimeInput() - { - (new SchemaFormatter)->format('date-time', false); - } - - public function testEnsuresTimestampsAreIntegers() - { - $t = time(); - $result = (new SchemaFormatter)->format('timestamp', $t); - $this->assertSame($t, $result); - $this->assertInternalType('int', $result); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/SchemaValidatorTest.php b/vendor/guzzlehttp/guzzle-services/tests/SchemaValidatorTest.php deleted file mode 100644 index 6db3d24c..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/SchemaValidatorTest.php +++ /dev/null @@ -1,330 +0,0 @@ -validator = new SchemaValidator(); - } - - public function testValidatesArrayListsAreNumericallyIndexed() - { - $value = [[1]]; - $this->assertFalse($this->validator->validate($this->getComplexParam(), $value)); - $this->assertEquals( - ['[Foo][0] must be an array of properties. Got a numerically indexed array.'], - $this->validator->getErrors() - ); - } - - public function testValidatesArrayListsContainProperItems() - { - $value = [true]; - $this->assertFalse($this->validator->validate($this->getComplexParam(), $value)); - $this->assertEquals( - ['[Foo][0] must be of type object'], - $this->validator->getErrors() - ); - } - - public function testAddsDefaultValuesInLists() - { - $value = [[]]; - $this->assertTrue($this->validator->validate($this->getComplexParam(), $value)); - $this->assertEquals([['Bar' => true]], $value); - } - - public function testMergesDefaultValuesInLists() - { - $value = [ - ['Baz' => 'hello!'], - ['Bar' => false], - ]; - $this->assertTrue($this->validator->validate($this->getComplexParam(), $value)); - $this->assertEquals([ - [ - 'Baz' => 'hello!', - 'Bar' => true, - ], - ['Bar' => false], - ], $value); - } - - public function testCorrectlyConvertsParametersToArrayWhenArraysArePresent() - { - $param = $this->getComplexParam(); - $result = $param->toArray(); - $this->assertInternalType('array', $result['items']); - $this->assertEquals('array', $result['type']); - $this->assertInstanceOf('GuzzleHttp\Command\Guzzle\Parameter', $param->getItems()); - } - - public function testEnforcesInstanceOfOnlyWhenObject() - { - $p = new Parameter([ - 'name' => 'foo', - 'type' => ['object', 'string'], - 'instanceOf' => get_class($this) - ]); - $this->assertTrue($this->validator->validate($p, $this)); - $s = 'test'; - $this->assertTrue($this->validator->validate($p, $s)); - } - - public function testConvertsObjectsToArraysWhenToArrayInterface() - { - $o = $this->getMockBuilder(ToArrayInterface::class) - ->setMethods(['toArray']) - ->getMockForAbstractClass(); - $o->expects($this->once()) - ->method('toArray') - ->will($this->returnValue(['foo' => 'bar'])); - $p = new Parameter([ - 'name' => 'test', - 'type' => 'object', - 'properties' => [ - 'foo' => ['required' => 'true'], - ], - ]); - $this->assertTrue($this->validator->validate($p, $o)); - } - - public function testMergesValidationErrorsInPropertiesWithParent() - { - $p = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'properties' => [ - 'bar' => ['type' => 'string', 'required' => true, 'description' => 'This is what it does'], - 'test' => ['type' => 'string', 'minLength' => 2, 'maxLength' => 5], - 'test2' => ['type' => 'string', 'minLength' => 2, 'maxLength' => 2], - 'test3' => ['type' => 'integer', 'minimum' => 100], - 'test4' => ['type' => 'integer', 'maximum' => 10], - 'test5' => ['type' => 'array', 'maxItems' => 2], - 'test6' => ['type' => 'string', 'enum' => ['a', 'bc']], - 'test7' => ['type' => 'string', 'pattern' => '/[0-9]+/'], - 'test8' => ['type' => 'number'], - 'baz' => [ - 'type' => 'array', - 'minItems' => 2, - 'required' => true, - "items" => ["type" => "string"], - ], - ], - ]); - - $value = [ - 'test' => 'a', - 'test2' => 'abc', - 'baz' => [false], - 'test3' => 10, - 'test4' => 100, - 'test5' => [1, 3, 4], - 'test6' => 'Foo', - 'test7' => 'abc', - 'test8' => 'abc', - ]; - - $this->assertFalse($this->validator->validate($p, $value)); - $this->assertEquals([ - '[foo][bar] is a required string: This is what it does', - '[foo][baz] must contain 2 or more elements', - '[foo][baz][0] must be of type string', - '[foo][test2] length must be less than or equal to 2', - '[foo][test3] must be greater than or equal to 100', - '[foo][test4] must be less than or equal to 10', - '[foo][test5] must contain 2 or fewer elements', - '[foo][test6] must be one of "a" or "bc"', - '[foo][test7] must match the following regular expression: /[0-9]+/', - '[foo][test8] must be of type number', - '[foo][test] length must be greater than or equal to 2', - ], $this->validator->getErrors()); - } - - public function testHandlesNullValuesInArraysWithDefaults() - { - $p = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'required' => true, - 'properties' => [ - 'bar' => [ - 'type' => 'object', - 'required' => true, - 'properties' => [ - 'foo' => ['default' => 'hi'], - ], - ], - ], - ]); - $value = []; - $this->assertTrue($this->validator->validate($p, $value)); - $this->assertEquals(['bar' => ['foo' => 'hi']], $value); - } - - public function testFailsWhenNullValuesInArraysWithNoDefaults() - { - $p = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'required' => true, - 'properties' => [ - 'bar' => [ - 'type' => 'object', - 'required' => true, - 'properties' => [ - 'foo' => ['type' => 'string'], - ], - ], - ], - ]); - $value = []; - $this->assertFalse($this->validator->validate($p, $value)); - $this->assertEquals(['[foo][bar] is a required object'], $this->validator->getErrors()); - } - - public function testChecksTypes() - { - $p = new SchemaValidator(); - $r = new \ReflectionMethod($p, 'determineType'); - $r->setAccessible(true); - $this->assertEquals('any', $r->invoke($p, 'any', 'hello')); - $this->assertEquals(false, $r->invoke($p, 'foo', 'foo')); - $this->assertEquals('string', $r->invoke($p, 'string', 'hello')); - $this->assertEquals(false, $r->invoke($p, 'string', false)); - $this->assertEquals('integer', $r->invoke($p, 'integer', 1)); - $this->assertEquals(false, $r->invoke($p, 'integer', 'abc')); - $this->assertEquals('numeric', $r->invoke($p, 'numeric', 1)); - $this->assertEquals('numeric', $r->invoke($p, 'numeric', '1')); - $this->assertEquals('number', $r->invoke($p, 'number', 1)); - $this->assertEquals('number', $r->invoke($p, 'number', '1')); - $this->assertEquals(false, $r->invoke($p, 'numeric', 'a')); - $this->assertEquals('boolean', $r->invoke($p, 'boolean', true)); - $this->assertEquals('boolean', $r->invoke($p, 'boolean', false)); - $this->assertEquals(false, $r->invoke($p, 'boolean', 'false')); - $this->assertEquals('null', $r->invoke($p, 'null', null)); - $this->assertEquals(false, $r->invoke($p, 'null', 'abc')); - $this->assertEquals('array', $r->invoke($p, 'array', [])); - $this->assertEquals(false, $r->invoke($p, 'array', 'foo')); - } - - public function testValidatesFalseAdditionalProperties() - { - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'properties' => [ - 'bar' => ['type' => 'string'], - ], - 'additionalProperties' => false, - ]); - $value = ['test' => '123']; - $this->assertFalse($this->validator->validate($param, $value)); - $this->assertEquals(['[foo][test] is not an allowed property'], $this->validator->getErrors()); - $value = ['bar' => '123']; - $this->assertTrue($this->validator->validate($param, $value)); - } - - public function testAllowsUndefinedAdditionalProperties() - { - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'properties' => [ - 'bar' => ['type' => 'string'], - ] - ]); - $value = ['test' => '123']; - $this->assertTrue($this->validator->validate($param, $value)); - } - - public function testValidatesAdditionalProperties() - { - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'properties' => [ - 'bar' => ['type' => 'string'], - ], - 'additionalProperties' => ['type' => 'integer'], - ]); - $value = ['test' => 'foo']; - $this->assertFalse($this->validator->validate($param, $value)); - $this->assertEquals(['[foo][test] must be of type integer'], $this->validator->getErrors()); - } - - public function testValidatesAdditionalPropertiesThatArrayArrays() - { - $param = new Parameter([ - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => [ - 'type' => 'array', - 'items' => ['type' => 'string'], - ], - ]); - $value = ['test' => [true]]; - $this->assertFalse($this->validator->validate($param, $value)); - $this->assertEquals(['[foo][test][0] must be of type string'], $this->validator->getErrors()); - } - - public function testIntegersCastToStringWhenTypeMismatch() - { - $param = new Parameter([ - 'name' => 'test', - 'type' => 'string', - ]); - $value = 12; - $this->assertTrue($this->validator->validate($param, $value)); - $this->assertEquals('12', $value); - } - - public function testRequiredMessageIncludesType() - { - $param = new Parameter([ - 'name' => 'test', - 'type' => [ - 'string', - 'boolean', - ], - 'required' => true, - ]); - $value = null; - $this->assertFalse($this->validator->validate($param, $value)); - $this->assertEquals(['[test] is a required string or boolean'], $this->validator->getErrors()); - } - - protected function getComplexParam() - { - return new Parameter([ - 'name' => 'Foo', - 'type' => 'array', - 'required' => true, - 'min' => 1, - 'items' => [ - 'type' => 'object', - 'properties' => [ - 'Baz' => [ - 'type' => 'string', - ], - 'Bar' => [ - 'required' => true, - 'type' => 'boolean', - 'default' => true, - ], - ], - ], - ]); - } -} diff --git a/vendor/guzzlehttp/guzzle-services/tests/SerializerTest.php b/vendor/guzzlehttp/guzzle-services/tests/SerializerTest.php deleted file mode 100644 index 1d3a5a1e..00000000 --- a/vendor/guzzlehttp/guzzle-services/tests/SerializerTest.php +++ /dev/null @@ -1,39 +0,0 @@ - 'http://test.com', - 'operations' => [ - 'test' => [ - 'httpMethod' => 'GET', - 'uri' => '/api/{key}/foo', - 'parameters' => [ - 'key' => [ - 'required' => true, - 'type' => 'string', - 'location' => 'uri' - ], - ] - ] - ] - ]); - - $command = new Command('test', ['key' => 'bar']); - $serializer = new Serializer($description); - /** @var Request $request */ - $request = $serializer($command); - $this->assertEquals('http://test.com/api/bar/foo', $request->getUri()); - } -} diff --git a/vendor/guzzlehttp/guzzle/.php_cs b/vendor/guzzlehttp/guzzle/.php_cs deleted file mode 100644 index a8ace8aa..00000000 --- a/vendor/guzzlehttp/guzzle/.php_cs +++ /dev/null @@ -1,21 +0,0 @@ -setRiskyAllowed(true) - ->setRules([ - '@PSR2' => true, - 'array_syntax' => ['syntax' => 'short'], - 'declare_strict_types' => false, - 'concat_space' => ['spacing'=>'one'], - // 'ordered_imports' => true, - // 'phpdoc_align' => ['align'=>'vertical'], - // 'native_function_invocation' => true, - ]) - ->setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__.'/src') - ->name('*.php') - ) -; - -return $config; diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md deleted file mode 100644 index 65557498..00000000 --- a/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ /dev/null @@ -1,1304 +0,0 @@ -# Change Log - -## 6.4.1 - 2019-10-23 - -* No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that -* Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar` - -## 6.4.0 - 2019-10-23 - -* Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108) -* Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081) -* Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161) -* Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163) -* Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242) -* Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284) -* Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273) -* Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335) -* Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362) - -## 6.3.3 - 2018-04-22 - -* Fix: Default headers when decode_content is specified - - -## 6.3.2 - 2018-03-26 - -* Fix: Release process - - -## 6.3.1 - 2018-03-26 - -* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014) -* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012) -* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999) -* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998) -* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953) -* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915) -* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916) - -+ Minor code cleanups, documentation fixes and clarifications. - - -## 6.3.0 - 2017-06-22 - -* Feature: force IP resolution (ipv4 or ipv6) [#1608](https://github.com/guzzle/guzzle/pull/1608), [#1659](https://github.com/guzzle/guzzle/pull/1659) -* Improvement: Don't include summary in exception message when body is empty [#1621](https://github.com/guzzle/guzzle/pull/1621) -* Improvement: Handle `on_headers` option in MockHandler [#1580](https://github.com/guzzle/guzzle/pull/1580) -* Improvement: Added SUSE Linux CA path [#1609](https://github.com/guzzle/guzzle/issues/1609) -* Improvement: Use class reference for getting the name of the class instead of using hardcoded strings [#1641](https://github.com/guzzle/guzzle/pull/1641) -* Feature: Added `read_timeout` option [#1611](https://github.com/guzzle/guzzle/pull/1611) -* Bug fix: PHP 7.x fixes [#1685](https://github.com/guzzle/guzzle/pull/1685), [#1686](https://github.com/guzzle/guzzle/pull/1686), [#1811](https://github.com/guzzle/guzzle/pull/1811) -* Deprecation: BadResponseException instantiation without a response [#1642](https://github.com/guzzle/guzzle/pull/1642) -* Feature: Added NTLM auth [#1569](https://github.com/guzzle/guzzle/pull/1569) -* Feature: Track redirect HTTP status codes [#1711](https://github.com/guzzle/guzzle/pull/1711) -* Improvement: Check handler type during construction [#1745](https://github.com/guzzle/guzzle/pull/1745) -* Improvement: Always include the Content-Length if there's a body [#1721](https://github.com/guzzle/guzzle/pull/1721) -* Feature: Added convenience method to access a cookie by name [#1318](https://github.com/guzzle/guzzle/pull/1318) -* Bug fix: Fill `CURLOPT_CAPATH` and `CURLOPT_CAINFO` properly [#1684](https://github.com/guzzle/guzzle/pull/1684) -* Improvement: Use `\GuzzleHttp\Promise\rejection_for` function instead of object init [#1827](https://github.com/guzzle/guzzle/pull/1827) - - -+ Minor code cleanups, documentation fixes and clarifications. - -## 6.2.3 - 2017-02-28 - -* Fix deprecations with guzzle/psr7 version 1.4 - -## 6.2.2 - 2016-10-08 - -* Allow to pass nullable Response to delay callable -* Only add scheme when host is present -* Fix drain case where content-length is the literal string zero -* Obfuscate in-URL credentials in exceptions - -## 6.2.1 - 2016-07-18 - -* Address HTTP_PROXY security vulnerability, CVE-2016-5385: - https://httpoxy.org/ -* Fixing timeout bug with StreamHandler: - https://github.com/guzzle/guzzle/pull/1488 -* Only read up to `Content-Length` in PHP StreamHandler to avoid timeouts when - a server does not honor `Connection: close`. -* Ignore URI fragment when sending requests. - -## 6.2.0 - 2016-03-21 - -* Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`. - https://github.com/guzzle/guzzle/pull/1389 -* Bug fix: Fix sleep calculation when waiting for delayed requests. - https://github.com/guzzle/guzzle/pull/1324 -* Feature: More flexible history containers. - https://github.com/guzzle/guzzle/pull/1373 -* Bug fix: defer sink stream opening in StreamHandler. - https://github.com/guzzle/guzzle/pull/1377 -* Bug fix: do not attempt to escape cookie values. - https://github.com/guzzle/guzzle/pull/1406 -* Feature: report original content encoding and length on decoded responses. - https://github.com/guzzle/guzzle/pull/1409 -* Bug fix: rewind seekable request bodies before dispatching to cURL. - https://github.com/guzzle/guzzle/pull/1422 -* Bug fix: provide an empty string to `http_build_query` for HHVM workaround. - https://github.com/guzzle/guzzle/pull/1367 - -## 6.1.1 - 2015-11-22 - -* Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler - https://github.com/guzzle/guzzle/commit/911bcbc8b434adce64e223a6d1d14e9a8f63e4e4 -* Feature: HandlerStack is now more generic. - https://github.com/guzzle/guzzle/commit/f2102941331cda544745eedd97fc8fd46e1ee33e -* Bug fix: setting verify to false in the StreamHandler now disables peer - verification. https://github.com/guzzle/guzzle/issues/1256 -* Feature: Middleware now uses an exception factory, including more error - context. https://github.com/guzzle/guzzle/pull/1282 -* Feature: better support for disabled functions. - https://github.com/guzzle/guzzle/pull/1287 -* Bug fix: fixed regression where MockHandler was not using `sink`. - https://github.com/guzzle/guzzle/pull/1292 - -## 6.1.0 - 2015-09-08 - -* Feature: Added the `on_stats` request option to provide access to transfer - statistics for requests. https://github.com/guzzle/guzzle/pull/1202 -* Feature: Added the ability to persist session cookies in CookieJars. - https://github.com/guzzle/guzzle/pull/1195 -* Feature: Some compatibility updates for Google APP Engine - https://github.com/guzzle/guzzle/pull/1216 -* Feature: Added support for NO_PROXY to prevent the use of a proxy based on - a simple set of rules. https://github.com/guzzle/guzzle/pull/1197 -* Feature: Cookies can now contain square brackets. - https://github.com/guzzle/guzzle/pull/1237 -* Bug fix: Now correctly parsing `=` inside of quotes in Cookies. - https://github.com/guzzle/guzzle/pull/1232 -* Bug fix: Cusotm cURL options now correctly override curl options of the - same name. https://github.com/guzzle/guzzle/pull/1221 -* Bug fix: Content-Type header is now added when using an explicitly provided - multipart body. https://github.com/guzzle/guzzle/pull/1218 -* Bug fix: Now ignoring Set-Cookie headers that have no name. -* Bug fix: Reason phrase is no longer cast to an int in some cases in the - cURL handler. https://github.com/guzzle/guzzle/pull/1187 -* Bug fix: Remove the Authorization header when redirecting if the Host - header changes. https://github.com/guzzle/guzzle/pull/1207 -* Bug fix: Cookie path matching fixes - https://github.com/guzzle/guzzle/issues/1129 -* Bug fix: Fixing the cURL `body_as_string` setting - https://github.com/guzzle/guzzle/pull/1201 -* Bug fix: quotes are no longer stripped when parsing cookies. - https://github.com/guzzle/guzzle/issues/1172 -* Bug fix: `form_params` and `query` now always uses the `&` separator. - https://github.com/guzzle/guzzle/pull/1163 -* Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set. - https://github.com/guzzle/guzzle/pull/1189 - -## 6.0.2 - 2015-07-04 - -* Fixed a memory leak in the curl handlers in which references to callbacks - were not being removed by `curl_reset`. -* Cookies are now extracted properly before redirects. -* Cookies now allow more character ranges. -* Decoded Content-Encoding responses are now modified to correctly reflect - their state if the encoding was automatically removed by a handler. This - means that the `Content-Encoding` header may be removed an the - `Content-Length` modified to reflect the message size after removing the - encoding. -* Added a more explicit error message when trying to use `form_params` and - `multipart` in the same request. -* Several fixes for HHVM support. -* Functions are now conditionally required using an additional level of - indirection to help with global Composer installations. - -## 6.0.1 - 2015-05-27 - -* Fixed a bug with serializing the `query` request option where the `&` - separator was missing. -* Added a better error message for when `body` is provided as an array. Please - use `form_params` or `multipart` instead. -* Various doc fixes. - -## 6.0.0 - 2015-05-26 - -* See the UPGRADING.md document for more information. -* Added `multipart` and `form_params` request options. -* Added `synchronous` request option. -* Added the `on_headers` request option. -* Fixed `expect` handling. -* No longer adding default middlewares in the client ctor. These need to be - present on the provided handler in order to work. -* Requests are no longer initiated when sending async requests with the - CurlMultiHandler. This prevents unexpected recursion from requests completing - while ticking the cURL loop. -* Removed the semantics of setting `default` to `true`. This is no longer - required now that the cURL loop is not ticked for async requests. -* Added request and response logging middleware. -* No longer allowing self signed certificates when using the StreamHandler. -* Ensuring that `sink` is valid if saving to a file. -* Request exceptions now include a "handler context" which provides handler - specific contextual information. -* Added `GuzzleHttp\RequestOptions` to allow request options to be applied - using constants. -* `$maxHandles` has been removed from CurlMultiHandler. -* `MultipartPostBody` is now part of the `guzzlehttp/psr7` package. - -## 5.3.0 - 2015-05-19 - -* Mock now supports `save_to` -* Marked `AbstractRequestEvent::getTransaction()` as public. -* Fixed a bug in which multiple headers using different casing would overwrite - previous headers in the associative array. -* Added `Utils::getDefaultHandler()` -* Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated. -* URL scheme is now always lowercased. - -## 6.0.0-beta.1 - -* Requires PHP >= 5.5 -* Updated to use PSR-7 - * Requires immutable messages, which basically means an event based system - owned by a request instance is no longer possible. - * Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7). - * Removed the dependency on `guzzlehttp/streams`. These stream abstractions - are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7` - namespace. -* Added middleware and handler system - * Replaced the Guzzle event and subscriber system with a middleware system. - * No longer depends on RingPHP, but rather places the HTTP handlers directly - in Guzzle, operating on PSR-7 messages. - * Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which - means the `guzzlehttp/retry-subscriber` is now obsolete. - * Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`. -* Asynchronous responses - * No longer supports the `future` request option to send an async request. - Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`, - `getAsync`, etc.). - * Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid - recursion required by chaining and forwarding react promises. See - https://github.com/guzzle/promises - * Added `requestAsync` and `sendAsync` to send request asynchronously. - * Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests - asynchronously. -* Request options - * POST and form updates - * Added the `form_fields` and `form_files` request options. - * Removed the `GuzzleHttp\Post` namespace. - * The `body` request option no longer accepts an array for POST requests. - * The `exceptions` request option has been deprecated in favor of the - `http_errors` request options. - * The `save_to` request option has been deprecated in favor of `sink` request - option. -* Clients no longer accept an array of URI template string and variables for - URI variables. You will need to expand URI templates before passing them - into a client constructor or request method. -* Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are - now magic methods that will send synchronous requests. -* Replaced `Utils.php` with plain functions in `functions.php`. -* Removed `GuzzleHttp\Collection`. -* Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as - an array. -* Removed `GuzzleHttp\Query`. Query string handling is now handled using an - associative array passed into the `query` request option. The query string - is serialized using PHP's `http_build_query`. If you need more control, you - can pass the query string in as a string. -* `GuzzleHttp\QueryParser` has been replaced with the - `GuzzleHttp\Psr7\parse_query`. - -## 5.2.0 - 2015-01-27 - -* Added `AppliesHeadersInterface` to make applying headers to a request based - on the body more generic and not specific to `PostBodyInterface`. -* Reduced the number of stack frames needed to send requests. -* Nested futures are now resolved in the client rather than the RequestFsm -* Finishing state transitions is now handled in the RequestFsm rather than the - RingBridge. -* Added a guard in the Pool class to not use recursion for request retries. - -## 5.1.0 - 2014-12-19 - -* Pool class no longer uses recursion when a request is intercepted. -* The size of a Pool can now be dynamically adjusted using a callback. - See https://github.com/guzzle/guzzle/pull/943. -* Setting a request option to `null` when creating a request with a client will - ensure that the option is not set. This allows you to overwrite default - request options on a per-request basis. - See https://github.com/guzzle/guzzle/pull/937. -* Added the ability to limit which protocols are allowed for redirects by - specifying a `protocols` array in the `allow_redirects` request option. -* Nested futures due to retries are now resolved when waiting for synchronous - responses. See https://github.com/guzzle/guzzle/pull/947. -* `"0"` is now an allowed URI path. See - https://github.com/guzzle/guzzle/pull/935. -* `Query` no longer typehints on the `$query` argument in the constructor, - allowing for strings and arrays. -* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle - specific exceptions if necessary. - -## 5.0.3 - 2014-11-03 - -This change updates query strings so that they are treated as un-encoded values -by default where the value represents an un-encoded value to send over the -wire. A Query object then encodes the value before sending over the wire. This -means that even value query string values (e.g., ":") are url encoded. This -makes the Query class match PHP's http_build_query function. However, if you -want to send requests over the wire using valid query string characters that do -not need to be encoded, then you can provide a string to Url::setQuery() and -pass true as the second argument to specify that the query string is a raw -string that should not be parsed or encoded (unless a call to getQuery() is -subsequently made, forcing the query-string to be converted into a Query -object). - -## 5.0.2 - 2014-10-30 - -* Added a trailing `\r\n` to multipart/form-data payloads. See - https://github.com/guzzle/guzzle/pull/871 -* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs. -* Status codes are now returned as integers. See - https://github.com/guzzle/guzzle/issues/881 -* No longer overwriting an existing `application/x-www-form-urlencoded` header - when sending POST requests, allowing for customized headers. See - https://github.com/guzzle/guzzle/issues/877 -* Improved path URL serialization. - - * No longer double percent-encoding characters in the path or query string if - they are already encoded. - * Now properly encoding the supplied path to a URL object, instead of only - encoding ' ' and '?'. - * Note: This has been changed in 5.0.3 to now encode query string values by - default unless the `rawString` argument is provided when setting the query - string on a URL: Now allowing many more characters to be present in the - query string without being percent encoded. See http://tools.ietf.org/html/rfc3986#appendix-A - -## 5.0.1 - 2014-10-16 - -Bugfix release. - -* Fixed an issue where connection errors still returned response object in - error and end events event though the response is unusable. This has been - corrected so that a response is not returned in the `getResponse` method of - these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867 -* Fixed an issue where transfer statistics were not being populated in the - RingBridge. https://github.com/guzzle/guzzle/issues/866 - -## 5.0.0 - 2014-10-12 - -Adding support for non-blocking responses and some minor API cleanup. - -### New Features - -* Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`. -* Added a public API for creating a default HTTP adapter. -* Updated the redirect plugin to be non-blocking so that redirects are sent - concurrently. Other plugins like this can now be updated to be non-blocking. -* Added a "progress" event so that you can get upload and download progress - events. -* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers - requests concurrently using a capped pool size as efficiently as possible. -* Added `hasListeners()` to EmitterInterface. -* Removed `GuzzleHttp\ClientInterface::sendAll` and marked - `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the - recommended way). - -### Breaking changes - -The breaking changes in this release are relatively minor. The biggest thing to -look out for is that request and response objects no longer implement fluent -interfaces. - -* Removed the fluent interfaces (i.e., `return $this`) from requests, - responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`, - `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and - `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of - why I did this: http://ocramius.github.io/blog/fluent-interfaces-are-evil/. - This also makes the Guzzle message interfaces compatible with the current - PSR-7 message proposal. -* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except - for the HTTP request functions from function.php, these functions are now - implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode` - moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to - `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to - `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be - `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php - caused problems for many users: they aren't PSR-4 compliant, require an - explicit include, and needed an if-guard to ensure that the functions are not - declared multiple times. -* Rewrote adapter layer. - * Removing all classes from `GuzzleHttp\Adapter`, these are now - implemented as callables that are stored in `GuzzleHttp\Ring\Client`. - * Removed the concept of "parallel adapters". Sending requests serially or - concurrently is now handled using a single adapter. - * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The - Transaction object now exposes the request, response, and client as public - properties. The getters and setters have been removed. -* Removed the "headers" event. This event was only useful for changing the - body a response once the headers of the response were known. You can implement - a similar behavior in a number of ways. One example might be to use a - FnStream that has access to the transaction being sent. For example, when the - first byte is written, you could check if the response headers match your - expectations, and if so, change the actual stream body that is being - written to. -* Removed the `asArray` parameter from - `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header - value as an array, then use the newly added `getHeaderAsArray()` method of - `MessageInterface`. This change makes the Guzzle interfaces compatible with - the PSR-7 interfaces. -* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add - custom request options using double-dispatch (this was an implementation - detail). Instead, you should now provide an associative array to the - constructor which is a mapping of the request option name mapping to a - function that applies the option value to a request. -* Removed the concept of "throwImmediately" from exceptions and error events. - This control mechanism was used to stop a transfer of concurrent requests - from completing. This can now be handled by throwing the exception or by - cancelling a pool of requests or each outstanding future request individually. -* Updated to "GuzzleHttp\Streams" 3.0. - * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a - `maxLen` parameter. This update makes the Guzzle streams project - compatible with the current PSR-7 proposal. - * `GuzzleHttp\Stream\Stream::__construct`, - `GuzzleHttp\Stream\Stream::factory`, and - `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second - argument. They now accept an associative array of options, including the - "size" key and "metadata" key which can be used to provide custom metadata. - -## 4.2.2 - 2014-09-08 - -* Fixed a memory leak in the CurlAdapter when reusing cURL handles. -* No longer using `request_fulluri` in stream adapter proxies. -* Relative redirects are now based on the last response, not the first response. - -## 4.2.1 - 2014-08-19 - -* Ensuring that the StreamAdapter does not always add a Content-Type header -* Adding automated github releases with a phar and zip - -## 4.2.0 - 2014-08-17 - -* Now merging in default options using a case-insensitive comparison. - Closes https://github.com/guzzle/guzzle/issues/767 -* Added the ability to automatically decode `Content-Encoding` response bodies - using the `decode_content` request option. This is set to `true` by default - to decode the response body if it comes over the wire with a - `Content-Encoding`. Set this value to `false` to disable decoding the - response content, and pass a string to provide a request `Accept-Encoding` - header and turn on automatic response decoding. This feature now allows you - to pass an `Accept-Encoding` header in the headers of a request but still - disable automatic response decoding. - Closes https://github.com/guzzle/guzzle/issues/764 -* Added the ability to throw an exception immediately when transferring - requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760 -* Updating guzzlehttp/streams dependency to ~2.1 -* No longer utilizing the now deprecated namespaced methods from the stream - package. - -## 4.1.8 - 2014-08-14 - -* Fixed an issue in the CurlFactory that caused setting the `stream=false` - request option to throw an exception. - See: https://github.com/guzzle/guzzle/issues/769 -* TransactionIterator now calls rewind on the inner iterator. - See: https://github.com/guzzle/guzzle/pull/765 -* You can now set the `Content-Type` header to `multipart/form-data` - when creating POST requests to force multipart bodies. - See https://github.com/guzzle/guzzle/issues/768 - -## 4.1.7 - 2014-08-07 - -* Fixed an error in the HistoryPlugin that caused the same request and response - to be logged multiple times when an HTTP protocol error occurs. -* Ensuring that cURL does not add a default Content-Type when no Content-Type - has been supplied by the user. This prevents the adapter layer from modifying - the request that is sent over the wire after any listeners may have already - put the request in a desired state (e.g., signed the request). -* Throwing an exception when you attempt to send requests that have the - "stream" set to true in parallel using the MultiAdapter. -* Only calling curl_multi_select when there are active cURL handles. This was - previously changed and caused performance problems on some systems due to PHP - always selecting until the maximum select timeout. -* Fixed a bug where multipart/form-data POST fields were not correctly - aggregated (e.g., values with "&"). - -## 4.1.6 - 2014-08-03 - -* Added helper methods to make it easier to represent messages as strings, - including getting the start line and getting headers as a string. - -## 4.1.5 - 2014-08-02 - -* Automatically retrying cURL "Connection died, retrying a fresh connect" - errors when possible. -* cURL implementation cleanup -* Allowing multiple event subscriber listeners to be registered per event by - passing an array of arrays of listener configuration. - -## 4.1.4 - 2014-07-22 - -* Fixed a bug that caused multi-part POST requests with more than one field to - serialize incorrectly. -* Paths can now be set to "0" -* `ResponseInterface::xml` now accepts a `libxml_options` option and added a - missing default argument that was required when parsing XML response bodies. -* A `save_to` stream is now created lazily, which means that files are not - created on disk unless a request succeeds. - -## 4.1.3 - 2014-07-15 - -* Various fixes to multipart/form-data POST uploads -* Wrapping function.php in an if-statement to ensure Guzzle can be used - globally and in a Composer install -* Fixed an issue with generating and merging in events to an event array -* POST headers are only applied before sending a request to allow you to change - the query aggregator used before uploading -* Added much more robust query string parsing -* Fixed various parsing and normalization issues with URLs -* Fixing an issue where multi-valued headers were not being utilized correctly - in the StreamAdapter - -## 4.1.2 - 2014-06-18 - -* Added support for sending payloads with GET requests - -## 4.1.1 - 2014-06-08 - -* Fixed an issue related to using custom message factory options in subclasses -* Fixed an issue with nested form fields in a multi-part POST -* Fixed an issue with using the `json` request option for POST requests -* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar` - -## 4.1.0 - 2014-05-27 - -* Added a `json` request option to easily serialize JSON payloads. -* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON. -* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`. -* Added the ability to provide an emitter to a client in the client constructor. -* Added the ability to persist a cookie session using $_SESSION. -* Added a trait that can be used to add event listeners to an iterator. -* Removed request method constants from RequestInterface. -* Fixed warning when invalid request start-lines are received. -* Updated MessageFactory to work with custom request option methods. -* Updated cacert bundle to latest build. - -4.0.2 (2014-04-16) ------------------- - -* Proxy requests using the StreamAdapter now properly use request_fulluri (#632) -* Added the ability to set scalars as POST fields (#628) - -## 4.0.1 - 2014-04-04 - -* The HTTP status code of a response is now set as the exception code of - RequestException objects. -* 303 redirects will now correctly switch from POST to GET requests. -* The default parallel adapter of a client now correctly uses the MultiAdapter. -* HasDataTrait now initializes the internal data array as an empty array so - that the toArray() method always returns an array. - -## 4.0.0 - 2014-03-29 - -* For more information on the 4.0 transition, see: - http://mtdowling.com/blog/2014/03/15/guzzle-4-rc/ -* For information on changes and upgrading, see: - https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 -* Added `GuzzleHttp\batch()` as a convenience function for sending requests in - parallel without needing to write asynchronous code. -* Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`. - You can now pass a callable or an array of associative arrays where each - associative array contains the "fn", "priority", and "once" keys. - -## 4.0.0.rc-2 - 2014-03-25 - -* Removed `getConfig()` and `setConfig()` from clients to avoid confusion - around whether things like base_url, message_factory, etc. should be able to - be retrieved or modified. -* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface -* functions.php functions were renamed using snake_case to match PHP idioms -* Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and - `GUZZLE_CURL_SELECT_TIMEOUT` environment variables -* Added the ability to specify custom `sendAll()` event priorities -* Added the ability to specify custom stream context options to the stream - adapter. -* Added a functions.php function for `get_path()` and `set_path()` -* CurlAdapter and MultiAdapter now use a callable to generate curl resources -* MockAdapter now properly reads a body and emits a `headers` event -* Updated Url class to check if a scheme and host are set before adding ":" - and "//". This allows empty Url (e.g., "") to be serialized as "". -* Parsing invalid XML no longer emits warnings -* Curl classes now properly throw AdapterExceptions -* Various performance optimizations -* Streams are created with the faster `Stream\create()` function -* Marked deprecation_proxy() as internal -* Test server is now a collection of static methods on a class - -## 4.0.0-rc.1 - 2014-03-15 - -* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 - -## 3.8.1 - 2014-01-28 - -* Bug: Always using GET requests when redirecting from a 303 response -* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in - `Guzzle\Http\ClientInterface::setSslVerification()` -* Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL -* Bug: The body of a request can now be set to `"0"` -* Sending PHP stream requests no longer forces `HTTP/1.0` -* Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of - each sub-exception -* Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than - clobbering everything). -* Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators) -* Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`. - For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`. -* Now properly escaping the regular expression delimiter when matching Cookie domains. -* Network access is now disabled when loading XML documents - -## 3.8.0 - 2013-12-05 - -* Added the ability to define a POST name for a file -* JSON response parsing now properly walks additionalProperties -* cURL error code 18 is now retried automatically in the BackoffPlugin -* Fixed a cURL error when URLs contain fragments -* Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were - CurlExceptions -* CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e) -* Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS` -* Fixed a bug that was encountered when parsing empty header parameters -* UriTemplate now has a `setRegex()` method to match the docs -* The `debug` request parameter now checks if it is truthy rather than if it exists -* Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin -* Added the ability to combine URLs using strict RFC 3986 compliance -* Command objects can now return the validation errors encountered by the command -* Various fixes to cache revalidation (#437 and 29797e5) -* Various fixes to the AsyncPlugin -* Cleaned up build scripts - -## 3.7.4 - 2013-10-02 - -* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430) -* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp - (see https://github.com/aws/aws-sdk-php/issues/147) -* Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots -* Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420) -* Updated the bundled cacert.pem (#419) -* OauthPlugin now supports adding authentication to headers or query string (#425) - -## 3.7.3 - 2013-09-08 - -* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and - `CommandTransferException`. -* Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description -* Schemas are only injected into response models when explicitly configured. -* No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of - an EntityBody. -* Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator. -* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`. -* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody() -* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin -* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests -* Bug fix: Properly parsing headers that contain commas contained in quotes -* Bug fix: mimetype guessing based on a filename is now case-insensitive - -## 3.7.2 - 2013-08-02 - -* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander - See https://github.com/guzzle/guzzle/issues/371 -* Bug fix: Cookie domains are now matched correctly according to RFC 6265 - See https://github.com/guzzle/guzzle/issues/377 -* Bug fix: GET parameters are now used when calculating an OAuth signature -* Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted -* `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched -* `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input. - See https://github.com/guzzle/guzzle/issues/379 -* Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See - https://github.com/guzzle/guzzle/pull/380 -* cURL multi cleanup and optimizations - -## 3.7.1 - 2013-07-05 - -* Bug fix: Setting default options on a client now works -* Bug fix: Setting options on HEAD requests now works. See #352 -* Bug fix: Moving stream factory before send event to before building the stream. See #353 -* Bug fix: Cookies no longer match on IP addresses per RFC 6265 -* Bug fix: Correctly parsing header parameters that are in `<>` and quotes -* Added `cert` and `ssl_key` as request options -* `Host` header can now diverge from the host part of a URL if the header is set manually -* `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter -* OAuth parameters are only added via the plugin if they aren't already set -* Exceptions are now thrown when a URL cannot be parsed -* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails -* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin - -## 3.7.0 - 2013-06-10 - -* See UPGRADING.md for more information on how to upgrade. -* Requests now support the ability to specify an array of $options when creating a request to more easily modify a - request. You can pass a 'request.options' configuration setting to a client to apply default request options to - every request created by a client (e.g. default query string variables, headers, curl options, etc.). -* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`. - See `Guzzle\Http\StaticClient::mount`. -* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests - created by a command (e.g. custom headers, query string variables, timeout settings, etc.). -* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the - headers of a response -* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key - (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`) -* ServiceBuilders now support storing and retrieving arbitrary data -* CachePlugin can now purge all resources for a given URI -* CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource -* CachePlugin now uses the Vary header to determine if a resource is a cache hit -* `Guzzle\Http\Message\Response` now implements `\Serializable` -* Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters -* `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable -* Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()` -* Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size -* `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message -* Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older - Symfony users can still use the old version of Monolog. -* Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`. - Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`. -* Several performance improvements to `Guzzle\Common\Collection` -* Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: - createRequest, head, delete, put, patch, post, options, prepareRequest -* Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` -* Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` -* Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to - `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a - resource, string, or EntityBody into the $options parameter to specify the download location of the response. -* Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a - default `array()` -* Added `Guzzle\Stream\StreamInterface::isRepeatable` -* Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use - $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or - $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`. -* Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`. -* Removed `Guzzle\Http\ClientInterface::expandTemplate()` -* Removed `Guzzle\Http\ClientInterface::setRequestFactory()` -* Removed `Guzzle\Http\ClientInterface::getCurlMulti()` -* Removed `Guzzle\Http\Message\RequestInterface::canCache` -* Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect` -* Removed `Guzzle\Http\Message\RequestInterface::isRedirect` -* Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. -* You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting - `Guzzle\Common\Version::$emitWarnings` to true. -* Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use - `$request->getResponseBody()->isRepeatable()` instead. -* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use - `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. -* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use - `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. -* Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. -* Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. -* Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated -* Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. - These will work through Guzzle 4.0 -* Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params]. -* Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. -* Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`. -* Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. -* Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. -* Marked `Guzzle\Common\Collection::inject()` as deprecated. -* Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');` -* CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a - CacheStorageInterface. These two objects and interface will be removed in a future version. -* Always setting X-cache headers on cached responses -* Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin -* `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface - $request, Response $response);` -* `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` -* `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` -* Added `CacheStorageInterface::purge($url)` -* `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin - $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, - CanCacheStrategyInterface $canCache = null)` -* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` - -## 3.6.0 - 2013-05-29 - -* ServiceDescription now implements ToArrayInterface -* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters -* Guzzle can now correctly parse incomplete URLs -* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. -* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution -* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). -* Specific header implementations can be created for complex headers. When a message creates a header, it uses a - HeaderFactory which can map specific headers to specific header classes. There is now a Link header and - CacheControl header implementation. -* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate -* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() -* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in - Guzzle\Http\Curl\RequestMediator -* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. -* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface -* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() -* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() -* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). -* All response header helper functions return a string rather than mixing Header objects and strings inconsistently -* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle - directly via interfaces -* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist - but are a no-op until removed. -* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a - `Guzzle\Service\Command\ArrayCommandInterface`. -* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response - on a request while the request is still being transferred -* The ability to case-insensitively search for header values -* Guzzle\Http\Message\Header::hasExactHeader -* Guzzle\Http\Message\Header::raw. Use getAll() -* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object - instead. -* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess -* Added the ability to cast Model objects to a string to view debug information. - -## 3.5.0 - 2013-05-13 - -* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times -* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove - itself from the EventDispatcher) -* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values -* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too -* Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a - non-existent key -* Bug: All __call() method arguments are now required (helps with mocking frameworks) -* Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference - to help with refcount based garbage collection of resources created by sending a request -* Deprecating ZF1 cache and log adapters. These will be removed in the next major version. -* Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the - HistoryPlugin for a history. -* Added a `responseBody` alias for the `response_body` location -* Refactored internals to no longer rely on Response::getRequest() -* HistoryPlugin can now be cast to a string -* HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests - and responses that are sent over the wire -* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects - -## 3.4.3 - 2013-04-30 - -* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response -* Added a check to re-extract the temp cacert bundle from the phar before sending each request - -## 3.4.2 - 2013-04-29 - -* Bug fix: Stream objects now work correctly with "a" and "a+" modes -* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present -* Bug fix: AsyncPlugin no longer forces HEAD requests -* Bug fix: DateTime timezones are now properly handled when using the service description schema formatter -* Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails -* Setting a response on a request will write to the custom request body from the response body if one is specified -* LogPlugin now writes to php://output when STDERR is undefined -* Added the ability to set multiple POST files for the same key in a single call -* application/x-www-form-urlencoded POSTs now use the utf-8 charset by default -* Added the ability to queue CurlExceptions to the MockPlugin -* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send) -* Configuration loading now allows remote files - -## 3.4.1 - 2013-04-16 - -* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti - handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost. -* Exceptions are now properly grouped when sending requests in parallel -* Redirects are now properly aggregated when a multi transaction fails -* Redirects now set the response on the original object even in the event of a failure -* Bug fix: Model names are now properly set even when using $refs -* Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax -* Added support for oauth_callback in OAuth signatures -* Added support for oauth_verifier in OAuth signatures -* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection - -## 3.4.0 - 2013-04-11 - -* Bug fix: URLs are now resolved correctly based on http://tools.ietf.org/html/rfc3986#section-5.2. #289 -* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289 -* Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263 -* Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264. -* Bug fix: Added `number` type to service descriptions. -* Bug fix: empty parameters are removed from an OAuth signature -* Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header -* Bug fix: Fixed "array to string" error when validating a union of types in a service description -* Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream -* Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin. -* Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs. -* The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections. -* Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if - the Content-Type can be determined based on the entity body or the path of the request. -* Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder. -* Added support for a PSR-3 LogAdapter. -* Added a `command.after_prepare` event -* Added `oauth_callback` parameter to the OauthPlugin -* Added the ability to create a custom stream class when using a stream factory -* Added a CachingEntityBody decorator -* Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized. -* The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar. -* You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies -* POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This - means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use - POST fields or files (the latter is only used when emulating a form POST in the browser). -* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest - -## 3.3.1 - 2013-03-10 - -* Added the ability to create PHP streaming responses from HTTP requests -* Bug fix: Running any filters when parsing response headers with service descriptions -* Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing -* Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across - response location visitors. -* Bug fix: Removed the possibility of creating configuration files with circular dependencies -* RequestFactory::create() now uses the key of a POST file when setting the POST file name -* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set - -## 3.3.0 - 2013-03-03 - -* A large number of performance optimizations have been made -* Bug fix: Added 'wb' as a valid write mode for streams -* Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned -* Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()` -* BC: Removed `Guzzle\Http\Utils` class -* BC: Setting a service description on a client will no longer modify the client's command factories. -* BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using - the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' -* BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to - lowercase -* Operation parameter objects are now lazy loaded internally -* Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses -* Added support for instantiating responseType=class responseClass classes. Classes must implement - `Guzzle\Service\Command\ResponseClassInterface` -* Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These - additional properties also support locations and can be used to parse JSON responses where the outermost part of the - JSON is an array -* Added support for nested renaming of JSON models (rename sentAs to name) -* CachePlugin - * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error - * Debug headers can now added to cached response in the CachePlugin - -## 3.2.0 - 2013-02-14 - -* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients. -* URLs with no path no longer contain a "/" by default -* Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url. -* BadResponseException no longer includes the full request and response message -* Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface -* Adding getResponseBody() to Guzzle\Http\Message\RequestInterface -* Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription -* Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list -* xmlEncoding can now be customized for the XML declaration of a XML service description operation -* Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value - aggregation and no longer uses callbacks -* The URL encoding implementation of Guzzle\Http\QueryString can now be customized -* Bug fix: Filters were not always invoked for array service description parameters -* Bug fix: Redirects now use a target response body rather than a temporary response body -* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded -* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives - -## 3.1.2 - 2013-01-27 - -* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the - response body. For example, the XmlVisitor now parses the XML response into an array in the before() method. -* Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent -* CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444) -* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse() -* Setting default headers on a client after setting the user-agent will not erase the user-agent setting - -## 3.1.1 - 2013-01-20 - -* Adding wildcard support to Guzzle\Common\Collection::getPath() -* Adding alias support to ServiceBuilder configs -* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface - -## 3.1.0 - 2013-01-12 - -* BC: CurlException now extends from RequestException rather than BadResponseException -* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse() -* Added getData to ServiceDescriptionInterface -* Added context array to RequestInterface::setState() -* Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http -* Bug: Adding required content-type when JSON request visitor adds JSON to a command -* Bug: Fixing the serialization of a service description with custom data -* Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing - an array of successful and failed responses -* Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection -* Added Guzzle\Http\IoEmittingEntityBody -* Moved command filtration from validators to location visitors -* Added `extends` attributes to service description parameters -* Added getModels to ServiceDescriptionInterface - -## 3.0.7 - 2012-12-19 - -* Fixing phar detection when forcing a cacert to system if null or true -* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()` -* Cleaning up `Guzzle\Common\Collection::inject` method -* Adding a response_body location to service descriptions - -## 3.0.6 - 2012-12-09 - -* CurlMulti performance improvements -* Adding setErrorResponses() to Operation -* composer.json tweaks - -## 3.0.5 - 2012-11-18 - -* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin -* Bug: Response body can now be a string containing "0" -* Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert -* Bug: QueryString::fromString now properly parses query string parameters that contain equal signs -* Added support for XML attributes in service description responses -* DefaultRequestSerializer now supports array URI parameter values for URI template expansion -* Added better mimetype guessing to requests and post files - -## 3.0.4 - 2012-11-11 - -* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value -* Bug: Cookies can now be added that have a name, domain, or value set to "0" -* Bug: Using the system cacert bundle when using the Phar -* Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures -* Enhanced cookie jar de-duplication -* Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added -* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies -* Added the ability to create any sort of hash for a stream rather than just an MD5 hash - -## 3.0.3 - 2012-11-04 - -* Implementing redirects in PHP rather than cURL -* Added PECL URI template extension and using as default parser if available -* Bug: Fixed Content-Length parsing of Response factory -* Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams. -* Adding ToArrayInterface throughout library -* Fixing OauthPlugin to create unique nonce values per request - -## 3.0.2 - 2012-10-25 - -* Magic methods are enabled by default on clients -* Magic methods return the result of a command -* Service clients no longer require a base_url option in the factory -* Bug: Fixed an issue with URI templates where null template variables were being expanded - -## 3.0.1 - 2012-10-22 - -* Models can now be used like regular collection objects by calling filter, map, etc. -* Models no longer require a Parameter structure or initial data in the constructor -* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator` - -## 3.0.0 - 2012-10-15 - -* Rewrote service description format to be based on Swagger - * Now based on JSON schema - * Added nested input structures and nested response models - * Support for JSON and XML input and output models - * Renamed `commands` to `operations` - * Removed dot class notation - * Removed custom types -* Broke the project into smaller top-level namespaces to be more component friendly -* Removed support for XML configs and descriptions. Use arrays or JSON files. -* Removed the Validation component and Inspector -* Moved all cookie code to Guzzle\Plugin\Cookie -* Magic methods on a Guzzle\Service\Client now return the command un-executed. -* Calling getResult() or getResponse() on a command will lazily execute the command if needed. -* Now shipping with cURL's CA certs and using it by default -* Added previousResponse() method to response objects -* No longer sending Accept and Accept-Encoding headers on every request -* Only sending an Expect header by default when a payload is greater than 1MB -* Added/moved client options: - * curl.blacklist to curl.option.blacklist - * Added ssl.certificate_authority -* Added a Guzzle\Iterator component -* Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin -* Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin) -* Added a more robust caching plugin -* Added setBody to response objects -* Updating LogPlugin to use a more flexible MessageFormatter -* Added a completely revamped build process -* Cleaning up Collection class and removing default values from the get method -* Fixed ZF2 cache adapters - -## 2.8.8 - 2012-10-15 - -* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did - -## 2.8.7 - 2012-09-30 - -* Bug: Fixed config file aliases for JSON includes -* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests -* Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload -* Bug: Hardening request and response parsing to account for missing parts -* Bug: Fixed PEAR packaging -* Bug: Fixed Request::getInfo -* Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail -* Adding the ability for the namespace Iterator factory to look in multiple directories -* Added more getters/setters/removers from service descriptions -* Added the ability to remove POST fields from OAuth signatures -* OAuth plugin now supports 2-legged OAuth - -## 2.8.6 - 2012-09-05 - -* Added the ability to modify and build service descriptions -* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command -* Added a `json` parameter location -* Now allowing dot notation for classes in the CacheAdapterFactory -* Using the union of two arrays rather than an array_merge when extending service builder services and service params -* Ensuring that a service is a string before doing strpos() checks on it when substituting services for references - in service builder config files. -* Services defined in two different config files that include one another will by default replace the previously - defined service, but you can now create services that extend themselves and merge their settings over the previous -* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like - '_default' with a default JSON configuration file. - -## 2.8.5 - 2012-08-29 - -* Bug: Suppressed empty arrays from URI templates -* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching -* Added support for HTTP responses that do not contain a reason phrase in the start-line -* AbstractCommand commands are now invokable -* Added a way to get the data used when signing an Oauth request before a request is sent - -## 2.8.4 - 2012-08-15 - -* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin -* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable. -* Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream -* Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream -* Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5()) -* Added additional response status codes -* Removed SSL information from the default User-Agent header -* DELETE requests can now send an entity body -* Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries -* Added the ability of the MockPlugin to consume mocked request bodies -* LogPlugin now exposes request and response objects in the extras array - -## 2.8.3 - 2012-07-30 - -* Bug: Fixed a case where empty POST requests were sent as GET requests -* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body -* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new -* Added multiple inheritance to service description commands -* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()` -* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything -* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles - -## 2.8.2 - 2012-07-24 - -* Bug: Query string values set to 0 are no longer dropped from the query string -* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()` -* Bug: `+` is now treated as an encoded space when parsing query strings -* QueryString and Collection performance improvements -* Allowing dot notation for class paths in filters attribute of a service descriptions - -## 2.8.1 - 2012-07-16 - -* Loosening Event Dispatcher dependency -* POST redirects can now be customized using CURLOPT_POSTREDIR - -## 2.8.0 - 2012-07-15 - -* BC: Guzzle\Http\Query - * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl) - * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding() - * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool) - * Changed the aggregation functions of QueryString to be static methods - * Can now use fromString() with querystrings that have a leading ? -* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters -* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body -* Cookies are no longer URL decoded by default -* Bug: URI template variables set to null are no longer expanded - -## 2.7.2 - 2012-07-02 - -* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser. -* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty() -* CachePlugin now allows for a custom request parameter function to check if a request can be cached -* Bug fix: CachePlugin now only caches GET and HEAD requests by default -* Bug fix: Using header glue when transferring headers over the wire -* Allowing deeply nested arrays for composite variables in URI templates -* Batch divisors can now return iterators or arrays - -## 2.7.1 - 2012-06-26 - -* Minor patch to update version number in UA string -* Updating build process - -## 2.7.0 - 2012-06-25 - -* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes. -* BC: Removed magic setX methods from commands -* BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method -* Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable. -* Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity) -* Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace -* Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin -* Added the ability to set POST fields and files in a service description -* Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method -* Adding a command.before_prepare event to clients -* Added BatchClosureTransfer and BatchClosureDivisor -* BatchTransferException now includes references to the batch divisor and transfer strategies -* Fixed some tests so that they pass more reliably -* Added Guzzle\Common\Log\ArrayLogAdapter - -## 2.6.6 - 2012-06-10 - -* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin -* BC: Removing Guzzle\Service\Command\CommandSet -* Adding generic batching system (replaces the batch queue plugin and command set) -* Updating ZF cache and log adapters and now using ZF's composer repository -* Bug: Setting the name of each ApiParam when creating through an ApiCommand -* Adding result_type, result_doc, deprecated, and doc_url to service descriptions -* Bug: Changed the default cookie header casing back to 'Cookie' - -## 2.6.5 - 2012-06-03 - -* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource() -* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from -* BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data -* BC: Renaming methods in the CookieJarInterface -* Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations -* Making the default glue for HTTP headers ';' instead of ',' -* Adding a removeValue to Guzzle\Http\Message\Header -* Adding getCookies() to request interface. -* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber() - -## 2.6.4 - 2012-05-30 - -* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class. -* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand -* Bug: Fixing magic method command calls on clients -* Bug: Email constraint only validates strings -* Bug: Aggregate POST fields when POST files are present in curl handle -* Bug: Fixing default User-Agent header -* Bug: Only appending or prepending parameters in commands if they are specified -* Bug: Not requiring response reason phrases or status codes to match a predefined list of codes -* Allowing the use of dot notation for class namespaces when using instance_of constraint -* Added any_match validation constraint -* Added an AsyncPlugin -* Passing request object to the calculateWait method of the ExponentialBackoffPlugin -* Allowing the result of a command object to be changed -* Parsing location and type sub values when instantiating a service description rather than over and over at runtime - -## 2.6.3 - 2012-05-23 - -* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options. -* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields. -* You can now use an array of data when creating PUT request bodies in the request factory. -* Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable. -* [Http] Adding support for Content-Type in multipart POST uploads per upload -* [Http] Added support for uploading multiple files using the same name (foo[0], foo[1]) -* Adding more POST data operations for easier manipulation of POST data. -* You can now set empty POST fields. -* The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files. -* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate. -* CS updates - -## 2.6.2 - 2012-05-19 - -* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method. - -## 2.6.1 - 2012-05-19 - -* [BC] Removing 'path' support in service descriptions. Use 'uri'. -* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache. -* [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it. -* [BC] Removing Guzzle\Common\XmlElement. -* All commands, both dynamic and concrete, have ApiCommand objects. -* Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits. -* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored. -* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible. - -## 2.6.0 - 2012-05-15 - -* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder -* [BC] Executing a Command returns the result of the command rather than the command -* [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed. -* [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args. -* [BC] Moving ResourceIterator* to Guzzle\Service\Resource -* [BC] Completely refactored ResourceIterators to iterate over a cloned command object -* [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate -* [BC] Guzzle\Guzzle is now deprecated -* Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject -* Adding Guzzle\Version class to give version information about Guzzle -* Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate() -* Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data -* ServiceDescription and ServiceBuilder are now cacheable using similar configs -* Changing the format of XML and JSON service builder configs. Backwards compatible. -* Cleaned up Cookie parsing -* Trimming the default Guzzle User-Agent header -* Adding a setOnComplete() method to Commands that is called when a command completes -* Keeping track of requests that were mocked in the MockPlugin -* Fixed a caching bug in the CacheAdapterFactory -* Inspector objects can be injected into a Command object -* Refactoring a lot of code and tests to be case insensitive when dealing with headers -* Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL -* Adding the ability to set global option overrides to service builder configs -* Adding the ability to include other service builder config files from within XML and JSON files -* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method. - -## 2.5.0 - 2012-05-08 - -* Major performance improvements -* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated. -* [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component. -* [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}" -* Added the ability to passed parameters to all requests created by a client -* Added callback functionality to the ExponentialBackoffPlugin -* Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies. -* Rewinding request stream bodies when retrying requests -* Exception is thrown when JSON response body cannot be decoded -* Added configurable magic method calls to clients and commands. This is off by default. -* Fixed a defect that added a hash to every parsed URL part -* Fixed duplicate none generation for OauthPlugin. -* Emitting an event each time a client is generated by a ServiceBuilder -* Using an ApiParams object instead of a Collection for parameters of an ApiCommand -* cache.* request parameters should be renamed to params.cache.* -* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle. -* Added the ability to disable type validation of service descriptions -* ServiceDescriptions and ServiceBuilders are now Serializable diff --git a/vendor/guzzlehttp/guzzle/Dockerfile b/vendor/guzzlehttp/guzzle/Dockerfile deleted file mode 100644 index f6a09523..00000000 --- a/vendor/guzzlehttp/guzzle/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM composer:latest as setup - -RUN mkdir /guzzle - -WORKDIR /guzzle - -RUN set -xe \ - && composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár " --no-interaction \ - && composer require guzzlehttp/guzzle - - -FROM php:7.3 - -RUN mkdir /guzzle - -WORKDIR /guzzle - -COPY --from=setup /guzzle /guzzle diff --git a/vendor/guzzlehttp/guzzle/LICENSE b/vendor/guzzlehttp/guzzle/LICENSE deleted file mode 100644 index 50a177b0..00000000 --- a/vendor/guzzlehttp/guzzle/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/guzzlehttp/guzzle/README.md b/vendor/guzzlehttp/guzzle/README.md deleted file mode 100644 index a5ef18ae..00000000 --- a/vendor/guzzlehttp/guzzle/README.md +++ /dev/null @@ -1,90 +0,0 @@ -Guzzle, PHP HTTP client -======================= - -[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases) -[![Build Status](https://img.shields.io/travis/guzzle/guzzle.svg?style=flat-square)](https://travis-ci.org/guzzle/guzzle) -[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle) - -Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and -trivial to integrate with web services. - -- Simple interface for building query strings, POST requests, streaming large - uploads, streaming large downloads, using HTTP cookies, uploading JSON data, - etc... -- Can send both synchronous and asynchronous requests using the same interface. -- Uses PSR-7 interfaces for requests, responses, and streams. This allows you - to utilize other PSR-7 compatible libraries with Guzzle. -- Abstracts away the underlying HTTP transport, allowing you to write - environment and transport agnostic code; i.e., no hard dependency on cURL, - PHP streams, sockets, or non-blocking event loops. -- Middleware system allows you to augment and compose client behavior. - -```php -$client = new \GuzzleHttp\Client(); -$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle'); - -echo $response->getStatusCode(); # 200 -echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8' -echo $response->getBody(); # '{"id": 1420053, "name": "guzzle", ...}' - -# Send an asynchronous request. -$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org'); -$promise = $client->sendAsync($request)->then(function ($response) { - echo 'I completed! ' . $response->getBody(); -}); - -$promise->wait(); -``` - -## Help and docs - -- [Documentation](http://guzzlephp.org/) -- [Stack Overflow](http://stackoverflow.com/questions/tagged/guzzle) -- [Gitter](https://gitter.im/guzzle/guzzle) - - -## Installing Guzzle - -The recommended way to install Guzzle is through -[Composer](http://getcomposer.org). - -```bash -# Install Composer -curl -sS https://getcomposer.org/installer | php -``` - -Next, run the Composer command to install the latest stable version of Guzzle: - -```bash -composer require guzzlehttp/guzzle -``` - -After installing, you need to require Composer's autoloader: - -```php -require 'vendor/autoload.php'; -``` - -You can then later update Guzzle using composer: - - ```bash -composer update - ``` - - -## Version Guidance - -| Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 | PHP Version | -|---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------| -| 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >= 5.3.3 | -| 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >= 5.4 | -| 5.x | Maintained | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 | -| 6.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 | - -[guzzle-3-repo]: https://github.com/guzzle/guzzle3 -[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x -[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3 -[guzzle-6-repo]: https://github.com/guzzle/guzzle -[guzzle-3-docs]: http://guzzle3.readthedocs.org -[guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/ -[guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/ diff --git a/vendor/guzzlehttp/guzzle/UPGRADING.md b/vendor/guzzlehttp/guzzle/UPGRADING.md deleted file mode 100644 index 91d1dcc9..00000000 --- a/vendor/guzzlehttp/guzzle/UPGRADING.md +++ /dev/null @@ -1,1203 +0,0 @@ -Guzzle Upgrade Guide -==================== - -5.0 to 6.0 ----------- - -Guzzle now uses [PSR-7](http://www.php-fig.org/psr/psr-7/) for HTTP messages. -Due to the fact that these messages are immutable, this prompted a refactoring -of Guzzle to use a middleware based system rather than an event system. Any -HTTP message interaction (e.g., `GuzzleHttp\Message\Request`) need to be -updated to work with the new immutable PSR-7 request and response objects. Any -event listeners or subscribers need to be updated to become middleware -functions that wrap handlers (or are injected into a -`GuzzleHttp\HandlerStack`). - -- Removed `GuzzleHttp\BatchResults` -- Removed `GuzzleHttp\Collection` -- Removed `GuzzleHttp\HasDataTrait` -- Removed `GuzzleHttp\ToArrayInterface` -- The `guzzlehttp/streams` dependency has been removed. Stream functionality - is now present in the `GuzzleHttp\Psr7` namespace provided by the - `guzzlehttp/psr7` package. -- Guzzle no longer uses ReactPHP promises and now uses the - `guzzlehttp/promises` library. We use a custom promise library for three - significant reasons: - 1. React promises (at the time of writing this) are recursive. Promise - chaining and promise resolution will eventually blow the stack. Guzzle - promises are not recursive as they use a sort of trampolining technique. - Note: there has been movement in the React project to modify promises to - no longer utilize recursion. - 2. Guzzle needs to have the ability to synchronously block on a promise to - wait for a result. Guzzle promises allows this functionality (and does - not require the use of recursion). - 3. Because we need to be able to wait on a result, doing so using React - promises requires wrapping react promises with RingPHP futures. This - overhead is no longer needed, reducing stack sizes, reducing complexity, - and improving performance. -- `GuzzleHttp\Mimetypes` has been moved to a function in - `GuzzleHttp\Psr7\mimetype_from_extension` and - `GuzzleHttp\Psr7\mimetype_from_filename`. -- `GuzzleHttp\Query` and `GuzzleHttp\QueryParser` have been removed. Query - strings must now be passed into request objects as strings, or provided to - the `query` request option when creating requests with clients. The `query` - option uses PHP's `http_build_query` to convert an array to a string. If you - need a different serialization technique, you will need to pass the query - string in as a string. There are a couple helper functions that will make - working with query strings easier: `GuzzleHttp\Psr7\parse_query` and - `GuzzleHttp\Psr7\build_query`. -- Guzzle no longer has a dependency on RingPHP. Due to the use of a middleware - system based on PSR-7, using RingPHP and it's middleware system as well adds - more complexity than the benefits it provides. All HTTP handlers that were - present in RingPHP have been modified to work directly with PSR-7 messages - and placed in the `GuzzleHttp\Handler` namespace. This significantly reduces - complexity in Guzzle, removes a dependency, and improves performance. RingPHP - will be maintained for Guzzle 5 support, but will no longer be a part of - Guzzle 6. -- As Guzzle now uses a middleware based systems the event system and RingPHP - integration has been removed. Note: while the event system has been removed, - it is possible to add your own type of event system that is powered by the - middleware system. - - Removed the `Event` namespace. - - Removed the `Subscriber` namespace. - - Removed `Transaction` class - - Removed `RequestFsm` - - Removed `RingBridge` - - `GuzzleHttp\Subscriber\Cookie` is now provided by - `GuzzleHttp\Middleware::cookies` - - `GuzzleHttp\Subscriber\HttpError` is now provided by - `GuzzleHttp\Middleware::httpError` - - `GuzzleHttp\Subscriber\History` is now provided by - `GuzzleHttp\Middleware::history` - - `GuzzleHttp\Subscriber\Mock` is now provided by - `GuzzleHttp\Handler\MockHandler` - - `GuzzleHttp\Subscriber\Prepare` is now provided by - `GuzzleHttp\PrepareBodyMiddleware` - - `GuzzleHttp\Subscriber\Redirect` is now provided by - `GuzzleHttp\RedirectMiddleware` -- Guzzle now uses `Psr\Http\Message\UriInterface` (implements in - `GuzzleHttp\Psr7\Uri`) for URI support. `GuzzleHttp\Url` is now gone. -- Static functions in `GuzzleHttp\Utils` have been moved to namespaced - functions under the `GuzzleHttp` namespace. This requires either a Composer - based autoloader or you to include functions.php. -- `GuzzleHttp\ClientInterface::getDefaultOption` has been renamed to - `GuzzleHttp\ClientInterface::getConfig`. -- `GuzzleHttp\ClientInterface::setDefaultOption` has been removed. -- The `json` and `xml` methods of response objects has been removed. With the - migration to strictly adhering to PSR-7 as the interface for Guzzle messages, - adding methods to message interfaces would actually require Guzzle messages - to extend from PSR-7 messages rather then work with them directly. - -## Migrating to middleware - -The change to PSR-7 unfortunately required significant refactoring to Guzzle -due to the fact that PSR-7 messages are immutable. Guzzle 5 relied on an event -system from plugins. The event system relied on mutability of HTTP messages and -side effects in order to work. With immutable messages, you have to change your -workflow to become more about either returning a value (e.g., functional -middlewares) or setting a value on an object. Guzzle v6 has chosen the -functional middleware approach. - -Instead of using the event system to listen for things like the `before` event, -you now create a stack based middleware function that intercepts a request on -the way in and the promise of the response on the way out. This is a much -simpler and more predictable approach than the event system and works nicely -with PSR-7 middleware. Due to the use of promises, the middleware system is -also asynchronous. - -v5: - -```php -use GuzzleHttp\Event\BeforeEvent; -$client = new GuzzleHttp\Client(); -// Get the emitter and listen to the before event. -$client->getEmitter()->on('before', function (BeforeEvent $e) { - // Guzzle v5 events relied on mutation - $e->getRequest()->setHeader('X-Foo', 'Bar'); -}); -``` - -v6: - -In v6, you can modify the request before it is sent using the `mapRequest` -middleware. The idiomatic way in v6 to modify the request/response lifecycle is -to setup a handler middleware stack up front and inject the handler into a -client. - -```php -use GuzzleHttp\Middleware; -// Create a handler stack that has all of the default middlewares attached -$handler = GuzzleHttp\HandlerStack::create(); -// Push the handler onto the handler stack -$handler->push(Middleware::mapRequest(function (RequestInterface $request) { - // Notice that we have to return a request object - return $request->withHeader('X-Foo', 'Bar'); -})); -// Inject the handler into the client -$client = new GuzzleHttp\Client(['handler' => $handler]); -``` - -## POST Requests - -This version added the [`form_params`](http://guzzle.readthedocs.org/en/latest/request-options.html#form_params) -and `multipart` request options. `form_params` is an associative array of -strings or array of strings and is used to serialize an -`application/x-www-form-urlencoded` POST request. The -[`multipart`](http://guzzle.readthedocs.org/en/latest/request-options.html#multipart) -option is now used to send a multipart/form-data POST request. - -`GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add -POST files to a multipart/form-data request. - -The `body` option no longer accepts an array to send POST requests. Please use -`multipart` or `form_params` instead. - -The `base_url` option has been renamed to `base_uri`. - -4.x to 5.0 ----------- - -## Rewritten Adapter Layer - -Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send -HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor -is still supported, but it has now been renamed to `handler`. Instead of -passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP -`callable` that follows the RingPHP specification. - -## Removed Fluent Interfaces - -[Fluent interfaces were removed](http://ocramius.github.io/blog/fluent-interfaces-are-evil) -from the following classes: - -- `GuzzleHttp\Collection` -- `GuzzleHttp\Url` -- `GuzzleHttp\Query` -- `GuzzleHttp\Post\PostBody` -- `GuzzleHttp\Cookie\SetCookie` - -## Removed functions.php - -Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following -functions can be used as replacements. - -- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode` -- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath` -- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path` -- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however, - deprecated in favor of using `GuzzleHttp\Pool::batch()`. - -The "procedural" global client has been removed with no replacement (e.g., -`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client` -object as a replacement. - -## `throwImmediately` has been removed - -The concept of "throwImmediately" has been removed from exceptions and error -events. This control mechanism was used to stop a transfer of concurrent -requests from completing. This can now be handled by throwing the exception or -by cancelling a pool of requests or each outstanding future request -individually. - -## headers event has been removed - -Removed the "headers" event. This event was only useful for changing the -body a response once the headers of the response were known. You can implement -a similar behavior in a number of ways. One example might be to use a -FnStream that has access to the transaction being sent. For example, when the -first byte is written, you could check if the response headers match your -expectations, and if so, change the actual stream body that is being -written to. - -## Updates to HTTP Messages - -Removed the `asArray` parameter from -`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header -value as an array, then use the newly added `getHeaderAsArray()` method of -`MessageInterface`. This change makes the Guzzle interfaces compatible with -the PSR-7 interfaces. - -3.x to 4.0 ----------- - -## Overarching changes: - -- Now requires PHP 5.4 or greater. -- No longer requires cURL to send requests. -- Guzzle no longer wraps every exception it throws. Only exceptions that are - recoverable are now wrapped by Guzzle. -- Various namespaces have been removed or renamed. -- No longer requiring the Symfony EventDispatcher. A custom event dispatcher - based on the Symfony EventDispatcher is - now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant - speed and functionality improvements). - -Changes per Guzzle 3.x namespace are described below. - -## Batch - -The `Guzzle\Batch` namespace has been removed. This is best left to -third-parties to implement on top of Guzzle's core HTTP library. - -## Cache - -The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement -has been implemented yet, but hoping to utilize a PSR cache interface). - -## Common - -- Removed all of the wrapped exceptions. It's better to use the standard PHP - library for unrecoverable exceptions. -- `FromConfigInterface` has been removed. -- `Guzzle\Common\Version` has been removed. The VERSION constant can be found - at `GuzzleHttp\ClientInterface::VERSION`. - -### Collection - -- `getAll` has been removed. Use `toArray` to convert a collection to an array. -- `inject` has been removed. -- `keySearch` has been removed. -- `getPath` no longer supports wildcard expressions. Use something better like - JMESPath for this. -- `setPath` now supports appending to an existing array via the `[]` notation. - -### Events - -Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses -`GuzzleHttp\Event\Emitter`. - -- `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by - `GuzzleHttp\Event\EmitterInterface`. -- `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by - `GuzzleHttp\Event\Emitter`. -- `Symfony\Component\EventDispatcher\Event` is replaced by - `GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in - `GuzzleHttp\Event\EventInterface`. -- `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and - `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the - event emitter of a request, client, etc. now uses the `getEmitter` method - rather than the `getDispatcher` method. - -#### Emitter - -- Use the `once()` method to add a listener that automatically removes itself - the first time it is invoked. -- Use the `listeners()` method to retrieve a list of event listeners rather than - the `getListeners()` method. -- Use `emit()` instead of `dispatch()` to emit an event from an emitter. -- Use `attach()` instead of `addSubscriber()` and `detach()` instead of - `removeSubscriber()`. - -```php -$mock = new Mock(); -// 3.x -$request->getEventDispatcher()->addSubscriber($mock); -$request->getEventDispatcher()->removeSubscriber($mock); -// 4.x -$request->getEmitter()->attach($mock); -$request->getEmitter()->detach($mock); -``` - -Use the `on()` method to add a listener rather than the `addListener()` method. - -```php -// 3.x -$request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } ); -// 4.x -$request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } ); -``` - -## Http - -### General changes - -- The cacert.pem certificate has been moved to `src/cacert.pem`. -- Added the concept of adapters that are used to transfer requests over the - wire. -- Simplified the event system. -- Sending requests in parallel is still possible, but batching is no longer a - concept of the HTTP layer. Instead, you must use the `complete` and `error` - events to asynchronously manage parallel request transfers. -- `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`. -- `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`. -- QueryAggregators have been rewritten so that they are simply callable - functions. -- `GuzzleHttp\StaticClient` has been removed. Use the functions provided in - `functions.php` for an easy to use static client instance. -- Exceptions in `GuzzleHttp\Exception` have been updated to all extend from - `GuzzleHttp\Exception\TransferException`. - -### Client - -Calling methods like `get()`, `post()`, `head()`, etc. no longer create and -return a request, but rather creates a request, sends the request, and returns -the response. - -```php -// 3.0 -$request = $client->get('/'); -$response = $request->send(); - -// 4.0 -$response = $client->get('/'); - -// or, to mirror the previous behavior -$request = $client->createRequest('GET', '/'); -$response = $client->send($request); -``` - -`GuzzleHttp\ClientInterface` has changed. - -- The `send` method no longer accepts more than one request. Use `sendAll` to - send multiple requests in parallel. -- `setUserAgent()` has been removed. Use a default request option instead. You - could, for example, do something like: - `$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`. -- `setSslVerification()` has been removed. Use default request options instead, - like `$client->setConfig('defaults/verify', true)`. - -`GuzzleHttp\Client` has changed. - -- The constructor now accepts only an associative array. You can include a - `base_url` string or array to use a URI template as the base URL of a client. - You can also specify a `defaults` key that is an associative array of default - request options. You can pass an `adapter` to use a custom adapter, - `batch_adapter` to use a custom adapter for sending requests in parallel, or - a `message_factory` to change the factory used to create HTTP requests and - responses. -- The client no longer emits a `client.create_request` event. -- Creating requests with a client no longer automatically utilize a URI - template. You must pass an array into a creational method (e.g., - `createRequest`, `get`, `put`, etc.) in order to expand a URI template. - -### Messages - -Messages no longer have references to their counterparts (i.e., a request no -longer has a reference to it's response, and a response no loger has a -reference to its request). This association is now managed through a -`GuzzleHttp\Adapter\TransactionInterface` object. You can get references to -these transaction objects using request events that are emitted over the -lifecycle of a request. - -#### Requests with a body - -- `GuzzleHttp\Message\EntityEnclosingRequest` and - `GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The - separation between requests that contain a body and requests that do not - contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface` - handles both use cases. -- Any method that previously accepts a `GuzzleHttp\Response` object now accept a - `GuzzleHttp\Message\ResponseInterface`. -- `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to - `GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create - both requests and responses and is implemented in - `GuzzleHttp\Message\MessageFactory`. -- POST field and file methods have been removed from the request object. You - must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface` - to control the format of a POST body. Requests that are created using a - standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use - a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if - the method is POST and no body is provided. - -```php -$request = $client->createRequest('POST', '/'); -$request->getBody()->setField('foo', 'bar'); -$request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r'))); -``` - -#### Headers - -- `GuzzleHttp\Message\Header` has been removed. Header values are now simply - represented by an array of values or as a string. Header values are returned - as a string by default when retrieving a header value from a message. You can - pass an optional argument of `true` to retrieve a header value as an array - of strings instead of a single concatenated string. -- `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to - `GuzzleHttp\Post`. This interface has been simplified and now allows the - addition of arbitrary headers. -- Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most - of the custom headers are now handled separately in specific - subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has - been updated to properly handle headers that contain parameters (like the - `Link` header). - -#### Responses - -- `GuzzleHttp\Message\Response::getInfo()` and - `GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event - system to retrieve this type of information. -- `GuzzleHttp\Message\Response::getRawHeaders()` has been removed. -- `GuzzleHttp\Message\Response::getMessage()` has been removed. -- `GuzzleHttp\Message\Response::calculateAge()` and other cache specific - methods have moved to the CacheSubscriber. -- Header specific helper functions like `getContentMd5()` have been removed. - Just use `getHeader('Content-MD5')` instead. -- `GuzzleHttp\Message\Response::setRequest()` and - `GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event - system to work with request and response objects as a transaction. -- `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the - Redirect subscriber instead. -- `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have - been removed. Use `getStatusCode()` instead. - -#### Streaming responses - -Streaming requests can now be created by a client directly, returning a -`GuzzleHttp\Message\ResponseInterface` object that contains a body stream -referencing an open PHP HTTP stream. - -```php -// 3.0 -use Guzzle\Stream\PhpStreamRequestFactory; -$request = $client->get('/'); -$factory = new PhpStreamRequestFactory(); -$stream = $factory->fromRequest($request); -$data = $stream->read(1024); - -// 4.0 -$response = $client->get('/', ['stream' => true]); -// Read some data off of the stream in the response body -$data = $response->getBody()->read(1024); -``` - -#### Redirects - -The `configureRedirects()` method has been removed in favor of a -`allow_redirects` request option. - -```php -// Standard redirects with a default of a max of 5 redirects -$request = $client->createRequest('GET', '/', ['allow_redirects' => true]); - -// Strict redirects with a custom number of redirects -$request = $client->createRequest('GET', '/', [ - 'allow_redirects' => ['max' => 5, 'strict' => true] -]); -``` - -#### EntityBody - -EntityBody interfaces and classes have been removed or moved to -`GuzzleHttp\Stream`. All classes and interfaces that once required -`GuzzleHttp\EntityBodyInterface` now require -`GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no -longer uses `GuzzleHttp\EntityBody::factory` but now uses -`GuzzleHttp\Stream\Stream::factory` or even better: -`GuzzleHttp\Stream\create()`. - -- `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface` -- `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream` -- `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream` -- `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream` -- `Guzzle\Http\IoEmittyinEntityBody` has been removed. - -#### Request lifecycle events - -Requests previously submitted a large number of requests. The number of events -emitted over the lifecycle of a request has been significantly reduced to make -it easier to understand how to extend the behavior of a request. All events -emitted during the lifecycle of a request now emit a custom -`GuzzleHttp\Event\EventInterface` object that contains context providing -methods and a way in which to modify the transaction at that specific point in -time (e.g., intercept the request and set a response on the transaction). - -- `request.before_send` has been renamed to `before` and now emits a - `GuzzleHttp\Event\BeforeEvent` -- `request.complete` has been renamed to `complete` and now emits a - `GuzzleHttp\Event\CompleteEvent`. -- `request.sent` has been removed. Use `complete`. -- `request.success` has been removed. Use `complete`. -- `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`. -- `request.exception` has been removed. Use `error`. -- `request.receive.status_line` has been removed. -- `curl.callback.progress` has been removed. Use a custom `StreamInterface` to - maintain a status update. -- `curl.callback.write` has been removed. Use a custom `StreamInterface` to - intercept writes. -- `curl.callback.read` has been removed. Use a custom `StreamInterface` to - intercept reads. - -`headers` is a new event that is emitted after the response headers of a -request have been received before the body of the response is downloaded. This -event emits a `GuzzleHttp\Event\HeadersEvent`. - -You can intercept a request and inject a response using the `intercept()` event -of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and -`GuzzleHttp\Event\ErrorEvent` event. - -See: http://docs.guzzlephp.org/en/latest/events.html - -## Inflection - -The `Guzzle\Inflection` namespace has been removed. This is not a core concern -of Guzzle. - -## Iterator - -The `Guzzle\Iterator` namespace has been removed. - -- `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and - `Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of - Guzzle itself. -- `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent - class is shipped with PHP 5.4. -- `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because - it's easier to just wrap an iterator in a generator that maps values. - -For a replacement of these iterators, see https://github.com/nikic/iter - -## Log - -The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The -`Guzzle\Log` namespace has been removed. Guzzle now relies on -`Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been -moved to `GuzzleHttp\Subscriber\Log\Formatter`. - -## Parser - -The `Guzzle\Parser` namespace has been removed. This was previously used to -make it possible to plug in custom parsers for cookies, messages, URI -templates, and URLs; however, this level of complexity is not needed in Guzzle -so it has been removed. - -- Cookie: Cookie parsing logic has been moved to - `GuzzleHttp\Cookie\SetCookie::fromString`. -- Message: Message parsing logic for both requests and responses has been moved - to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only - used in debugging or deserializing messages, so it doesn't make sense for - Guzzle as a library to add this level of complexity to parsing messages. -- UriTemplate: URI template parsing has been moved to - `GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL - URI template library if it is installed. -- Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously - it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary, - then developers are free to subclass `GuzzleHttp\Url`. - -## Plugin - -The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`. -Several plugins are shipping with the core Guzzle library under this namespace. - -- `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar - code has moved to `GuzzleHttp\Cookie`. -- `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin. -- `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is - received. -- `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin. -- `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before - sending. This subscriber is attached to all requests by default. -- `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin. - -The following plugins have been removed (third-parties are free to re-implement -these if needed): - -- `GuzzleHttp\Plugin\Async` has been removed. -- `GuzzleHttp\Plugin\CurlAuth` has been removed. -- `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This - functionality should instead be implemented with event listeners that occur - after normal response parsing occurs in the guzzle/command package. - -The following plugins are not part of the core Guzzle package, but are provided -in separate repositories: - -- `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be much simpler - to build custom retry policies using simple functions rather than various - chained classes. See: https://github.com/guzzle/retry-subscriber -- `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to - https://github.com/guzzle/cache-subscriber -- `Guzzle\Http\Plugin\Log\LogPlugin` has moved to - https://github.com/guzzle/log-subscriber -- `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to - https://github.com/guzzle/message-integrity-subscriber -- `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to - `GuzzleHttp\Subscriber\MockSubscriber`. -- `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to - https://github.com/guzzle/oauth-subscriber - -## Service - -The service description layer of Guzzle has moved into two separate packages: - -- http://github.com/guzzle/command Provides a high level abstraction over web - services by representing web service operations using commands. -- http://github.com/guzzle/guzzle-services Provides an implementation of - guzzle/command that provides request serialization and response parsing using - Guzzle service descriptions. - -## Stream - -Stream have moved to a separate package available at -https://github.com/guzzle/streams. - -`Guzzle\Stream\StreamInterface` has been given a large update to cleanly take -on the responsibilities of `Guzzle\Http\EntityBody` and -`Guzzle\Http\EntityBodyInterface` now that they have been removed. The number -of methods implemented by the `StreamInterface` has been drastically reduced to -allow developers to more easily extend and decorate stream behavior. - -## Removed methods from StreamInterface - -- `getStream` and `setStream` have been removed to better encapsulate streams. -- `getMetadata` and `setMetadata` have been removed in favor of - `GuzzleHttp\Stream\MetadataStreamInterface`. -- `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been - removed. This data is accessible when - using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`. -- `rewind` has been removed. Use `seek(0)` for a similar behavior. - -## Renamed methods - -- `detachStream` has been renamed to `detach`. -- `feof` has been renamed to `eof`. -- `ftell` has been renamed to `tell`. -- `readLine` has moved from an instance method to a static class method of - `GuzzleHttp\Stream\Stream`. - -## Metadata streams - -`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams -that contain additional metadata accessible via `getMetadata()`. -`GuzzleHttp\Stream\StreamInterface::getMetadata` and -`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed. - -## StreamRequestFactory - -The entire concept of the StreamRequestFactory has been removed. The way this -was used in Guzzle 3 broke the actual interface of sending streaming requests -(instead of getting back a Response, you got a StreamInterface). Streaming -PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`. - -3.6 to 3.7 ----------- - -### Deprecations - -- You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.: - -```php -\Guzzle\Common\Version::$emitWarnings = true; -``` - -The following APIs and options have been marked as deprecated: - -- Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead. -- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. -- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. -- Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. -- Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. -- Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated -- Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. -- Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. -- Marked `Guzzle\Common\Collection::inject()` as deprecated. -- Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use - `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or - `$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` - -3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational -request methods. When paired with a client's configuration settings, these options allow you to specify default settings -for various aspects of a request. Because these options make other previous configuration options redundant, several -configuration options and methods of a client and AbstractCommand have been deprecated. - -- Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`. -- Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`. -- Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')` -- Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0 - - $command = $client->getCommand('foo', array( - 'command.headers' => array('Test' => '123'), - 'command.response_body' => '/path/to/file' - )); - - // Should be changed to: - - $command = $client->getCommand('foo', array( - 'command.request_options' => array( - 'headers' => array('Test' => '123'), - 'save_as' => '/path/to/file' - ) - )); - -### Interface changes - -Additions and changes (you will need to update any implementations or subclasses you may have created): - -- Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: - createRequest, head, delete, put, patch, post, options, prepareRequest -- Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` -- Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` -- Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to - `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a - resource, string, or EntityBody into the $options parameter to specify the download location of the response. -- Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a - default `array()` -- Added `Guzzle\Stream\StreamInterface::isRepeatable` -- Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. - -The following methods were removed from interfaces. All of these methods are still available in the concrete classes -that implement them, but you should update your code to use alternative methods: - -- Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use - `$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or - `$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or - `$client->setDefaultOption('headers/{header_name}', 'value')`. or - `$client->setDefaultOption('headers', array('header_name' => 'value'))`. -- Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`. -- Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail. -- Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail. -- Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail. -- Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin. -- Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin. -- Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin. - -### Cache plugin breaking changes - -- CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a - CacheStorageInterface. These two objects and interface will be removed in a future version. -- Always setting X-cache headers on cached responses -- Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin -- `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface - $request, Response $response);` -- `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` -- `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` -- Added `CacheStorageInterface::purge($url)` -- `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin - $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, - CanCacheStrategyInterface $canCache = null)` -- Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` - -3.5 to 3.6 ----------- - -* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. -* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution -* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). - For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader(). - Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request. -* Specific header implementations can be created for complex headers. When a message creates a header, it uses a - HeaderFactory which can map specific headers to specific header classes. There is now a Link header and - CacheControl header implementation. -* Moved getLinks() from Response to just be used on a Link header object. - -If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the -HeaderInterface (e.g. toArray(), getAll(), etc.). - -### Interface changes - -* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate -* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() -* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in - Guzzle\Http\Curl\RequestMediator -* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. -* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface -* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() - -### Removed deprecated functions - -* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() -* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). - -### Deprecations - -* The ability to case-insensitively search for header values -* Guzzle\Http\Message\Header::hasExactHeader -* Guzzle\Http\Message\Header::raw. Use getAll() -* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object - instead. - -### Other changes - -* All response header helper functions return a string rather than mixing Header objects and strings inconsistently -* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle - directly via interfaces -* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist - but are a no-op until removed. -* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a - `Guzzle\Service\Command\ArrayCommandInterface`. -* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response - on a request while the request is still being transferred -* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess - -3.3 to 3.4 ----------- - -Base URLs of a client now follow the rules of http://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs. - -3.2 to 3.3 ----------- - -### Response::getEtag() quote stripping removed - -`Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header - -### Removed `Guzzle\Http\Utils` - -The `Guzzle\Http\Utils` class was removed. This class was only used for testing. - -### Stream wrapper and type - -`Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase. - -### curl.emit_io became emit_io - -Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the -'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' - -3.1 to 3.2 ----------- - -### CurlMulti is no longer reused globally - -Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added -to a single client can pollute requests dispatched from other clients. - -If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the -ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is -created. - -```php -$multi = new Guzzle\Http\Curl\CurlMulti(); -$builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json'); -$builder->addListener('service_builder.create_client', function ($event) use ($multi) { - $event['client']->setCurlMulti($multi); -} -}); -``` - -### No default path - -URLs no longer have a default path value of '/' if no path was specified. - -Before: - -```php -$request = $client->get('http://www.foo.com'); -echo $request->getUrl(); -// >> http://www.foo.com/ -``` - -After: - -```php -$request = $client->get('http://www.foo.com'); -echo $request->getUrl(); -// >> http://www.foo.com -``` - -### Less verbose BadResponseException - -The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and -response information. You can, however, get access to the request and response object by calling `getRequest()` or -`getResponse()` on the exception object. - -### Query parameter aggregation - -Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a -setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is -responsible for handling the aggregation of multi-valued query string variables into a flattened hash. - -2.8 to 3.x ----------- - -### Guzzle\Service\Inspector - -Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig` - -**Before** - -```php -use Guzzle\Service\Inspector; - -class YourClient extends \Guzzle\Service\Client -{ - public static function factory($config = array()) - { - $default = array(); - $required = array('base_url', 'username', 'api_key'); - $config = Inspector::fromConfig($config, $default, $required); - - $client = new self( - $config->get('base_url'), - $config->get('username'), - $config->get('api_key') - ); - $client->setConfig($config); - - $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); - - return $client; - } -``` - -**After** - -```php -use Guzzle\Common\Collection; - -class YourClient extends \Guzzle\Service\Client -{ - public static function factory($config = array()) - { - $default = array(); - $required = array('base_url', 'username', 'api_key'); - $config = Collection::fromConfig($config, $default, $required); - - $client = new self( - $config->get('base_url'), - $config->get('username'), - $config->get('api_key') - ); - $client->setConfig($config); - - $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); - - return $client; - } -``` - -### Convert XML Service Descriptions to JSON - -**Before** - -```xml - - - - - - Get a list of groups - - - Uses a search query to get a list of groups - - - - Create a group - - - - - Delete a group by ID - - - - - - - Update a group - - - - - - -``` - -**After** - -```json -{ - "name": "Zendesk REST API v2", - "apiVersion": "2012-12-31", - "description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users", - "operations": { - "list_groups": { - "httpMethod":"GET", - "uri": "groups.json", - "summary": "Get a list of groups" - }, - "search_groups":{ - "httpMethod":"GET", - "uri": "search.json?query=\"{query} type:group\"", - "summary": "Uses a search query to get a list of groups", - "parameters":{ - "query":{ - "location": "uri", - "description":"Zendesk Search Query", - "type": "string", - "required": true - } - } - }, - "create_group": { - "httpMethod":"POST", - "uri": "groups.json", - "summary": "Create a group", - "parameters":{ - "data": { - "type": "array", - "location": "body", - "description":"Group JSON", - "filters": "json_encode", - "required": true - }, - "Content-Type":{ - "type": "string", - "location":"header", - "static": "application/json" - } - } - }, - "delete_group": { - "httpMethod":"DELETE", - "uri": "groups/{id}.json", - "summary": "Delete a group", - "parameters":{ - "id":{ - "location": "uri", - "description":"Group to delete by ID", - "type": "integer", - "required": true - } - } - }, - "get_group": { - "httpMethod":"GET", - "uri": "groups/{id}.json", - "summary": "Get a ticket", - "parameters":{ - "id":{ - "location": "uri", - "description":"Group to get by ID", - "type": "integer", - "required": true - } - } - }, - "update_group": { - "httpMethod":"PUT", - "uri": "groups/{id}.json", - "summary": "Update a group", - "parameters":{ - "id": { - "location": "uri", - "description":"Group to update by ID", - "type": "integer", - "required": true - }, - "data": { - "type": "array", - "location": "body", - "description":"Group JSON", - "filters": "json_encode", - "required": true - }, - "Content-Type":{ - "type": "string", - "location":"header", - "static": "application/json" - } - } - } -} -``` - -### Guzzle\Service\Description\ServiceDescription - -Commands are now called Operations - -**Before** - -```php -use Guzzle\Service\Description\ServiceDescription; - -$sd = new ServiceDescription(); -$sd->getCommands(); // @returns ApiCommandInterface[] -$sd->hasCommand($name); -$sd->getCommand($name); // @returns ApiCommandInterface|null -$sd->addCommand($command); // @param ApiCommandInterface $command -``` - -**After** - -```php -use Guzzle\Service\Description\ServiceDescription; - -$sd = new ServiceDescription(); -$sd->getOperations(); // @returns OperationInterface[] -$sd->hasOperation($name); -$sd->getOperation($name); // @returns OperationInterface|null -$sd->addOperation($operation); // @param OperationInterface $operation -``` - -### Guzzle\Common\Inflection\Inflector - -Namespace is now `Guzzle\Inflection\Inflector` - -### Guzzle\Http\Plugin - -Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below. - -### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log - -Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively. - -**Before** - -```php -use Guzzle\Common\Log\ClosureLogAdapter; -use Guzzle\Http\Plugin\LogPlugin; - -/** @var \Guzzle\Http\Client */ -$client; - -// $verbosity is an integer indicating desired message verbosity level -$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE); -``` - -**After** - -```php -use Guzzle\Log\ClosureLogAdapter; -use Guzzle\Log\MessageFormatter; -use Guzzle\Plugin\Log\LogPlugin; - -/** @var \Guzzle\Http\Client */ -$client; - -// $format is a string indicating desired message format -- @see MessageFormatter -$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT); -``` - -### Guzzle\Http\Plugin\CurlAuthPlugin - -Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`. - -### Guzzle\Http\Plugin\ExponentialBackoffPlugin - -Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes. - -**Before** - -```php -use Guzzle\Http\Plugin\ExponentialBackoffPlugin; - -$backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge( - ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429) - )); - -$client->addSubscriber($backoffPlugin); -``` - -**After** - -```php -use Guzzle\Plugin\Backoff\BackoffPlugin; -use Guzzle\Plugin\Backoff\HttpBackoffStrategy; - -// Use convenient factory method instead -- see implementation for ideas of what -// you can do with chaining backoff strategies -$backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge( - HttpBackoffStrategy::getDefaultFailureCodes(), array(429) - )); -$client->addSubscriber($backoffPlugin); -``` - -### Known Issues - -#### [BUG] Accept-Encoding header behavior changed unintentionally. - -(See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e) - -In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to -properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen. -See issue #217 for a workaround, or use a version containing the fix. diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json deleted file mode 100644 index c5532575..00000000 --- a/vendor/guzzlehttp/guzzle/composer.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "guzzlehttp/guzzle", - "type": "library", - "description": "Guzzle is a PHP HTTP client library", - "keywords": [ - "framework", - "http", - "rest", - "web service", - "curl", - "client", - "HTTP client" - ], - "homepage": "http://guzzlephp.org/", - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.5", - "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" - }, - "suggest": { - "psr/log": "Required for using the Log middleware" - }, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "6.3-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\Tests\\": "tests/" - } - } -} diff --git a/vendor/guzzlehttp/guzzle/phpstan.neon.dist b/vendor/guzzlehttp/guzzle/phpstan.neon.dist deleted file mode 100644 index 4ef4192d..00000000 --- a/vendor/guzzlehttp/guzzle/phpstan.neon.dist +++ /dev/null @@ -1,9 +0,0 @@ -parameters: - level: 1 - paths: - - src - - ignoreErrors: - - - message: '#Function uri_template not found#' - path: %currentWorkingDirectory%/src/functions.php diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php deleted file mode 100644 index 0f43c71f..00000000 --- a/vendor/guzzlehttp/guzzle/src/Client.php +++ /dev/null @@ -1,422 +0,0 @@ - 'http://www.foo.com/1.0/', - * 'timeout' => 0, - * 'allow_redirects' => false, - * 'proxy' => '192.168.16.1:10' - * ]); - * - * Client configuration settings include the following options: - * - * - handler: (callable) Function that transfers HTTP requests over the - * wire. The function is called with a Psr7\Http\Message\RequestInterface - * and array of transfer options, and must return a - * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a - * Psr7\Http\Message\ResponseInterface on success. "handler" is a - * constructor only option that cannot be overridden in per/request - * options. If no handler is provided, a default handler will be created - * that enables all of the request options below by attaching all of the - * default middleware to the handler. - * - base_uri: (string|UriInterface) Base URI of the client that is merged - * into relative URIs. Can be a string or instance of UriInterface. - * - **: any request option - * - * @param array $config Client configuration settings. - * - * @see \GuzzleHttp\RequestOptions for a list of available request options. - */ - public function __construct(array $config = []) - { - if (!isset($config['handler'])) { - $config['handler'] = HandlerStack::create(); - } elseif (!is_callable($config['handler'])) { - throw new \InvalidArgumentException('handler must be a callable'); - } - - // Convert the base_uri to a UriInterface - if (isset($config['base_uri'])) { - $config['base_uri'] = Psr7\uri_for($config['base_uri']); - } - - $this->configureDefaults($config); - } - - public function __call($method, $args) - { - if (count($args) < 1) { - throw new \InvalidArgumentException('Magic request methods require a URI and optional options array'); - } - - $uri = $args[0]; - $opts = isset($args[1]) ? $args[1] : []; - - return substr($method, -5) === 'Async' - ? $this->requestAsync(substr($method, 0, -5), $uri, $opts) - : $this->request($method, $uri, $opts); - } - - public function sendAsync(RequestInterface $request, array $options = []) - { - // Merge the base URI into the request URI if needed. - $options = $this->prepareDefaults($options); - - return $this->transfer( - $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), - $options - ); - } - - public function send(RequestInterface $request, array $options = []) - { - $options[RequestOptions::SYNCHRONOUS] = true; - return $this->sendAsync($request, $options)->wait(); - } - - public function requestAsync($method, $uri = '', array $options = []) - { - $options = $this->prepareDefaults($options); - // Remove request modifying parameter because it can be done up-front. - $headers = isset($options['headers']) ? $options['headers'] : []; - $body = isset($options['body']) ? $options['body'] : null; - $version = isset($options['version']) ? $options['version'] : '1.1'; - // Merge the URI into the base URI. - $uri = $this->buildUri($uri, $options); - if (is_array($body)) { - $this->invalidBody(); - } - $request = new Psr7\Request($method, $uri, $headers, $body, $version); - // Remove the option so that they are not doubly-applied. - unset($options['headers'], $options['body'], $options['version']); - - return $this->transfer($request, $options); - } - - public function request($method, $uri = '', array $options = []) - { - $options[RequestOptions::SYNCHRONOUS] = true; - return $this->requestAsync($method, $uri, $options)->wait(); - } - - public function getConfig($option = null) - { - return $option === null - ? $this->config - : (isset($this->config[$option]) ? $this->config[$option] : null); - } - - private function buildUri($uri, array $config) - { - // for BC we accept null which would otherwise fail in uri_for - $uri = Psr7\uri_for($uri === null ? '' : $uri); - - if (isset($config['base_uri'])) { - $uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri); - } - - return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; - } - - /** - * Configures the default options for a client. - * - * @param array $config - */ - private function configureDefaults(array $config) - { - $defaults = [ - 'allow_redirects' => RedirectMiddleware::$defaultSettings, - 'http_errors' => true, - 'decode_content' => true, - 'verify' => true, - 'cookies' => false - ]; - - // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. - - // We can only trust the HTTP_PROXY environment variable in a CLI - // process due to the fact that PHP has no reliable mechanism to - // get environment variables that start with "HTTP_". - if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) { - $defaults['proxy']['http'] = getenv('HTTP_PROXY'); - } - - if ($proxy = getenv('HTTPS_PROXY')) { - $defaults['proxy']['https'] = $proxy; - } - - if ($noProxy = getenv('NO_PROXY')) { - $cleanedNoProxy = str_replace(' ', '', $noProxy); - $defaults['proxy']['no'] = explode(',', $cleanedNoProxy); - } - - $this->config = $config + $defaults; - - if (!empty($config['cookies']) && $config['cookies'] === true) { - $this->config['cookies'] = new CookieJar(); - } - - // Add the default user-agent header. - if (!isset($this->config['headers'])) { - $this->config['headers'] = ['User-Agent' => default_user_agent()]; - } else { - // Add the User-Agent header if one was not already set. - foreach (array_keys($this->config['headers']) as $name) { - if (strtolower($name) === 'user-agent') { - return; - } - } - $this->config['headers']['User-Agent'] = default_user_agent(); - } - } - - /** - * Merges default options into the array. - * - * @param array $options Options to modify by reference - * - * @return array - */ - private function prepareDefaults(array $options) - { - $defaults = $this->config; - - if (!empty($defaults['headers'])) { - // Default headers are only added if they are not present. - $defaults['_conditional'] = $defaults['headers']; - unset($defaults['headers']); - } - - // Special handling for headers is required as they are added as - // conditional headers and as headers passed to a request ctor. - if (array_key_exists('headers', $options)) { - // Allows default headers to be unset. - if ($options['headers'] === null) { - $defaults['_conditional'] = null; - unset($options['headers']); - } elseif (!is_array($options['headers'])) { - throw new \InvalidArgumentException('headers must be an array'); - } - } - - // Shallow merge defaults underneath options. - $result = $options + $defaults; - - // Remove null values. - foreach ($result as $k => $v) { - if ($v === null) { - unset($result[$k]); - } - } - - return $result; - } - - /** - * Transfers the given request and applies request options. - * - * The URI of the request is not modified and the request options are used - * as-is without merging in default options. - * - * @param RequestInterface $request - * @param array $options - * - * @return Promise\PromiseInterface - */ - private function transfer(RequestInterface $request, array $options) - { - // save_to -> sink - if (isset($options['save_to'])) { - $options['sink'] = $options['save_to']; - unset($options['save_to']); - } - - // exceptions -> http_errors - if (isset($options['exceptions'])) { - $options['http_errors'] = $options['exceptions']; - unset($options['exceptions']); - } - - $request = $this->applyOptions($request, $options); - $handler = $options['handler']; - - try { - return Promise\promise_for($handler($request, $options)); - } catch (\Exception $e) { - return Promise\rejection_for($e); - } - } - - /** - * Applies the array of request options to a request. - * - * @param RequestInterface $request - * @param array $options - * - * @return RequestInterface - */ - private function applyOptions(RequestInterface $request, array &$options) - { - $modify = [ - 'set_headers' => [], - ]; - - if (isset($options['headers'])) { - $modify['set_headers'] = $options['headers']; - unset($options['headers']); - } - - if (isset($options['form_params'])) { - if (isset($options['multipart'])) { - throw new \InvalidArgumentException('You cannot use ' - . 'form_params and multipart at the same time. Use the ' - . 'form_params option if you want to send application/' - . 'x-www-form-urlencoded requests, and the multipart ' - . 'option to send multipart/form-data requests.'); - } - $options['body'] = http_build_query($options['form_params'], '', '&'); - unset($options['form_params']); - // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); - $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; - } - - if (isset($options['multipart'])) { - $options['body'] = new Psr7\MultipartStream($options['multipart']); - unset($options['multipart']); - } - - if (isset($options['json'])) { - $options['body'] = \GuzzleHttp\json_encode($options['json']); - unset($options['json']); - // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); - $options['_conditional']['Content-Type'] = 'application/json'; - } - - if (!empty($options['decode_content']) - && $options['decode_content'] !== true - ) { - // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']); - $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; - } - - if (isset($options['body'])) { - if (is_array($options['body'])) { - $this->invalidBody(); - } - $modify['body'] = Psr7\stream_for($options['body']); - unset($options['body']); - } - - if (!empty($options['auth']) && is_array($options['auth'])) { - $value = $options['auth']; - $type = isset($value[2]) ? strtolower($value[2]) : 'basic'; - switch ($type) { - case 'basic': - // Ensure that we don't have the header in different case and set the new value. - $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']); - $modify['set_headers']['Authorization'] = 'Basic ' - . base64_encode("$value[0]:$value[1]"); - break; - case 'digest': - // @todo: Do not rely on curl - $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST; - $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]"; - break; - case 'ntlm': - $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_NTLM; - $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]"; - break; - } - } - - if (isset($options['query'])) { - $value = $options['query']; - if (is_array($value)) { - $value = http_build_query($value, null, '&', PHP_QUERY_RFC3986); - } - if (!is_string($value)) { - throw new \InvalidArgumentException('query must be a string or array'); - } - $modify['query'] = $value; - unset($options['query']); - } - - // Ensure that sink is not an invalid value. - if (isset($options['sink'])) { - // TODO: Add more sink validation? - if (is_bool($options['sink'])) { - throw new \InvalidArgumentException('sink must not be a boolean'); - } - } - - $request = Psr7\modify_request($request, $modify); - if ($request->getBody() instanceof Psr7\MultipartStream) { - // Use a multipart/form-data POST if a Content-Type is not set. - // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); - $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' - . $request->getBody()->getBoundary(); - } - - // Merge in conditional headers if they are not present. - if (isset($options['_conditional'])) { - // Build up the changes so it's in a single clone of the message. - $modify = []; - foreach ($options['_conditional'] as $k => $v) { - if (!$request->hasHeader($k)) { - $modify['set_headers'][$k] = $v; - } - } - $request = Psr7\modify_request($request, $modify); - // Don't pass this internal value along to middleware/handlers. - unset($options['_conditional']); - } - - return $request; - } - - private function invalidBody() - { - throw new \InvalidArgumentException('Passing in the "body" request ' - . 'option as an array to send a POST request has been deprecated. ' - . 'Please use the "form_params" request option to send a ' - . 'application/x-www-form-urlencoded request, or the "multipart" ' - . 'request option to send a multipart/form-data request.'); - } -} diff --git a/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/vendor/guzzlehttp/guzzle/src/ClientInterface.php deleted file mode 100644 index 5b370851..00000000 --- a/vendor/guzzlehttp/guzzle/src/ClientInterface.php +++ /dev/null @@ -1,84 +0,0 @@ -strictMode = $strictMode; - - foreach ($cookieArray as $cookie) { - if (!($cookie instanceof SetCookie)) { - $cookie = new SetCookie($cookie); - } - $this->setCookie($cookie); - } - } - - /** - * Create a new Cookie jar from an associative array and domain. - * - * @param array $cookies Cookies to create the jar from - * @param string $domain Domain to set the cookies to - * - * @return self - */ - public static function fromArray(array $cookies, $domain) - { - $cookieJar = new self(); - foreach ($cookies as $name => $value) { - $cookieJar->setCookie(new SetCookie([ - 'Domain' => $domain, - 'Name' => $name, - 'Value' => $value, - 'Discard' => true - ])); - } - - return $cookieJar; - } - - /** - * @deprecated - */ - public static function getCookieValue($value) - { - return $value; - } - - /** - * Evaluate if this cookie should be persisted to storage - * that survives between requests. - * - * @param SetCookie $cookie Being evaluated. - * @param bool $allowSessionCookies If we should persist session cookies - * @return bool - */ - public static function shouldPersist( - SetCookie $cookie, - $allowSessionCookies = false - ) { - if ($cookie->getExpires() || $allowSessionCookies) { - if (!$cookie->getDiscard()) { - return true; - } - } - - return false; - } - - /** - * Finds and returns the cookie based on the name - * - * @param string $name cookie name to search for - * @return SetCookie|null cookie that was found or null if not found - */ - public function getCookieByName($name) - { - // don't allow a null name - if ($name === null) { - return null; - } - foreach ($this->cookies as $cookie) { - if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { - return $cookie; - } - } - } - - public function toArray() - { - return array_map(function (SetCookie $cookie) { - return $cookie->toArray(); - }, $this->getIterator()->getArrayCopy()); - } - - public function clear($domain = null, $path = null, $name = null) - { - if (!$domain) { - $this->cookies = []; - return; - } elseif (!$path) { - $this->cookies = array_filter( - $this->cookies, - function (SetCookie $cookie) use ($domain) { - return !$cookie->matchesDomain($domain); - } - ); - } elseif (!$name) { - $this->cookies = array_filter( - $this->cookies, - function (SetCookie $cookie) use ($path, $domain) { - return !($cookie->matchesPath($path) && - $cookie->matchesDomain($domain)); - } - ); - } else { - $this->cookies = array_filter( - $this->cookies, - function (SetCookie $cookie) use ($path, $domain, $name) { - return !($cookie->getName() == $name && - $cookie->matchesPath($path) && - $cookie->matchesDomain($domain)); - } - ); - } - } - - public function clearSessionCookies() - { - $this->cookies = array_filter( - $this->cookies, - function (SetCookie $cookie) { - return !$cookie->getDiscard() && $cookie->getExpires(); - } - ); - } - - public function setCookie(SetCookie $cookie) - { - // If the name string is empty (but not 0), ignore the set-cookie - // string entirely. - $name = $cookie->getName(); - if (!$name && $name !== '0') { - return false; - } - - // Only allow cookies with set and valid domain, name, value - $result = $cookie->validate(); - if ($result !== true) { - if ($this->strictMode) { - throw new \RuntimeException('Invalid cookie: ' . $result); - } else { - $this->removeCookieIfEmpty($cookie); - return false; - } - } - - // Resolve conflicts with previously set cookies - foreach ($this->cookies as $i => $c) { - - // Two cookies are identical, when their path, and domain are - // identical. - if ($c->getPath() != $cookie->getPath() || - $c->getDomain() != $cookie->getDomain() || - $c->getName() != $cookie->getName() - ) { - continue; - } - - // The previously set cookie is a discard cookie and this one is - // not so allow the new cookie to be set - if (!$cookie->getDiscard() && $c->getDiscard()) { - unset($this->cookies[$i]); - continue; - } - - // If the new cookie's expiration is further into the future, then - // replace the old cookie - if ($cookie->getExpires() > $c->getExpires()) { - unset($this->cookies[$i]); - continue; - } - - // If the value has changed, we better change it - if ($cookie->getValue() !== $c->getValue()) { - unset($this->cookies[$i]); - continue; - } - - // The cookie exists, so no need to continue - return false; - } - - $this->cookies[] = $cookie; - - return true; - } - - public function count() - { - return count($this->cookies); - } - - public function getIterator() - { - return new \ArrayIterator(array_values($this->cookies)); - } - - public function extractCookies( - RequestInterface $request, - ResponseInterface $response - ) { - if ($cookieHeader = $response->getHeader('Set-Cookie')) { - foreach ($cookieHeader as $cookie) { - $sc = SetCookie::fromString($cookie); - if (!$sc->getDomain()) { - $sc->setDomain($request->getUri()->getHost()); - } - if (0 !== strpos($sc->getPath(), '/')) { - $sc->setPath($this->getCookiePathFromRequest($request)); - } - $this->setCookie($sc); - } - } - } - - /** - * Computes cookie path following RFC 6265 section 5.1.4 - * - * @link https://tools.ietf.org/html/rfc6265#section-5.1.4 - * - * @param RequestInterface $request - * @return string - */ - private function getCookiePathFromRequest(RequestInterface $request) - { - $uriPath = $request->getUri()->getPath(); - if ('' === $uriPath) { - return '/'; - } - if (0 !== strpos($uriPath, '/')) { - return '/'; - } - if ('/' === $uriPath) { - return '/'; - } - if (0 === $lastSlashPos = strrpos($uriPath, '/')) { - return '/'; - } - - return substr($uriPath, 0, $lastSlashPos); - } - - public function withCookieHeader(RequestInterface $request) - { - $values = []; - $uri = $request->getUri(); - $scheme = $uri->getScheme(); - $host = $uri->getHost(); - $path = $uri->getPath() ?: '/'; - - foreach ($this->cookies as $cookie) { - if ($cookie->matchesPath($path) && - $cookie->matchesDomain($host) && - !$cookie->isExpired() && - (!$cookie->getSecure() || $scheme === 'https') - ) { - $values[] = $cookie->getName() . '=' - . $cookie->getValue(); - } - } - - return $values - ? $request->withHeader('Cookie', implode('; ', $values)) - : $request; - } - - /** - * If a cookie already exists and the server asks to set it again with a - * null value, the cookie must be deleted. - * - * @param SetCookie $cookie - */ - private function removeCookieIfEmpty(SetCookie $cookie) - { - $cookieValue = $cookie->getValue(); - if ($cookieValue === null || $cookieValue === '') { - $this->clear( - $cookie->getDomain(), - $cookie->getPath(), - $cookie->getName() - ); - } - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php deleted file mode 100644 index 2cf298a8..00000000 --- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +++ /dev/null @@ -1,84 +0,0 @@ -filename = $cookieFile; - $this->storeSessionCookies = $storeSessionCookies; - - if (file_exists($cookieFile)) { - $this->load($cookieFile); - } - } - - /** - * Saves the file when shutting down - */ - public function __destruct() - { - $this->save($this->filename); - } - - /** - * Saves the cookies to a file. - * - * @param string $filename File to save - * @throws \RuntimeException if the file cannot be found or created - */ - public function save($filename) - { - $json = []; - foreach ($this as $cookie) { - /** @var SetCookie $cookie */ - if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { - $json[] = $cookie->toArray(); - } - } - - $jsonStr = \GuzzleHttp\json_encode($json); - if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) { - throw new \RuntimeException("Unable to save file {$filename}"); - } - } - - /** - * Load cookies from a JSON formatted file. - * - * Old cookies are kept unless overwritten by newly loaded ones. - * - * @param string $filename Cookie file to load. - * @throws \RuntimeException if the file cannot be loaded. - */ - public function load($filename) - { - $json = file_get_contents($filename); - if (false === $json) { - throw new \RuntimeException("Unable to load file {$filename}"); - } elseif ($json === '') { - return; - } - - $data = \GuzzleHttp\json_decode($json, true); - if (is_array($data)) { - foreach (json_decode($json, true) as $cookie) { - $this->setCookie(new SetCookie($cookie)); - } - } elseif (strlen($data)) { - throw new \RuntimeException("Invalid cookie file: {$filename}"); - } - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php deleted file mode 100644 index 0224a244..00000000 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +++ /dev/null @@ -1,72 +0,0 @@ -sessionKey = $sessionKey; - $this->storeSessionCookies = $storeSessionCookies; - $this->load(); - } - - /** - * Saves cookies to session when shutting down - */ - public function __destruct() - { - $this->save(); - } - - /** - * Save cookies to the client session - */ - public function save() - { - $json = []; - foreach ($this as $cookie) { - /** @var SetCookie $cookie */ - if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { - $json[] = $cookie->toArray(); - } - } - - $_SESSION[$this->sessionKey] = json_encode($json); - } - - /** - * Load the contents of the client session into the data array - */ - protected function load() - { - if (!isset($_SESSION[$this->sessionKey])) { - return; - } - $data = json_decode($_SESSION[$this->sessionKey], true); - if (is_array($data)) { - foreach ($data as $cookie) { - $this->setCookie(new SetCookie($cookie)); - } - } elseif (strlen($data)) { - throw new \RuntimeException("Invalid cookie data"); - } - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php deleted file mode 100644 index 3d776a70..00000000 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +++ /dev/null @@ -1,403 +0,0 @@ - null, - 'Value' => null, - 'Domain' => null, - 'Path' => '/', - 'Max-Age' => null, - 'Expires' => null, - 'Secure' => false, - 'Discard' => false, - 'HttpOnly' => false - ]; - - /** @var array Cookie data */ - private $data; - - /** - * Create a new SetCookie object from a string - * - * @param string $cookie Set-Cookie header string - * - * @return self - */ - public static function fromString($cookie) - { - // Create the default return array - $data = self::$defaults; - // Explode the cookie string using a series of semicolons - $pieces = array_filter(array_map('trim', explode(';', $cookie))); - // The name of the cookie (first kvp) must exist and include an equal sign. - if (empty($pieces[0]) || !strpos($pieces[0], '=')) { - return new self($data); - } - - // Add the cookie pieces into the parsed data array - foreach ($pieces as $part) { - $cookieParts = explode('=', $part, 2); - $key = trim($cookieParts[0]); - $value = isset($cookieParts[1]) - ? trim($cookieParts[1], " \n\r\t\0\x0B") - : true; - - // Only check for non-cookies when cookies have been found - if (empty($data['Name'])) { - $data['Name'] = $key; - $data['Value'] = $value; - } else { - foreach (array_keys(self::$defaults) as $search) { - if (!strcasecmp($search, $key)) { - $data[$search] = $value; - continue 2; - } - } - $data[$key] = $value; - } - } - - return new self($data); - } - - /** - * @param array $data Array of cookie data provided by a Cookie parser - */ - public function __construct(array $data = []) - { - $this->data = array_replace(self::$defaults, $data); - // Extract the Expires value and turn it into a UNIX timestamp if needed - if (!$this->getExpires() && $this->getMaxAge()) { - // Calculate the Expires date - $this->setExpires(time() + $this->getMaxAge()); - } elseif ($this->getExpires() && !is_numeric($this->getExpires())) { - $this->setExpires($this->getExpires()); - } - } - - public function __toString() - { - $str = $this->data['Name'] . '=' . $this->data['Value'] . '; '; - foreach ($this->data as $k => $v) { - if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) { - if ($k === 'Expires') { - $str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; '; - } else { - $str .= ($v === true ? $k : "{$k}={$v}") . '; '; - } - } - } - - return rtrim($str, '; '); - } - - public function toArray() - { - return $this->data; - } - - /** - * Get the cookie name - * - * @return string - */ - public function getName() - { - return $this->data['Name']; - } - - /** - * Set the cookie name - * - * @param string $name Cookie name - */ - public function setName($name) - { - $this->data['Name'] = $name; - } - - /** - * Get the cookie value - * - * @return string - */ - public function getValue() - { - return $this->data['Value']; - } - - /** - * Set the cookie value - * - * @param string $value Cookie value - */ - public function setValue($value) - { - $this->data['Value'] = $value; - } - - /** - * Get the domain - * - * @return string|null - */ - public function getDomain() - { - return $this->data['Domain']; - } - - /** - * Set the domain of the cookie - * - * @param string $domain - */ - public function setDomain($domain) - { - $this->data['Domain'] = $domain; - } - - /** - * Get the path - * - * @return string - */ - public function getPath() - { - return $this->data['Path']; - } - - /** - * Set the path of the cookie - * - * @param string $path Path of the cookie - */ - public function setPath($path) - { - $this->data['Path'] = $path; - } - - /** - * Maximum lifetime of the cookie in seconds - * - * @return int|null - */ - public function getMaxAge() - { - return $this->data['Max-Age']; - } - - /** - * Set the max-age of the cookie - * - * @param int $maxAge Max age of the cookie in seconds - */ - public function setMaxAge($maxAge) - { - $this->data['Max-Age'] = $maxAge; - } - - /** - * The UNIX timestamp when the cookie Expires - * - * @return mixed - */ - public function getExpires() - { - return $this->data['Expires']; - } - - /** - * Set the unix timestamp for which the cookie will expire - * - * @param int $timestamp Unix timestamp - */ - public function setExpires($timestamp) - { - $this->data['Expires'] = is_numeric($timestamp) - ? (int) $timestamp - : strtotime($timestamp); - } - - /** - * Get whether or not this is a secure cookie - * - * @return bool|null - */ - public function getSecure() - { - return $this->data['Secure']; - } - - /** - * Set whether or not the cookie is secure - * - * @param bool $secure Set to true or false if secure - */ - public function setSecure($secure) - { - $this->data['Secure'] = $secure; - } - - /** - * Get whether or not this is a session cookie - * - * @return bool|null - */ - public function getDiscard() - { - return $this->data['Discard']; - } - - /** - * Set whether or not this is a session cookie - * - * @param bool $discard Set to true or false if this is a session cookie - */ - public function setDiscard($discard) - { - $this->data['Discard'] = $discard; - } - - /** - * Get whether or not this is an HTTP only cookie - * - * @return bool - */ - public function getHttpOnly() - { - return $this->data['HttpOnly']; - } - - /** - * Set whether or not this is an HTTP only cookie - * - * @param bool $httpOnly Set to true or false if this is HTTP only - */ - public function setHttpOnly($httpOnly) - { - $this->data['HttpOnly'] = $httpOnly; - } - - /** - * Check if the cookie matches a path value. - * - * A request-path path-matches a given cookie-path if at least one of - * the following conditions holds: - * - * - The cookie-path and the request-path are identical. - * - The cookie-path is a prefix of the request-path, and the last - * character of the cookie-path is %x2F ("/"). - * - The cookie-path is a prefix of the request-path, and the first - * character of the request-path that is not included in the cookie- - * path is a %x2F ("/") character. - * - * @param string $requestPath Path to check against - * - * @return bool - */ - public function matchesPath($requestPath) - { - $cookiePath = $this->getPath(); - - // Match on exact matches or when path is the default empty "/" - if ($cookiePath === '/' || $cookiePath == $requestPath) { - return true; - } - - // Ensure that the cookie-path is a prefix of the request path. - if (0 !== strpos($requestPath, $cookiePath)) { - return false; - } - - // Match if the last character of the cookie-path is "/" - if (substr($cookiePath, -1, 1) === '/') { - return true; - } - - // Match if the first character not included in cookie path is "/" - return substr($requestPath, strlen($cookiePath), 1) === '/'; - } - - /** - * Check if the cookie matches a domain value - * - * @param string $domain Domain to check against - * - * @return bool - */ - public function matchesDomain($domain) - { - // Remove the leading '.' as per spec in RFC 6265. - // http://tools.ietf.org/html/rfc6265#section-5.2.3 - $cookieDomain = ltrim($this->getDomain(), '.'); - - // Domain not set or exact match. - if (!$cookieDomain || !strcasecmp($domain, $cookieDomain)) { - return true; - } - - // Matching the subdomain according to RFC 6265. - // http://tools.ietf.org/html/rfc6265#section-5.1.3 - if (filter_var($domain, FILTER_VALIDATE_IP)) { - return false; - } - - return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain); - } - - /** - * Check if the cookie is expired - * - * @return bool - */ - public function isExpired() - { - return $this->getExpires() !== null && time() > $this->getExpires(); - } - - /** - * Check if the cookie is valid according to RFC 6265 - * - * @return bool|string Returns true if valid or an error message if invalid - */ - public function validate() - { - // Names must not be empty, but can be 0 - $name = $this->getName(); - if (empty($name) && !is_numeric($name)) { - return 'The cookie name must not be empty'; - } - - // Check if any of the invalid characters are present in the cookie name - if (preg_match( - '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/', - $name - )) { - return 'Cookie name must not contain invalid characters: ASCII ' - . 'Control characters (0-31;127), space, tab and the ' - . 'following characters: ()<>@,;:\"/?={}'; - } - - // Value must not be empty, but can be 0 - $value = $this->getValue(); - if (empty($value) && !is_numeric($value)) { - return 'The cookie value must not be empty'; - } - - // Domains must not be empty, but can be 0 - // A "0" is not a valid internet domain, but may be used as server name - // in a private network. - $domain = $this->getDomain(); - if (empty($domain) && !is_numeric($domain)) { - return 'The cookie domain must not be empty'; - } - - return true; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php deleted file mode 100644 index 427d896f..00000000 --- a/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php +++ /dev/null @@ -1,27 +0,0 @@ -getStatusCode() - : 0; - parent::__construct($message, $code, $previous); - $this->request = $request; - $this->response = $response; - $this->handlerContext = $handlerContext; - } - - /** - * Wrap non-RequestExceptions with a RequestException - * - * @param RequestInterface $request - * @param \Exception $e - * - * @return RequestException - */ - public static function wrapException(RequestInterface $request, \Exception $e) - { - return $e instanceof RequestException - ? $e - : new RequestException($e->getMessage(), $request, null, $e); - } - - /** - * Factory method to create a new exception with a normalized error message - * - * @param RequestInterface $request Request - * @param ResponseInterface $response Response received - * @param \Exception $previous Previous exception - * @param array $ctx Optional handler context. - * - * @return self - */ - public static function create( - RequestInterface $request, - ResponseInterface $response = null, - \Exception $previous = null, - array $ctx = [] - ) { - if (!$response) { - return new self( - 'Error completing request', - $request, - null, - $previous, - $ctx - ); - } - - $level = (int) floor($response->getStatusCode() / 100); - if ($level === 4) { - $label = 'Client error'; - $className = ClientException::class; - } elseif ($level === 5) { - $label = 'Server error'; - $className = ServerException::class; - } else { - $label = 'Unsuccessful request'; - $className = __CLASS__; - } - - $uri = $request->getUri(); - $uri = static::obfuscateUri($uri); - - // Client Error: `GET /` resulted in a `404 Not Found` response: - // ... (truncated) - $message = sprintf( - '%s: `%s %s` resulted in a `%s %s` response', - $label, - $request->getMethod(), - $uri, - $response->getStatusCode(), - $response->getReasonPhrase() - ); - - $summary = static::getResponseBodySummary($response); - - if ($summary !== null) { - $message .= ":\n{$summary}\n"; - } - - return new $className($message, $request, $response, $previous, $ctx); - } - - /** - * Get a short summary of the response - * - * Will return `null` if the response is not printable. - * - * @param ResponseInterface $response - * - * @return string|null - */ - public static function getResponseBodySummary(ResponseInterface $response) - { - $body = $response->getBody(); - - if (!$body->isSeekable() || !$body->isReadable()) { - return null; - } - - $size = $body->getSize(); - - if ($size === 0) { - return null; - } - - $summary = $body->read(120); - $body->rewind(); - - if ($size > 120) { - $summary .= ' (truncated...)'; - } - - // Matches any printable character, including unicode characters: - // letters, marks, numbers, punctuation, spacing, and separators. - if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) { - return null; - } - - return $summary; - } - - /** - * Obfuscates URI if there is an username and a password present - * - * @param UriInterface $uri - * - * @return UriInterface - */ - private static function obfuscateUri($uri) - { - $userInfo = $uri->getUserInfo(); - - if (false !== ($pos = strpos($userInfo, ':'))) { - return $uri->withUserInfo(substr($userInfo, 0, $pos), '***'); - } - - return $uri; - } - - /** - * Get the request that caused the exception - * - * @return RequestInterface - */ - public function getRequest() - { - return $this->request; - } - - /** - * Get the associated response - * - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - - /** - * Check if a response was received - * - * @return bool - */ - public function hasResponse() - { - return $this->response !== null; - } - - /** - * Get contextual information about the error from the underlying handler. - * - * The contents of this array will vary depending on which handler you are - * using. It may also be just an empty array. Relying on this data will - * couple you to a specific handler, but can give more debug information - * when needed. - * - * @return array - */ - public function getHandlerContext() - { - return $this->handlerContext; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php b/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php deleted file mode 100644 index a77c2892..00000000 --- a/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php +++ /dev/null @@ -1,27 +0,0 @@ -stream = $stream; - $msg = $msg ?: 'Could not seek the stream to position ' . $pos; - parent::__construct($msg); - } - - /** - * @return StreamInterface - */ - public function getStream() - { - return $this->stream; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php deleted file mode 100644 index 127094c1..00000000 --- a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php +++ /dev/null @@ -1,9 +0,0 @@ -maxHandles = $maxHandles; - } - - public function create(RequestInterface $request, array $options) - { - if (isset($options['curl']['body_as_string'])) { - $options['_body_as_string'] = $options['curl']['body_as_string']; - unset($options['curl']['body_as_string']); - } - - $easy = new EasyHandle; - $easy->request = $request; - $easy->options = $options; - $conf = $this->getDefaultConf($easy); - $this->applyMethod($easy, $conf); - $this->applyHandlerOptions($easy, $conf); - $this->applyHeaders($easy, $conf); - unset($conf['_headers']); - - // Add handler options from the request configuration options - if (isset($options['curl'])) { - $conf = array_replace($conf, $options['curl']); - } - - $conf[CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); - $easy->handle = $this->handles - ? array_pop($this->handles) - : curl_init(); - curl_setopt_array($easy->handle, $conf); - - return $easy; - } - - public function release(EasyHandle $easy) - { - $resource = $easy->handle; - unset($easy->handle); - - if (count($this->handles) >= $this->maxHandles) { - curl_close($resource); - } else { - // Remove all callback functions as they can hold onto references - // and are not cleaned up by curl_reset. Using curl_setopt_array - // does not work for some reason, so removing each one - // individually. - curl_setopt($resource, CURLOPT_HEADERFUNCTION, null); - curl_setopt($resource, CURLOPT_READFUNCTION, null); - curl_setopt($resource, CURLOPT_WRITEFUNCTION, null); - curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null); - curl_reset($resource); - $this->handles[] = $resource; - } - } - - /** - * Completes a cURL transaction, either returning a response promise or a - * rejected promise. - * - * @param callable $handler - * @param EasyHandle $easy - * @param CurlFactoryInterface $factory Dictates how the handle is released - * - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public static function finish( - callable $handler, - EasyHandle $easy, - CurlFactoryInterface $factory - ) { - if (isset($easy->options['on_stats'])) { - self::invokeStats($easy); - } - - if (!$easy->response || $easy->errno) { - return self::finishError($handler, $easy, $factory); - } - - // Return the response if it is present and there is no error. - $factory->release($easy); - - // Rewind the body of the response if possible. - $body = $easy->response->getBody(); - if ($body->isSeekable()) { - $body->rewind(); - } - - return new FulfilledPromise($easy->response); - } - - private static function invokeStats(EasyHandle $easy) - { - $curlStats = curl_getinfo($easy->handle); - $curlStats['appconnect_time'] = curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME); - $stats = new TransferStats( - $easy->request, - $easy->response, - $curlStats['total_time'], - $easy->errno, - $curlStats - ); - call_user_func($easy->options['on_stats'], $stats); - } - - private static function finishError( - callable $handler, - EasyHandle $easy, - CurlFactoryInterface $factory - ) { - // Get error information and release the handle to the factory. - $ctx = [ - 'errno' => $easy->errno, - 'error' => curl_error($easy->handle), - 'appconnect_time' => curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME), - ] + curl_getinfo($easy->handle); - $ctx[self::CURL_VERSION_STR] = curl_version()['version']; - $factory->release($easy); - - // Retry when nothing is present or when curl failed to rewind. - if (empty($easy->options['_err_message']) - && (!$easy->errno || $easy->errno == 65) - ) { - return self::retryFailedRewind($handler, $easy, $ctx); - } - - return self::createRejection($easy, $ctx); - } - - private static function createRejection(EasyHandle $easy, array $ctx) - { - static $connectionErrors = [ - CURLE_OPERATION_TIMEOUTED => true, - CURLE_COULDNT_RESOLVE_HOST => true, - CURLE_COULDNT_CONNECT => true, - CURLE_SSL_CONNECT_ERROR => true, - CURLE_GOT_NOTHING => true, - ]; - - // If an exception was encountered during the onHeaders event, then - // return a rejected promise that wraps that exception. - if ($easy->onHeadersException) { - return \GuzzleHttp\Promise\rejection_for( - new RequestException( - 'An error was encountered during the on_headers event', - $easy->request, - $easy->response, - $easy->onHeadersException, - $ctx - ) - ); - } - if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) { - $message = sprintf( - 'cURL error %s: %s (%s)', - $ctx['errno'], - $ctx['error'], - 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html' - ); - } else { - $message = sprintf( - 'cURL error %s: %s (%s) for %s', - $ctx['errno'], - $ctx['error'], - 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html', - $easy->request->getUri() - ); - } - - // Create a connection exception if it was a specific error code. - $error = isset($connectionErrors[$easy->errno]) - ? new ConnectException($message, $easy->request, null, $ctx) - : new RequestException($message, $easy->request, $easy->response, null, $ctx); - - return \GuzzleHttp\Promise\rejection_for($error); - } - - private function getDefaultConf(EasyHandle $easy) - { - $conf = [ - '_headers' => $easy->request->getHeaders(), - CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), - CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), - CURLOPT_RETURNTRANSFER => false, - CURLOPT_HEADER => false, - CURLOPT_CONNECTTIMEOUT => 150, - ]; - - if (defined('CURLOPT_PROTOCOLS')) { - $conf[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; - } - - $version = $easy->request->getProtocolVersion(); - if ($version == 1.1) { - $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; - } elseif ($version == 2.0) { - $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; - } else { - $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; - } - - return $conf; - } - - private function applyMethod(EasyHandle $easy, array &$conf) - { - $body = $easy->request->getBody(); - $size = $body->getSize(); - - if ($size === null || $size > 0) { - $this->applyBody($easy->request, $easy->options, $conf); - return; - } - - $method = $easy->request->getMethod(); - if ($method === 'PUT' || $method === 'POST') { - // See http://tools.ietf.org/html/rfc7230#section-3.3.2 - if (!$easy->request->hasHeader('Content-Length')) { - $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; - } - } elseif ($method === 'HEAD') { - $conf[CURLOPT_NOBODY] = true; - unset( - $conf[CURLOPT_WRITEFUNCTION], - $conf[CURLOPT_READFUNCTION], - $conf[CURLOPT_FILE], - $conf[CURLOPT_INFILE] - ); - } - } - - private function applyBody(RequestInterface $request, array $options, array &$conf) - { - $size = $request->hasHeader('Content-Length') - ? (int) $request->getHeaderLine('Content-Length') - : null; - - // Send the body as a string if the size is less than 1MB OR if the - // [curl][body_as_string] request value is set. - if (($size !== null && $size < 1000000) || - !empty($options['_body_as_string']) - ) { - $conf[CURLOPT_POSTFIELDS] = (string) $request->getBody(); - // Don't duplicate the Content-Length header - $this->removeHeader('Content-Length', $conf); - $this->removeHeader('Transfer-Encoding', $conf); - } else { - $conf[CURLOPT_UPLOAD] = true; - if ($size !== null) { - $conf[CURLOPT_INFILESIZE] = $size; - $this->removeHeader('Content-Length', $conf); - } - $body = $request->getBody(); - if ($body->isSeekable()) { - $body->rewind(); - } - $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { - return $body->read($length); - }; - } - - // If the Expect header is not present, prevent curl from adding it - if (!$request->hasHeader('Expect')) { - $conf[CURLOPT_HTTPHEADER][] = 'Expect:'; - } - - // cURL sometimes adds a content-type by default. Prevent this. - if (!$request->hasHeader('Content-Type')) { - $conf[CURLOPT_HTTPHEADER][] = 'Content-Type:'; - } - } - - private function applyHeaders(EasyHandle $easy, array &$conf) - { - foreach ($conf['_headers'] as $name => $values) { - foreach ($values as $value) { - $value = (string) $value; - if ($value === '') { - // cURL requires a special format for empty headers. - // See https://github.com/guzzle/guzzle/issues/1882 for more details. - $conf[CURLOPT_HTTPHEADER][] = "$name;"; - } else { - $conf[CURLOPT_HTTPHEADER][] = "$name: $value"; - } - } - } - - // Remove the Accept header if one was not set - if (!$easy->request->hasHeader('Accept')) { - $conf[CURLOPT_HTTPHEADER][] = 'Accept:'; - } - } - - /** - * Remove a header from the options array. - * - * @param string $name Case-insensitive header to remove - * @param array $options Array of options to modify - */ - private function removeHeader($name, array &$options) - { - foreach (array_keys($options['_headers']) as $key) { - if (!strcasecmp($key, $name)) { - unset($options['_headers'][$key]); - return; - } - } - } - - private function applyHandlerOptions(EasyHandle $easy, array &$conf) - { - $options = $easy->options; - if (isset($options['verify'])) { - if ($options['verify'] === false) { - unset($conf[CURLOPT_CAINFO]); - $conf[CURLOPT_SSL_VERIFYHOST] = 0; - $conf[CURLOPT_SSL_VERIFYPEER] = false; - } else { - $conf[CURLOPT_SSL_VERIFYHOST] = 2; - $conf[CURLOPT_SSL_VERIFYPEER] = true; - if (is_string($options['verify'])) { - // Throw an error if the file/folder/link path is not valid or doesn't exist. - if (!file_exists($options['verify'])) { - throw new \InvalidArgumentException( - "SSL CA bundle not found: {$options['verify']}" - ); - } - // If it's a directory or a link to a directory use CURLOPT_CAPATH. - // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO. - if (is_dir($options['verify']) || - (is_link($options['verify']) && is_dir(readlink($options['verify'])))) { - $conf[CURLOPT_CAPATH] = $options['verify']; - } else { - $conf[CURLOPT_CAINFO] = $options['verify']; - } - } - } - } - - if (!empty($options['decode_content'])) { - $accept = $easy->request->getHeaderLine('Accept-Encoding'); - if ($accept) { - $conf[CURLOPT_ENCODING] = $accept; - } else { - $conf[CURLOPT_ENCODING] = ''; - // Don't let curl send the header over the wire - $conf[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; - } - } - - if (isset($options['sink'])) { - $sink = $options['sink']; - if (!is_string($sink)) { - $sink = \GuzzleHttp\Psr7\stream_for($sink); - } elseif (!is_dir(dirname($sink))) { - // Ensure that the directory exists before failing in curl. - throw new \RuntimeException(sprintf( - 'Directory %s does not exist for sink value of %s', - dirname($sink), - $sink - )); - } else { - $sink = new LazyOpenStream($sink, 'w+'); - } - $easy->sink = $sink; - $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) { - return $sink->write($write); - }; - } else { - // Use a default temp stream if no sink was set. - $conf[CURLOPT_FILE] = fopen('php://temp', 'w+'); - $easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]); - } - $timeoutRequiresNoSignal = false; - if (isset($options['timeout'])) { - $timeoutRequiresNoSignal |= $options['timeout'] < 1; - $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; - } - - // CURL default value is CURL_IPRESOLVE_WHATEVER - if (isset($options['force_ip_resolve'])) { - if ('v4' === $options['force_ip_resolve']) { - $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; - } elseif ('v6' === $options['force_ip_resolve']) { - $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; - } - } - - if (isset($options['connect_timeout'])) { - $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; - $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; - } - - if ($timeoutRequiresNoSignal && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $conf[CURLOPT_NOSIGNAL] = true; - } - - if (isset($options['proxy'])) { - if (!is_array($options['proxy'])) { - $conf[CURLOPT_PROXY] = $options['proxy']; - } else { - $scheme = $easy->request->getUri()->getScheme(); - if (isset($options['proxy'][$scheme])) { - $host = $easy->request->getUri()->getHost(); - if (!isset($options['proxy']['no']) || - !\GuzzleHttp\is_host_in_noproxy($host, $options['proxy']['no']) - ) { - $conf[CURLOPT_PROXY] = $options['proxy'][$scheme]; - } - } - } - } - - if (isset($options['cert'])) { - $cert = $options['cert']; - if (is_array($cert)) { - $conf[CURLOPT_SSLCERTPASSWD] = $cert[1]; - $cert = $cert[0]; - } - if (!file_exists($cert)) { - throw new \InvalidArgumentException( - "SSL certificate not found: {$cert}" - ); - } - $conf[CURLOPT_SSLCERT] = $cert; - } - - if (isset($options['ssl_key'])) { - $sslKey = $options['ssl_key']; - if (is_array($sslKey)) { - $conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1]; - $sslKey = $sslKey[0]; - } - if (!file_exists($sslKey)) { - throw new \InvalidArgumentException( - "SSL private key not found: {$sslKey}" - ); - } - $conf[CURLOPT_SSLKEY] = $sslKey; - } - - if (isset($options['progress'])) { - $progress = $options['progress']; - if (!is_callable($progress)) { - throw new \InvalidArgumentException( - 'progress client option must be callable' - ); - } - $conf[CURLOPT_NOPROGRESS] = false; - $conf[CURLOPT_PROGRESSFUNCTION] = function () use ($progress) { - $args = func_get_args(); - // PHP 5.5 pushed the handle onto the start of the args - if (is_resource($args[0])) { - array_shift($args); - } - call_user_func_array($progress, $args); - }; - } - - if (!empty($options['debug'])) { - $conf[CURLOPT_STDERR] = \GuzzleHttp\debug_resource($options['debug']); - $conf[CURLOPT_VERBOSE] = true; - } - } - - /** - * This function ensures that a response was set on a transaction. If one - * was not set, then the request is retried if possible. This error - * typically means you are sending a payload, curl encountered a - * "Connection died, retrying a fresh connect" error, tried to rewind the - * stream, and then encountered a "necessary data rewind wasn't possible" - * error, causing the request to be sent through curl_multi_info_read() - * without an error status. - */ - private static function retryFailedRewind( - callable $handler, - EasyHandle $easy, - array $ctx - ) { - try { - // Only rewind if the body has been read from. - $body = $easy->request->getBody(); - if ($body->tell() > 0) { - $body->rewind(); - } - } catch (\RuntimeException $e) { - $ctx['error'] = 'The connection unexpectedly failed without ' - . 'providing an error. The request would have been retried, ' - . 'but attempting to rewind the request body failed. ' - . 'Exception: ' . $e; - return self::createRejection($easy, $ctx); - } - - // Retry no more than 3 times before giving up. - if (!isset($easy->options['_curl_retries'])) { - $easy->options['_curl_retries'] = 1; - } elseif ($easy->options['_curl_retries'] == 2) { - $ctx['error'] = 'The cURL request was retried 3 times ' - . 'and did not succeed. The most likely reason for the failure ' - . 'is that cURL was unable to rewind the body of the request ' - . 'and subsequent retries resulted in the same error. Turn on ' - . 'the debug option to see what went wrong. See ' - . 'https://bugs.php.net/bug.php?id=47204 for more information.'; - return self::createRejection($easy, $ctx); - } else { - $easy->options['_curl_retries']++; - } - - return $handler($easy->request, $easy->options); - } - - private function createHeaderFn(EasyHandle $easy) - { - if (isset($easy->options['on_headers'])) { - $onHeaders = $easy->options['on_headers']; - - if (!is_callable($onHeaders)) { - throw new \InvalidArgumentException('on_headers must be callable'); - } - } else { - $onHeaders = null; - } - - return function ($ch, $h) use ( - $onHeaders, - $easy, - &$startingResponse - ) { - $value = trim($h); - if ($value === '') { - $startingResponse = true; - $easy->createResponse(); - if ($onHeaders !== null) { - try { - $onHeaders($easy->response); - } catch (\Exception $e) { - // Associate the exception with the handle and trigger - // a curl header write error by returning 0. - $easy->onHeadersException = $e; - return -1; - } - } - } elseif ($startingResponse) { - $startingResponse = false; - $easy->headers = [$value]; - } else { - $easy->headers[] = $value; - } - return strlen($h); - }; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php deleted file mode 100644 index b0fc2368..00000000 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -factory = isset($options['handle_factory']) - ? $options['handle_factory'] - : new CurlFactory(3); - } - - public function __invoke(RequestInterface $request, array $options) - { - if (isset($options['delay'])) { - usleep($options['delay'] * 1000); - } - - $easy = $this->factory->create($request, $options); - curl_exec($easy->handle); - $easy->errno = curl_errno($easy->handle); - - return CurlFactory::finish($this, $easy, $this->factory); - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php deleted file mode 100644 index d8297623..00000000 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +++ /dev/null @@ -1,205 +0,0 @@ -factory = isset($options['handle_factory']) - ? $options['handle_factory'] : new CurlFactory(50); - - if (isset($options['select_timeout'])) { - $this->selectTimeout = $options['select_timeout']; - } elseif ($selectTimeout = getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { - $this->selectTimeout = $selectTimeout; - } else { - $this->selectTimeout = 1; - } - } - - public function __get($name) - { - if ($name === '_mh') { - return $this->_mh = curl_multi_init(); - } - - throw new \BadMethodCallException(); - } - - public function __destruct() - { - if (isset($this->_mh)) { - curl_multi_close($this->_mh); - unset($this->_mh); - } - } - - public function __invoke(RequestInterface $request, array $options) - { - $easy = $this->factory->create($request, $options); - $id = (int) $easy->handle; - - $promise = new Promise( - [$this, 'execute'], - function () use ($id) { - return $this->cancel($id); - } - ); - - $this->addRequest(['easy' => $easy, 'deferred' => $promise]); - - return $promise; - } - - /** - * Ticks the curl event loop. - */ - public function tick() - { - // Add any delayed handles if needed. - if ($this->delays) { - $currentTime = \GuzzleHttp\_current_time(); - foreach ($this->delays as $id => $delay) { - if ($currentTime >= $delay) { - unset($this->delays[$id]); - curl_multi_add_handle( - $this->_mh, - $this->handles[$id]['easy']->handle - ); - } - } - } - - // Step through the task queue which may add additional requests. - P\queue()->run(); - - if ($this->active && - curl_multi_select($this->_mh, $this->selectTimeout) === -1 - ) { - // Perform a usleep if a select returns -1. - // See: https://bugs.php.net/bug.php?id=61141 - usleep(250); - } - - while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM); - - $this->processMessages(); - } - - /** - * Runs until all outstanding connections have completed. - */ - public function execute() - { - $queue = P\queue(); - - while ($this->handles || !$queue->isEmpty()) { - // If there are no transfers, then sleep for the next delay - if (!$this->active && $this->delays) { - usleep($this->timeToNext()); - } - $this->tick(); - } - } - - private function addRequest(array $entry) - { - $easy = $entry['easy']; - $id = (int) $easy->handle; - $this->handles[$id] = $entry; - if (empty($easy->options['delay'])) { - curl_multi_add_handle($this->_mh, $easy->handle); - } else { - $this->delays[$id] = \GuzzleHttp\_current_time() + ($easy->options['delay'] / 1000); - } - } - - /** - * Cancels a handle from sending and removes references to it. - * - * @param int $id Handle ID to cancel and remove. - * - * @return bool True on success, false on failure. - */ - private function cancel($id) - { - // Cannot cancel if it has been processed. - if (!isset($this->handles[$id])) { - return false; - } - - $handle = $this->handles[$id]['easy']->handle; - unset($this->delays[$id], $this->handles[$id]); - curl_multi_remove_handle($this->_mh, $handle); - curl_close($handle); - - return true; - } - - private function processMessages() - { - while ($done = curl_multi_info_read($this->_mh)) { - $id = (int) $done['handle']; - curl_multi_remove_handle($this->_mh, $done['handle']); - - if (!isset($this->handles[$id])) { - // Probably was cancelled. - continue; - } - - $entry = $this->handles[$id]; - unset($this->handles[$id], $this->delays[$id]); - $entry['easy']->errno = $done['result']; - $entry['deferred']->resolve( - CurlFactory::finish( - $this, - $entry['easy'], - $this->factory - ) - ); - } - } - - private function timeToNext() - { - $currentTime = \GuzzleHttp\_current_time(); - $nextTime = PHP_INT_MAX; - foreach ($this->delays as $time) { - if ($time < $nextTime) { - $nextTime = $time; - } - } - - return max(0, $nextTime - $currentTime) * 1000000; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php deleted file mode 100644 index 7754e911..00000000 --- a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php +++ /dev/null @@ -1,92 +0,0 @@ -headers)) { - throw new \RuntimeException('No headers have been received'); - } - - // HTTP-version SP status-code SP reason-phrase - $startLine = explode(' ', array_shift($this->headers), 3); - $headers = \GuzzleHttp\headers_from_lines($this->headers); - $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); - - if (!empty($this->options['decode_content']) - && isset($normalizedKeys['content-encoding']) - ) { - $headers['x-encoded-content-encoding'] - = $headers[$normalizedKeys['content-encoding']]; - unset($headers[$normalizedKeys['content-encoding']]); - if (isset($normalizedKeys['content-length'])) { - $headers['x-encoded-content-length'] - = $headers[$normalizedKeys['content-length']]; - - $bodyLength = (int) $this->sink->getSize(); - if ($bodyLength) { - $headers[$normalizedKeys['content-length']] = $bodyLength; - } else { - unset($headers[$normalizedKeys['content-length']]); - } - } - } - - // Attach a response to the easy handle with the parsed headers. - $this->response = new Response( - $startLine[1], - $headers, - $this->sink, - substr($startLine[0], 5), - isset($startLine[2]) ? (string) $startLine[2] : null - ); - } - - public function __get($name) - { - $msg = $name === 'handle' - ? 'The EasyHandle has been released' - : 'Invalid property: ' . $name; - throw new \BadMethodCallException($msg); - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php deleted file mode 100644 index d5c449c1..00000000 --- a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +++ /dev/null @@ -1,190 +0,0 @@ -onFulfilled = $onFulfilled; - $this->onRejected = $onRejected; - - if ($queue) { - call_user_func_array([$this, 'append'], $queue); - } - } - - public function __invoke(RequestInterface $request, array $options) - { - if (!$this->queue) { - throw new \OutOfBoundsException('Mock queue is empty'); - } - - if (isset($options['delay'])) { - usleep($options['delay'] * 1000); - } - - $this->lastRequest = $request; - $this->lastOptions = $options; - $response = array_shift($this->queue); - - if (isset($options['on_headers'])) { - if (!is_callable($options['on_headers'])) { - throw new \InvalidArgumentException('on_headers must be callable'); - } - try { - $options['on_headers']($response); - } catch (\Exception $e) { - $msg = 'An error was encountered during the on_headers event'; - $response = new RequestException($msg, $request, $response, $e); - } - } - - if (is_callable($response)) { - $response = call_user_func($response, $request, $options); - } - - $response = $response instanceof \Exception - ? \GuzzleHttp\Promise\rejection_for($response) - : \GuzzleHttp\Promise\promise_for($response); - - return $response->then( - function ($value) use ($request, $options) { - $this->invokeStats($request, $options, $value); - if ($this->onFulfilled) { - call_user_func($this->onFulfilled, $value); - } - if (isset($options['sink'])) { - $contents = (string) $value->getBody(); - $sink = $options['sink']; - - if (is_resource($sink)) { - fwrite($sink, $contents); - } elseif (is_string($sink)) { - file_put_contents($sink, $contents); - } elseif ($sink instanceof \Psr\Http\Message\StreamInterface) { - $sink->write($contents); - } - } - - return $value; - }, - function ($reason) use ($request, $options) { - $this->invokeStats($request, $options, null, $reason); - if ($this->onRejected) { - call_user_func($this->onRejected, $reason); - } - return \GuzzleHttp\Promise\rejection_for($reason); - } - ); - } - - /** - * Adds one or more variadic requests, exceptions, callables, or promises - * to the queue. - */ - public function append() - { - foreach (func_get_args() as $value) { - if ($value instanceof ResponseInterface - || $value instanceof \Exception - || $value instanceof PromiseInterface - || is_callable($value) - ) { - $this->queue[] = $value; - } else { - throw new \InvalidArgumentException('Expected a response or ' - . 'exception. Found ' . \GuzzleHttp\describe_type($value)); - } - } - } - - /** - * Get the last received request. - * - * @return RequestInterface - */ - public function getLastRequest() - { - return $this->lastRequest; - } - - /** - * Get the last received request options. - * - * @return array - */ - public function getLastOptions() - { - return $this->lastOptions; - } - - /** - * Returns the number of remaining items in the queue. - * - * @return int - */ - public function count() - { - return count($this->queue); - } - - private function invokeStats( - RequestInterface $request, - array $options, - ResponseInterface $response = null, - $reason = null - ) { - if (isset($options['on_stats'])) { - $transferTime = isset($options['transfer_time']) ? $options['transfer_time'] : 0; - $stats = new TransferStats($request, $response, $transferTime, $reason); - call_user_func($options['on_stats'], $stats); - } - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php deleted file mode 100644 index f8b00be0..00000000 --- a/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php +++ /dev/null @@ -1,55 +0,0 @@ -withoutHeader('Expect'); - - // Append a content-length header if body size is zero to match - // cURL's behavior. - if (0 === $request->getBody()->getSize()) { - $request = $request->withHeader('Content-Length', '0'); - } - - return $this->createResponse( - $request, - $options, - $this->createStream($request, $options), - $startTime - ); - } catch (\InvalidArgumentException $e) { - throw $e; - } catch (\Exception $e) { - // Determine if the error was a networking error. - $message = $e->getMessage(); - // This list can probably get more comprehensive. - if (strpos($message, 'getaddrinfo') // DNS lookup failed - || strpos($message, 'Connection refused') - || strpos($message, "couldn't connect to host") // error on HHVM - || strpos($message, "connection attempt failed") - ) { - $e = new ConnectException($e->getMessage(), $request, $e); - } - $e = RequestException::wrapException($request, $e); - $this->invokeStats($options, $request, $startTime, null, $e); - - return \GuzzleHttp\Promise\rejection_for($e); - } - } - - private function invokeStats( - array $options, - RequestInterface $request, - $startTime, - ResponseInterface $response = null, - $error = null - ) { - if (isset($options['on_stats'])) { - $stats = new TransferStats( - $request, - $response, - \GuzzleHttp\_current_time() - $startTime, - $error, - [] - ); - call_user_func($options['on_stats'], $stats); - } - } - - private function createResponse( - RequestInterface $request, - array $options, - $stream, - $startTime - ) { - $hdrs = $this->lastHeaders; - $this->lastHeaders = []; - $parts = explode(' ', array_shift($hdrs), 3); - $ver = explode('/', $parts[0])[1]; - $status = $parts[1]; - $reason = isset($parts[2]) ? $parts[2] : null; - $headers = \GuzzleHttp\headers_from_lines($hdrs); - list($stream, $headers) = $this->checkDecode($options, $headers, $stream); - $stream = Psr7\stream_for($stream); - $sink = $stream; - - if (strcasecmp('HEAD', $request->getMethod())) { - $sink = $this->createSink($stream, $options); - } - - $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); - - if (isset($options['on_headers'])) { - try { - $options['on_headers']($response); - } catch (\Exception $e) { - $msg = 'An error was encountered during the on_headers event'; - $ex = new RequestException($msg, $request, $response, $e); - return \GuzzleHttp\Promise\rejection_for($ex); - } - } - - // Do not drain when the request is a HEAD request because they have - // no body. - if ($sink !== $stream) { - $this->drain( - $stream, - $sink, - $response->getHeaderLine('Content-Length') - ); - } - - $this->invokeStats($options, $request, $startTime, $response, null); - - return new FulfilledPromise($response); - } - - private function createSink(StreamInterface $stream, array $options) - { - if (!empty($options['stream'])) { - return $stream; - } - - $sink = isset($options['sink']) - ? $options['sink'] - : fopen('php://temp', 'r+'); - - return is_string($sink) - ? new Psr7\LazyOpenStream($sink, 'w+') - : Psr7\stream_for($sink); - } - - private function checkDecode(array $options, array $headers, $stream) - { - // Automatically decode responses when instructed. - if (!empty($options['decode_content'])) { - $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); - if (isset($normalizedKeys['content-encoding'])) { - $encoding = $headers[$normalizedKeys['content-encoding']]; - if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { - $stream = new Psr7\InflateStream( - Psr7\stream_for($stream) - ); - $headers['x-encoded-content-encoding'] - = $headers[$normalizedKeys['content-encoding']]; - // Remove content-encoding header - unset($headers[$normalizedKeys['content-encoding']]); - // Fix content-length header - if (isset($normalizedKeys['content-length'])) { - $headers['x-encoded-content-length'] - = $headers[$normalizedKeys['content-length']]; - - $length = (int) $stream->getSize(); - if ($length === 0) { - unset($headers[$normalizedKeys['content-length']]); - } else { - $headers[$normalizedKeys['content-length']] = [$length]; - } - } - } - } - } - - return [$stream, $headers]; - } - - /** - * Drains the source stream into the "sink" client option. - * - * @param StreamInterface $source - * @param StreamInterface $sink - * @param string $contentLength Header specifying the amount of - * data to read. - * - * @return StreamInterface - * @throws \RuntimeException when the sink option is invalid. - */ - private function drain( - StreamInterface $source, - StreamInterface $sink, - $contentLength - ) { - // If a content-length header is provided, then stop reading once - // that number of bytes has been read. This can prevent infinitely - // reading from a stream when dealing with servers that do not honor - // Connection: Close headers. - Psr7\copy_to_stream( - $source, - $sink, - (strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1 - ); - - $sink->seek(0); - $source->close(); - - return $sink; - } - - /** - * Create a resource and check to ensure it was created successfully - * - * @param callable $callback Callable that returns stream resource - * - * @return resource - * @throws \RuntimeException on error - */ - private function createResource(callable $callback) - { - $errors = null; - set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { - $errors[] = [ - 'message' => $msg, - 'file' => $file, - 'line' => $line - ]; - return true; - }); - - $resource = $callback(); - restore_error_handler(); - - if (!$resource) { - $message = 'Error creating resource: '; - foreach ($errors as $err) { - foreach ($err as $key => $value) { - $message .= "[$key] $value" . PHP_EOL; - } - } - throw new \RuntimeException(trim($message)); - } - - return $resource; - } - - private function createStream(RequestInterface $request, array $options) - { - static $methods; - if (!$methods) { - $methods = array_flip(get_class_methods(__CLASS__)); - } - - // HTTP/1.1 streams using the PHP stream wrapper require a - // Connection: close header - if ($request->getProtocolVersion() == '1.1' - && !$request->hasHeader('Connection') - ) { - $request = $request->withHeader('Connection', 'close'); - } - - // Ensure SSL is verified by default - if (!isset($options['verify'])) { - $options['verify'] = true; - } - - $params = []; - $context = $this->getDefaultContext($request); - - if (isset($options['on_headers']) && !is_callable($options['on_headers'])) { - throw new \InvalidArgumentException('on_headers must be callable'); - } - - if (!empty($options)) { - foreach ($options as $key => $value) { - $method = "add_{$key}"; - if (isset($methods[$method])) { - $this->{$method}($request, $context, $value, $params); - } - } - } - - if (isset($options['stream_context'])) { - if (!is_array($options['stream_context'])) { - throw new \InvalidArgumentException('stream_context must be an array'); - } - $context = array_replace_recursive( - $context, - $options['stream_context'] - ); - } - - // Microsoft NTLM authentication only supported with curl handler - if (isset($options['auth']) - && is_array($options['auth']) - && isset($options['auth'][2]) - && 'ntlm' == $options['auth'][2] - ) { - throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); - } - - $uri = $this->resolveHost($request, $options); - - $context = $this->createResource( - function () use ($context, $params) { - return stream_context_create($context, $params); - } - ); - - return $this->createResource( - function () use ($uri, &$http_response_header, $context, $options) { - $resource = fopen((string) $uri, 'r', null, $context); - $this->lastHeaders = $http_response_header; - - if (isset($options['read_timeout'])) { - $readTimeout = $options['read_timeout']; - $sec = (int) $readTimeout; - $usec = ($readTimeout - $sec) * 100000; - stream_set_timeout($resource, $sec, $usec); - } - - return $resource; - } - ); - } - - private function resolveHost(RequestInterface $request, array $options) - { - $uri = $request->getUri(); - - if (isset($options['force_ip_resolve']) && !filter_var($uri->getHost(), FILTER_VALIDATE_IP)) { - if ('v4' === $options['force_ip_resolve']) { - $records = dns_get_record($uri->getHost(), DNS_A); - if (!isset($records[0]['ip'])) { - throw new ConnectException( - sprintf( - "Could not resolve IPv4 address for host '%s'", - $uri->getHost() - ), - $request - ); - } - $uri = $uri->withHost($records[0]['ip']); - } elseif ('v6' === $options['force_ip_resolve']) { - $records = dns_get_record($uri->getHost(), DNS_AAAA); - if (!isset($records[0]['ipv6'])) { - throw new ConnectException( - sprintf( - "Could not resolve IPv6 address for host '%s'", - $uri->getHost() - ), - $request - ); - } - $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']'); - } - } - - return $uri; - } - - private function getDefaultContext(RequestInterface $request) - { - $headers = ''; - foreach ($request->getHeaders() as $name => $value) { - foreach ($value as $val) { - $headers .= "$name: $val\r\n"; - } - } - - $context = [ - 'http' => [ - 'method' => $request->getMethod(), - 'header' => $headers, - 'protocol_version' => $request->getProtocolVersion(), - 'ignore_errors' => true, - 'follow_location' => 0, - ], - ]; - - $body = (string) $request->getBody(); - - if (!empty($body)) { - $context['http']['content'] = $body; - // Prevent the HTTP handler from adding a Content-Type header. - if (!$request->hasHeader('Content-Type')) { - $context['http']['header'] .= "Content-Type:\r\n"; - } - } - - $context['http']['header'] = rtrim($context['http']['header']); - - return $context; - } - - private function add_proxy(RequestInterface $request, &$options, $value, &$params) - { - if (!is_array($value)) { - $options['http']['proxy'] = $value; - } else { - $scheme = $request->getUri()->getScheme(); - if (isset($value[$scheme])) { - if (!isset($value['no']) - || !\GuzzleHttp\is_host_in_noproxy( - $request->getUri()->getHost(), - $value['no'] - ) - ) { - $options['http']['proxy'] = $value[$scheme]; - } - } - } - } - - private function add_timeout(RequestInterface $request, &$options, $value, &$params) - { - if ($value > 0) { - $options['http']['timeout'] = $value; - } - } - - private function add_verify(RequestInterface $request, &$options, $value, &$params) - { - if ($value === true) { - // PHP 5.6 or greater will find the system cert by default. When - // < 5.6, use the Guzzle bundled cacert. - if (PHP_VERSION_ID < 50600) { - $options['ssl']['cafile'] = \GuzzleHttp\default_ca_bundle(); - } - } elseif (is_string($value)) { - $options['ssl']['cafile'] = $value; - if (!file_exists($value)) { - throw new \RuntimeException("SSL CA bundle not found: $value"); - } - } elseif ($value === false) { - $options['ssl']['verify_peer'] = false; - $options['ssl']['verify_peer_name'] = false; - return; - } else { - throw new \InvalidArgumentException('Invalid verify request option'); - } - - $options['ssl']['verify_peer'] = true; - $options['ssl']['verify_peer_name'] = true; - $options['ssl']['allow_self_signed'] = false; - } - - private function add_cert(RequestInterface $request, &$options, $value, &$params) - { - if (is_array($value)) { - $options['ssl']['passphrase'] = $value[1]; - $value = $value[0]; - } - - if (!file_exists($value)) { - throw new \RuntimeException("SSL certificate not found: {$value}"); - } - - $options['ssl']['local_cert'] = $value; - } - - private function add_progress(RequestInterface $request, &$options, $value, &$params) - { - $this->addNotification( - $params, - function ($code, $a, $b, $c, $transferred, $total) use ($value) { - if ($code == STREAM_NOTIFY_PROGRESS) { - $value($total, $transferred, null, null); - } - } - ); - } - - private function add_debug(RequestInterface $request, &$options, $value, &$params) - { - if ($value === false) { - return; - } - - static $map = [ - STREAM_NOTIFY_CONNECT => 'CONNECT', - STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', - STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', - STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', - STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', - STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', - STREAM_NOTIFY_PROGRESS => 'PROGRESS', - STREAM_NOTIFY_FAILURE => 'FAILURE', - STREAM_NOTIFY_COMPLETED => 'COMPLETED', - STREAM_NOTIFY_RESOLVE => 'RESOLVE', - ]; - static $args = ['severity', 'message', 'message_code', - 'bytes_transferred', 'bytes_max']; - - $value = \GuzzleHttp\debug_resource($value); - $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); - $this->addNotification( - $params, - function () use ($ident, $value, $map, $args) { - $passed = func_get_args(); - $code = array_shift($passed); - fprintf($value, '<%s> [%s] ', $ident, $map[$code]); - foreach (array_filter($passed) as $i => $v) { - fwrite($value, $args[$i] . ': "' . $v . '" '); - } - fwrite($value, "\n"); - } - ); - } - - private function addNotification(array &$params, callable $notify) - { - // Wrap the existing function if needed. - if (!isset($params['notification'])) { - $params['notification'] = $notify; - } else { - $params['notification'] = $this->callArray([ - $params['notification'], - $notify - ]); - } - } - - private function callArray(array $functions) - { - return function () use ($functions) { - $args = func_get_args(); - foreach ($functions as $fn) { - call_user_func_array($fn, $args); - } - }; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php deleted file mode 100644 index f0016861..00000000 --- a/vendor/guzzlehttp/guzzle/src/HandlerStack.php +++ /dev/null @@ -1,273 +0,0 @@ -push(Middleware::httpErrors(), 'http_errors'); - $stack->push(Middleware::redirect(), 'allow_redirects'); - $stack->push(Middleware::cookies(), 'cookies'); - $stack->push(Middleware::prepareBody(), 'prepare_body'); - - return $stack; - } - - /** - * @param callable $handler Underlying HTTP handler. - */ - public function __construct(callable $handler = null) - { - $this->handler = $handler; - } - - /** - * Invokes the handler stack as a composed handler - * - * @param RequestInterface $request - * @param array $options - */ - public function __invoke(RequestInterface $request, array $options) - { - $handler = $this->resolve(); - - return $handler($request, $options); - } - - /** - * Dumps a string representation of the stack. - * - * @return string - */ - public function __toString() - { - $depth = 0; - $stack = []; - if ($this->handler) { - $stack[] = "0) Handler: " . $this->debugCallable($this->handler); - } - - $result = ''; - foreach (array_reverse($this->stack) as $tuple) { - $depth++; - $str = "{$depth}) Name: '{$tuple[1]}', "; - $str .= "Function: " . $this->debugCallable($tuple[0]); - $result = "> {$str}\n{$result}"; - $stack[] = $str; - } - - foreach (array_keys($stack) as $k) { - $result .= "< {$stack[$k]}\n"; - } - - return $result; - } - - /** - * Set the HTTP handler that actually returns a promise. - * - * @param callable $handler Accepts a request and array of options and - * returns a Promise. - */ - public function setHandler(callable $handler) - { - $this->handler = $handler; - $this->cached = null; - } - - /** - * Returns true if the builder has a handler. - * - * @return bool - */ - public function hasHandler() - { - return (bool) $this->handler; - } - - /** - * Unshift a middleware to the bottom of the stack. - * - * @param callable $middleware Middleware function - * @param string $name Name to register for this middleware. - */ - public function unshift(callable $middleware, $name = null) - { - array_unshift($this->stack, [$middleware, $name]); - $this->cached = null; - } - - /** - * Push a middleware to the top of the stack. - * - * @param callable $middleware Middleware function - * @param string $name Name to register for this middleware. - */ - public function push(callable $middleware, $name = '') - { - $this->stack[] = [$middleware, $name]; - $this->cached = null; - } - - /** - * Add a middleware before another middleware by name. - * - * @param string $findName Middleware to find - * @param callable $middleware Middleware function - * @param string $withName Name to register for this middleware. - */ - public function before($findName, callable $middleware, $withName = '') - { - $this->splice($findName, $withName, $middleware, true); - } - - /** - * Add a middleware after another middleware by name. - * - * @param string $findName Middleware to find - * @param callable $middleware Middleware function - * @param string $withName Name to register for this middleware. - */ - public function after($findName, callable $middleware, $withName = '') - { - $this->splice($findName, $withName, $middleware, false); - } - - /** - * Remove a middleware by instance or name from the stack. - * - * @param callable|string $remove Middleware to remove by instance or name. - */ - public function remove($remove) - { - $this->cached = null; - $idx = is_callable($remove) ? 0 : 1; - $this->stack = array_values(array_filter( - $this->stack, - function ($tuple) use ($idx, $remove) { - return $tuple[$idx] !== $remove; - } - )); - } - - /** - * Compose the middleware and handler into a single callable function. - * - * @return callable - */ - public function resolve() - { - if (!$this->cached) { - if (!($prev = $this->handler)) { - throw new \LogicException('No handler has been specified'); - } - - foreach (array_reverse($this->stack) as $fn) { - $prev = $fn[0]($prev); - } - - $this->cached = $prev; - } - - return $this->cached; - } - - /** - * @param string $name - * @return int - */ - private function findByName($name) - { - foreach ($this->stack as $k => $v) { - if ($v[1] === $name) { - return $k; - } - } - - throw new \InvalidArgumentException("Middleware not found: $name"); - } - - /** - * Splices a function into the middleware list at a specific position. - * - * @param string $findName - * @param string $withName - * @param callable $middleware - * @param bool $before - */ - private function splice($findName, $withName, callable $middleware, $before) - { - $this->cached = null; - $idx = $this->findByName($findName); - $tuple = [$middleware, $withName]; - - if ($before) { - if ($idx === 0) { - array_unshift($this->stack, $tuple); - } else { - $replacement = [$tuple, $this->stack[$idx]]; - array_splice($this->stack, $idx, 1, $replacement); - } - } elseif ($idx === count($this->stack) - 1) { - $this->stack[] = $tuple; - } else { - $replacement = [$this->stack[$idx], $tuple]; - array_splice($this->stack, $idx, 1, $replacement); - } - } - - /** - * Provides a debug string for a given callable. - * - * @param array|callable $fn Function to write as a string. - * - * @return string - */ - private function debugCallable($fn) - { - if (is_string($fn)) { - return "callable({$fn})"; - } - - if (is_array($fn)) { - return is_string($fn[0]) - ? "callable({$fn[0]}::{$fn[1]})" - : "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])"; - } - - return 'callable(' . spl_object_hash($fn) . ')'; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php deleted file mode 100644 index 663ac739..00000000 --- a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php +++ /dev/null @@ -1,180 +0,0 @@ ->>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; - const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}'; - - /** @var string Template used to format log messages */ - private $template; - - /** - * @param string $template Log message template - */ - public function __construct($template = self::CLF) - { - $this->template = $template ?: self::CLF; - } - - /** - * Returns a formatted message string. - * - * @param RequestInterface $request Request that was sent - * @param ResponseInterface $response Response that was received - * @param \Exception $error Exception that was received - * - * @return string - */ - public function format( - RequestInterface $request, - ResponseInterface $response = null, - \Exception $error = null - ) { - $cache = []; - - return preg_replace_callback( - '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', - function (array $matches) use ($request, $response, $error, &$cache) { - if (isset($cache[$matches[1]])) { - return $cache[$matches[1]]; - } - - $result = ''; - switch ($matches[1]) { - case 'request': - $result = Psr7\str($request); - break; - case 'response': - $result = $response ? Psr7\str($response) : ''; - break; - case 'req_headers': - $result = trim($request->getMethod() - . ' ' . $request->getRequestTarget()) - . ' HTTP/' . $request->getProtocolVersion() . "\r\n" - . $this->headers($request); - break; - case 'res_headers': - $result = $response ? - sprintf( - 'HTTP/%s %d %s', - $response->getProtocolVersion(), - $response->getStatusCode(), - $response->getReasonPhrase() - ) . "\r\n" . $this->headers($response) - : 'NULL'; - break; - case 'req_body': - $result = $request->getBody(); - break; - case 'res_body': - $result = $response ? $response->getBody() : 'NULL'; - break; - case 'ts': - case 'date_iso_8601': - $result = gmdate('c'); - break; - case 'date_common_log': - $result = date('d/M/Y:H:i:s O'); - break; - case 'method': - $result = $request->getMethod(); - break; - case 'version': - $result = $request->getProtocolVersion(); - break; - case 'uri': - case 'url': - $result = $request->getUri(); - break; - case 'target': - $result = $request->getRequestTarget(); - break; - case 'req_version': - $result = $request->getProtocolVersion(); - break; - case 'res_version': - $result = $response - ? $response->getProtocolVersion() - : 'NULL'; - break; - case 'host': - $result = $request->getHeaderLine('Host'); - break; - case 'hostname': - $result = gethostname(); - break; - case 'code': - $result = $response ? $response->getStatusCode() : 'NULL'; - break; - case 'phrase': - $result = $response ? $response->getReasonPhrase() : 'NULL'; - break; - case 'error': - $result = $error ? $error->getMessage() : 'NULL'; - break; - default: - // handle prefixed dynamic headers - if (strpos($matches[1], 'req_header_') === 0) { - $result = $request->getHeaderLine(substr($matches[1], 11)); - } elseif (strpos($matches[1], 'res_header_') === 0) { - $result = $response - ? $response->getHeaderLine(substr($matches[1], 11)) - : 'NULL'; - } - } - - $cache[$matches[1]] = $result; - return $result; - }, - $this->template - ); - } - - private function headers(MessageInterface $message) - { - $result = ''; - foreach ($message->getHeaders() as $name => $values) { - $result .= $name . ': ' . implode(', ', $values) . "\r\n"; - } - - return trim($result); - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Middleware.php b/vendor/guzzlehttp/guzzle/src/Middleware.php deleted file mode 100644 index bffc1974..00000000 --- a/vendor/guzzlehttp/guzzle/src/Middleware.php +++ /dev/null @@ -1,254 +0,0 @@ -withCookieHeader($request); - return $handler($request, $options) - ->then( - function ($response) use ($cookieJar, $request) { - $cookieJar->extractCookies($request, $response); - return $response; - } - ); - }; - }; - } - - /** - * Middleware that throws exceptions for 4xx or 5xx responses when the - * "http_error" request option is set to true. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function httpErrors() - { - return function (callable $handler) { - return function ($request, array $options) use ($handler) { - if (empty($options['http_errors'])) { - return $handler($request, $options); - } - return $handler($request, $options)->then( - function (ResponseInterface $response) use ($request) { - $code = $response->getStatusCode(); - if ($code < 400) { - return $response; - } - throw RequestException::create($request, $response); - } - ); - }; - }; - } - - /** - * Middleware that pushes history data to an ArrayAccess container. - * - * @param array|\ArrayAccess $container Container to hold the history (by reference). - * - * @return callable Returns a function that accepts the next handler. - * @throws \InvalidArgumentException if container is not an array or ArrayAccess. - */ - public static function history(&$container) - { - if (!is_array($container) && !$container instanceof \ArrayAccess) { - throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); - } - - return function (callable $handler) use (&$container) { - return function ($request, array $options) use ($handler, &$container) { - return $handler($request, $options)->then( - function ($value) use ($request, &$container, $options) { - $container[] = [ - 'request' => $request, - 'response' => $value, - 'error' => null, - 'options' => $options - ]; - return $value; - }, - function ($reason) use ($request, &$container, $options) { - $container[] = [ - 'request' => $request, - 'response' => null, - 'error' => $reason, - 'options' => $options - ]; - return \GuzzleHttp\Promise\rejection_for($reason); - } - ); - }; - }; - } - - /** - * Middleware that invokes a callback before and after sending a request. - * - * The provided listener cannot modify or alter the response. It simply - * "taps" into the chain to be notified before returning the promise. The - * before listener accepts a request and options array, and the after - * listener accepts a request, options array, and response promise. - * - * @param callable $before Function to invoke before forwarding the request. - * @param callable $after Function invoked after forwarding. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function tap(callable $before = null, callable $after = null) - { - return function (callable $handler) use ($before, $after) { - return function ($request, array $options) use ($handler, $before, $after) { - if ($before) { - $before($request, $options); - } - $response = $handler($request, $options); - if ($after) { - $after($request, $options, $response); - } - return $response; - }; - }; - } - - /** - * Middleware that handles request redirects. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function redirect() - { - return function (callable $handler) { - return new RedirectMiddleware($handler); - }; - } - - /** - * Middleware that retries requests based on the boolean result of - * invoking the provided "decider" function. - * - * If no delay function is provided, a simple implementation of exponential - * backoff will be utilized. - * - * @param callable $decider Function that accepts the number of retries, - * a request, [response], and [exception] and - * returns true if the request is to be retried. - * @param callable $delay Function that accepts the number of retries and - * returns the number of milliseconds to delay. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function retry(callable $decider, callable $delay = null) - { - return function (callable $handler) use ($decider, $delay) { - return new RetryMiddleware($decider, $handler, $delay); - }; - } - - /** - * Middleware that logs requests, responses, and errors using a message - * formatter. - * - * @param LoggerInterface $logger Logs messages. - * @param MessageFormatter $formatter Formatter used to create message strings. - * @param string $logLevel Level at which to log requests. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = 'info' /* \Psr\Log\LogLevel::INFO */) - { - return function (callable $handler) use ($logger, $formatter, $logLevel) { - return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) { - return $handler($request, $options)->then( - function ($response) use ($logger, $request, $formatter, $logLevel) { - $message = $formatter->format($request, $response); - $logger->log($logLevel, $message); - return $response; - }, - function ($reason) use ($logger, $request, $formatter) { - $response = $reason instanceof RequestException - ? $reason->getResponse() - : null; - $message = $formatter->format($request, $response, $reason); - $logger->notice($message); - return \GuzzleHttp\Promise\rejection_for($reason); - } - ); - }; - }; - } - - /** - * This middleware adds a default content-type if possible, a default - * content-length or transfer-encoding header, and the expect header. - * - * @return callable - */ - public static function prepareBody() - { - return function (callable $handler) { - return new PrepareBodyMiddleware($handler); - }; - } - - /** - * Middleware that applies a map function to the request before passing to - * the next handler. - * - * @param callable $fn Function that accepts a RequestInterface and returns - * a RequestInterface. - * @return callable - */ - public static function mapRequest(callable $fn) - { - return function (callable $handler) use ($fn) { - return function ($request, array $options) use ($handler, $fn) { - return $handler($fn($request), $options); - }; - }; - } - - /** - * Middleware that applies a map function to the resolved promise's - * response. - * - * @param callable $fn Function that accepts a ResponseInterface and - * returns a ResponseInterface. - * @return callable - */ - public static function mapResponse(callable $fn) - { - return function (callable $handler) use ($fn) { - return function ($request, array $options) use ($handler, $fn) { - return $handler($request, $options)->then($fn); - }; - }; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/Pool.php b/vendor/guzzlehttp/guzzle/src/Pool.php deleted file mode 100644 index 05c854ae..00000000 --- a/vendor/guzzlehttp/guzzle/src/Pool.php +++ /dev/null @@ -1,123 +0,0 @@ - $rfn) { - if ($rfn instanceof RequestInterface) { - yield $key => $client->sendAsync($rfn, $opts); - } elseif (is_callable($rfn)) { - yield $key => $rfn($opts); - } else { - throw new \InvalidArgumentException('Each value yielded by ' - . 'the iterator must be a Psr7\Http\Message\RequestInterface ' - . 'or a callable that returns a promise that fulfills ' - . 'with a Psr7\Message\Http\ResponseInterface object.'); - } - } - }; - - $this->each = new EachPromise($requests(), $config); - } - - public function promise() - { - return $this->each->promise(); - } - - /** - * Sends multiple requests concurrently and returns an array of responses - * and exceptions that uses the same ordering as the provided requests. - * - * IMPORTANT: This method keeps every request and response in memory, and - * as such, is NOT recommended when sending a large number or an - * indeterminate number of requests concurrently. - * - * @param ClientInterface $client Client used to send the requests - * @param array|\Iterator $requests Requests to send concurrently. - * @param array $options Passes through the options available in - * {@see GuzzleHttp\Pool::__construct} - * - * @return array Returns an array containing the response or an exception - * in the same order that the requests were sent. - * @throws \InvalidArgumentException if the event format is incorrect. - */ - public static function batch( - ClientInterface $client, - $requests, - array $options = [] - ) { - $res = []; - self::cmpCallback($options, 'fulfilled', $res); - self::cmpCallback($options, 'rejected', $res); - $pool = new static($client, $requests, $options); - $pool->promise()->wait(); - ksort($res); - - return $res; - } - - private static function cmpCallback(array &$options, $name, array &$results) - { - if (!isset($options[$name])) { - $options[$name] = function ($v, $k) use (&$results) { - $results[$k] = $v; - }; - } else { - $currentFn = $options[$name]; - $options[$name] = function ($v, $k) use (&$results, $currentFn) { - $currentFn($v, $k); - $results[$k] = $v; - }; - } - } -} diff --git a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php deleted file mode 100644 index 2eb95f9b..00000000 --- a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +++ /dev/null @@ -1,106 +0,0 @@ -nextHandler = $nextHandler; - } - - /** - * @param RequestInterface $request - * @param array $options - * - * @return PromiseInterface - */ - public function __invoke(RequestInterface $request, array $options) - { - $fn = $this->nextHandler; - - // Don't do anything if the request has no body. - if ($request->getBody()->getSize() === 0) { - return $fn($request, $options); - } - - $modify = []; - - // Add a default content-type if possible. - if (!$request->hasHeader('Content-Type')) { - if ($uri = $request->getBody()->getMetadata('uri')) { - if ($type = Psr7\mimetype_from_filename($uri)) { - $modify['set_headers']['Content-Type'] = $type; - } - } - } - - // Add a default content-length or transfer-encoding header. - if (!$request->hasHeader('Content-Length') - && !$request->hasHeader('Transfer-Encoding') - ) { - $size = $request->getBody()->getSize(); - if ($size !== null) { - $modify['set_headers']['Content-Length'] = $size; - } else { - $modify['set_headers']['Transfer-Encoding'] = 'chunked'; - } - } - - // Add the expect header if needed. - $this->addExpectHeader($request, $options, $modify); - - return $fn(Psr7\modify_request($request, $modify), $options); - } - - private function addExpectHeader( - RequestInterface $request, - array $options, - array &$modify - ) { - // Determine if the Expect header should be used - if ($request->hasHeader('Expect')) { - return; - } - - $expect = isset($options['expect']) ? $options['expect'] : null; - - // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0 - if ($expect === false || $request->getProtocolVersion() < 1.1) { - return; - } - - // The expect header is unconditionally enabled - if ($expect === true) { - $modify['set_headers']['Expect'] = '100-Continue'; - return; - } - - // By default, send the expect header when the payload is > 1mb - if ($expect === null) { - $expect = 1048576; - } - - // Always add if the body cannot be rewound, the size cannot be - // determined, or the size is greater than the cutoff threshold - $body = $request->getBody(); - $size = $body->getSize(); - - if ($size === null || $size >= (int) $expect || !$body->isSeekable()) { - $modify['set_headers']['Expect'] = '100-Continue'; - } - } -} diff --git a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php deleted file mode 100644 index bff4e4e8..00000000 --- a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +++ /dev/null @@ -1,237 +0,0 @@ - 5, - 'protocols' => ['http', 'https'], - 'strict' => false, - 'referer' => false, - 'track_redirects' => false, - ]; - - /** @var callable */ - private $nextHandler; - - /** - * @param callable $nextHandler Next handler to invoke. - */ - public function __construct(callable $nextHandler) - { - $this->nextHandler = $nextHandler; - } - - /** - * @param RequestInterface $request - * @param array $options - * - * @return PromiseInterface - */ - public function __invoke(RequestInterface $request, array $options) - { - $fn = $this->nextHandler; - - if (empty($options['allow_redirects'])) { - return $fn($request, $options); - } - - if ($options['allow_redirects'] === true) { - $options['allow_redirects'] = self::$defaultSettings; - } elseif (!is_array($options['allow_redirects'])) { - throw new \InvalidArgumentException('allow_redirects must be true, false, or array'); - } else { - // Merge the default settings with the provided settings - $options['allow_redirects'] += self::$defaultSettings; - } - - if (empty($options['allow_redirects']['max'])) { - return $fn($request, $options); - } - - return $fn($request, $options) - ->then(function (ResponseInterface $response) use ($request, $options) { - return $this->checkRedirect($request, $options, $response); - }); - } - - /** - * @param RequestInterface $request - * @param array $options - * @param ResponseInterface|PromiseInterface $response - * - * @return ResponseInterface|PromiseInterface - */ - public function checkRedirect( - RequestInterface $request, - array $options, - ResponseInterface $response - ) { - if (substr($response->getStatusCode(), 0, 1) != '3' - || !$response->hasHeader('Location') - ) { - return $response; - } - - $this->guardMax($request, $options); - $nextRequest = $this->modifyRequest($request, $options, $response); - - if (isset($options['allow_redirects']['on_redirect'])) { - call_user_func( - $options['allow_redirects']['on_redirect'], - $request, - $response, - $nextRequest->getUri() - ); - } - - /** @var PromiseInterface|ResponseInterface $promise */ - $promise = $this($nextRequest, $options); - - // Add headers to be able to track history of redirects. - if (!empty($options['allow_redirects']['track_redirects'])) { - return $this->withTracking( - $promise, - (string) $nextRequest->getUri(), - $response->getStatusCode() - ); - } - - return $promise; - } - - private function withTracking(PromiseInterface $promise, $uri, $statusCode) - { - return $promise->then( - function (ResponseInterface $response) use ($uri, $statusCode) { - // Note that we are pushing to the front of the list as this - // would be an earlier response than what is currently present - // in the history header. - $historyHeader = $response->getHeader(self::HISTORY_HEADER); - $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); - array_unshift($historyHeader, $uri); - array_unshift($statusHeader, $statusCode); - return $response->withHeader(self::HISTORY_HEADER, $historyHeader) - ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); - } - ); - } - - private function guardMax(RequestInterface $request, array &$options) - { - $current = isset($options['__redirect_count']) - ? $options['__redirect_count'] - : 0; - $options['__redirect_count'] = $current + 1; - $max = $options['allow_redirects']['max']; - - if ($options['__redirect_count'] > $max) { - throw new TooManyRedirectsException( - "Will not follow more than {$max} redirects", - $request - ); - } - } - - /** - * @param RequestInterface $request - * @param array $options - * @param ResponseInterface $response - * - * @return RequestInterface - */ - public function modifyRequest( - RequestInterface $request, - array $options, - ResponseInterface $response - ) { - // Request modifications to apply. - $modify = []; - $protocols = $options['allow_redirects']['protocols']; - - // Use a GET request if this is an entity enclosing request and we are - // not forcing RFC compliance, but rather emulating what all browsers - // would do. - $statusCode = $response->getStatusCode(); - if ($statusCode == 303 || - ($statusCode <= 302 && $request->getBody() && !$options['allow_redirects']['strict']) - ) { - $modify['method'] = 'GET'; - $modify['body'] = ''; - } - - $modify['uri'] = $this->redirectUri($request, $response, $protocols); - Psr7\rewind_body($request); - - // Add the Referer header if it is told to do so and only - // add the header if we are not redirecting from https to http. - if ($options['allow_redirects']['referer'] - && $modify['uri']->getScheme() === $request->getUri()->getScheme() - ) { - $uri = $request->getUri()->withUserInfo(''); - $modify['set_headers']['Referer'] = (string) $uri; - } else { - $modify['remove_headers'][] = 'Referer'; - } - - // Remove Authorization header if host is different. - if ($request->getUri()->getHost() !== $modify['uri']->getHost()) { - $modify['remove_headers'][] = 'Authorization'; - } - - return Psr7\modify_request($request, $modify); - } - - /** - * Set the appropriate URL on the request based on the location header - * - * @param RequestInterface $request - * @param ResponseInterface $response - * @param array $protocols - * - * @return UriInterface - */ - private function redirectUri( - RequestInterface $request, - ResponseInterface $response, - array $protocols - ) { - $location = Psr7\UriResolver::resolve( - $request->getUri(), - new Psr7\Uri($response->getHeaderLine('Location')) - ); - - // Ensure that the redirect URI is allowed based on the protocols. - if (!in_array($location->getScheme(), $protocols)) { - throw new BadResponseException( - sprintf( - 'Redirect URI, %s, does not use one of the allowed redirect protocols: %s', - $location, - implode(', ', $protocols) - ), - $request, - $response - ); - } - - return $location; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/vendor/guzzlehttp/guzzle/src/RequestOptions.php deleted file mode 100644 index 5c0fd19d..00000000 --- a/vendor/guzzlehttp/guzzle/src/RequestOptions.php +++ /dev/null @@ -1,255 +0,0 @@ -decider = $decider; - $this->nextHandler = $nextHandler; - $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; - } - - /** - * Default exponential backoff delay function. - * - * @param int $retries - * - * @return int - */ - public static function exponentialDelay($retries) - { - return (int) pow(2, $retries - 1); - } - - /** - * @param RequestInterface $request - * @param array $options - * - * @return PromiseInterface - */ - public function __invoke(RequestInterface $request, array $options) - { - if (!isset($options['retries'])) { - $options['retries'] = 0; - } - - $fn = $this->nextHandler; - return $fn($request, $options) - ->then( - $this->onFulfilled($request, $options), - $this->onRejected($request, $options) - ); - } - - private function onFulfilled(RequestInterface $req, array $options) - { - return function ($value) use ($req, $options) { - if (!call_user_func( - $this->decider, - $options['retries'], - $req, - $value, - null - )) { - return $value; - } - return $this->doRetry($req, $options, $value); - }; - } - - private function onRejected(RequestInterface $req, array $options) - { - return function ($reason) use ($req, $options) { - if (!call_user_func( - $this->decider, - $options['retries'], - $req, - null, - $reason - )) { - return \GuzzleHttp\Promise\rejection_for($reason); - } - return $this->doRetry($req, $options); - }; - } - - private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null) - { - $options['delay'] = call_user_func($this->delay, ++$options['retries'], $response); - - return $this($request, $options); - } -} diff --git a/vendor/guzzlehttp/guzzle/src/TransferStats.php b/vendor/guzzlehttp/guzzle/src/TransferStats.php deleted file mode 100644 index 23a22a33..00000000 --- a/vendor/guzzlehttp/guzzle/src/TransferStats.php +++ /dev/null @@ -1,126 +0,0 @@ -request = $request; - $this->response = $response; - $this->transferTime = $transferTime; - $this->handlerErrorData = $handlerErrorData; - $this->handlerStats = $handlerStats; - } - - /** - * @return RequestInterface - */ - public function getRequest() - { - return $this->request; - } - - /** - * Returns the response that was received (if any). - * - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - - /** - * Returns true if a response was received. - * - * @return bool - */ - public function hasResponse() - { - return $this->response !== null; - } - - /** - * Gets handler specific error data. - * - * This might be an exception, a integer representing an error code, or - * anything else. Relying on this value assumes that you know what handler - * you are using. - * - * @return mixed - */ - public function getHandlerErrorData() - { - return $this->handlerErrorData; - } - - /** - * Get the effective URI the request was sent to. - * - * @return UriInterface - */ - public function getEffectiveUri() - { - return $this->request->getUri(); - } - - /** - * Get the estimated time the request was being transferred by the handler. - * - * @return float Time in seconds. - */ - public function getTransferTime() - { - return $this->transferTime; - } - - /** - * Gets an array of all of the handler specific transfer data. - * - * @return array - */ - public function getHandlerStats() - { - return $this->handlerStats; - } - - /** - * Get a specific handler statistic from the handler by name. - * - * @param string $stat Handler specific transfer stat to retrieve. - * - * @return mixed|null - */ - public function getHandlerStat($stat) - { - return isset($this->handlerStats[$stat]) - ? $this->handlerStats[$stat] - : null; - } -} diff --git a/vendor/guzzlehttp/guzzle/src/UriTemplate.php b/vendor/guzzlehttp/guzzle/src/UriTemplate.php deleted file mode 100644 index 96dcfd09..00000000 --- a/vendor/guzzlehttp/guzzle/src/UriTemplate.php +++ /dev/null @@ -1,237 +0,0 @@ - ['prefix' => '', 'joiner' => ',', 'query' => false], - '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], - '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false], - '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false], - '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false], - ';' => ['prefix' => ';', 'joiner' => ';', 'query' => true], - '?' => ['prefix' => '?', 'joiner' => '&', 'query' => true], - '&' => ['prefix' => '&', 'joiner' => '&', 'query' => true] - ]; - - /** @var array Delimiters */ - private static $delims = [':', '/', '?', '#', '[', ']', '@', '!', '$', - '&', '\'', '(', ')', '*', '+', ',', ';', '=']; - - /** @var array Percent encoded delimiters */ - private static $delimsPct = ['%3A', '%2F', '%3F', '%23', '%5B', '%5D', - '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', - '%3B', '%3D']; - - public function expand($template, array $variables) - { - if (false === strpos($template, '{')) { - return $template; - } - - $this->template = $template; - $this->variables = $variables; - - return preg_replace_callback( - '/\{([^\}]+)\}/', - [$this, 'expandMatch'], - $this->template - ); - } - - /** - * Parse an expression into parts - * - * @param string $expression Expression to parse - * - * @return array Returns an associative array of parts - */ - private function parseExpression($expression) - { - $result = []; - - if (isset(self::$operatorHash[$expression[0]])) { - $result['operator'] = $expression[0]; - $expression = substr($expression, 1); - } else { - $result['operator'] = ''; - } - - foreach (explode(',', $expression) as $value) { - $value = trim($value); - $varspec = []; - if ($colonPos = strpos($value, ':')) { - $varspec['value'] = substr($value, 0, $colonPos); - $varspec['modifier'] = ':'; - $varspec['position'] = (int) substr($value, $colonPos + 1); - } elseif (substr($value, -1) === '*') { - $varspec['modifier'] = '*'; - $varspec['value'] = substr($value, 0, -1); - } else { - $varspec['value'] = (string) $value; - $varspec['modifier'] = ''; - } - $result['values'][] = $varspec; - } - - return $result; - } - - /** - * Process an expansion - * - * @param array $matches Matches met in the preg_replace_callback - * - * @return string Returns the replacement string - */ - private function expandMatch(array $matches) - { - static $rfc1738to3986 = ['+' => '%20', '%7e' => '~']; - - $replacements = []; - $parsed = self::parseExpression($matches[1]); - $prefix = self::$operatorHash[$parsed['operator']]['prefix']; - $joiner = self::$operatorHash[$parsed['operator']]['joiner']; - $useQuery = self::$operatorHash[$parsed['operator']]['query']; - - foreach ($parsed['values'] as $value) { - if (!isset($this->variables[$value['value']])) { - continue; - } - - $variable = $this->variables[$value['value']]; - $actuallyUseQuery = $useQuery; - $expanded = ''; - - if (is_array($variable)) { - $isAssoc = $this->isAssoc($variable); - $kvp = []; - foreach ($variable as $key => $var) { - if ($isAssoc) { - $key = rawurlencode($key); - $isNestedArray = is_array($var); - } else { - $isNestedArray = false; - } - - if (!$isNestedArray) { - $var = rawurlencode($var); - if ($parsed['operator'] === '+' || - $parsed['operator'] === '#' - ) { - $var = $this->decodeReserved($var); - } - } - - if ($value['modifier'] === '*') { - if ($isAssoc) { - if ($isNestedArray) { - // Nested arrays must allow for deeply nested - // structures. - $var = strtr( - http_build_query([$key => $var]), - $rfc1738to3986 - ); - } else { - $var = $key . '=' . $var; - } - } elseif ($key > 0 && $actuallyUseQuery) { - $var = $value['value'] . '=' . $var; - } - } - - $kvp[$key] = $var; - } - - if (empty($variable)) { - $actuallyUseQuery = false; - } elseif ($value['modifier'] === '*') { - $expanded = implode($joiner, $kvp); - if ($isAssoc) { - // Don't prepend the value name when using the explode - // modifier with an associative array. - $actuallyUseQuery = false; - } - } else { - if ($isAssoc) { - // When an associative array is encountered and the - // explode modifier is not set, then the result must be - // a comma separated list of keys followed by their - // respective values. - foreach ($kvp as $k => &$v) { - $v = $k . ',' . $v; - } - } - $expanded = implode(',', $kvp); - } - } else { - if ($value['modifier'] === ':') { - $variable = substr($variable, 0, $value['position']); - } - $expanded = rawurlencode($variable); - if ($parsed['operator'] === '+' || $parsed['operator'] === '#') { - $expanded = $this->decodeReserved($expanded); - } - } - - if ($actuallyUseQuery) { - if (!$expanded && $joiner !== '&') { - $expanded = $value['value']; - } else { - $expanded = $value['value'] . '=' . $expanded; - } - } - - $replacements[] = $expanded; - } - - $ret = implode($joiner, $replacements); - if ($ret && $prefix) { - return $prefix . $ret; - } - - return $ret; - } - - /** - * Determines if an array is associative. - * - * This makes the assumption that input arrays are sequences or hashes. - * This assumption is a tradeoff for accuracy in favor of speed, but it - * should work in almost every case where input is supplied for a URI - * template. - * - * @param array $array Array to check - * - * @return bool - */ - private function isAssoc(array $array) - { - return $array && array_keys($array)[0] !== 0; - } - - /** - * Removes percent encoding on reserved characters (used with + and # - * modifiers). - * - * @param string $string String to fix - * - * @return string - */ - private function decodeReserved($string) - { - return str_replace(self::$delimsPct, self::$delims, $string); - } -} diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php deleted file mode 100644 index 51d736d8..00000000 --- a/vendor/guzzlehttp/guzzle/src/functions.php +++ /dev/null @@ -1,346 +0,0 @@ -expand($template, $variables); -} - -/** - * Debug function used to describe the provided value type and class. - * - * @param mixed $input - * - * @return string Returns a string containing the type of the variable and - * if a class is provided, the class name. - */ -function describe_type($input) -{ - switch (gettype($input)) { - case 'object': - return 'object(' . get_class($input) . ')'; - case 'array': - return 'array(' . count($input) . ')'; - default: - ob_start(); - var_dump($input); - // normalize float vs double - return str_replace('double(', 'float(', rtrim(ob_get_clean())); - } -} - -/** - * Parses an array of header lines into an associative array of headers. - * - * @param array $lines Header lines array of strings in the following - * format: "Name: Value" - * @return array - */ -function headers_from_lines($lines) -{ - $headers = []; - - foreach ($lines as $line) { - $parts = explode(':', $line, 2); - $headers[trim($parts[0])][] = isset($parts[1]) - ? trim($parts[1]) - : null; - } - - return $headers; -} - -/** - * Returns a debug stream based on the provided variable. - * - * @param mixed $value Optional value - * - * @return resource - */ -function debug_resource($value = null) -{ - if (is_resource($value)) { - return $value; - } elseif (defined('STDOUT')) { - return STDOUT; - } - - return fopen('php://output', 'w'); -} - -/** - * Chooses and creates a default handler to use based on the environment. - * - * The returned handler is not wrapped by any default middlewares. - * - * @throws \RuntimeException if no viable Handler is available. - * @return callable Returns the best handler for the given system. - */ -function choose_handler() -{ - $handler = null; - if (function_exists('curl_multi_exec') && function_exists('curl_exec')) { - $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler()); - } elseif (function_exists('curl_exec')) { - $handler = new CurlHandler(); - } elseif (function_exists('curl_multi_exec')) { - $handler = new CurlMultiHandler(); - } - - if (ini_get('allow_url_fopen')) { - $handler = $handler - ? Proxy::wrapStreaming($handler, new StreamHandler()) - : new StreamHandler(); - } elseif (!$handler) { - throw new \RuntimeException('GuzzleHttp requires cURL, the ' - . 'allow_url_fopen ini setting, or a custom HTTP handler.'); - } - - return $handler; -} - -/** - * Get the default User-Agent string to use with Guzzle - * - * @return string - */ -function default_user_agent() -{ - static $defaultAgent = ''; - - if (!$defaultAgent) { - $defaultAgent = 'GuzzleHttp/' . Client::VERSION; - if (extension_loaded('curl') && function_exists('curl_version')) { - $defaultAgent .= ' curl/' . \curl_version()['version']; - } - $defaultAgent .= ' PHP/' . PHP_VERSION; - } - - return $defaultAgent; -} - -/** - * Returns the default cacert bundle for the current system. - * - * First, the openssl.cafile and curl.cainfo php.ini settings are checked. - * If those settings are not configured, then the common locations for - * bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X - * and Windows are checked. If any of these file locations are found on - * disk, they will be utilized. - * - * Note: the result of this function is cached for subsequent calls. - * - * @return string - * @throws \RuntimeException if no bundle can be found. - */ -function default_ca_bundle() -{ - static $cached = null; - static $cafiles = [ - // Red Hat, CentOS, Fedora (provided by the ca-certificates package) - '/etc/pki/tls/certs/ca-bundle.crt', - // Ubuntu, Debian (provided by the ca-certificates package) - '/etc/ssl/certs/ca-certificates.crt', - // FreeBSD (provided by the ca_root_nss package) - '/usr/local/share/certs/ca-root-nss.crt', - // SLES 12 (provided by the ca-certificates package) - '/var/lib/ca-certificates/ca-bundle.pem', - // OS X provided by homebrew (using the default path) - '/usr/local/etc/openssl/cert.pem', - // Google app engine - '/etc/ca-certificates.crt', - // Windows? - 'C:\\windows\\system32\\curl-ca-bundle.crt', - 'C:\\windows\\curl-ca-bundle.crt', - ]; - - if ($cached) { - return $cached; - } - - if ($ca = ini_get('openssl.cafile')) { - return $cached = $ca; - } - - if ($ca = ini_get('curl.cainfo')) { - return $cached = $ca; - } - - foreach ($cafiles as $filename) { - if (file_exists($filename)) { - return $cached = $filename; - } - } - - throw new \RuntimeException( - <<< EOT -No system CA bundle could be found in any of the the common system locations. -PHP versions earlier than 5.6 are not properly configured to use the system's -CA bundle by default. In order to verify peer certificates, you will need to -supply the path on disk to a certificate bundle to the 'verify' request -option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not -need a specific certificate bundle, then Mozilla provides a commonly used CA -bundle which can be downloaded here (provided by the maintainer of cURL): -https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt. Once -you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP -ini setting to point to the path to the file, allowing you to omit the 'verify' -request option. See http://curl.haxx.se/docs/sslcerts.html for more -information. -EOT - ); -} - -/** - * Creates an associative array of lowercase header names to the actual - * header casing. - * - * @param array $headers - * - * @return array - */ -function normalize_header_keys(array $headers) -{ - $result = []; - foreach (array_keys($headers) as $key) { - $result[strtolower($key)] = $key; - } - - return $result; -} - -/** - * Returns true if the provided host matches any of the no proxy areas. - * - * This method will strip a port from the host if it is present. Each pattern - * can be matched with an exact match (e.g., "foo.com" == "foo.com") or a - * partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" == - * "baz.foo.com", but ".foo.com" != "foo.com"). - * - * Areas are matched in the following cases: - * 1. "*" (without quotes) always matches any hosts. - * 2. An exact match. - * 3. The area starts with "." and the area is the last part of the host. e.g. - * '.mit.edu' will match any host that ends with '.mit.edu'. - * - * @param string $host Host to check against the patterns. - * @param array $noProxyArray An array of host patterns. - * - * @return bool - */ -function is_host_in_noproxy($host, array $noProxyArray) -{ - if (strlen($host) === 0) { - throw new \InvalidArgumentException('Empty host provided'); - } - - // Strip port if present. - if (strpos($host, ':')) { - $host = explode($host, ':', 2)[0]; - } - - foreach ($noProxyArray as $area) { - // Always match on wildcards. - if ($area === '*') { - return true; - } elseif (empty($area)) { - // Don't match on empty values. - continue; - } elseif ($area === $host) { - // Exact matches. - return true; - } else { - // Special match if the area when prefixed with ".". Remove any - // existing leading "." and add a new leading ".". - $area = '.' . ltrim($area, '.'); - if (substr($host, -(strlen($area))) === $area) { - return true; - } - } - } - - return false; -} - -/** - * Wrapper for json_decode that throws when an error occurs. - * - * @param string $json JSON data to parse - * @param bool $assoc When true, returned objects will be converted - * into associative arrays. - * @param int $depth User specified recursion depth. - * @param int $options Bitmask of JSON decode options. - * - * @return mixed - * @throws Exception\InvalidArgumentException if the JSON cannot be decoded. - * @link http://www.php.net/manual/en/function.json-decode.php - */ -function json_decode($json, $assoc = false, $depth = 512, $options = 0) -{ - $data = \json_decode($json, $assoc, $depth, $options); - if (JSON_ERROR_NONE !== json_last_error()) { - throw new Exception\InvalidArgumentException( - 'json_decode error: ' . json_last_error_msg() - ); - } - - return $data; -} - -/** - * Wrapper for JSON encoding that throws when an error occurs. - * - * @param mixed $value The value being encoded - * @param int $options JSON encode option bitmask - * @param int $depth Set the maximum depth. Must be greater than zero. - * - * @return string - * @throws Exception\InvalidArgumentException if the JSON cannot be encoded. - * @link http://www.php.net/manual/en/function.json-encode.php - */ -function json_encode($value, $options = 0, $depth = 512) -{ - $json = \json_encode($value, $options, $depth); - if (JSON_ERROR_NONE !== json_last_error()) { - throw new Exception\InvalidArgumentException( - 'json_encode error: ' . json_last_error_msg() - ); - } - - return $json; -} - -/** - * Wrapper for the hrtime() or microtime() functions - * (depending on the PHP version, one of the two is used) - * - * @return float|mixed UNIX timestamp - * @internal - */ -function _current_time() -{ - return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true); -} diff --git a/vendor/guzzlehttp/guzzle/src/functions_include.php b/vendor/guzzlehttp/guzzle/src/functions_include.php deleted file mode 100644 index a93393ac..00000000 --- a/vendor/guzzlehttp/guzzle/src/functions_include.php +++ /dev/null @@ -1,6 +0,0 @@ - - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/guzzlehttp/promises/Makefile b/vendor/guzzlehttp/promises/Makefile deleted file mode 100644 index 8d5b3ef9..00000000 --- a/vendor/guzzlehttp/promises/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -all: clean test - -test: - vendor/bin/phpunit - -coverage: - vendor/bin/phpunit --coverage-html=artifacts/coverage - -view-coverage: - open artifacts/coverage/index.html - -clean: - rm -rf artifacts/* diff --git a/vendor/guzzlehttp/promises/README.md b/vendor/guzzlehttp/promises/README.md deleted file mode 100644 index 7b607e28..00000000 --- a/vendor/guzzlehttp/promises/README.md +++ /dev/null @@ -1,504 +0,0 @@ -# Guzzle Promises - -[Promises/A+](https://promisesaplus.com/) implementation that handles promise -chaining and resolution iteratively, allowing for "infinite" promise chaining -while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/) -for a general introduction to promises. - -- [Features](#features) -- [Quick start](#quick-start) -- [Synchronous wait](#synchronous-wait) -- [Cancellation](#cancellation) -- [API](#api) - - [Promise](#promise) - - [FulfilledPromise](#fulfilledpromise) - - [RejectedPromise](#rejectedpromise) -- [Promise interop](#promise-interop) -- [Implementation notes](#implementation-notes) - - -# Features - -- [Promises/A+](https://promisesaplus.com/) implementation. -- Promise resolution and chaining is handled iteratively, allowing for - "infinite" promise chaining. -- Promises have a synchronous `wait` method. -- Promises can be cancelled. -- Works with any object that has a `then` function. -- C# style async/await coroutine promises using - `GuzzleHttp\Promise\coroutine()`. - - -# Quick start - -A *promise* represents the eventual result of an asynchronous operation. The -primary way of interacting with a promise is through its `then` method, which -registers callbacks to receive either a promise's eventual value or the reason -why the promise cannot be fulfilled. - - -## Callbacks - -Callbacks are registered with the `then` method by providing an optional -`$onFulfilled` followed by an optional `$onRejected` function. - - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then( - // $onFulfilled - function ($value) { - echo 'The promise was fulfilled.'; - }, - // $onRejected - function ($reason) { - echo 'The promise was rejected.'; - } -); -``` - -*Resolving* a promise means that you either fulfill a promise with a *value* or -reject a promise with a *reason*. Resolving a promises triggers callbacks -registered with the promises's `then` method. These callbacks are triggered -only once and in the order in which they were added. - - -## Resolving a promise - -Promises are fulfilled using the `resolve($value)` method. Resolving a promise -with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger -all of the onFulfilled callbacks (resolving a promise with a rejected promise -will reject the promise and trigger the `$onRejected` callbacks). - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise - ->then(function ($value) { - // Return a value and don't break the chain - return "Hello, " . $value; - }) - // This then is executed after the first then and receives the value - // returned from the first then. - ->then(function ($value) { - echo $value; - }); - -// Resolving the promise triggers the $onFulfilled callbacks and outputs -// "Hello, reader". -$promise->resolve('reader.'); -``` - - -## Promise forwarding - -Promises can be chained one after the other. Each then in the chain is a new -promise. The return value of a promise is what's forwarded to the next -promise in the chain. Returning a promise in a `then` callback will cause the -subsequent promises in the chain to only be fulfilled when the returned promise -has been fulfilled. The next promise in the chain will be invoked with the -resolved value of the promise. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$nextPromise = new Promise(); - -$promise - ->then(function ($value) use ($nextPromise) { - echo $value; - return $nextPromise; - }) - ->then(function ($value) { - echo $value; - }); - -// Triggers the first callback and outputs "A" -$promise->resolve('A'); -// Triggers the second callback and outputs "B" -$nextPromise->resolve('B'); -``` - -## Promise rejection - -When a promise is rejected, the `$onRejected` callbacks are invoked with the -rejection reason. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - echo $reason; -}); - -$promise->reject('Error!'); -// Outputs "Error!" -``` - -## Rejection forwarding - -If an exception is thrown in an `$onRejected` callback, subsequent -`$onRejected` callbacks are invoked with the thrown exception as the reason. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - throw new \Exception($reason); -})->then(null, function ($reason) { - assert($reason->getMessage() === 'Error!'); -}); - -$promise->reject('Error!'); -``` - -You can also forward a rejection down the promise chain by returning a -`GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or -`$onRejected` callback. - -```php -use GuzzleHttp\Promise\Promise; -use GuzzleHttp\Promise\RejectedPromise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - return new RejectedPromise($reason); -})->then(null, function ($reason) { - assert($reason === 'Error!'); -}); - -$promise->reject('Error!'); -``` - -If an exception is not thrown in a `$onRejected` callback and the callback -does not return a rejected promise, downstream `$onFulfilled` callbacks are -invoked using the value returned from the `$onRejected` callback. - -```php -use GuzzleHttp\Promise\Promise; -use GuzzleHttp\Promise\RejectedPromise; - -$promise = new Promise(); -$promise - ->then(null, function ($reason) { - return "It's ok"; - }) - ->then(function ($value) { - assert($value === "It's ok"); - }); - -$promise->reject('Error!'); -``` - -# Synchronous wait - -You can synchronously force promises to complete using a promise's `wait` -method. When creating a promise, you can provide a wait function that is used -to synchronously force a promise to complete. When a wait function is invoked -it is expected to deliver a value to the promise or reject the promise. If the -wait function does not deliver a value, then an exception is thrown. The wait -function provided to a promise constructor is invoked when the `wait` function -of the promise is called. - -```php -$promise = new Promise(function () use (&$promise) { - $promise->resolve('foo'); -}); - -// Calling wait will return the value of the promise. -echo $promise->wait(); // outputs "foo" -``` - -If an exception is encountered while invoking the wait function of a promise, -the promise is rejected with the exception and the exception is thrown. - -```php -$promise = new Promise(function () use (&$promise) { - throw new \Exception('foo'); -}); - -$promise->wait(); // throws the exception. -``` - -Calling `wait` on a promise that has been fulfilled will not trigger the wait -function. It will simply return the previously resolved value. - -```php -$promise = new Promise(function () { die('this is not called!'); }); -$promise->resolve('foo'); -echo $promise->wait(); // outputs "foo" -``` - -Calling `wait` on a promise that has been rejected will throw an exception. If -the rejection reason is an instance of `\Exception` the reason is thrown. -Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason -can be obtained by calling the `getReason` method of the exception. - -```php -$promise = new Promise(); -$promise->reject('foo'); -$promise->wait(); -``` - -> PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo' - - -## Unwrapping a promise - -When synchronously waiting on a promise, you are joining the state of the -promise into the current state of execution (i.e., return the value of the -promise if it was fulfilled or throw an exception if it was rejected). This is -called "unwrapping" the promise. Waiting on a promise will by default unwrap -the promise state. - -You can force a promise to resolve and *not* unwrap the state of the promise -by passing `false` to the first argument of the `wait` function: - -```php -$promise = new Promise(); -$promise->reject('foo'); -// This will not throw an exception. It simply ensures the promise has -// been resolved. -$promise->wait(false); -``` - -When unwrapping a promise, the resolved value of the promise will be waited -upon until the unwrapped value is not a promise. This means that if you resolve -promise A with a promise B and unwrap promise A, the value returned by the -wait function will be the value delivered to promise B. - -**Note**: when you do not unwrap the promise, no value is returned. - - -# Cancellation - -You can cancel a promise that has not yet been fulfilled using the `cancel()` -method of a promise. When creating a promise you can provide an optional -cancel function that when invoked cancels the action of computing a resolution -of the promise. - - -# API - - -## Promise - -When creating a promise object, you can provide an optional `$waitFn` and -`$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is -expected to resolve the promise. `$cancelFn` is a function with no arguments -that is expected to cancel the computation of a promise. It is invoked when the -`cancel()` method of a promise is called. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise( - function () use (&$promise) { - $promise->resolve('waited'); - }, - function () { - // do something that will cancel the promise computation (e.g., close - // a socket, cancel a database query, etc...) - } -); - -assert('waited' === $promise->wait()); -``` - -A promise has the following methods: - -- `then(callable $onFulfilled, callable $onRejected) : PromiseInterface` - - Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler. - -- `otherwise(callable $onRejected) : PromiseInterface` - - Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled. - -- `wait($unwrap = true) : mixed` - - Synchronously waits on the promise to complete. - - `$unwrap` controls whether or not the value of the promise is returned for a - fulfilled promise or if an exception is thrown if the promise is rejected. - This is set to `true` by default. - -- `cancel()` - - Attempts to cancel the promise if possible. The promise being cancelled and - the parent most ancestor that has not yet been resolved will also be - cancelled. Any promises waiting on the cancelled promise to resolve will also - be cancelled. - -- `getState() : string` - - Returns the state of the promise. One of `pending`, `fulfilled`, or - `rejected`. - -- `resolve($value)` - - Fulfills the promise with the given `$value`. - -- `reject($reason)` - - Rejects the promise with the given `$reason`. - - -## FulfilledPromise - -A fulfilled promise can be created to represent a promise that has been -fulfilled. - -```php -use GuzzleHttp\Promise\FulfilledPromise; - -$promise = new FulfilledPromise('value'); - -// Fulfilled callbacks are immediately invoked. -$promise->then(function ($value) { - echo $value; -}); -``` - - -## RejectedPromise - -A rejected promise can be created to represent a promise that has been -rejected. - -```php -use GuzzleHttp\Promise\RejectedPromise; - -$promise = new RejectedPromise('Error'); - -// Rejected callbacks are immediately invoked. -$promise->then(null, function ($reason) { - echo $reason; -}); -``` - - -# Promise interop - -This library works with foreign promises that have a `then` method. This means -you can use Guzzle promises with [React promises](https://github.com/reactphp/promise) -for example. When a foreign promise is returned inside of a then method -callback, promise resolution will occur recursively. - -```php -// Create a React promise -$deferred = new React\Promise\Deferred(); -$reactPromise = $deferred->promise(); - -// Create a Guzzle promise that is fulfilled with a React promise. -$guzzlePromise = new \GuzzleHttp\Promise\Promise(); -$guzzlePromise->then(function ($value) use ($reactPromise) { - // Do something something with the value... - // Return the React promise - return $reactPromise; -}); -``` - -Please note that wait and cancel chaining is no longer possible when forwarding -a foreign promise. You will need to wrap a third-party promise with a Guzzle -promise in order to utilize wait and cancel functions with foreign promises. - - -## Event Loop Integration - -In order to keep the stack size constant, Guzzle promises are resolved -asynchronously using a task queue. When waiting on promises synchronously, the -task queue will be automatically run to ensure that the blocking promise and -any forwarded promises are resolved. When using promises asynchronously in an -event loop, you will need to run the task queue on each tick of the loop. If -you do not run the task queue, then promises will not be resolved. - -You can run the task queue using the `run()` method of the global task queue -instance. - -```php -// Get the global task queue -$queue = \GuzzleHttp\Promise\queue(); -$queue->run(); -``` - -For example, you could use Guzzle promises with React using a periodic timer: - -```php -$loop = React\EventLoop\Factory::create(); -$loop->addPeriodicTimer(0, [$queue, 'run']); -``` - -*TODO*: Perhaps adding a `futureTick()` on each tick would be faster? - - -# Implementation notes - - -## Promise resolution and chaining is handled iteratively - -By shuffling pending handlers from one owner to another, promises are -resolved iteratively, allowing for "infinite" then chaining. - -```php -then(function ($v) { - // The stack size remains constant (a good thing) - echo xdebug_get_stack_depth() . ', '; - return $v + 1; - }); -} - -$parent->resolve(0); -var_dump($p->wait()); // int(1000) - -``` - -When a promise is fulfilled or rejected with a non-promise value, the promise -then takes ownership of the handlers of each child promise and delivers values -down the chain without using recursion. - -When a promise is resolved with another promise, the original promise transfers -all of its pending handlers to the new promise. When the new promise is -eventually resolved, all of the pending handlers are delivered the forwarded -value. - - -## A promise is the deferred. - -Some promise libraries implement promises using a deferred object to represent -a computation and a promise object to represent the delivery of the result of -the computation. This is a nice separation of computation and delivery because -consumers of the promise cannot modify the value that will be eventually -delivered. - -One side effect of being able to implement promise resolution and chaining -iteratively is that you need to be able for one promise to reach into the state -of another promise to shuffle around ownership of handlers. In order to achieve -this without making the handlers of a promise publicly mutable, a promise is -also the deferred value, allowing promises of the same parent class to reach -into and modify the private properties of promises of the same type. While this -does allow consumers of the value to modify the resolution or rejection of the -deferred, it is a small price to pay for keeping the stack size constant. - -```php -$promise = new Promise(); -$promise->then(function ($value) { echo $value; }); -// The promise is the deferred value, so you can deliver a value to it. -$promise->resolve('foo'); -// prints "foo" -``` diff --git a/vendor/guzzlehttp/promises/composer.json b/vendor/guzzlehttp/promises/composer.json deleted file mode 100644 index ec41a61e..00000000 --- a/vendor/guzzlehttp/promises/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "guzzlehttp/promises", - "description": "Guzzle promises library", - "keywords": ["promise"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": ["src/functions_include.php"] - }, - "scripts": { - "test": "vendor/bin/phpunit", - "test-ci": "vendor/bin/phpunit --coverage-text" - }, - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - } -} diff --git a/vendor/guzzlehttp/promises/src/AggregateException.php b/vendor/guzzlehttp/promises/src/AggregateException.php deleted file mode 100644 index 6a5690c3..00000000 --- a/vendor/guzzlehttp/promises/src/AggregateException.php +++ /dev/null @@ -1,16 +0,0 @@ -then(function ($v) { echo $v; }); - * - * @param callable $generatorFn Generator function to wrap into a promise. - * - * @return Promise - * @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration - */ -final class Coroutine implements PromiseInterface -{ - /** - * @var PromiseInterface|null - */ - private $currentPromise; - - /** - * @var Generator - */ - private $generator; - - /** - * @var Promise - */ - private $result; - - public function __construct(callable $generatorFn) - { - $this->generator = $generatorFn(); - $this->result = new Promise(function () { - while (isset($this->currentPromise)) { - $this->currentPromise->wait(); - } - }); - $this->nextCoroutine($this->generator->current()); - } - - public function then( - callable $onFulfilled = null, - callable $onRejected = null - ) { - return $this->result->then($onFulfilled, $onRejected); - } - - public function otherwise(callable $onRejected) - { - return $this->result->otherwise($onRejected); - } - - public function wait($unwrap = true) - { - return $this->result->wait($unwrap); - } - - public function getState() - { - return $this->result->getState(); - } - - public function resolve($value) - { - $this->result->resolve($value); - } - - public function reject($reason) - { - $this->result->reject($reason); - } - - public function cancel() - { - $this->currentPromise->cancel(); - $this->result->cancel(); - } - - private function nextCoroutine($yielded) - { - $this->currentPromise = promise_for($yielded) - ->then([$this, '_handleSuccess'], [$this, '_handleFailure']); - } - - /** - * @internal - */ - public function _handleSuccess($value) - { - unset($this->currentPromise); - try { - $next = $this->generator->send($value); - if ($this->generator->valid()) { - $this->nextCoroutine($next); - } else { - $this->result->resolve($value); - } - } catch (Exception $exception) { - $this->result->reject($exception); - } catch (Throwable $throwable) { - $this->result->reject($throwable); - } - } - - /** - * @internal - */ - public function _handleFailure($reason) - { - unset($this->currentPromise); - try { - $nextYield = $this->generator->throw(exception_for($reason)); - // The throw was caught, so keep iterating on the coroutine - $this->nextCoroutine($nextYield); - } catch (Exception $exception) { - $this->result->reject($exception); - } catch (Throwable $throwable) { - $this->result->reject($throwable); - } - } -} diff --git a/vendor/guzzlehttp/promises/src/EachPromise.php b/vendor/guzzlehttp/promises/src/EachPromise.php deleted file mode 100644 index d0ddf603..00000000 --- a/vendor/guzzlehttp/promises/src/EachPromise.php +++ /dev/null @@ -1,229 +0,0 @@ -iterable = iter_for($iterable); - - if (isset($config['concurrency'])) { - $this->concurrency = $config['concurrency']; - } - - if (isset($config['fulfilled'])) { - $this->onFulfilled = $config['fulfilled']; - } - - if (isset($config['rejected'])) { - $this->onRejected = $config['rejected']; - } - } - - public function promise() - { - if ($this->aggregate) { - return $this->aggregate; - } - - try { - $this->createPromise(); - $this->iterable->rewind(); - $this->refillPending(); - } catch (\Throwable $e) { - $this->aggregate->reject($e); - } catch (\Exception $e) { - $this->aggregate->reject($e); - } - - return $this->aggregate; - } - - private function createPromise() - { - $this->mutex = false; - $this->aggregate = new Promise(function () { - reset($this->pending); - if (empty($this->pending) && !$this->iterable->valid()) { - $this->aggregate->resolve(null); - return; - } - - // Consume a potentially fluctuating list of promises while - // ensuring that indexes are maintained (precluding array_shift). - while ($promise = current($this->pending)) { - next($this->pending); - $promise->wait(); - if ($this->aggregate->getState() !== PromiseInterface::PENDING) { - return; - } - } - }); - - // Clear the references when the promise is resolved. - $clearFn = function () { - $this->iterable = $this->concurrency = $this->pending = null; - $this->onFulfilled = $this->onRejected = null; - }; - - $this->aggregate->then($clearFn, $clearFn); - } - - private function refillPending() - { - if (!$this->concurrency) { - // Add all pending promises. - while ($this->addPending() && $this->advanceIterator()); - return; - } - - // Add only up to N pending promises. - $concurrency = is_callable($this->concurrency) - ? call_user_func($this->concurrency, count($this->pending)) - : $this->concurrency; - $concurrency = max($concurrency - count($this->pending), 0); - // Concurrency may be set to 0 to disallow new promises. - if (!$concurrency) { - return; - } - // Add the first pending promise. - $this->addPending(); - // Note this is special handling for concurrency=1 so that we do - // not advance the iterator after adding the first promise. This - // helps work around issues with generators that might not have the - // next value to yield until promise callbacks are called. - while (--$concurrency - && $this->advanceIterator() - && $this->addPending()); - } - - private function addPending() - { - if (!$this->iterable || !$this->iterable->valid()) { - return false; - } - - $promise = promise_for($this->iterable->current()); - $idx = $this->iterable->key(); - - $this->pending[$idx] = $promise->then( - function ($value) use ($idx) { - if ($this->onFulfilled) { - call_user_func( - $this->onFulfilled, $value, $idx, $this->aggregate - ); - } - $this->step($idx); - }, - function ($reason) use ($idx) { - if ($this->onRejected) { - call_user_func( - $this->onRejected, $reason, $idx, $this->aggregate - ); - } - $this->step($idx); - } - ); - - return true; - } - - private function advanceIterator() - { - // Place a lock on the iterator so that we ensure to not recurse, - // preventing fatal generator errors. - if ($this->mutex) { - return false; - } - - $this->mutex = true; - - try { - $this->iterable->next(); - $this->mutex = false; - return true; - } catch (\Throwable $e) { - $this->aggregate->reject($e); - $this->mutex = false; - return false; - } catch (\Exception $e) { - $this->aggregate->reject($e); - $this->mutex = false; - return false; - } - } - - private function step($idx) - { - // If the promise was already resolved, then ignore this step. - if ($this->aggregate->getState() !== PromiseInterface::PENDING) { - return; - } - - unset($this->pending[$idx]); - - // Only refill pending promises if we are not locked, preventing the - // EachPromise to recursively invoke the provided iterator, which - // cause a fatal error: "Cannot resume an already running generator" - if ($this->advanceIterator() && !$this->checkIfFinished()) { - // Add more pending promises if possible. - $this->refillPending(); - } - } - - private function checkIfFinished() - { - if (!$this->pending && !$this->iterable->valid()) { - // Resolve the promise if there's nothing left to do. - $this->aggregate->resolve(null); - return true; - } - - return false; - } -} diff --git a/vendor/guzzlehttp/promises/src/FulfilledPromise.php b/vendor/guzzlehttp/promises/src/FulfilledPromise.php deleted file mode 100644 index dbbeeb9f..00000000 --- a/vendor/guzzlehttp/promises/src/FulfilledPromise.php +++ /dev/null @@ -1,82 +0,0 @@ -value = $value; - } - - public function then( - callable $onFulfilled = null, - callable $onRejected = null - ) { - // Return itself if there is no onFulfilled function. - if (!$onFulfilled) { - return $this; - } - - $queue = queue(); - $p = new Promise([$queue, 'run']); - $value = $this->value; - $queue->add(static function () use ($p, $value, $onFulfilled) { - if ($p->getState() === self::PENDING) { - try { - $p->resolve($onFulfilled($value)); - } catch (\Throwable $e) { - $p->reject($e); - } catch (\Exception $e) { - $p->reject($e); - } - } - }); - - return $p; - } - - public function otherwise(callable $onRejected) - { - return $this->then(null, $onRejected); - } - - public function wait($unwrap = true, $defaultDelivery = null) - { - return $unwrap ? $this->value : null; - } - - public function getState() - { - return self::FULFILLED; - } - - public function resolve($value) - { - if ($value !== $this->value) { - throw new \LogicException("Cannot resolve a fulfilled promise"); - } - } - - public function reject($reason) - { - throw new \LogicException("Cannot reject a fulfilled promise"); - } - - public function cancel() - { - // pass - } -} diff --git a/vendor/guzzlehttp/promises/src/Promise.php b/vendor/guzzlehttp/promises/src/Promise.php deleted file mode 100644 index 844ada07..00000000 --- a/vendor/guzzlehttp/promises/src/Promise.php +++ /dev/null @@ -1,280 +0,0 @@ -waitFn = $waitFn; - $this->cancelFn = $cancelFn; - } - - public function then( - callable $onFulfilled = null, - callable $onRejected = null - ) { - if ($this->state === self::PENDING) { - $p = new Promise(null, [$this, 'cancel']); - $this->handlers[] = [$p, $onFulfilled, $onRejected]; - $p->waitList = $this->waitList; - $p->waitList[] = $this; - return $p; - } - - // Return a fulfilled promise and immediately invoke any callbacks. - if ($this->state === self::FULFILLED) { - return $onFulfilled - ? promise_for($this->result)->then($onFulfilled) - : promise_for($this->result); - } - - // It's either cancelled or rejected, so return a rejected promise - // and immediately invoke any callbacks. - $rejection = rejection_for($this->result); - return $onRejected ? $rejection->then(null, $onRejected) : $rejection; - } - - public function otherwise(callable $onRejected) - { - return $this->then(null, $onRejected); - } - - public function wait($unwrap = true) - { - $this->waitIfPending(); - - $inner = $this->result instanceof PromiseInterface - ? $this->result->wait($unwrap) - : $this->result; - - if ($unwrap) { - if ($this->result instanceof PromiseInterface - || $this->state === self::FULFILLED - ) { - return $inner; - } else { - // It's rejected so "unwrap" and throw an exception. - throw exception_for($inner); - } - } - } - - public function getState() - { - return $this->state; - } - - public function cancel() - { - if ($this->state !== self::PENDING) { - return; - } - - $this->waitFn = $this->waitList = null; - - if ($this->cancelFn) { - $fn = $this->cancelFn; - $this->cancelFn = null; - try { - $fn(); - } catch (\Throwable $e) { - $this->reject($e); - } catch (\Exception $e) { - $this->reject($e); - } - } - - // Reject the promise only if it wasn't rejected in a then callback. - if ($this->state === self::PENDING) { - $this->reject(new CancellationException('Promise has been cancelled')); - } - } - - public function resolve($value) - { - $this->settle(self::FULFILLED, $value); - } - - public function reject($reason) - { - $this->settle(self::REJECTED, $reason); - } - - private function settle($state, $value) - { - if ($this->state !== self::PENDING) { - // Ignore calls with the same resolution. - if ($state === $this->state && $value === $this->result) { - return; - } - throw $this->state === $state - ? new \LogicException("The promise is already {$state}.") - : new \LogicException("Cannot change a {$this->state} promise to {$state}"); - } - - if ($value === $this) { - throw new \LogicException('Cannot fulfill or reject a promise with itself'); - } - - // Clear out the state of the promise but stash the handlers. - $this->state = $state; - $this->result = $value; - $handlers = $this->handlers; - $this->handlers = null; - $this->waitList = $this->waitFn = null; - $this->cancelFn = null; - - if (!$handlers) { - return; - } - - // If the value was not a settled promise or a thenable, then resolve - // it in the task queue using the correct ID. - if (!method_exists($value, 'then')) { - $id = $state === self::FULFILLED ? 1 : 2; - // It's a success, so resolve the handlers in the queue. - queue()->add(static function () use ($id, $value, $handlers) { - foreach ($handlers as $handler) { - self::callHandler($id, $value, $handler); - } - }); - } elseif ($value instanceof Promise - && $value->getState() === self::PENDING - ) { - // We can just merge our handlers onto the next promise. - $value->handlers = array_merge($value->handlers, $handlers); - } else { - // Resolve the handlers when the forwarded promise is resolved. - $value->then( - static function ($value) use ($handlers) { - foreach ($handlers as $handler) { - self::callHandler(1, $value, $handler); - } - }, - static function ($reason) use ($handlers) { - foreach ($handlers as $handler) { - self::callHandler(2, $reason, $handler); - } - } - ); - } - } - - /** - * Call a stack of handlers using a specific callback index and value. - * - * @param int $index 1 (resolve) or 2 (reject). - * @param mixed $value Value to pass to the callback. - * @param array $handler Array of handler data (promise and callbacks). - * - * @return array Returns the next group to resolve. - */ - private static function callHandler($index, $value, array $handler) - { - /** @var PromiseInterface $promise */ - $promise = $handler[0]; - - // The promise may have been cancelled or resolved before placing - // this thunk in the queue. - if ($promise->getState() !== self::PENDING) { - return; - } - - try { - if (isset($handler[$index])) { - $promise->resolve($handler[$index]($value)); - } elseif ($index === 1) { - // Forward resolution values as-is. - $promise->resolve($value); - } else { - // Forward rejections down the chain. - $promise->reject($value); - } - } catch (\Throwable $reason) { - $promise->reject($reason); - } catch (\Exception $reason) { - $promise->reject($reason); - } - } - - private function waitIfPending() - { - if ($this->state !== self::PENDING) { - return; - } elseif ($this->waitFn) { - $this->invokeWaitFn(); - } elseif ($this->waitList) { - $this->invokeWaitList(); - } else { - // If there's not wait function, then reject the promise. - $this->reject('Cannot wait on a promise that has ' - . 'no internal wait function. You must provide a wait ' - . 'function when constructing the promise to be able to ' - . 'wait on a promise.'); - } - - queue()->run(); - - if ($this->state === self::PENDING) { - $this->reject('Invoking the wait callback did not resolve the promise'); - } - } - - private function invokeWaitFn() - { - try { - $wfn = $this->waitFn; - $this->waitFn = null; - $wfn(true); - } catch (\Exception $reason) { - if ($this->state === self::PENDING) { - // The promise has not been resolved yet, so reject the promise - // with the exception. - $this->reject($reason); - } else { - // The promise was already resolved, so there's a problem in - // the application. - throw $reason; - } - } - } - - private function invokeWaitList() - { - $waitList = $this->waitList; - $this->waitList = null; - - foreach ($waitList as $result) { - while (true) { - $result->waitIfPending(); - - if ($result->result instanceof Promise) { - $result = $result->result; - } else { - if ($result->result instanceof PromiseInterface) { - $result->result->wait(false); - } - break; - } - } - } - } -} diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php deleted file mode 100644 index 8f5f4b99..00000000 --- a/vendor/guzzlehttp/promises/src/PromiseInterface.php +++ /dev/null @@ -1,93 +0,0 @@ -reason = $reason; - } - - public function then( - callable $onFulfilled = null, - callable $onRejected = null - ) { - // If there's no onRejected callback then just return self. - if (!$onRejected) { - return $this; - } - - $queue = queue(); - $reason = $this->reason; - $p = new Promise([$queue, 'run']); - $queue->add(static function () use ($p, $reason, $onRejected) { - if ($p->getState() === self::PENDING) { - try { - // Return a resolved promise if onRejected does not throw. - $p->resolve($onRejected($reason)); - } catch (\Throwable $e) { - // onRejected threw, so return a rejected promise. - $p->reject($e); - } catch (\Exception $e) { - // onRejected threw, so return a rejected promise. - $p->reject($e); - } - } - }); - - return $p; - } - - public function otherwise(callable $onRejected) - { - return $this->then(null, $onRejected); - } - - public function wait($unwrap = true, $defaultDelivery = null) - { - if ($unwrap) { - throw exception_for($this->reason); - } - } - - public function getState() - { - return self::REJECTED; - } - - public function resolve($value) - { - throw new \LogicException("Cannot resolve a rejected promise"); - } - - public function reject($reason) - { - if ($reason !== $this->reason) { - throw new \LogicException("Cannot reject a rejected promise"); - } - } - - public function cancel() - { - // pass - } -} diff --git a/vendor/guzzlehttp/promises/src/RejectionException.php b/vendor/guzzlehttp/promises/src/RejectionException.php deleted file mode 100644 index 07c1136d..00000000 --- a/vendor/guzzlehttp/promises/src/RejectionException.php +++ /dev/null @@ -1,47 +0,0 @@ -reason = $reason; - - $message = 'The promise was rejected'; - - if ($description) { - $message .= ' with reason: ' . $description; - } elseif (is_string($reason) - || (is_object($reason) && method_exists($reason, '__toString')) - ) { - $message .= ' with reason: ' . $this->reason; - } elseif ($reason instanceof \JsonSerializable) { - $message .= ' with reason: ' - . json_encode($this->reason, JSON_PRETTY_PRINT); - } - - parent::__construct($message); - } - - /** - * Returns the rejection reason. - * - * @return mixed - */ - public function getReason() - { - return $this->reason; - } -} diff --git a/vendor/guzzlehttp/promises/src/TaskQueue.php b/vendor/guzzlehttp/promises/src/TaskQueue.php deleted file mode 100644 index 6e8a2a08..00000000 --- a/vendor/guzzlehttp/promises/src/TaskQueue.php +++ /dev/null @@ -1,66 +0,0 @@ -run(); - */ -class TaskQueue implements TaskQueueInterface -{ - private $enableShutdown = true; - private $queue = []; - - public function __construct($withShutdown = true) - { - if ($withShutdown) { - register_shutdown_function(function () { - if ($this->enableShutdown) { - // Only run the tasks if an E_ERROR didn't occur. - $err = error_get_last(); - if (!$err || ($err['type'] ^ E_ERROR)) { - $this->run(); - } - } - }); - } - } - - public function isEmpty() - { - return !$this->queue; - } - - public function add(callable $task) - { - $this->queue[] = $task; - } - - public function run() - { - /** @var callable $task */ - while ($task = array_shift($this->queue)) { - $task(); - } - } - - /** - * The task queue will be run and exhausted by default when the process - * exits IFF the exit is not the result of a PHP E_ERROR error. - * - * You can disable running the automatic shutdown of the queue by calling - * this function. If you disable the task queue shutdown process, then you - * MUST either run the task queue (as a result of running your event loop - * or manually using the run() method) or wait on each outstanding promise. - * - * Note: This shutdown will occur before any destructors are triggered. - */ - public function disableShutdown() - { - $this->enableShutdown = false; - } -} diff --git a/vendor/guzzlehttp/promises/src/TaskQueueInterface.php b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php deleted file mode 100644 index ac8306e1..00000000 --- a/vendor/guzzlehttp/promises/src/TaskQueueInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * while ($eventLoop->isRunning()) { - * GuzzleHttp\Promise\queue()->run(); - * } - * - * - * @param TaskQueueInterface $assign Optionally specify a new queue instance. - * - * @return TaskQueueInterface - */ -function queue(TaskQueueInterface $assign = null) -{ - static $queue; - - if ($assign) { - $queue = $assign; - } elseif (!$queue) { - $queue = new TaskQueue(); - } - - return $queue; -} - -/** - * Adds a function to run in the task queue when it is next `run()` and returns - * a promise that is fulfilled or rejected with the result. - * - * @param callable $task Task function to run. - * - * @return PromiseInterface - */ -function task(callable $task) -{ - $queue = queue(); - $promise = new Promise([$queue, 'run']); - $queue->add(function () use ($task, $promise) { - try { - $promise->resolve($task()); - } catch (\Throwable $e) { - $promise->reject($e); - } catch (\Exception $e) { - $promise->reject($e); - } - }); - - return $promise; -} - -/** - * Creates a promise for a value if the value is not a promise. - * - * @param mixed $value Promise or value. - * - * @return PromiseInterface - */ -function promise_for($value) -{ - if ($value instanceof PromiseInterface) { - return $value; - } - - // Return a Guzzle promise that shadows the given promise. - if (method_exists($value, 'then')) { - $wfn = method_exists($value, 'wait') ? [$value, 'wait'] : null; - $cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null; - $promise = new Promise($wfn, $cfn); - $value->then([$promise, 'resolve'], [$promise, 'reject']); - return $promise; - } - - return new FulfilledPromise($value); -} - -/** - * Creates a rejected promise for a reason if the reason is not a promise. If - * the provided reason is a promise, then it is returned as-is. - * - * @param mixed $reason Promise or reason. - * - * @return PromiseInterface - */ -function rejection_for($reason) -{ - if ($reason instanceof PromiseInterface) { - return $reason; - } - - return new RejectedPromise($reason); -} - -/** - * Create an exception for a rejected promise value. - * - * @param mixed $reason - * - * @return \Exception|\Throwable - */ -function exception_for($reason) -{ - return $reason instanceof \Exception || $reason instanceof \Throwable - ? $reason - : new RejectionException($reason); -} - -/** - * Returns an iterator for the given value. - * - * @param mixed $value - * - * @return \Iterator - */ -function iter_for($value) -{ - if ($value instanceof \Iterator) { - return $value; - } elseif (is_array($value)) { - return new \ArrayIterator($value); - } else { - return new \ArrayIterator([$value]); - } -} - -/** - * Synchronously waits on a promise to resolve and returns an inspection state - * array. - * - * Returns a state associative array containing a "state" key mapping to a - * valid promise state. If the state of the promise is "fulfilled", the array - * will contain a "value" key mapping to the fulfilled value of the promise. If - * the promise is rejected, the array will contain a "reason" key mapping to - * the rejection reason of the promise. - * - * @param PromiseInterface $promise Promise or value. - * - * @return array - */ -function inspect(PromiseInterface $promise) -{ - try { - return [ - 'state' => PromiseInterface::FULFILLED, - 'value' => $promise->wait() - ]; - } catch (RejectionException $e) { - return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()]; - } catch (\Throwable $e) { - return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; - } catch (\Exception $e) { - return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; - } -} - -/** - * Waits on all of the provided promises, but does not unwrap rejected promises - * as thrown exception. - * - * Returns an array of inspection state arrays. - * - * @param PromiseInterface[] $promises Traversable of promises to wait upon. - * - * @return array - * @see GuzzleHttp\Promise\inspect for the inspection state array format. - */ -function inspect_all($promises) -{ - $results = []; - foreach ($promises as $key => $promise) { - $results[$key] = inspect($promise); - } - - return $results; -} - -/** - * Waits on all of the provided promises and returns the fulfilled values. - * - * Returns an array that contains the value of each promise (in the same order - * the promises were provided). An exception is thrown if any of the promises - * are rejected. - * - * @param mixed $promises Iterable of PromiseInterface objects to wait on. - * - * @return array - * @throws \Exception on error - * @throws \Throwable on error in PHP >=7 - */ -function unwrap($promises) -{ - $results = []; - foreach ($promises as $key => $promise) { - $results[$key] = $promise->wait(); - } - - return $results; -} - -/** - * Given an array of promises, return a promise that is fulfilled when all the - * items in the array are fulfilled. - * - * The promise's fulfillment value is an array with fulfillment values at - * respective positions to the original array. If any promise in the array - * rejects, the returned promise is rejected with the rejection reason. - * - * @param mixed $promises Promises or values. - * - * @return PromiseInterface - */ -function all($promises) -{ - $results = []; - return each( - $promises, - function ($value, $idx) use (&$results) { - $results[$idx] = $value; - }, - function ($reason, $idx, Promise $aggregate) { - $aggregate->reject($reason); - } - )->then(function () use (&$results) { - ksort($results); - return $results; - }); -} - -/** - * Initiate a competitive race between multiple promises or values (values will - * become immediately fulfilled promises). - * - * When count amount of promises have been fulfilled, the returned promise is - * fulfilled with an array that contains the fulfillment values of the winners - * in order of resolution. - * - * This prommise is rejected with a {@see GuzzleHttp\Promise\AggregateException} - * if the number of fulfilled promises is less than the desired $count. - * - * @param int $count Total number of promises. - * @param mixed $promises Promises or values. - * - * @return PromiseInterface - */ -function some($count, $promises) -{ - $results = []; - $rejections = []; - - return each( - $promises, - function ($value, $idx, PromiseInterface $p) use (&$results, $count) { - if ($p->getState() !== PromiseInterface::PENDING) { - return; - } - $results[$idx] = $value; - if (count($results) >= $count) { - $p->resolve(null); - } - }, - function ($reason) use (&$rejections) { - $rejections[] = $reason; - } - )->then( - function () use (&$results, &$rejections, $count) { - if (count($results) !== $count) { - throw new AggregateException( - 'Not enough promises to fulfill count', - $rejections - ); - } - ksort($results); - return array_values($results); - } - ); -} - -/** - * Like some(), with 1 as count. However, if the promise fulfills, the - * fulfillment value is not an array of 1 but the value directly. - * - * @param mixed $promises Promises or values. - * - * @return PromiseInterface - */ -function any($promises) -{ - return some(1, $promises)->then(function ($values) { return $values[0]; }); -} - -/** - * Returns a promise that is fulfilled when all of the provided promises have - * been fulfilled or rejected. - * - * The returned promise is fulfilled with an array of inspection state arrays. - * - * @param mixed $promises Promises or values. - * - * @return PromiseInterface - * @see GuzzleHttp\Promise\inspect for the inspection state array format. - */ -function settle($promises) -{ - $results = []; - - return each( - $promises, - function ($value, $idx) use (&$results) { - $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; - }, - function ($reason, $idx) use (&$results) { - $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason]; - } - )->then(function () use (&$results) { - ksort($results); - return $results; - }); -} - -/** - * Given an iterator that yields promises or values, returns a promise that is - * fulfilled with a null value when the iterator has been consumed or the - * aggregate promise has been fulfilled or rejected. - * - * $onFulfilled is a function that accepts the fulfilled value, iterator - * index, and the aggregate promise. The callback can invoke any necessary side - * effects and choose to resolve or reject the aggregate promise if needed. - * - * $onRejected is a function that accepts the rejection reason, iterator - * index, and the aggregate promise. The callback can invoke any necessary side - * effects and choose to resolve or reject the aggregate promise if needed. - * - * @param mixed $iterable Iterator or array to iterate over. - * @param callable $onFulfilled - * @param callable $onRejected - * - * @return PromiseInterface - */ -function each( - $iterable, - callable $onFulfilled = null, - callable $onRejected = null -) { - return (new EachPromise($iterable, [ - 'fulfilled' => $onFulfilled, - 'rejected' => $onRejected - ]))->promise(); -} - -/** - * Like each, but only allows a certain number of outstanding promises at any - * given time. - * - * $concurrency may be an integer or a function that accepts the number of - * pending promises and returns a numeric concurrency limit value to allow for - * dynamic a concurrency size. - * - * @param mixed $iterable - * @param int|callable $concurrency - * @param callable $onFulfilled - * @param callable $onRejected - * - * @return PromiseInterface - */ -function each_limit( - $iterable, - $concurrency, - callable $onFulfilled = null, - callable $onRejected = null -) { - return (new EachPromise($iterable, [ - 'fulfilled' => $onFulfilled, - 'rejected' => $onRejected, - 'concurrency' => $concurrency - ]))->promise(); -} - -/** - * Like each_limit, but ensures that no promise in the given $iterable argument - * is rejected. If any promise is rejected, then the aggregate promise is - * rejected with the encountered rejection. - * - * @param mixed $iterable - * @param int|callable $concurrency - * @param callable $onFulfilled - * - * @return PromiseInterface - */ -function each_limit_all( - $iterable, - $concurrency, - callable $onFulfilled = null -) { - return each_limit( - $iterable, - $concurrency, - $onFulfilled, - function ($reason, $idx, PromiseInterface $aggregate) { - $aggregate->reject($reason); - } - ); -} - -/** - * Returns true if a promise is fulfilled. - * - * @param PromiseInterface $promise - * - * @return bool - */ -function is_fulfilled(PromiseInterface $promise) -{ - return $promise->getState() === PromiseInterface::FULFILLED; -} - -/** - * Returns true if a promise is rejected. - * - * @param PromiseInterface $promise - * - * @return bool - */ -function is_rejected(PromiseInterface $promise) -{ - return $promise->getState() === PromiseInterface::REJECTED; -} - -/** - * Returns true if a promise is fulfilled or rejected. - * - * @param PromiseInterface $promise - * - * @return bool - */ -function is_settled(PromiseInterface $promise) -{ - return $promise->getState() !== PromiseInterface::PENDING; -} - -/** - * @see Coroutine - * - * @param callable $generatorFn - * - * @return PromiseInterface - */ -function coroutine(callable $generatorFn) -{ - return new Coroutine($generatorFn); -} diff --git a/vendor/guzzlehttp/promises/src/functions_include.php b/vendor/guzzlehttp/promises/src/functions_include.php deleted file mode 100644 index 34cd1710..00000000 --- a/vendor/guzzlehttp/promises/src/functions_include.php +++ /dev/null @@ -1,6 +0,0 @@ -withPath('foo')->withHost('example.com')` will throw an exception - because the path of a URI with an authority must start with a slash "/" or be empty - - `(new Uri())->withScheme('http')` will return `'http://localhost'` - -### Deprecated - -- `Uri::resolve` in favor of `UriResolver::resolve` -- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` - -### Fixed - -- `Stream::read` when length parameter <= 0. -- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. -- `ServerRequest::getUriFromGlobals` when `Host` header contains port. -- Compatibility of URIs with `file` scheme and empty host. - - -## [1.3.1] - 2016-06-25 - -### Fixed - -- `Uri::__toString` for network path references, e.g. `//example.org`. -- Missing lowercase normalization for host. -- Handling of URI components in case they are `'0'` in a lot of places, - e.g. as a user info password. -- `Uri::withAddedHeader` to correctly merge headers with different case. -- Trimming of header values in `Uri::withAddedHeader`. Header values may - be surrounded by whitespace which should be ignored according to RFC 7230 - Section 3.2.4. This does not apply to header names. -- `Uri::withAddedHeader` with an array of header values. -- `Uri::resolve` when base path has no slash and handling of fragment. -- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the - key/value both in encoded as well as decoded form to those methods. This is - consistent with withPath, withQuery etc. -- `ServerRequest::withoutAttribute` when attribute value is null. - - -## [1.3.0] - 2016-04-13 - -### Added - -- Remaining interfaces needed for full PSR7 compatibility - (ServerRequestInterface, UploadedFileInterface, etc.). -- Support for stream_for from scalars. - -### Changed - -- Can now extend Uri. - -### Fixed -- A bug in validating request methods by making it more permissive. - - -## [1.2.3] - 2016-02-18 - -### Fixed - -- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote - streams, which can sometimes return fewer bytes than requested with `fread`. -- Handling of gzipped responses with FNAME headers. - - -## [1.2.2] - 2016-01-22 - -### Added - -- Support for URIs without any authority. -- Support for HTTP 451 'Unavailable For Legal Reasons.' -- Support for using '0' as a filename. -- Support for including non-standard ports in Host headers. - - -## [1.2.1] - 2015-11-02 - -### Changes - -- Now supporting negative offsets when seeking to SEEK_END. - - -## [1.2.0] - 2015-08-15 - -### Changed - -- Body as `"0"` is now properly added to a response. -- Now allowing forward seeking in CachingStream. -- Now properly parsing HTTP requests that contain proxy targets in - `parse_request`. -- functions.php is now conditionally required. -- user-info is no longer dropped when resolving URIs. - - -## [1.1.0] - 2015-06-24 - -### Changed - -- URIs can now be relative. -- `multipart/form-data` headers are now overridden case-insensitively. -- URI paths no longer encode the following characters because they are allowed - in URIs: "(", ")", "*", "!", "'" -- A port is no longer added to a URI when the scheme is missing and no port is - present. - - -## 1.0.0 - 2015-05-19 - -Initial release. - -Currently unsupported: - -- `Psr\Http\Message\ServerRequestInterface` -- `Psr\Http\Message\UploadedFileInterface` - - - -[Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD -[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 -[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 -[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 -[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 -[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 -[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 -[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 -[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 -[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 -[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 -[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 -[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 -[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 -[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/vendor/guzzlehttp/psr7/LICENSE b/vendor/guzzlehttp/psr7/LICENSE deleted file mode 100644 index 581d95f9..00000000 --- a/vendor/guzzlehttp/psr7/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md deleted file mode 100644 index c60a6a38..00000000 --- a/vendor/guzzlehttp/psr7/README.md +++ /dev/null @@ -1,745 +0,0 @@ -# PSR-7 Message Implementation - -This repository contains a full [PSR-7](http://www.php-fig.org/psr/psr-7/) -message implementation, several stream decorators, and some helpful -functionality like query string parsing. - - -[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7) - - -# Stream implementation - -This package comes with a number of stream implementations and stream -decorators. - - -## AppendStream - -`GuzzleHttp\Psr7\AppendStream` - -Reads from multiple streams, one after the other. - -```php -use GuzzleHttp\Psr7; - -$a = Psr7\stream_for('abc, '); -$b = Psr7\stream_for('123.'); -$composed = new Psr7\AppendStream([$a, $b]); - -$composed->addStream(Psr7\stream_for(' Above all listen to me')); - -echo $composed; // abc, 123. Above all listen to me. -``` - - -## BufferStream - -`GuzzleHttp\Psr7\BufferStream` - -Provides a buffer stream that can be written to fill a buffer, and read -from to remove bytes from the buffer. - -This stream returns a "hwm" metadata value that tells upstream consumers -what the configured high water mark of the stream is, or the maximum -preferred size of the buffer. - -```php -use GuzzleHttp\Psr7; - -// When more than 1024 bytes are in the buffer, it will begin returning -// false to writes. This is an indication that writers should slow down. -$buffer = new Psr7\BufferStream(1024); -``` - - -## CachingStream - -The CachingStream is used to allow seeking over previously read bytes on -non-seekable streams. This can be useful when transferring a non-seekable -entity body fails due to needing to rewind the stream (for example, resulting -from a redirect). Data that is read from the remote stream will be buffered in -a PHP temp stream so that previously read bytes are cached first in memory, -then on disk. - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\stream_for(fopen('http://www.google.com', 'r')); -$stream = new Psr7\CachingStream($original); - -$stream->read(1024); -echo $stream->tell(); -// 1024 - -$stream->seek(0); -echo $stream->tell(); -// 0 -``` - - -## DroppingStream - -`GuzzleHttp\Psr7\DroppingStream` - -Stream decorator that begins dropping data once the size of the underlying -stream becomes too full. - -```php -use GuzzleHttp\Psr7; - -// Create an empty stream -$stream = Psr7\stream_for(); - -// Start dropping data when the stream has more than 10 bytes -$dropping = new Psr7\DroppingStream($stream, 10); - -$dropping->write('01234567890123456789'); -echo $stream; // 0123456789 -``` - - -## FnStream - -`GuzzleHttp\Psr7\FnStream` - -Compose stream implementations based on a hash of functions. - -Allows for easy testing and extension of a provided stream without needing -to create a concrete class for a simple extension point. - -```php - -use GuzzleHttp\Psr7; - -$stream = Psr7\stream_for('hi'); -$fnStream = Psr7\FnStream::decorate($stream, [ - 'rewind' => function () use ($stream) { - echo 'About to rewind - '; - $stream->rewind(); - echo 'rewound!'; - } -]); - -$fnStream->rewind(); -// Outputs: About to rewind - rewound! -``` - - -## InflateStream - -`GuzzleHttp\Psr7\InflateStream` - -Uses PHP's zlib.inflate filter to inflate deflate or gzipped content. - -This stream decorator skips the first 10 bytes of the given stream to remove -the gzip header, converts the provided stream to a PHP stream resource, -then appends the zlib.inflate filter. The stream is then converted back -to a Guzzle stream resource to be used as a Guzzle stream. - - -## LazyOpenStream - -`GuzzleHttp\Psr7\LazyOpenStream` - -Lazily reads or writes to a file that is opened only after an IO operation -take place on the stream. - -```php -use GuzzleHttp\Psr7; - -$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); -// The file has not yet been opened... - -echo $stream->read(10); -// The file is opened and read from only when needed. -``` - - -## LimitStream - -`GuzzleHttp\Psr7\LimitStream` - -LimitStream can be used to read a subset or slice of an existing stream object. -This can be useful for breaking a large file into smaller pieces to be sent in -chunks (e.g. Amazon S3's multipart upload API). - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\stream_for(fopen('/tmp/test.txt', 'r+')); -echo $original->getSize(); -// >>> 1048576 - -// Limit the size of the body to 1024 bytes and start reading from byte 2048 -$stream = new Psr7\LimitStream($original, 1024, 2048); -echo $stream->getSize(); -// >>> 1024 -echo $stream->tell(); -// >>> 0 -``` - - -## MultipartStream - -`GuzzleHttp\Psr7\MultipartStream` - -Stream that when read returns bytes for a streaming multipart or -multipart/form-data stream. - - -## NoSeekStream - -`GuzzleHttp\Psr7\NoSeekStream` - -NoSeekStream wraps a stream and does not allow seeking. - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\stream_for('foo'); -$noSeek = new Psr7\NoSeekStream($original); - -echo $noSeek->read(3); -// foo -var_export($noSeek->isSeekable()); -// false -$noSeek->seek(0); -var_export($noSeek->read(3)); -// NULL -``` - - -## PumpStream - -`GuzzleHttp\Psr7\PumpStream` - -Provides a read only stream that pumps data from a PHP callable. - -When invoking the provided callable, the PumpStream will pass the amount of -data requested to read to the callable. The callable can choose to ignore -this value and return fewer or more bytes than requested. Any extra data -returned by the provided callable is buffered internally until drained using -the read() function of the PumpStream. The provided callable MUST return -false when there is no more data to read. - - -## Implementing stream decorators - -Creating a stream decorator is very easy thanks to the -`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that -implement `Psr\Http\Message\StreamInterface` by proxying to an underlying -stream. Just `use` the `StreamDecoratorTrait` and implement your custom -methods. - -For example, let's say we wanted to call a specific function each time the last -byte is read from a stream. This could be implemented by overriding the -`read()` method. - -```php -use Psr\Http\Message\StreamInterface; -use GuzzleHttp\Psr7\StreamDecoratorTrait; - -class EofCallbackStream implements StreamInterface -{ - use StreamDecoratorTrait; - - private $callback; - - public function __construct(StreamInterface $stream, callable $cb) - { - $this->stream = $stream; - $this->callback = $cb; - } - - public function read($length) - { - $result = $this->stream->read($length); - - // Invoke the callback when EOF is hit. - if ($this->eof()) { - call_user_func($this->callback); - } - - return $result; - } -} -``` - -This decorator could be added to any existing stream and used like so: - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\stream_for('foo'); - -$eofStream = new EofCallbackStream($original, function () { - echo 'EOF!'; -}); - -$eofStream->read(2); -$eofStream->read(1); -// echoes "EOF!" -$eofStream->seek(0); -$eofStream->read(3); -// echoes "EOF!" -``` - - -## PHP StreamWrapper - -You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a -PSR-7 stream as a PHP stream resource. - -Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP -stream from a PSR-7 stream. - -```php -use GuzzleHttp\Psr7\StreamWrapper; - -$stream = GuzzleHttp\Psr7\stream_for('hello!'); -$resource = StreamWrapper::getResource($stream); -echo fread($resource, 6); // outputs hello! -``` - - -# Function API - -There are various functions available under the `GuzzleHttp\Psr7` namespace. - - -## `function str` - -`function str(MessageInterface $message)` - -Returns the string representation of an HTTP message. - -```php -$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); -echo GuzzleHttp\Psr7\str($request); -``` - - -## `function uri_for` - -`function uri_for($uri)` - -This function accepts a string or `Psr\Http\Message\UriInterface` and returns a -UriInterface for the given value. If the value is already a `UriInterface`, it -is returned as-is. - -```php -$uri = GuzzleHttp\Psr7\uri_for('http://example.com'); -assert($uri === GuzzleHttp\Psr7\uri_for($uri)); -``` - - -## `function stream_for` - -`function stream_for($resource = '', array $options = [])` - -Create a new stream based on the input type. - -Options is an associative array that can contain the following keys: - -* - metadata: Array of custom metadata. -* - size: Size of the stream. - -This method accepts the following `$resource` types: - -- `Psr\Http\Message\StreamInterface`: Returns the value as-is. -- `string`: Creates a stream object that uses the given string as the contents. -- `resource`: Creates a stream object that wraps the given PHP stream resource. -- `Iterator`: If the provided value implements `Iterator`, then a read-only - stream object will be created that wraps the given iterable. Each time the - stream is read from, data from the iterator will fill a buffer and will be - continuously called until the buffer is equal to the requested read size. - Subsequent read calls will first read from the buffer and then call `next` - on the underlying iterator until it is exhausted. -- `object` with `__toString()`: If the object has the `__toString()` method, - the object will be cast to a string and then a stream will be returned that - uses the string value. -- `NULL`: When `null` is passed, an empty stream object is returned. -- `callable` When a callable is passed, a read-only stream object will be - created that invokes the given callable. The callable is invoked with the - number of suggested bytes to read. The callable can return any number of - bytes, but MUST return `false` when there is no more data to return. The - stream object that wraps the callable will invoke the callable until the - number of requested bytes are available. Any additional bytes will be - buffered and used in subsequent reads. - -```php -$stream = GuzzleHttp\Psr7\stream_for('foo'); -$stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r')); - -$generator = function ($bytes) { - for ($i = 0; $i < $bytes; $i++) { - yield ' '; - } -} - -$stream = GuzzleHttp\Psr7\stream_for($generator(100)); -``` - - -## `function parse_header` - -`function parse_header($header)` - -Parse an array of header values containing ";" separated data into an array of -associative arrays representing the header key value pair data of the header. -When a parameter does not contain a value, but just contains a key, this -function will inject a key with a '' string value. - - -## `function normalize_header` - -`function normalize_header($header)` - -Converts an array of header values that may contain comma separated headers -into an array of headers with no comma separated values. - - -## `function modify_request` - -`function modify_request(RequestInterface $request, array $changes)` - -Clone and modify a request with the given changes. This method is useful for -reducing the number of clones needed to mutate a message. - -The changes can be one of: - -- method: (string) Changes the HTTP method. -- set_headers: (array) Sets the given headers. -- remove_headers: (array) Remove the given headers. -- body: (mixed) Sets the given body. -- uri: (UriInterface) Set the URI. -- query: (string) Set the query string value of the URI. -- version: (string) Set the protocol version. - - -## `function rewind_body` - -`function rewind_body(MessageInterface $message)` - -Attempts to rewind a message body and throws an exception on failure. The body -of the message will only be rewound if a call to `tell()` returns a value other -than `0`. - - -## `function try_fopen` - -`function try_fopen($filename, $mode)` - -Safely opens a PHP stream resource using a filename. - -When fopen fails, PHP normally raises a warning. This function adds an error -handler that checks for errors and throws an exception instead. - - -## `function copy_to_string` - -`function copy_to_string(StreamInterface $stream, $maxLen = -1)` - -Copy the contents of a stream into a string until the given number of bytes -have been read. - - -## `function copy_to_stream` - -`function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)` - -Copy the contents of a stream into another stream until the given number of -bytes have been read. - - -## `function hash` - -`function hash(StreamInterface $stream, $algo, $rawOutput = false)` - -Calculate a hash of a Stream. This method reads the entire stream to calculate -a rolling hash (based on PHP's hash_init functions). - - -## `function readline` - -`function readline(StreamInterface $stream, $maxLength = null)` - -Read a line from the stream up to the maximum allowed buffer length. - - -## `function parse_request` - -`function parse_request($message)` - -Parses a request message string into a request object. - - -## `function parse_response` - -`function parse_response($message)` - -Parses a response message string into a response object. - - -## `function parse_query` - -`function parse_query($str, $urlEncoding = true)` - -Parse a query string into an associative array. - -If multiple values are found for the same key, the value of that key value pair -will become an array. This function does not parse nested PHP style arrays into -an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed into -`['foo[a]' => '1', 'foo[b]' => '2']`). - - -## `function build_query` - -`function build_query(array $params, $encoding = PHP_QUERY_RFC3986)` - -Build a query string from an array of key value pairs. - -This function can use the return value of parse_query() to build a query string. -This function does not modify the provided keys when an array is encountered -(like http_build_query would). - - -## `function mimetype_from_filename` - -`function mimetype_from_filename($filename)` - -Determines the mimetype of a file by looking at its extension. - - -## `function mimetype_from_extension` - -`function mimetype_from_extension($extension)` - -Maps a file extensions to a mimetype. - - -# Additional URI Methods - -Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, -this library also provides additional functionality when working with URIs as static methods. - -## URI Types - -An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. -An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, -the base URI. Relative references can be divided into several forms according to -[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): - -- network-path references, e.g. `//example.com/path` -- absolute-path references, e.g. `/path` -- relative-path references, e.g. `subpath` - -The following methods can be used to identify the type of the URI. - -### `GuzzleHttp\Psr7\Uri::isAbsolute` - -`public static function isAbsolute(UriInterface $uri): bool` - -Whether the URI is absolute, i.e. it has a scheme. - -### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` - -`public static function isNetworkPathReference(UriInterface $uri): bool` - -Whether the URI is a network-path reference. A relative reference that begins with two slash characters is -termed an network-path reference. - -### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` - -`public static function isAbsolutePathReference(UriInterface $uri): bool` - -Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is -termed an absolute-path reference. - -### `GuzzleHttp\Psr7\Uri::isRelativePathReference` - -`public static function isRelativePathReference(UriInterface $uri): bool` - -Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is -termed a relative-path reference. - -### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` - -`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool` - -Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its -fragment component, identical to the base URI. When no base URI is given, only an empty URI reference -(apart from its fragment) is considered a same-document reference. - -## URI Components - -Additional methods to work with URI components. - -### `GuzzleHttp\Psr7\Uri::isDefaultPort` - -`public static function isDefaultPort(UriInterface $uri): bool` - -Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null -or the standard port. This method can be used independently of the implementation. - -### `GuzzleHttp\Psr7\Uri::composeComponents` - -`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` - -Composes a URI reference string from its various components according to -[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called -manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. - -### `GuzzleHttp\Psr7\Uri::fromParts` - -`public static function fromParts(array $parts): UriInterface` - -Creates a URI from a hash of [`parse_url`](http://php.net/manual/en/function.parse-url.php) components. - - -### `GuzzleHttp\Psr7\Uri::withQueryValue` - -`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` - -Creates a new URI with a specific query string value. Any existing query string values that exactly match the -provided key are removed and replaced with the given key value pair. A value of null will set the query string -key without a value, e.g. "key" instead of "key=value". - -### `GuzzleHttp\Psr7\Uri::withQueryValues` - -`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` - -Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an -associative array of key => value. - -### `GuzzleHttp\Psr7\Uri::withoutQueryValue` - -`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` - -Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the -provided key are removed. - -## Reference Resolution - -`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according -to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers -do when resolving a link in a website based on the current request URI. - -### `GuzzleHttp\Psr7\UriResolver::resolve` - -`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` - -Converts the relative URI into a new URI that is resolved against the base URI. - -### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` - -`public static function removeDotSegments(string $path): string` - -Removes dot segments from a path and returns the new path according to -[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). - -### `GuzzleHttp\Psr7\UriResolver::relativize` - -`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` - -Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): - -```php -(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) -``` - -One use-case is to use the current request URI as base URI and then generate relative links in your documents -to reduce the document size or offer self-contained downloadable document archives. - -```php -$base = new Uri('http://example.com/a/b/'); -echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. -echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. -echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. -echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. -``` - -## Normalization and Comparison - -`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to -[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). - -### `GuzzleHttp\Psr7\UriNormalizer::normalize` - -`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` - -Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. -This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask -of normalizations to apply. The following normalizations are available: - -- `UriNormalizer::PRESERVING_NORMALIZATIONS` - - Default normalizations which only include the ones that preserve semantics. - -- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` - - All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. - - Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` - -- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` - - Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of - ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should - not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved - characters by URI normalizers. - - Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` - -- `UriNormalizer::CONVERT_EMPTY_PATH` - - Converts the empty path to "/" for http and https URIs. - - Example: `http://example.org` → `http://example.org/` - -- `UriNormalizer::REMOVE_DEFAULT_HOST` - - Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host - "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to - RFC 3986. - - Example: `file://localhost/myfile` → `file:///myfile` - -- `UriNormalizer::REMOVE_DEFAULT_PORT` - - Removes the default port of the given URI scheme from the URI. - - Example: `http://example.org:80/` → `http://example.org/` - -- `UriNormalizer::REMOVE_DOT_SEGMENTS` - - Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would - change the semantics of the URI reference. - - Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` - -- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` - - Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes - and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization - may change the semantics. Encoded slashes (%2F) are not removed. - - Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` - -- `UriNormalizer::SORT_QUERY_PARAMETERS` - - Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be - significant (this is not defined by the standard). So this normalization is not safe and may change the semantics - of the URI. - - Example: `?lang=en&article=fred` → `?article=fred&lang=en` - -### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` - -`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` - -Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given -`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. -This of course assumes they will be resolved against the same base URI. If this is not the case, determination of -equivalence or difference of relative references does not mean anything. diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json deleted file mode 100644 index 168a055b..00000000 --- a/vendor/guzzlehttp/psr7/composer.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "guzzlehttp/psr7", - "type": "library", - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8", - "ext-zlib": "*" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": ["src/functions_include.php"] - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\Tests\\Psr7\\": "tests/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - } -} diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php deleted file mode 100644 index 472a0d61..00000000 --- a/vendor/guzzlehttp/psr7/src/AppendStream.php +++ /dev/null @@ -1,241 +0,0 @@ -addStream($stream); - } - } - - public function __toString() - { - try { - $this->rewind(); - return $this->getContents(); - } catch (\Exception $e) { - return ''; - } - } - - /** - * Add a stream to the AppendStream - * - * @param StreamInterface $stream Stream to append. Must be readable. - * - * @throws \InvalidArgumentException if the stream is not readable - */ - public function addStream(StreamInterface $stream) - { - if (!$stream->isReadable()) { - throw new \InvalidArgumentException('Each stream must be readable'); - } - - // The stream is only seekable if all streams are seekable - if (!$stream->isSeekable()) { - $this->seekable = false; - } - - $this->streams[] = $stream; - } - - public function getContents() - { - return copy_to_string($this); - } - - /** - * Closes each attached stream. - * - * {@inheritdoc} - */ - public function close() - { - $this->pos = $this->current = 0; - $this->seekable = true; - - foreach ($this->streams as $stream) { - $stream->close(); - } - - $this->streams = []; - } - - /** - * Detaches each attached stream. - * - * Returns null as it's not clear which underlying stream resource to return. - * - * {@inheritdoc} - */ - public function detach() - { - $this->pos = $this->current = 0; - $this->seekable = true; - - foreach ($this->streams as $stream) { - $stream->detach(); - } - - $this->streams = []; - } - - public function tell() - { - return $this->pos; - } - - /** - * Tries to calculate the size by adding the size of each stream. - * - * If any of the streams do not return a valid number, then the size of the - * append stream cannot be determined and null is returned. - * - * {@inheritdoc} - */ - public function getSize() - { - $size = 0; - - foreach ($this->streams as $stream) { - $s = $stream->getSize(); - if ($s === null) { - return null; - } - $size += $s; - } - - return $size; - } - - public function eof() - { - return !$this->streams || - ($this->current >= count($this->streams) - 1 && - $this->streams[$this->current]->eof()); - } - - public function rewind() - { - $this->seek(0); - } - - /** - * Attempts to seek to the given position. Only supports SEEK_SET. - * - * {@inheritdoc} - */ - public function seek($offset, $whence = SEEK_SET) - { - if (!$this->seekable) { - throw new \RuntimeException('This AppendStream is not seekable'); - } elseif ($whence !== SEEK_SET) { - throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); - } - - $this->pos = $this->current = 0; - - // Rewind each stream - foreach ($this->streams as $i => $stream) { - try { - $stream->rewind(); - } catch (\Exception $e) { - throw new \RuntimeException('Unable to seek stream ' - . $i . ' of the AppendStream', 0, $e); - } - } - - // Seek to the actual position by reading from each stream - while ($this->pos < $offset && !$this->eof()) { - $result = $this->read(min(8096, $offset - $this->pos)); - if ($result === '') { - break; - } - } - } - - /** - * Reads from all of the appended streams until the length is met or EOF. - * - * {@inheritdoc} - */ - public function read($length) - { - $buffer = ''; - $total = count($this->streams) - 1; - $remaining = $length; - $progressToNext = false; - - while ($remaining > 0) { - - // Progress to the next stream if needed. - if ($progressToNext || $this->streams[$this->current]->eof()) { - $progressToNext = false; - if ($this->current === $total) { - break; - } - $this->current++; - } - - $result = $this->streams[$this->current]->read($remaining); - - // Using a loose comparison here to match on '', false, and null - if ($result == null) { - $progressToNext = true; - continue; - } - - $buffer .= $result; - $remaining = $length - strlen($buffer); - } - - $this->pos += strlen($buffer); - - return $buffer; - } - - public function isReadable() - { - return true; - } - - public function isWritable() - { - return false; - } - - public function isSeekable() - { - return $this->seekable; - } - - public function write($string) - { - throw new \RuntimeException('Cannot write to an AppendStream'); - } - - public function getMetadata($key = null) - { - return $key ? null : []; - } -} diff --git a/vendor/guzzlehttp/psr7/src/BufferStream.php b/vendor/guzzlehttp/psr7/src/BufferStream.php deleted file mode 100644 index af4d4c22..00000000 --- a/vendor/guzzlehttp/psr7/src/BufferStream.php +++ /dev/null @@ -1,137 +0,0 @@ -hwm = $hwm; - } - - public function __toString() - { - return $this->getContents(); - } - - public function getContents() - { - $buffer = $this->buffer; - $this->buffer = ''; - - return $buffer; - } - - public function close() - { - $this->buffer = ''; - } - - public function detach() - { - $this->close(); - } - - public function getSize() - { - return strlen($this->buffer); - } - - public function isReadable() - { - return true; - } - - public function isWritable() - { - return true; - } - - public function isSeekable() - { - return false; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - throw new \RuntimeException('Cannot seek a BufferStream'); - } - - public function eof() - { - return strlen($this->buffer) === 0; - } - - public function tell() - { - throw new \RuntimeException('Cannot determine the position of a BufferStream'); - } - - /** - * Reads data from the buffer. - */ - public function read($length) - { - $currentLength = strlen($this->buffer); - - if ($length >= $currentLength) { - // No need to slice the buffer because we don't have enough data. - $result = $this->buffer; - $this->buffer = ''; - } else { - // Slice up the result to provide a subset of the buffer. - $result = substr($this->buffer, 0, $length); - $this->buffer = substr($this->buffer, $length); - } - - return $result; - } - - /** - * Writes data to the buffer. - */ - public function write($string) - { - $this->buffer .= $string; - - // TODO: What should happen here? - if (strlen($this->buffer) >= $this->hwm) { - return false; - } - - return strlen($string); - } - - public function getMetadata($key = null) - { - if ($key == 'hwm') { - return $this->hwm; - } - - return $key ? null : []; - } -} diff --git a/vendor/guzzlehttp/psr7/src/CachingStream.php b/vendor/guzzlehttp/psr7/src/CachingStream.php deleted file mode 100644 index ed68f086..00000000 --- a/vendor/guzzlehttp/psr7/src/CachingStream.php +++ /dev/null @@ -1,138 +0,0 @@ -remoteStream = $stream; - $this->stream = $target ?: new Stream(fopen('php://temp', 'r+')); - } - - public function getSize() - { - return max($this->stream->getSize(), $this->remoteStream->getSize()); - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - if ($whence == SEEK_SET) { - $byte = $offset; - } elseif ($whence == SEEK_CUR) { - $byte = $offset + $this->tell(); - } elseif ($whence == SEEK_END) { - $size = $this->remoteStream->getSize(); - if ($size === null) { - $size = $this->cacheEntireStream(); - } - $byte = $size + $offset; - } else { - throw new \InvalidArgumentException('Invalid whence'); - } - - $diff = $byte - $this->stream->getSize(); - - if ($diff > 0) { - // Read the remoteStream until we have read in at least the amount - // of bytes requested, or we reach the end of the file. - while ($diff > 0 && !$this->remoteStream->eof()) { - $this->read($diff); - $diff = $byte - $this->stream->getSize(); - } - } else { - // We can just do a normal seek since we've already seen this byte. - $this->stream->seek($byte); - } - } - - public function read($length) - { - // Perform a regular read on any previously read data from the buffer - $data = $this->stream->read($length); - $remaining = $length - strlen($data); - - // More data was requested so read from the remote stream - if ($remaining) { - // If data was written to the buffer in a position that would have - // been filled from the remote stream, then we must skip bytes on - // the remote stream to emulate overwriting bytes from that - // position. This mimics the behavior of other PHP stream wrappers. - $remoteData = $this->remoteStream->read( - $remaining + $this->skipReadBytes - ); - - if ($this->skipReadBytes) { - $len = strlen($remoteData); - $remoteData = substr($remoteData, $this->skipReadBytes); - $this->skipReadBytes = max(0, $this->skipReadBytes - $len); - } - - $data .= $remoteData; - $this->stream->write($remoteData); - } - - return $data; - } - - public function write($string) - { - // When appending to the end of the currently read stream, you'll want - // to skip bytes from being read from the remote stream to emulate - // other stream wrappers. Basically replacing bytes of data of a fixed - // length. - $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); - if ($overflow > 0) { - $this->skipReadBytes += $overflow; - } - - return $this->stream->write($string); - } - - public function eof() - { - return $this->stream->eof() && $this->remoteStream->eof(); - } - - /** - * Close both the remote stream and buffer stream - */ - public function close() - { - $this->remoteStream->close() && $this->stream->close(); - } - - private function cacheEntireStream() - { - $target = new FnStream(['write' => 'strlen']); - copy_to_stream($this, $target); - - return $this->tell(); - } -} diff --git a/vendor/guzzlehttp/psr7/src/DroppingStream.php b/vendor/guzzlehttp/psr7/src/DroppingStream.php deleted file mode 100644 index 8935c80d..00000000 --- a/vendor/guzzlehttp/psr7/src/DroppingStream.php +++ /dev/null @@ -1,42 +0,0 @@ -stream = $stream; - $this->maxLength = $maxLength; - } - - public function write($string) - { - $diff = $this->maxLength - $this->stream->getSize(); - - // Begin returning 0 when the underlying stream is too large. - if ($diff <= 0) { - return 0; - } - - // Write the stream or a subset of the stream if needed. - if (strlen($string) < $diff) { - return $this->stream->write($string); - } - - return $this->stream->write(substr($string, 0, $diff)); - } -} diff --git a/vendor/guzzlehttp/psr7/src/FnStream.php b/vendor/guzzlehttp/psr7/src/FnStream.php deleted file mode 100644 index 73daea6f..00000000 --- a/vendor/guzzlehttp/psr7/src/FnStream.php +++ /dev/null @@ -1,158 +0,0 @@ -methods = $methods; - - // Create the functions on the class - foreach ($methods as $name => $fn) { - $this->{'_fn_' . $name} = $fn; - } - } - - /** - * Lazily determine which methods are not implemented. - * @throws \BadMethodCallException - */ - public function __get($name) - { - throw new \BadMethodCallException(str_replace('_fn_', '', $name) - . '() is not implemented in the FnStream'); - } - - /** - * The close method is called on the underlying stream only if possible. - */ - public function __destruct() - { - if (isset($this->_fn_close)) { - call_user_func($this->_fn_close); - } - } - - /** - * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. - * @throws \LogicException - */ - public function __wakeup() - { - throw new \LogicException('FnStream should never be unserialized'); - } - - /** - * Adds custom functionality to an underlying stream by intercepting - * specific method calls. - * - * @param StreamInterface $stream Stream to decorate - * @param array $methods Hash of method name to a closure - * - * @return FnStream - */ - public static function decorate(StreamInterface $stream, array $methods) - { - // If any of the required methods were not provided, then simply - // proxy to the decorated stream. - foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { - $methods[$diff] = [$stream, $diff]; - } - - return new self($methods); - } - - public function __toString() - { - return call_user_func($this->_fn___toString); - } - - public function close() - { - return call_user_func($this->_fn_close); - } - - public function detach() - { - return call_user_func($this->_fn_detach); - } - - public function getSize() - { - return call_user_func($this->_fn_getSize); - } - - public function tell() - { - return call_user_func($this->_fn_tell); - } - - public function eof() - { - return call_user_func($this->_fn_eof); - } - - public function isSeekable() - { - return call_user_func($this->_fn_isSeekable); - } - - public function rewind() - { - call_user_func($this->_fn_rewind); - } - - public function seek($offset, $whence = SEEK_SET) - { - call_user_func($this->_fn_seek, $offset, $whence); - } - - public function isWritable() - { - return call_user_func($this->_fn_isWritable); - } - - public function write($string) - { - return call_user_func($this->_fn_write, $string); - } - - public function isReadable() - { - return call_user_func($this->_fn_isReadable); - } - - public function read($length) - { - return call_user_func($this->_fn_read, $length); - } - - public function getContents() - { - return call_user_func($this->_fn_getContents); - } - - public function getMetadata($key = null) - { - return call_user_func($this->_fn_getMetadata, $key); - } -} diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php deleted file mode 100644 index 5e4f6028..00000000 --- a/vendor/guzzlehttp/psr7/src/InflateStream.php +++ /dev/null @@ -1,52 +0,0 @@ -read(10); - $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header); - // Skip the header, that is 10 + length of filename + 1 (nil) bytes - $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength); - $resource = StreamWrapper::getResource($stream); - stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ); - $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); - } - - /** - * @param StreamInterface $stream - * @param $header - * @return int - */ - private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header) - { - $filename_header_length = 0; - - if (substr(bin2hex($header), 6, 2) === '08') { - // we have a filename, read until nil - $filename_header_length = 1; - while ($stream->read(1) !== chr(0)) { - $filename_header_length++; - } - } - - return $filename_header_length; - } -} diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php deleted file mode 100644 index 02cec3af..00000000 --- a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php +++ /dev/null @@ -1,39 +0,0 @@ -filename = $filename; - $this->mode = $mode; - } - - /** - * Creates the underlying stream lazily when required. - * - * @return StreamInterface - */ - protected function createStream() - { - return stream_for(try_fopen($this->filename, $this->mode)); - } -} diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php deleted file mode 100644 index e4f239e3..00000000 --- a/vendor/guzzlehttp/psr7/src/LimitStream.php +++ /dev/null @@ -1,155 +0,0 @@ -stream = $stream; - $this->setLimit($limit); - $this->setOffset($offset); - } - - public function eof() - { - // Always return true if the underlying stream is EOF - if ($this->stream->eof()) { - return true; - } - - // No limit and the underlying stream is not at EOF - if ($this->limit == -1) { - return false; - } - - return $this->stream->tell() >= $this->offset + $this->limit; - } - - /** - * Returns the size of the limited subset of data - * {@inheritdoc} - */ - public function getSize() - { - if (null === ($length = $this->stream->getSize())) { - return null; - } elseif ($this->limit == -1) { - return $length - $this->offset; - } else { - return min($this->limit, $length - $this->offset); - } - } - - /** - * Allow for a bounded seek on the read limited stream - * {@inheritdoc} - */ - public function seek($offset, $whence = SEEK_SET) - { - if ($whence !== SEEK_SET || $offset < 0) { - throw new \RuntimeException(sprintf( - 'Cannot seek to offset %s with whence %s', - $offset, - $whence - )); - } - - $offset += $this->offset; - - if ($this->limit !== -1) { - if ($offset > $this->offset + $this->limit) { - $offset = $this->offset + $this->limit; - } - } - - $this->stream->seek($offset); - } - - /** - * Give a relative tell() - * {@inheritdoc} - */ - public function tell() - { - return $this->stream->tell() - $this->offset; - } - - /** - * Set the offset to start limiting from - * - * @param int $offset Offset to seek to and begin byte limiting from - * - * @throws \RuntimeException if the stream cannot be seeked. - */ - public function setOffset($offset) - { - $current = $this->stream->tell(); - - if ($current !== $offset) { - // If the stream cannot seek to the offset position, then read to it - if ($this->stream->isSeekable()) { - $this->stream->seek($offset); - } elseif ($current > $offset) { - throw new \RuntimeException("Could not seek to stream offset $offset"); - } else { - $this->stream->read($offset - $current); - } - } - - $this->offset = $offset; - } - - /** - * Set the limit of bytes that the decorator allows to be read from the - * stream. - * - * @param int $limit Number of bytes to allow to be read from the stream. - * Use -1 for no limit. - */ - public function setLimit($limit) - { - $this->limit = $limit; - } - - public function read($length) - { - if ($this->limit == -1) { - return $this->stream->read($length); - } - - // Check if the current position is less than the total allowed - // bytes + original offset - $remaining = ($this->offset + $this->limit) - $this->stream->tell(); - if ($remaining > 0) { - // Only return the amount of requested data, ensuring that the byte - // limit is not exceeded - return $this->stream->read(min($remaining, $length)); - } - - return ''; - } -} diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php deleted file mode 100644 index a7966d10..00000000 --- a/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ /dev/null @@ -1,213 +0,0 @@ - array of values */ - private $headers = []; - - /** @var array Map of lowercase header name => original name at registration */ - private $headerNames = []; - - /** @var string */ - private $protocol = '1.1'; - - /** @var StreamInterface */ - private $stream; - - public function getProtocolVersion() - { - return $this->protocol; - } - - public function withProtocolVersion($version) - { - if ($this->protocol === $version) { - return $this; - } - - $new = clone $this; - $new->protocol = $version; - return $new; - } - - public function getHeaders() - { - return $this->headers; - } - - public function hasHeader($header) - { - return isset($this->headerNames[strtolower($header)]); - } - - public function getHeader($header) - { - $header = strtolower($header); - - if (!isset($this->headerNames[$header])) { - return []; - } - - $header = $this->headerNames[$header]; - - return $this->headers[$header]; - } - - public function getHeaderLine($header) - { - return implode(', ', $this->getHeader($header)); - } - - public function withHeader($header, $value) - { - $this->assertHeader($header); - $value = $this->normalizeHeaderValue($value); - $normalized = strtolower($header); - - $new = clone $this; - if (isset($new->headerNames[$normalized])) { - unset($new->headers[$new->headerNames[$normalized]]); - } - $new->headerNames[$normalized] = $header; - $new->headers[$header] = $value; - - return $new; - } - - public function withAddedHeader($header, $value) - { - $this->assertHeader($header); - $value = $this->normalizeHeaderValue($value); - $normalized = strtolower($header); - - $new = clone $this; - if (isset($new->headerNames[$normalized])) { - $header = $this->headerNames[$normalized]; - $new->headers[$header] = array_merge($this->headers[$header], $value); - } else { - $new->headerNames[$normalized] = $header; - $new->headers[$header] = $value; - } - - return $new; - } - - public function withoutHeader($header) - { - $normalized = strtolower($header); - - if (!isset($this->headerNames[$normalized])) { - return $this; - } - - $header = $this->headerNames[$normalized]; - - $new = clone $this; - unset($new->headers[$header], $new->headerNames[$normalized]); - - return $new; - } - - public function getBody() - { - if (!$this->stream) { - $this->stream = stream_for(''); - } - - return $this->stream; - } - - public function withBody(StreamInterface $body) - { - if ($body === $this->stream) { - return $this; - } - - $new = clone $this; - $new->stream = $body; - return $new; - } - - private function setHeaders(array $headers) - { - $this->headerNames = $this->headers = []; - foreach ($headers as $header => $value) { - if (is_int($header)) { - // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec - // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass. - $header = (string) $header; - } - $this->assertHeader($header); - $value = $this->normalizeHeaderValue($value); - $normalized = strtolower($header); - if (isset($this->headerNames[$normalized])) { - $header = $this->headerNames[$normalized]; - $this->headers[$header] = array_merge($this->headers[$header], $value); - } else { - $this->headerNames[$normalized] = $header; - $this->headers[$header] = $value; - } - } - } - - private function normalizeHeaderValue($value) - { - if (!is_array($value)) { - return $this->trimHeaderValues([$value]); - } - - if (count($value) === 0) { - throw new \InvalidArgumentException('Header value can not be an empty array.'); - } - - return $this->trimHeaderValues($value); - } - - /** - * Trims whitespace from the header values. - * - * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. - * - * header-field = field-name ":" OWS field-value OWS - * OWS = *( SP / HTAB ) - * - * @param string[] $values Header values - * - * @return string[] Trimmed header values - * - * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 - */ - private function trimHeaderValues(array $values) - { - return array_map(function ($value) { - if (!is_scalar($value) && null !== $value) { - throw new \InvalidArgumentException(sprintf( - 'Header value must be scalar or null but %s provided.', - is_object($value) ? get_class($value) : gettype($value) - )); - } - - return trim((string) $value, " \t"); - }, $values); - } - - private function assertHeader($header) - { - if (!is_string($header)) { - throw new \InvalidArgumentException(sprintf( - 'Header name must be a string but %s provided.', - is_object($header) ? get_class($header) : gettype($header) - )); - } - - if ($header === '') { - throw new \InvalidArgumentException('Header name can not be empty.'); - } - } -} diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php deleted file mode 100644 index c0fd584f..00000000 --- a/vendor/guzzlehttp/psr7/src/MultipartStream.php +++ /dev/null @@ -1,153 +0,0 @@ -boundary = $boundary ?: sha1(uniqid('', true)); - $this->stream = $this->createStream($elements); - } - - /** - * Get the boundary - * - * @return string - */ - public function getBoundary() - { - return $this->boundary; - } - - public function isWritable() - { - return false; - } - - /** - * Get the headers needed before transferring the content of a POST file - */ - private function getHeaders(array $headers) - { - $str = ''; - foreach ($headers as $key => $value) { - $str .= "{$key}: {$value}\r\n"; - } - - return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; - } - - /** - * Create the aggregate stream that will be used to upload the POST data - */ - protected function createStream(array $elements) - { - $stream = new AppendStream(); - - foreach ($elements as $element) { - $this->addElement($stream, $element); - } - - // Add the trailing boundary with CRLF - $stream->addStream(stream_for("--{$this->boundary}--\r\n")); - - return $stream; - } - - private function addElement(AppendStream $stream, array $element) - { - foreach (['contents', 'name'] as $key) { - if (!array_key_exists($key, $element)) { - throw new \InvalidArgumentException("A '{$key}' key is required"); - } - } - - $element['contents'] = stream_for($element['contents']); - - if (empty($element['filename'])) { - $uri = $element['contents']->getMetadata('uri'); - if (substr($uri, 0, 6) !== 'php://') { - $element['filename'] = $uri; - } - } - - list($body, $headers) = $this->createElement( - $element['name'], - $element['contents'], - isset($element['filename']) ? $element['filename'] : null, - isset($element['headers']) ? $element['headers'] : [] - ); - - $stream->addStream(stream_for($this->getHeaders($headers))); - $stream->addStream($body); - $stream->addStream(stream_for("\r\n")); - } - - /** - * @return array - */ - private function createElement($name, StreamInterface $stream, $filename, array $headers) - { - // Set a default content-disposition header if one was no provided - $disposition = $this->getHeader($headers, 'content-disposition'); - if (!$disposition) { - $headers['Content-Disposition'] = ($filename === '0' || $filename) - ? sprintf('form-data; name="%s"; filename="%s"', - $name, - basename($filename)) - : "form-data; name=\"{$name}\""; - } - - // Set a default content-length header if one was no provided - $length = $this->getHeader($headers, 'content-length'); - if (!$length) { - if ($length = $stream->getSize()) { - $headers['Content-Length'] = (string) $length; - } - } - - // Set a default Content-Type if one was not supplied - $type = $this->getHeader($headers, 'content-type'); - if (!$type && ($filename === '0' || $filename)) { - if ($type = mimetype_from_filename($filename)) { - $headers['Content-Type'] = $type; - } - } - - return [$stream, $headers]; - } - - private function getHeader(array $headers, $key) - { - $lowercaseHeader = strtolower($key); - foreach ($headers as $k => $v) { - if (strtolower($k) === $lowercaseHeader) { - return $v; - } - } - - return null; - } -} diff --git a/vendor/guzzlehttp/psr7/src/NoSeekStream.php b/vendor/guzzlehttp/psr7/src/NoSeekStream.php deleted file mode 100644 index 23322180..00000000 --- a/vendor/guzzlehttp/psr7/src/NoSeekStream.php +++ /dev/null @@ -1,22 +0,0 @@ -source = $source; - $this->size = isset($options['size']) ? $options['size'] : null; - $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; - $this->buffer = new BufferStream(); - } - - public function __toString() - { - try { - return copy_to_string($this); - } catch (\Exception $e) { - return ''; - } - } - - public function close() - { - $this->detach(); - } - - public function detach() - { - $this->tellPos = false; - $this->source = null; - } - - public function getSize() - { - return $this->size; - } - - public function tell() - { - return $this->tellPos; - } - - public function eof() - { - return !$this->source; - } - - public function isSeekable() - { - return false; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - throw new \RuntimeException('Cannot seek a PumpStream'); - } - - public function isWritable() - { - return false; - } - - public function write($string) - { - throw new \RuntimeException('Cannot write to a PumpStream'); - } - - public function isReadable() - { - return true; - } - - public function read($length) - { - $data = $this->buffer->read($length); - $readLen = strlen($data); - $this->tellPos += $readLen; - $remaining = $length - $readLen; - - if ($remaining) { - $this->pump($remaining); - $data .= $this->buffer->read($remaining); - $this->tellPos += strlen($data) - $readLen; - } - - return $data; - } - - public function getContents() - { - $result = ''; - while (!$this->eof()) { - $result .= $this->read(1000000); - } - - return $result; - } - - public function getMetadata($key = null) - { - if (!$key) { - return $this->metadata; - } - - return isset($this->metadata[$key]) ? $this->metadata[$key] : null; - } - - private function pump($length) - { - if ($this->source) { - do { - $data = call_user_func($this->source, $length); - if ($data === false || $data === null) { - $this->source = null; - return; - } - $this->buffer->write($data); - $length -= strlen($data); - } while ($length > 0); - } - } -} diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php deleted file mode 100644 index 59f337db..00000000 --- a/vendor/guzzlehttp/psr7/src/Request.php +++ /dev/null @@ -1,151 +0,0 @@ -assertMethod($method); - if (!($uri instanceof UriInterface)) { - $uri = new Uri($uri); - } - - $this->method = strtoupper($method); - $this->uri = $uri; - $this->setHeaders($headers); - $this->protocol = $version; - - if (!isset($this->headerNames['host'])) { - $this->updateHostFromUri(); - } - - if ($body !== '' && $body !== null) { - $this->stream = stream_for($body); - } - } - - public function getRequestTarget() - { - if ($this->requestTarget !== null) { - return $this->requestTarget; - } - - $target = $this->uri->getPath(); - if ($target == '') { - $target = '/'; - } - if ($this->uri->getQuery() != '') { - $target .= '?' . $this->uri->getQuery(); - } - - return $target; - } - - public function withRequestTarget($requestTarget) - { - if (preg_match('#\s#', $requestTarget)) { - throw new InvalidArgumentException( - 'Invalid request target provided; cannot contain whitespace' - ); - } - - $new = clone $this; - $new->requestTarget = $requestTarget; - return $new; - } - - public function getMethod() - { - return $this->method; - } - - public function withMethod($method) - { - $this->assertMethod($method); - $new = clone $this; - $new->method = strtoupper($method); - return $new; - } - - public function getUri() - { - return $this->uri; - } - - public function withUri(UriInterface $uri, $preserveHost = false) - { - if ($uri === $this->uri) { - return $this; - } - - $new = clone $this; - $new->uri = $uri; - - if (!$preserveHost || !isset($this->headerNames['host'])) { - $new->updateHostFromUri(); - } - - return $new; - } - - private function updateHostFromUri() - { - $host = $this->uri->getHost(); - - if ($host == '') { - return; - } - - if (($port = $this->uri->getPort()) !== null) { - $host .= ':' . $port; - } - - if (isset($this->headerNames['host'])) { - $header = $this->headerNames['host']; - } else { - $header = 'Host'; - $this->headerNames['host'] = 'Host'; - } - // Ensure Host is the first header. - // See: http://tools.ietf.org/html/rfc7230#section-5.4 - $this->headers = [$header => [$host]] + $this->headers; - } - - private function assertMethod($method) - { - if (!is_string($method) || $method === '') { - throw new \InvalidArgumentException('Method must be a non-empty string.'); - } - } -} diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php deleted file mode 100644 index e7e04d86..00000000 --- a/vendor/guzzlehttp/psr7/src/Response.php +++ /dev/null @@ -1,154 +0,0 @@ - 'Continue', - 101 => 'Switching Protocols', - 102 => 'Processing', - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 207 => 'Multi-status', - 208 => 'Already Reported', - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 306 => 'Switch Proxy', - 307 => 'Temporary Redirect', - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Time-out', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Large', - 415 => 'Unsupported Media Type', - 416 => 'Requested range not satisfiable', - 417 => 'Expectation Failed', - 418 => 'I\'m a teapot', - 422 => 'Unprocessable Entity', - 423 => 'Locked', - 424 => 'Failed Dependency', - 425 => 'Unordered Collection', - 426 => 'Upgrade Required', - 428 => 'Precondition Required', - 429 => 'Too Many Requests', - 431 => 'Request Header Fields Too Large', - 451 => 'Unavailable For Legal Reasons', - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Time-out', - 505 => 'HTTP Version not supported', - 506 => 'Variant Also Negotiates', - 507 => 'Insufficient Storage', - 508 => 'Loop Detected', - 511 => 'Network Authentication Required', - ]; - - /** @var string */ - private $reasonPhrase = ''; - - /** @var int */ - private $statusCode = 200; - - /** - * @param int $status Status code - * @param array $headers Response headers - * @param string|null|resource|StreamInterface $body Response body - * @param string $version Protocol version - * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) - */ - public function __construct( - $status = 200, - array $headers = [], - $body = null, - $version = '1.1', - $reason = null - ) { - $this->assertStatusCodeIsInteger($status); - $status = (int) $status; - $this->assertStatusCodeRange($status); - - $this->statusCode = $status; - - if ($body !== '' && $body !== null) { - $this->stream = stream_for($body); - } - - $this->setHeaders($headers); - if ($reason == '' && isset(self::$phrases[$this->statusCode])) { - $this->reasonPhrase = self::$phrases[$this->statusCode]; - } else { - $this->reasonPhrase = (string) $reason; - } - - $this->protocol = $version; - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function getReasonPhrase() - { - return $this->reasonPhrase; - } - - public function withStatus($code, $reasonPhrase = '') - { - $this->assertStatusCodeIsInteger($code); - $code = (int) $code; - $this->assertStatusCodeRange($code); - - $new = clone $this; - $new->statusCode = $code; - if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) { - $reasonPhrase = self::$phrases[$new->statusCode]; - } - $new->reasonPhrase = $reasonPhrase; - return $new; - } - - private function assertStatusCodeIsInteger($statusCode) - { - if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { - throw new \InvalidArgumentException('Status code must be an integer value.'); - } - } - - private function assertStatusCodeRange($statusCode) - { - if ($statusCode < 100 || $statusCode >= 600) { - throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); - } - } -} diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php deleted file mode 100644 index 505e4742..00000000 --- a/vendor/guzzlehttp/psr7/src/Rfc7230.php +++ /dev/null @@ -1,18 +0,0 @@ -@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; - const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; -} diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php deleted file mode 100644 index 1a09a6c8..00000000 --- a/vendor/guzzlehttp/psr7/src/ServerRequest.php +++ /dev/null @@ -1,376 +0,0 @@ -serverParams = $serverParams; - - parent::__construct($method, $uri, $headers, $body, $version); - } - - /** - * Return an UploadedFile instance array. - * - * @param array $files A array which respect $_FILES structure - * @throws InvalidArgumentException for unrecognized values - * @return array - */ - public static function normalizeFiles(array $files) - { - $normalized = []; - - foreach ($files as $key => $value) { - if ($value instanceof UploadedFileInterface) { - $normalized[$key] = $value; - } elseif (is_array($value) && isset($value['tmp_name'])) { - $normalized[$key] = self::createUploadedFileFromSpec($value); - } elseif (is_array($value)) { - $normalized[$key] = self::normalizeFiles($value); - continue; - } else { - throw new InvalidArgumentException('Invalid value in files specification'); - } - } - - return $normalized; - } - - /** - * Create and return an UploadedFile instance from a $_FILES specification. - * - * If the specification represents an array of values, this method will - * delegate to normalizeNestedFileSpec() and return that return value. - * - * @param array $value $_FILES struct - * @return array|UploadedFileInterface - */ - private static function createUploadedFileFromSpec(array $value) - { - if (is_array($value['tmp_name'])) { - return self::normalizeNestedFileSpec($value); - } - - return new UploadedFile( - $value['tmp_name'], - (int) $value['size'], - (int) $value['error'], - $value['name'], - $value['type'] - ); - } - - /** - * Normalize an array of file specifications. - * - * Loops through all nested files and returns a normalized array of - * UploadedFileInterface instances. - * - * @param array $files - * @return UploadedFileInterface[] - */ - private static function normalizeNestedFileSpec(array $files = []) - { - $normalizedFiles = []; - - foreach (array_keys($files['tmp_name']) as $key) { - $spec = [ - 'tmp_name' => $files['tmp_name'][$key], - 'size' => $files['size'][$key], - 'error' => $files['error'][$key], - 'name' => $files['name'][$key], - 'type' => $files['type'][$key], - ]; - $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); - } - - return $normalizedFiles; - } - - /** - * Return a ServerRequest populated with superglobals: - * $_GET - * $_POST - * $_COOKIE - * $_FILES - * $_SERVER - * - * @return ServerRequestInterface - */ - public static function fromGlobals() - { - $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; - $headers = getallheaders(); - $uri = self::getUriFromGlobals(); - $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); - $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; - - $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); - - return $serverRequest - ->withCookieParams($_COOKIE) - ->withQueryParams($_GET) - ->withParsedBody($_POST) - ->withUploadedFiles(self::normalizeFiles($_FILES)); - } - - private static function extractHostAndPortFromAuthority($authority) - { - $uri = 'http://'.$authority; - $parts = parse_url($uri); - if (false === $parts) { - return [null, null]; - } - - $host = isset($parts['host']) ? $parts['host'] : null; - $port = isset($parts['port']) ? $parts['port'] : null; - - return [$host, $port]; - } - - /** - * Get a Uri populated with values from $_SERVER. - * - * @return UriInterface - */ - public static function getUriFromGlobals() - { - $uri = new Uri(''); - - $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); - - $hasPort = false; - if (isset($_SERVER['HTTP_HOST'])) { - list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); - if ($host !== null) { - $uri = $uri->withHost($host); - } - - if ($port !== null) { - $hasPort = true; - $uri = $uri->withPort($port); - } - } elseif (isset($_SERVER['SERVER_NAME'])) { - $uri = $uri->withHost($_SERVER['SERVER_NAME']); - } elseif (isset($_SERVER['SERVER_ADDR'])) { - $uri = $uri->withHost($_SERVER['SERVER_ADDR']); - } - - if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { - $uri = $uri->withPort($_SERVER['SERVER_PORT']); - } - - $hasQuery = false; - if (isset($_SERVER['REQUEST_URI'])) { - $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); - $uri = $uri->withPath($requestUriParts[0]); - if (isset($requestUriParts[1])) { - $hasQuery = true; - $uri = $uri->withQuery($requestUriParts[1]); - } - } - - if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { - $uri = $uri->withQuery($_SERVER['QUERY_STRING']); - } - - return $uri; - } - - - /** - * {@inheritdoc} - */ - public function getServerParams() - { - return $this->serverParams; - } - - /** - * {@inheritdoc} - */ - public function getUploadedFiles() - { - return $this->uploadedFiles; - } - - /** - * {@inheritdoc} - */ - public function withUploadedFiles(array $uploadedFiles) - { - $new = clone $this; - $new->uploadedFiles = $uploadedFiles; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function getCookieParams() - { - return $this->cookieParams; - } - - /** - * {@inheritdoc} - */ - public function withCookieParams(array $cookies) - { - $new = clone $this; - $new->cookieParams = $cookies; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function getQueryParams() - { - return $this->queryParams; - } - - /** - * {@inheritdoc} - */ - public function withQueryParams(array $query) - { - $new = clone $this; - $new->queryParams = $query; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function getParsedBody() - { - return $this->parsedBody; - } - - /** - * {@inheritdoc} - */ - public function withParsedBody($data) - { - $new = clone $this; - $new->parsedBody = $data; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * {@inheritdoc} - */ - public function getAttribute($attribute, $default = null) - { - if (false === array_key_exists($attribute, $this->attributes)) { - return $default; - } - - return $this->attributes[$attribute]; - } - - /** - * {@inheritdoc} - */ - public function withAttribute($attribute, $value) - { - $new = clone $this; - $new->attributes[$attribute] = $value; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function withoutAttribute($attribute) - { - if (false === array_key_exists($attribute, $this->attributes)) { - return $this; - } - - $new = clone $this; - unset($new->attributes[$attribute]); - - return $new; - } -} diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php deleted file mode 100644 index d9e7409c..00000000 --- a/vendor/guzzlehttp/psr7/src/Stream.php +++ /dev/null @@ -1,267 +0,0 @@ -size = $options['size']; - } - - $this->customMetadata = isset($options['metadata']) - ? $options['metadata'] - : []; - - $this->stream = $stream; - $meta = stream_get_meta_data($this->stream); - $this->seekable = $meta['seekable']; - $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']); - $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']); - $this->uri = $this->getMetadata('uri'); - } - - /** - * Closes the stream when the destructed - */ - public function __destruct() - { - $this->close(); - } - - public function __toString() - { - try { - $this->seek(0); - return (string) stream_get_contents($this->stream); - } catch (\Exception $e) { - return ''; - } - } - - public function getContents() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - $contents = stream_get_contents($this->stream); - - if ($contents === false) { - throw new \RuntimeException('Unable to read stream contents'); - } - - return $contents; - } - - public function close() - { - if (isset($this->stream)) { - if (is_resource($this->stream)) { - fclose($this->stream); - } - $this->detach(); - } - } - - public function detach() - { - if (!isset($this->stream)) { - return null; - } - - $result = $this->stream; - unset($this->stream); - $this->size = $this->uri = null; - $this->readable = $this->writable = $this->seekable = false; - - return $result; - } - - public function getSize() - { - if ($this->size !== null) { - return $this->size; - } - - if (!isset($this->stream)) { - return null; - } - - // Clear the stat cache if the stream has a URI - if ($this->uri) { - clearstatcache(true, $this->uri); - } - - $stats = fstat($this->stream); - if (isset($stats['size'])) { - $this->size = $stats['size']; - return $this->size; - } - - return null; - } - - public function isReadable() - { - return $this->readable; - } - - public function isWritable() - { - return $this->writable; - } - - public function isSeekable() - { - return $this->seekable; - } - - public function eof() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - return feof($this->stream); - } - - public function tell() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - $result = ftell($this->stream); - - if ($result === false) { - throw new \RuntimeException('Unable to determine stream position'); - } - - return $result; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - $whence = (int) $whence; - - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->seekable) { - throw new \RuntimeException('Stream is not seekable'); - } - if (fseek($this->stream, $offset, $whence) === -1) { - throw new \RuntimeException('Unable to seek to stream position ' - . $offset . ' with whence ' . var_export($whence, true)); - } - } - - public function read($length) - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->readable) { - throw new \RuntimeException('Cannot read from non-readable stream'); - } - if ($length < 0) { - throw new \RuntimeException('Length parameter cannot be negative'); - } - - if (0 === $length) { - return ''; - } - - $string = fread($this->stream, $length); - if (false === $string) { - throw new \RuntimeException('Unable to read from stream'); - } - - return $string; - } - - public function write($string) - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->writable) { - throw new \RuntimeException('Cannot write to a non-writable stream'); - } - - // We can't know the size after writing anything - $this->size = null; - $result = fwrite($this->stream, $string); - - if ($result === false) { - throw new \RuntimeException('Unable to write to stream'); - } - - return $result; - } - - public function getMetadata($key = null) - { - if (!isset($this->stream)) { - return $key ? null : []; - } elseif (!$key) { - return $this->customMetadata + stream_get_meta_data($this->stream); - } elseif (isset($this->customMetadata[$key])) { - return $this->customMetadata[$key]; - } - - $meta = stream_get_meta_data($this->stream); - - return isset($meta[$key]) ? $meta[$key] : null; - } -} diff --git a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php deleted file mode 100644 index daec6f52..00000000 --- a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php +++ /dev/null @@ -1,149 +0,0 @@ -stream = $stream; - } - - /** - * Magic method used to create a new stream if streams are not added in - * the constructor of a decorator (e.g., LazyOpenStream). - * - * @param string $name Name of the property (allows "stream" only). - * - * @return StreamInterface - */ - public function __get($name) - { - if ($name == 'stream') { - $this->stream = $this->createStream(); - return $this->stream; - } - - throw new \UnexpectedValueException("$name not found on class"); - } - - public function __toString() - { - try { - if ($this->isSeekable()) { - $this->seek(0); - } - return $this->getContents(); - } catch (\Exception $e) { - // Really, PHP? https://bugs.php.net/bug.php?id=53648 - trigger_error('StreamDecorator::__toString exception: ' - . (string) $e, E_USER_ERROR); - return ''; - } - } - - public function getContents() - { - return copy_to_string($this); - } - - /** - * Allow decorators to implement custom methods - * - * @param string $method Missing method name - * @param array $args Method arguments - * - * @return mixed - */ - public function __call($method, array $args) - { - $result = call_user_func_array([$this->stream, $method], $args); - - // Always return the wrapped object if the result is a return $this - return $result === $this->stream ? $this : $result; - } - - public function close() - { - $this->stream->close(); - } - - public function getMetadata($key = null) - { - return $this->stream->getMetadata($key); - } - - public function detach() - { - return $this->stream->detach(); - } - - public function getSize() - { - return $this->stream->getSize(); - } - - public function eof() - { - return $this->stream->eof(); - } - - public function tell() - { - return $this->stream->tell(); - } - - public function isReadable() - { - return $this->stream->isReadable(); - } - - public function isWritable() - { - return $this->stream->isWritable(); - } - - public function isSeekable() - { - return $this->stream->isSeekable(); - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - $this->stream->seek($offset, $whence); - } - - public function read($length) - { - return $this->stream->read($length); - } - - public function write($string) - { - return $this->stream->write($string); - } - - /** - * Implement in subclasses to dynamically create streams when requested. - * - * @return StreamInterface - * @throws \BadMethodCallException - */ - protected function createStream() - { - throw new \BadMethodCallException('Not implemented'); - } -} diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php deleted file mode 100644 index 0f3a2856..00000000 --- a/vendor/guzzlehttp/psr7/src/StreamWrapper.php +++ /dev/null @@ -1,161 +0,0 @@ -isReadable()) { - $mode = $stream->isWritable() ? 'r+' : 'r'; - } elseif ($stream->isWritable()) { - $mode = 'w'; - } else { - throw new \InvalidArgumentException('The stream must be readable, ' - . 'writable, or both.'); - } - - return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); - } - - /** - * Creates a stream context that can be used to open a stream as a php stream resource. - * - * @param StreamInterface $stream - * - * @return resource - */ - public static function createStreamContext(StreamInterface $stream) - { - return stream_context_create([ - 'guzzle' => ['stream' => $stream] - ]); - } - - /** - * Registers the stream wrapper if needed - */ - public static function register() - { - if (!in_array('guzzle', stream_get_wrappers())) { - stream_wrapper_register('guzzle', __CLASS__); - } - } - - public function stream_open($path, $mode, $options, &$opened_path) - { - $options = stream_context_get_options($this->context); - - if (!isset($options['guzzle']['stream'])) { - return false; - } - - $this->mode = $mode; - $this->stream = $options['guzzle']['stream']; - - return true; - } - - public function stream_read($count) - { - return $this->stream->read($count); - } - - public function stream_write($data) - { - return (int) $this->stream->write($data); - } - - public function stream_tell() - { - return $this->stream->tell(); - } - - public function stream_eof() - { - return $this->stream->eof(); - } - - public function stream_seek($offset, $whence) - { - $this->stream->seek($offset, $whence); - - return true; - } - - public function stream_cast($cast_as) - { - $stream = clone($this->stream); - - return $stream->detach(); - } - - public function stream_stat() - { - static $modeMap = [ - 'r' => 33060, - 'rb' => 33060, - 'r+' => 33206, - 'w' => 33188, - 'wb' => 33188 - ]; - - return [ - 'dev' => 0, - 'ino' => 0, - 'mode' => $modeMap[$this->mode], - 'nlink' => 0, - 'uid' => 0, - 'gid' => 0, - 'rdev' => 0, - 'size' => $this->stream->getSize() ?: 0, - 'atime' => 0, - 'mtime' => 0, - 'ctime' => 0, - 'blksize' => 0, - 'blocks' => 0 - ]; - } - - public function url_stat($path, $flags) - { - return [ - 'dev' => 0, - 'ino' => 0, - 'mode' => 0, - 'nlink' => 0, - 'uid' => 0, - 'gid' => 0, - 'rdev' => 0, - 'size' => 0, - 'atime' => 0, - 'mtime' => 0, - 'ctime' => 0, - 'blksize' => 0, - 'blocks' => 0 - ]; - } -} diff --git a/vendor/guzzlehttp/psr7/src/UploadedFile.php b/vendor/guzzlehttp/psr7/src/UploadedFile.php deleted file mode 100644 index e62bd5c8..00000000 --- a/vendor/guzzlehttp/psr7/src/UploadedFile.php +++ /dev/null @@ -1,316 +0,0 @@ -setError($errorStatus); - $this->setSize($size); - $this->setClientFilename($clientFilename); - $this->setClientMediaType($clientMediaType); - - if ($this->isOk()) { - $this->setStreamOrFile($streamOrFile); - } - } - - /** - * Depending on the value set file or stream variable - * - * @param mixed $streamOrFile - * @throws InvalidArgumentException - */ - private function setStreamOrFile($streamOrFile) - { - if (is_string($streamOrFile)) { - $this->file = $streamOrFile; - } elseif (is_resource($streamOrFile)) { - $this->stream = new Stream($streamOrFile); - } elseif ($streamOrFile instanceof StreamInterface) { - $this->stream = $streamOrFile; - } else { - throw new InvalidArgumentException( - 'Invalid stream or file provided for UploadedFile' - ); - } - } - - /** - * @param int $error - * @throws InvalidArgumentException - */ - private function setError($error) - { - if (false === is_int($error)) { - throw new InvalidArgumentException( - 'Upload file error status must be an integer' - ); - } - - if (false === in_array($error, UploadedFile::$errors)) { - throw new InvalidArgumentException( - 'Invalid error status for UploadedFile' - ); - } - - $this->error = $error; - } - - /** - * @param int $size - * @throws InvalidArgumentException - */ - private function setSize($size) - { - if (false === is_int($size)) { - throw new InvalidArgumentException( - 'Upload file size must be an integer' - ); - } - - $this->size = $size; - } - - /** - * @param mixed $param - * @return boolean - */ - private function isStringOrNull($param) - { - return in_array(gettype($param), ['string', 'NULL']); - } - - /** - * @param mixed $param - * @return boolean - */ - private function isStringNotEmpty($param) - { - return is_string($param) && false === empty($param); - } - - /** - * @param string|null $clientFilename - * @throws InvalidArgumentException - */ - private function setClientFilename($clientFilename) - { - if (false === $this->isStringOrNull($clientFilename)) { - throw new InvalidArgumentException( - 'Upload file client filename must be a string or null' - ); - } - - $this->clientFilename = $clientFilename; - } - - /** - * @param string|null $clientMediaType - * @throws InvalidArgumentException - */ - private function setClientMediaType($clientMediaType) - { - if (false === $this->isStringOrNull($clientMediaType)) { - throw new InvalidArgumentException( - 'Upload file client media type must be a string or null' - ); - } - - $this->clientMediaType = $clientMediaType; - } - - /** - * Return true if there is no upload error - * - * @return boolean - */ - private function isOk() - { - return $this->error === UPLOAD_ERR_OK; - } - - /** - * @return boolean - */ - public function isMoved() - { - return $this->moved; - } - - /** - * @throws RuntimeException if is moved or not ok - */ - private function validateActive() - { - if (false === $this->isOk()) { - throw new RuntimeException('Cannot retrieve stream due to upload error'); - } - - if ($this->isMoved()) { - throw new RuntimeException('Cannot retrieve stream after it has already been moved'); - } - } - - /** - * {@inheritdoc} - * @throws RuntimeException if the upload was not successful. - */ - public function getStream() - { - $this->validateActive(); - - if ($this->stream instanceof StreamInterface) { - return $this->stream; - } - - return new LazyOpenStream($this->file, 'r+'); - } - - /** - * {@inheritdoc} - * - * @see http://php.net/is_uploaded_file - * @see http://php.net/move_uploaded_file - * @param string $targetPath Path to which to move the uploaded file. - * @throws RuntimeException if the upload was not successful. - * @throws InvalidArgumentException if the $path specified is invalid. - * @throws RuntimeException on any error during the move operation, or on - * the second or subsequent call to the method. - */ - public function moveTo($targetPath) - { - $this->validateActive(); - - if (false === $this->isStringNotEmpty($targetPath)) { - throw new InvalidArgumentException( - 'Invalid path provided for move operation; must be a non-empty string' - ); - } - - if ($this->file) { - $this->moved = php_sapi_name() == 'cli' - ? rename($this->file, $targetPath) - : move_uploaded_file($this->file, $targetPath); - } else { - copy_to_stream( - $this->getStream(), - new LazyOpenStream($targetPath, 'w') - ); - - $this->moved = true; - } - - if (false === $this->moved) { - throw new RuntimeException( - sprintf('Uploaded file could not be moved to %s', $targetPath) - ); - } - } - - /** - * {@inheritdoc} - * - * @return int|null The file size in bytes or null if unknown. - */ - public function getSize() - { - return $this->size; - } - - /** - * {@inheritdoc} - * - * @see http://php.net/manual/en/features.file-upload.errors.php - * @return int One of PHP's UPLOAD_ERR_XXX constants. - */ - public function getError() - { - return $this->error; - } - - /** - * {@inheritdoc} - * - * @return string|null The filename sent by the client or null if none - * was provided. - */ - public function getClientFilename() - { - return $this->clientFilename; - } - - /** - * {@inheritdoc} - */ - public function getClientMediaType() - { - return $this->clientMediaType; - } -} diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php deleted file mode 100644 index 825a25ee..00000000 --- a/vendor/guzzlehttp/psr7/src/Uri.php +++ /dev/null @@ -1,760 +0,0 @@ - 80, - 'https' => 443, - 'ftp' => 21, - 'gopher' => 70, - 'nntp' => 119, - 'news' => 119, - 'telnet' => 23, - 'tn3270' => 23, - 'imap' => 143, - 'pop' => 110, - 'ldap' => 389, - ]; - - private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; - private static $charSubDelims = '!\$&\'\(\)\*\+,;='; - private static $replaceQuery = ['=' => '%3D', '&' => '%26']; - - /** @var string Uri scheme. */ - private $scheme = ''; - - /** @var string Uri user info. */ - private $userInfo = ''; - - /** @var string Uri host. */ - private $host = ''; - - /** @var int|null Uri port. */ - private $port; - - /** @var string Uri path. */ - private $path = ''; - - /** @var string Uri query string. */ - private $query = ''; - - /** @var string Uri fragment. */ - private $fragment = ''; - - /** - * @param string $uri URI to parse - */ - public function __construct($uri = '') - { - // weak type check to also accept null until we can add scalar type hints - if ($uri != '') { - $parts = parse_url($uri); - if ($parts === false) { - throw new \InvalidArgumentException("Unable to parse URI: $uri"); - } - $this->applyParts($parts); - } - } - - public function __toString() - { - return self::composeComponents( - $this->scheme, - $this->getAuthority(), - $this->path, - $this->query, - $this->fragment - ); - } - - /** - * Composes a URI reference string from its various components. - * - * Usually this method does not need to be called manually but instead is used indirectly via - * `Psr\Http\Message\UriInterface::__toString`. - * - * PSR-7 UriInterface treats an empty component the same as a missing component as - * getQuery(), getFragment() etc. always return a string. This explains the slight - * difference to RFC 3986 Section 5.3. - * - * Another adjustment is that the authority separator is added even when the authority is missing/empty - * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with - * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But - * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to - * that format). - * - * @param string $scheme - * @param string $authority - * @param string $path - * @param string $query - * @param string $fragment - * - * @return string - * - * @link https://tools.ietf.org/html/rfc3986#section-5.3 - */ - public static function composeComponents($scheme, $authority, $path, $query, $fragment) - { - $uri = ''; - - // weak type checks to also accept null until we can add scalar type hints - if ($scheme != '') { - $uri .= $scheme . ':'; - } - - if ($authority != ''|| $scheme === 'file') { - $uri .= '//' . $authority; - } - - $uri .= $path; - - if ($query != '') { - $uri .= '?' . $query; - } - - if ($fragment != '') { - $uri .= '#' . $fragment; - } - - return $uri; - } - - /** - * Whether the URI has the default port of the current scheme. - * - * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used - * independently of the implementation. - * - * @param UriInterface $uri - * - * @return bool - */ - public static function isDefaultPort(UriInterface $uri) - { - return $uri->getPort() === null - || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); - } - - /** - * Whether the URI is absolute, i.e. it has a scheme. - * - * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true - * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative - * to another URI, the base URI. Relative references can be divided into several forms: - * - network-path references, e.g. '//example.com/path' - * - absolute-path references, e.g. '/path' - * - relative-path references, e.g. 'subpath' - * - * @param UriInterface $uri - * - * @return bool - * @see Uri::isNetworkPathReference - * @see Uri::isAbsolutePathReference - * @see Uri::isRelativePathReference - * @link https://tools.ietf.org/html/rfc3986#section-4 - */ - public static function isAbsolute(UriInterface $uri) - { - return $uri->getScheme() !== ''; - } - - /** - * Whether the URI is a network-path reference. - * - * A relative reference that begins with two slash characters is termed an network-path reference. - * - * @param UriInterface $uri - * - * @return bool - * @link https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isNetworkPathReference(UriInterface $uri) - { - return $uri->getScheme() === '' && $uri->getAuthority() !== ''; - } - - /** - * Whether the URI is a absolute-path reference. - * - * A relative reference that begins with a single slash character is termed an absolute-path reference. - * - * @param UriInterface $uri - * - * @return bool - * @link https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isAbsolutePathReference(UriInterface $uri) - { - return $uri->getScheme() === '' - && $uri->getAuthority() === '' - && isset($uri->getPath()[0]) - && $uri->getPath()[0] === '/'; - } - - /** - * Whether the URI is a relative-path reference. - * - * A relative reference that does not begin with a slash character is termed a relative-path reference. - * - * @param UriInterface $uri - * - * @return bool - * @link https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isRelativePathReference(UriInterface $uri) - { - return $uri->getScheme() === '' - && $uri->getAuthority() === '' - && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); - } - - /** - * Whether the URI is a same-document reference. - * - * A same-document reference refers to a URI that is, aside from its fragment - * component, identical to the base URI. When no base URI is given, only an empty - * URI reference (apart from its fragment) is considered a same-document reference. - * - * @param UriInterface $uri The URI to check - * @param UriInterface|null $base An optional base URI to compare against - * - * @return bool - * @link https://tools.ietf.org/html/rfc3986#section-4.4 - */ - public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) - { - if ($base !== null) { - $uri = UriResolver::resolve($base, $uri); - - return ($uri->getScheme() === $base->getScheme()) - && ($uri->getAuthority() === $base->getAuthority()) - && ($uri->getPath() === $base->getPath()) - && ($uri->getQuery() === $base->getQuery()); - } - - return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; - } - - /** - * Removes dot segments from a path and returns the new path. - * - * @param string $path - * - * @return string - * - * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. - * @see UriResolver::removeDotSegments - */ - public static function removeDotSegments($path) - { - return UriResolver::removeDotSegments($path); - } - - /** - * Converts the relative URI into a new URI that is resolved against the base URI. - * - * @param UriInterface $base Base URI - * @param string|UriInterface $rel Relative URI - * - * @return UriInterface - * - * @deprecated since version 1.4. Use UriResolver::resolve instead. - * @see UriResolver::resolve - */ - public static function resolve(UriInterface $base, $rel) - { - if (!($rel instanceof UriInterface)) { - $rel = new self($rel); - } - - return UriResolver::resolve($base, $rel); - } - - /** - * Creates a new URI with a specific query string value removed. - * - * Any existing query string values that exactly match the provided key are - * removed. - * - * @param UriInterface $uri URI to use as a base. - * @param string $key Query string key to remove. - * - * @return UriInterface - */ - public static function withoutQueryValue(UriInterface $uri, $key) - { - $result = self::getFilteredQueryString($uri, [$key]); - - return $uri->withQuery(implode('&', $result)); - } - - /** - * Creates a new URI with a specific query string value. - * - * Any existing query string values that exactly match the provided key are - * removed and replaced with the given key value pair. - * - * A value of null will set the query string key without a value, e.g. "key" - * instead of "key=value". - * - * @param UriInterface $uri URI to use as a base. - * @param string $key Key to set. - * @param string|null $value Value to set - * - * @return UriInterface - */ - public static function withQueryValue(UriInterface $uri, $key, $value) - { - $result = self::getFilteredQueryString($uri, [$key]); - - $result[] = self::generateQueryString($key, $value); - - return $uri->withQuery(implode('&', $result)); - } - - /** - * Creates a new URI with multiple specific query string values. - * - * It has the same behavior as withQueryValue() but for an associative array of key => value. - * - * @param UriInterface $uri URI to use as a base. - * @param array $keyValueArray Associative array of key and values - * - * @return UriInterface - */ - public static function withQueryValues(UriInterface $uri, array $keyValueArray) - { - $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); - - foreach ($keyValueArray as $key => $value) { - $result[] = self::generateQueryString($key, $value); - } - - return $uri->withQuery(implode('&', $result)); - } - - /** - * Creates a URI from a hash of `parse_url` components. - * - * @param array $parts - * - * @return UriInterface - * @link http://php.net/manual/en/function.parse-url.php - * - * @throws \InvalidArgumentException If the components do not form a valid URI. - */ - public static function fromParts(array $parts) - { - $uri = new self(); - $uri->applyParts($parts); - $uri->validateState(); - - return $uri; - } - - public function getScheme() - { - return $this->scheme; - } - - public function getAuthority() - { - $authority = $this->host; - if ($this->userInfo !== '') { - $authority = $this->userInfo . '@' . $authority; - } - - if ($this->port !== null) { - $authority .= ':' . $this->port; - } - - return $authority; - } - - public function getUserInfo() - { - return $this->userInfo; - } - - public function getHost() - { - return $this->host; - } - - public function getPort() - { - return $this->port; - } - - public function getPath() - { - return $this->path; - } - - public function getQuery() - { - return $this->query; - } - - public function getFragment() - { - return $this->fragment; - } - - public function withScheme($scheme) - { - $scheme = $this->filterScheme($scheme); - - if ($this->scheme === $scheme) { - return $this; - } - - $new = clone $this; - $new->scheme = $scheme; - $new->removeDefaultPort(); - $new->validateState(); - - return $new; - } - - public function withUserInfo($user, $password = null) - { - $info = $this->filterUserInfoComponent($user); - if ($password !== null) { - $info .= ':' . $this->filterUserInfoComponent($password); - } - - if ($this->userInfo === $info) { - return $this; - } - - $new = clone $this; - $new->userInfo = $info; - $new->validateState(); - - return $new; - } - - public function withHost($host) - { - $host = $this->filterHost($host); - - if ($this->host === $host) { - return $this; - } - - $new = clone $this; - $new->host = $host; - $new->validateState(); - - return $new; - } - - public function withPort($port) - { - $port = $this->filterPort($port); - - if ($this->port === $port) { - return $this; - } - - $new = clone $this; - $new->port = $port; - $new->removeDefaultPort(); - $new->validateState(); - - return $new; - } - - public function withPath($path) - { - $path = $this->filterPath($path); - - if ($this->path === $path) { - return $this; - } - - $new = clone $this; - $new->path = $path; - $new->validateState(); - - return $new; - } - - public function withQuery($query) - { - $query = $this->filterQueryAndFragment($query); - - if ($this->query === $query) { - return $this; - } - - $new = clone $this; - $new->query = $query; - - return $new; - } - - public function withFragment($fragment) - { - $fragment = $this->filterQueryAndFragment($fragment); - - if ($this->fragment === $fragment) { - return $this; - } - - $new = clone $this; - $new->fragment = $fragment; - - return $new; - } - - /** - * Apply parse_url parts to a URI. - * - * @param array $parts Array of parse_url parts to apply. - */ - private function applyParts(array $parts) - { - $this->scheme = isset($parts['scheme']) - ? $this->filterScheme($parts['scheme']) - : ''; - $this->userInfo = isset($parts['user']) - ? $this->filterUserInfoComponent($parts['user']) - : ''; - $this->host = isset($parts['host']) - ? $this->filterHost($parts['host']) - : ''; - $this->port = isset($parts['port']) - ? $this->filterPort($parts['port']) - : null; - $this->path = isset($parts['path']) - ? $this->filterPath($parts['path']) - : ''; - $this->query = isset($parts['query']) - ? $this->filterQueryAndFragment($parts['query']) - : ''; - $this->fragment = isset($parts['fragment']) - ? $this->filterQueryAndFragment($parts['fragment']) - : ''; - if (isset($parts['pass'])) { - $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); - } - - $this->removeDefaultPort(); - } - - /** - * @param string $scheme - * - * @return string - * - * @throws \InvalidArgumentException If the scheme is invalid. - */ - private function filterScheme($scheme) - { - if (!is_string($scheme)) { - throw new \InvalidArgumentException('Scheme must be a string'); - } - - return strtolower($scheme); - } - - /** - * @param string $component - * - * @return string - * - * @throws \InvalidArgumentException If the user info is invalid. - */ - private function filterUserInfoComponent($component) - { - if (!is_string($component)) { - throw new \InvalidArgumentException('User info must be a string'); - } - - return preg_replace_callback( - '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/', - [$this, 'rawurlencodeMatchZero'], - $component - ); - } - - /** - * @param string $host - * - * @return string - * - * @throws \InvalidArgumentException If the host is invalid. - */ - private function filterHost($host) - { - if (!is_string($host)) { - throw new \InvalidArgumentException('Host must be a string'); - } - - return strtolower($host); - } - - /** - * @param int|null $port - * - * @return int|null - * - * @throws \InvalidArgumentException If the port is invalid. - */ - private function filterPort($port) - { - if ($port === null) { - return null; - } - - $port = (int) $port; - if (0 > $port || 0xffff < $port) { - throw new \InvalidArgumentException( - sprintf('Invalid port: %d. Must be between 0 and 65535', $port) - ); - } - - return $port; - } - - /** - * @param UriInterface $uri - * @param array $keys - * - * @return array - */ - private static function getFilteredQueryString(UriInterface $uri, array $keys) - { - $current = $uri->getQuery(); - - if ($current === '') { - return []; - } - - $decodedKeys = array_map('rawurldecode', $keys); - - return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { - return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); - }); - } - - /** - * @param string $key - * @param string|null $value - * - * @return string - */ - private static function generateQueryString($key, $value) - { - // Query string separators ("=", "&") within the key or value need to be encoded - // (while preventing double-encoding) before setting the query string. All other - // chars that need percent-encoding will be encoded by withQuery(). - $queryString = strtr($key, self::$replaceQuery); - - if ($value !== null) { - $queryString .= '=' . strtr($value, self::$replaceQuery); - } - - return $queryString; - } - - private function removeDefaultPort() - { - if ($this->port !== null && self::isDefaultPort($this)) { - $this->port = null; - } - } - - /** - * Filters the path of a URI - * - * @param string $path - * - * @return string - * - * @throws \InvalidArgumentException If the path is invalid. - */ - private function filterPath($path) - { - if (!is_string($path)) { - throw new \InvalidArgumentException('Path must be a string'); - } - - return preg_replace_callback( - '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', - [$this, 'rawurlencodeMatchZero'], - $path - ); - } - - /** - * Filters the query string or fragment of a URI. - * - * @param string $str - * - * @return string - * - * @throws \InvalidArgumentException If the query or fragment is invalid. - */ - private function filterQueryAndFragment($str) - { - if (!is_string($str)) { - throw new \InvalidArgumentException('Query and fragment must be a string'); - } - - return preg_replace_callback( - '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', - [$this, 'rawurlencodeMatchZero'], - $str - ); - } - - private function rawurlencodeMatchZero(array $match) - { - return rawurlencode($match[0]); - } - - private function validateState() - { - if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { - $this->host = self::HTTP_DEFAULT_HOST; - } - - if ($this->getAuthority() === '') { - if (0 === strpos($this->path, '//')) { - throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); - } - if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { - throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); - } - } elseif (isset($this->path[0]) && $this->path[0] !== '/') { - @trigger_error( - 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . - 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', - E_USER_DEPRECATED - ); - $this->path = '/'. $this->path; - //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); - } - } -} diff --git a/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/vendor/guzzlehttp/psr7/src/UriNormalizer.php deleted file mode 100644 index 384c29e5..00000000 --- a/vendor/guzzlehttp/psr7/src/UriNormalizer.php +++ /dev/null @@ -1,216 +0,0 @@ -getPath() === '' && - ($uri->getScheme() === 'http' || $uri->getScheme() === 'https') - ) { - $uri = $uri->withPath('/'); - } - - if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { - $uri = $uri->withHost(''); - } - - if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { - $uri = $uri->withPort(null); - } - - if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { - $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); - } - - if ($flags & self::REMOVE_DUPLICATE_SLASHES) { - $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); - } - - if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { - $queryKeyValues = explode('&', $uri->getQuery()); - sort($queryKeyValues); - $uri = $uri->withQuery(implode('&', $queryKeyValues)); - } - - return $uri; - } - - /** - * Whether two URIs can be considered equivalent. - * - * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also - * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be - * resolved against the same base URI. If this is not the case, determination of equivalence or difference of - * relative references does not mean anything. - * - * @param UriInterface $uri1 An URI to compare - * @param UriInterface $uri2 An URI to compare - * @param int $normalizations A bitmask of normalizations to apply, see constants - * - * @return bool - * @link https://tools.ietf.org/html/rfc3986#section-6.1 - */ - public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) - { - return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); - } - - private static function capitalizePercentEncoding(UriInterface $uri) - { - $regex = '/(?:%[A-Fa-f0-9]{2})++/'; - - $callback = function (array $match) { - return strtoupper($match[0]); - }; - - return - $uri->withPath( - preg_replace_callback($regex, $callback, $uri->getPath()) - )->withQuery( - preg_replace_callback($regex, $callback, $uri->getQuery()) - ); - } - - private static function decodeUnreservedCharacters(UriInterface $uri) - { - $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; - - $callback = function (array $match) { - return rawurldecode($match[0]); - }; - - return - $uri->withPath( - preg_replace_callback($regex, $callback, $uri->getPath()) - )->withQuery( - preg_replace_callback($regex, $callback, $uri->getQuery()) - ); - } - - private function __construct() - { - // cannot be instantiated - } -} diff --git a/vendor/guzzlehttp/psr7/src/UriResolver.php b/vendor/guzzlehttp/psr7/src/UriResolver.php deleted file mode 100644 index c1cb8a27..00000000 --- a/vendor/guzzlehttp/psr7/src/UriResolver.php +++ /dev/null @@ -1,219 +0,0 @@ -getScheme() != '') { - return $rel->withPath(self::removeDotSegments($rel->getPath())); - } - - if ($rel->getAuthority() != '') { - $targetAuthority = $rel->getAuthority(); - $targetPath = self::removeDotSegments($rel->getPath()); - $targetQuery = $rel->getQuery(); - } else { - $targetAuthority = $base->getAuthority(); - if ($rel->getPath() === '') { - $targetPath = $base->getPath(); - $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); - } else { - if ($rel->getPath()[0] === '/') { - $targetPath = $rel->getPath(); - } else { - if ($targetAuthority != '' && $base->getPath() === '') { - $targetPath = '/' . $rel->getPath(); - } else { - $lastSlashPos = strrpos($base->getPath(), '/'); - if ($lastSlashPos === false) { - $targetPath = $rel->getPath(); - } else { - $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); - } - } - } - $targetPath = self::removeDotSegments($targetPath); - $targetQuery = $rel->getQuery(); - } - } - - return new Uri(Uri::composeComponents( - $base->getScheme(), - $targetAuthority, - $targetPath, - $targetQuery, - $rel->getFragment() - )); - } - - /** - * Returns the target URI as a relative reference from the base URI. - * - * This method is the counterpart to resolve(): - * - * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) - * - * One use-case is to use the current request URI as base URI and then generate relative links in your documents - * to reduce the document size or offer self-contained downloadable document archives. - * - * $base = new Uri('http://example.com/a/b/'); - * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. - * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. - * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. - * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. - * - * This method also accepts a target that is already relative and will try to relativize it further. Only a - * relative-path reference will be returned as-is. - * - * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well - * - * @param UriInterface $base Base URI - * @param UriInterface $target Target URI - * - * @return UriInterface The relative URI reference - */ - public static function relativize(UriInterface $base, UriInterface $target) - { - if ($target->getScheme() !== '' && - ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '') - ) { - return $target; - } - - if (Uri::isRelativePathReference($target)) { - // As the target is already highly relative we return it as-is. It would be possible to resolve - // the target with `$target = self::resolve($base, $target);` and then try make it more relative - // by removing a duplicate query. But let's not do that automatically. - return $target; - } - - if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { - return $target->withScheme(''); - } - - // We must remove the path before removing the authority because if the path starts with two slashes, the URI - // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also - // invalid. - $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); - - if ($base->getPath() !== $target->getPath()) { - return $emptyPathUri->withPath(self::getRelativePath($base, $target)); - } - - if ($base->getQuery() === $target->getQuery()) { - // Only the target fragment is left. And it must be returned even if base and target fragment are the same. - return $emptyPathUri->withQuery(''); - } - - // If the base URI has a query but the target has none, we cannot return an empty path reference as it would - // inherit the base query component when resolving. - if ($target->getQuery() === '') { - $segments = explode('/', $target->getPath()); - $lastSegment = end($segments); - - return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); - } - - return $emptyPathUri; - } - - private static function getRelativePath(UriInterface $base, UriInterface $target) - { - $sourceSegments = explode('/', $base->getPath()); - $targetSegments = explode('/', $target->getPath()); - array_pop($sourceSegments); - $targetLastSegment = array_pop($targetSegments); - foreach ($sourceSegments as $i => $segment) { - if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { - unset($sourceSegments[$i], $targetSegments[$i]); - } else { - break; - } - } - $targetSegments[] = $targetLastSegment; - $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); - - // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". - // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used - // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. - if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { - $relativePath = "./$relativePath"; - } elseif ('/' === $relativePath[0]) { - if ($base->getAuthority() != '' && $base->getPath() === '') { - // In this case an extra slash is added by resolve() automatically. So we must not add one here. - $relativePath = ".$relativePath"; - } else { - $relativePath = "./$relativePath"; - } - } - - return $relativePath; - } - - private function __construct() - { - // cannot be instantiated - } -} diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php deleted file mode 100644 index 8e6dafe6..00000000 --- a/vendor/guzzlehttp/psr7/src/functions.php +++ /dev/null @@ -1,899 +0,0 @@ -getMethod() . ' ' - . $message->getRequestTarget()) - . ' HTTP/' . $message->getProtocolVersion(); - if (!$message->hasHeader('host')) { - $msg .= "\r\nHost: " . $message->getUri()->getHost(); - } - } elseif ($message instanceof ResponseInterface) { - $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' - . $message->getStatusCode() . ' ' - . $message->getReasonPhrase(); - } else { - throw new \InvalidArgumentException('Unknown message type'); - } - - foreach ($message->getHeaders() as $name => $values) { - $msg .= "\r\n{$name}: " . implode(', ', $values); - } - - return "{$msg}\r\n\r\n" . $message->getBody(); -} - -/** - * Returns a UriInterface for the given value. - * - * This function accepts a string or {@see Psr\Http\Message\UriInterface} and - * returns a UriInterface for the given value. If the value is already a - * `UriInterface`, it is returned as-is. - * - * @param string|UriInterface $uri - * - * @return UriInterface - * @throws \InvalidArgumentException - */ -function uri_for($uri) -{ - if ($uri instanceof UriInterface) { - return $uri; - } elseif (is_string($uri)) { - return new Uri($uri); - } - - throw new \InvalidArgumentException('URI must be a string or UriInterface'); -} - -/** - * Create a new stream based on the input type. - * - * Options is an associative array that can contain the following keys: - * - metadata: Array of custom metadata. - * - size: Size of the stream. - * - * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data - * @param array $options Additional options - * - * @return StreamInterface - * @throws \InvalidArgumentException if the $resource arg is not valid. - */ -function stream_for($resource = '', array $options = []) -{ - if (is_scalar($resource)) { - $stream = fopen('php://temp', 'r+'); - if ($resource !== '') { - fwrite($stream, $resource); - fseek($stream, 0); - } - return new Stream($stream, $options); - } - - switch (gettype($resource)) { - case 'resource': - return new Stream($resource, $options); - case 'object': - if ($resource instanceof StreamInterface) { - return $resource; - } elseif ($resource instanceof \Iterator) { - return new PumpStream(function () use ($resource) { - if (!$resource->valid()) { - return false; - } - $result = $resource->current(); - $resource->next(); - return $result; - }, $options); - } elseif (method_exists($resource, '__toString')) { - return stream_for((string) $resource, $options); - } - break; - case 'NULL': - return new Stream(fopen('php://temp', 'r+'), $options); - } - - if (is_callable($resource)) { - return new PumpStream($resource, $options); - } - - throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); -} - -/** - * Parse an array of header values containing ";" separated data into an - * array of associative arrays representing the header key value pair - * data of the header. When a parameter does not contain a value, but just - * contains a key, this function will inject a key with a '' string value. - * - * @param string|array $header Header to parse into components. - * - * @return array Returns the parsed header values. - */ -function parse_header($header) -{ - static $trimmed = "\"' \n\t\r"; - $params = $matches = []; - - foreach (normalize_header($header) as $val) { - $part = []; - foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { - if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { - $m = $matches[0]; - if (isset($m[1])) { - $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); - } else { - $part[] = trim($m[0], $trimmed); - } - } - } - if ($part) { - $params[] = $part; - } - } - - return $params; -} - -/** - * Converts an array of header values that may contain comma separated - * headers into an array of headers with no comma separated values. - * - * @param string|array $header Header to normalize. - * - * @return array Returns the normalized header field values. - */ -function normalize_header($header) -{ - if (!is_array($header)) { - return array_map('trim', explode(',', $header)); - } - - $result = []; - foreach ($header as $value) { - foreach ((array) $value as $v) { - if (strpos($v, ',') === false) { - $result[] = $v; - continue; - } - foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) { - $result[] = trim($vv); - } - } - } - - return $result; -} - -/** - * Clone and modify a request with the given changes. - * - * The changes can be one of: - * - method: (string) Changes the HTTP method. - * - set_headers: (array) Sets the given headers. - * - remove_headers: (array) Remove the given headers. - * - body: (mixed) Sets the given body. - * - uri: (UriInterface) Set the URI. - * - query: (string) Set the query string value of the URI. - * - version: (string) Set the protocol version. - * - * @param RequestInterface $request Request to clone and modify. - * @param array $changes Changes to apply. - * - * @return RequestInterface - */ -function modify_request(RequestInterface $request, array $changes) -{ - if (!$changes) { - return $request; - } - - $headers = $request->getHeaders(); - - if (!isset($changes['uri'])) { - $uri = $request->getUri(); - } else { - // Remove the host header if one is on the URI - if ($host = $changes['uri']->getHost()) { - $changes['set_headers']['Host'] = $host; - - if ($port = $changes['uri']->getPort()) { - $standardPorts = ['http' => 80, 'https' => 443]; - $scheme = $changes['uri']->getScheme(); - if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { - $changes['set_headers']['Host'] .= ':'.$port; - } - } - } - $uri = $changes['uri']; - } - - if (!empty($changes['remove_headers'])) { - $headers = _caseless_remove($changes['remove_headers'], $headers); - } - - if (!empty($changes['set_headers'])) { - $headers = _caseless_remove(array_keys($changes['set_headers']), $headers); - $headers = $changes['set_headers'] + $headers; - } - - if (isset($changes['query'])) { - $uri = $uri->withQuery($changes['query']); - } - - if ($request instanceof ServerRequestInterface) { - return (new ServerRequest( - isset($changes['method']) ? $changes['method'] : $request->getMethod(), - $uri, - $headers, - isset($changes['body']) ? $changes['body'] : $request->getBody(), - isset($changes['version']) - ? $changes['version'] - : $request->getProtocolVersion(), - $request->getServerParams() - )) - ->withParsedBody($request->getParsedBody()) - ->withQueryParams($request->getQueryParams()) - ->withCookieParams($request->getCookieParams()) - ->withUploadedFiles($request->getUploadedFiles()); - } - - return new Request( - isset($changes['method']) ? $changes['method'] : $request->getMethod(), - $uri, - $headers, - isset($changes['body']) ? $changes['body'] : $request->getBody(), - isset($changes['version']) - ? $changes['version'] - : $request->getProtocolVersion() - ); -} - -/** - * Attempts to rewind a message body and throws an exception on failure. - * - * The body of the message will only be rewound if a call to `tell()` returns a - * value other than `0`. - * - * @param MessageInterface $message Message to rewind - * - * @throws \RuntimeException - */ -function rewind_body(MessageInterface $message) -{ - $body = $message->getBody(); - - if ($body->tell()) { - $body->rewind(); - } -} - -/** - * Safely opens a PHP stream resource using a filename. - * - * When fopen fails, PHP normally raises a warning. This function adds an - * error handler that checks for errors and throws an exception instead. - * - * @param string $filename File to open - * @param string $mode Mode used to open the file - * - * @return resource - * @throws \RuntimeException if the file cannot be opened - */ -function try_fopen($filename, $mode) -{ - $ex = null; - set_error_handler(function () use ($filename, $mode, &$ex) { - $ex = new \RuntimeException(sprintf( - 'Unable to open %s using mode %s: %s', - $filename, - $mode, - func_get_args()[1] - )); - }); - - $handle = fopen($filename, $mode); - restore_error_handler(); - - if ($ex) { - /** @var $ex \RuntimeException */ - throw $ex; - } - - return $handle; -} - -/** - * Copy the contents of a stream into a string until the given number of - * bytes have been read. - * - * @param StreamInterface $stream Stream to read - * @param int $maxLen Maximum number of bytes to read. Pass -1 - * to read the entire stream. - * @return string - * @throws \RuntimeException on error. - */ -function copy_to_string(StreamInterface $stream, $maxLen = -1) -{ - $buffer = ''; - - if ($maxLen === -1) { - while (!$stream->eof()) { - $buf = $stream->read(1048576); - // Using a loose equality here to match on '' and false. - if ($buf == null) { - break; - } - $buffer .= $buf; - } - return $buffer; - } - - $len = 0; - while (!$stream->eof() && $len < $maxLen) { - $buf = $stream->read($maxLen - $len); - // Using a loose equality here to match on '' and false. - if ($buf == null) { - break; - } - $buffer .= $buf; - $len = strlen($buffer); - } - - return $buffer; -} - -/** - * Copy the contents of a stream into another stream until the given number - * of bytes have been read. - * - * @param StreamInterface $source Stream to read from - * @param StreamInterface $dest Stream to write to - * @param int $maxLen Maximum number of bytes to read. Pass -1 - * to read the entire stream. - * - * @throws \RuntimeException on error. - */ -function copy_to_stream( - StreamInterface $source, - StreamInterface $dest, - $maxLen = -1 -) { - $bufferSize = 8192; - - if ($maxLen === -1) { - while (!$source->eof()) { - if (!$dest->write($source->read($bufferSize))) { - break; - } - } - } else { - $remaining = $maxLen; - while ($remaining > 0 && !$source->eof()) { - $buf = $source->read(min($bufferSize, $remaining)); - $len = strlen($buf); - if (!$len) { - break; - } - $remaining -= $len; - $dest->write($buf); - } - } -} - -/** - * Calculate a hash of a Stream - * - * @param StreamInterface $stream Stream to calculate the hash for - * @param string $algo Hash algorithm (e.g. md5, crc32, etc) - * @param bool $rawOutput Whether or not to use raw output - * - * @return string Returns the hash of the stream - * @throws \RuntimeException on error. - */ -function hash( - StreamInterface $stream, - $algo, - $rawOutput = false -) { - $pos = $stream->tell(); - - if ($pos > 0) { - $stream->rewind(); - } - - $ctx = hash_init($algo); - while (!$stream->eof()) { - hash_update($ctx, $stream->read(1048576)); - } - - $out = hash_final($ctx, (bool) $rawOutput); - $stream->seek($pos); - - return $out; -} - -/** - * Read a line from the stream up to the maximum allowed buffer length - * - * @param StreamInterface $stream Stream to read from - * @param int $maxLength Maximum buffer length - * - * @return string - */ -function readline(StreamInterface $stream, $maxLength = null) -{ - $buffer = ''; - $size = 0; - - while (!$stream->eof()) { - // Using a loose equality here to match on '' and false. - if (null == ($byte = $stream->read(1))) { - return $buffer; - } - $buffer .= $byte; - // Break when a new line is found or the max length - 1 is reached - if ($byte === "\n" || ++$size === $maxLength - 1) { - break; - } - } - - return $buffer; -} - -/** - * Parses a request message string into a request object. - * - * @param string $message Request message string. - * - * @return Request - */ -function parse_request($message) -{ - $data = _parse_message($message); - $matches = []; - if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { - throw new \InvalidArgumentException('Invalid request string'); - } - $parts = explode(' ', $data['start-line'], 3); - $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; - - $request = new Request( - $parts[0], - $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1], - $data['headers'], - $data['body'], - $version - ); - - return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); -} - -/** - * Parses a response message string into a response object. - * - * @param string $message Response message string. - * - * @return Response - */ -function parse_response($message) -{ - $data = _parse_message($message); - // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space - // between status-code and reason-phrase is required. But browsers accept - // responses without space and reason as well. - if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { - throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); - } - $parts = explode(' ', $data['start-line'], 3); - - return new Response( - $parts[1], - $data['headers'], - $data['body'], - explode('/', $parts[0])[1], - isset($parts[2]) ? $parts[2] : null - ); -} - -/** - * Parse a query string into an associative array. - * - * If multiple values are found for the same key, the value of that key - * value pair will become an array. This function does not parse nested - * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will - * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']). - * - * @param string $str Query string to parse - * @param int|bool $urlEncoding How the query string is encoded - * - * @return array - */ -function parse_query($str, $urlEncoding = true) -{ - $result = []; - - if ($str === '') { - return $result; - } - - if ($urlEncoding === true) { - $decoder = function ($value) { - return rawurldecode(str_replace('+', ' ', $value)); - }; - } elseif ($urlEncoding === PHP_QUERY_RFC3986) { - $decoder = 'rawurldecode'; - } elseif ($urlEncoding === PHP_QUERY_RFC1738) { - $decoder = 'urldecode'; - } else { - $decoder = function ($str) { return $str; }; - } - - foreach (explode('&', $str) as $kvp) { - $parts = explode('=', $kvp, 2); - $key = $decoder($parts[0]); - $value = isset($parts[1]) ? $decoder($parts[1]) : null; - if (!isset($result[$key])) { - $result[$key] = $value; - } else { - if (!is_array($result[$key])) { - $result[$key] = [$result[$key]]; - } - $result[$key][] = $value; - } - } - - return $result; -} - -/** - * Build a query string from an array of key value pairs. - * - * This function can use the return value of parse_query() to build a query - * string. This function does not modify the provided keys when an array is - * encountered (like http_build_query would). - * - * @param array $params Query string parameters. - * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 - * to encode using RFC3986, or PHP_QUERY_RFC1738 - * to encode using RFC1738. - * @return string - */ -function build_query(array $params, $encoding = PHP_QUERY_RFC3986) -{ - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { return $str; }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder($k); - if (!is_array($v)) { - $qs .= $k; - if ($v !== null) { - $qs .= '=' . $encoder($v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - if ($vv !== null) { - $qs .= '=' . $encoder($vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; -} - -/** - * Determines the mimetype of a file by looking at its extension. - * - * @param $filename - * - * @return null|string - */ -function mimetype_from_filename($filename) -{ - return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION)); -} - -/** - * Maps a file extensions to a mimetype. - * - * @param $extension string The file extension. - * - * @return string|null - * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types - */ -function mimetype_from_extension($extension) -{ - static $mimetypes = [ - '3gp' => 'video/3gpp', - '7z' => 'application/x-7z-compressed', - 'aac' => 'audio/x-aac', - 'ai' => 'application/postscript', - 'aif' => 'audio/x-aiff', - 'asc' => 'text/plain', - 'asf' => 'video/x-ms-asf', - 'atom' => 'application/atom+xml', - 'avi' => 'video/x-msvideo', - 'bmp' => 'image/bmp', - 'bz2' => 'application/x-bzip2', - 'cer' => 'application/pkix-cert', - 'crl' => 'application/pkix-crl', - 'crt' => 'application/x-x509-ca-cert', - 'css' => 'text/css', - 'csv' => 'text/csv', - 'cu' => 'application/cu-seeme', - 'deb' => 'application/x-debian-package', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dvi' => 'application/x-dvi', - 'eot' => 'application/vnd.ms-fontobject', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'etx' => 'text/x-setext', - 'flac' => 'audio/flac', - 'flv' => 'video/x-flv', - 'gif' => 'image/gif', - 'gz' => 'application/gzip', - 'htm' => 'text/html', - 'html' => 'text/html', - 'ico' => 'image/x-icon', - 'ics' => 'text/calendar', - 'ini' => 'text/plain', - 'iso' => 'application/x-iso9660-image', - 'jar' => 'application/java-archive', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'js' => 'text/javascript', - 'json' => 'application/json', - 'latex' => 'application/x-latex', - 'log' => 'text/plain', - 'm4a' => 'audio/mp4', - 'm4v' => 'video/mp4', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mov' => 'video/quicktime', - 'mkv' => 'video/x-matroska', - 'mp3' => 'audio/mpeg', - 'mp4' => 'video/mp4', - 'mp4a' => 'audio/mp4', - 'mp4v' => 'video/mp4', - 'mpe' => 'video/mpeg', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpg4' => 'video/mp4', - 'oga' => 'audio/ogg', - 'ogg' => 'audio/ogg', - 'ogv' => 'video/ogg', - 'ogx' => 'application/ogg', - 'pbm' => 'image/x-portable-bitmap', - 'pdf' => 'application/pdf', - 'pgm' => 'image/x-portable-graymap', - 'png' => 'image/png', - 'pnm' => 'image/x-portable-anymap', - 'ppm' => 'image/x-portable-pixmap', - 'ppt' => 'application/vnd.ms-powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'ps' => 'application/postscript', - 'qt' => 'video/quicktime', - 'rar' => 'application/x-rar-compressed', - 'ras' => 'image/x-cmu-raster', - 'rss' => 'application/rss+xml', - 'rtf' => 'application/rtf', - 'sgm' => 'text/sgml', - 'sgml' => 'text/sgml', - 'svg' => 'image/svg+xml', - 'swf' => 'application/x-shockwave-flash', - 'tar' => 'application/x-tar', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'torrent' => 'application/x-bittorrent', - 'ttf' => 'application/x-font-ttf', - 'txt' => 'text/plain', - 'wav' => 'audio/x-wav', - 'webm' => 'video/webm', - 'webp' => 'image/webp', - 'wma' => 'audio/x-ms-wma', - 'wmv' => 'video/x-ms-wmv', - 'woff' => 'application/x-font-woff', - 'wsdl' => 'application/wsdl+xml', - 'xbm' => 'image/x-xbitmap', - 'xls' => 'application/vnd.ms-excel', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xml' => 'application/xml', - 'xpm' => 'image/x-xpixmap', - 'xwd' => 'image/x-xwindowdump', - 'yaml' => 'text/yaml', - 'yml' => 'text/yaml', - 'zip' => 'application/zip', - ]; - - $extension = strtolower($extension); - - return isset($mimetypes[$extension]) - ? $mimetypes[$extension] - : null; -} - -/** - * Parses an HTTP message into an associative array. - * - * The array contains the "start-line" key containing the start line of - * the message, "headers" key containing an associative array of header - * array values, and a "body" key containing the body of the message. - * - * @param string $message HTTP request or response to parse. - * - * @return array - * @internal - */ -function _parse_message($message) -{ - if (!$message) { - throw new \InvalidArgumentException('Invalid message'); - } - - $message = ltrim($message, "\r\n"); - - $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); - - if ($messageParts === false || count($messageParts) !== 2) { - throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); - } - - list($rawHeaders, $body) = $messageParts; - $rawHeaders .= "\r\n"; // Put back the delimiter we split previously - $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); - - if ($headerParts === false || count($headerParts) !== 2) { - throw new \InvalidArgumentException('Invalid message: Missing status line'); - } - - list($startLine, $rawHeaders) = $headerParts; - - if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { - // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 - $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); - } - - /** @var array[] $headerLines */ - $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); - - // If these aren't the same, then one line didn't match and there's an invalid header. - if ($count !== substr_count($rawHeaders, "\n")) { - // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 - if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { - throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); - } - - throw new \InvalidArgumentException('Invalid header syntax'); - } - - $headers = []; - - foreach ($headerLines as $headerLine) { - $headers[$headerLine[1]][] = $headerLine[2]; - } - - return [ - 'start-line' => $startLine, - 'headers' => $headers, - 'body' => $body, - ]; -} - -/** - * Constructs a URI for an HTTP request message. - * - * @param string $path Path from the start-line - * @param array $headers Array of headers (each value an array). - * - * @return string - * @internal - */ -function _parse_request_uri($path, array $headers) -{ - $hostKey = array_filter(array_keys($headers), function ($k) { - return strtolower($k) === 'host'; - }); - - // If no host is found, then a full URI cannot be constructed. - if (!$hostKey) { - return $path; - } - - $host = $headers[reset($hostKey)][0]; - $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; - - return $scheme . '://' . $host . '/' . ltrim($path, '/'); -} - -/** - * Get a short summary of the message body - * - * Will return `null` if the response is not printable. - * - * @param MessageInterface $message The message to get the body summary - * @param int $truncateAt The maximum allowed size of the summary - * - * @return null|string - */ -function get_message_body_summary(MessageInterface $message, $truncateAt = 120) -{ - $body = $message->getBody(); - - if (!$body->isSeekable() || !$body->isReadable()) { - return null; - } - - $size = $body->getSize(); - - if ($size === 0) { - return null; - } - - $summary = $body->read($truncateAt); - $body->rewind(); - - if ($size > $truncateAt) { - $summary .= ' (truncated...)'; - } - - // Matches any printable character, including unicode characters: - // letters, marks, numbers, punctuation, spacing, and separators. - if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) { - return null; - } - - return $summary; -} - -/** @internal */ -function _caseless_remove($keys, array $data) -{ - $result = []; - - foreach ($keys as &$key) { - $key = strtolower($key); - } - - foreach ($data as $k => $v) { - if (!in_array(strtolower($k), $keys)) { - $result[$k] = $v; - } - } - - return $result; -} diff --git a/vendor/guzzlehttp/psr7/src/functions_include.php b/vendor/guzzlehttp/psr7/src/functions_include.php deleted file mode 100644 index 96a4a83a..00000000 --- a/vendor/guzzlehttp/psr7/src/functions_include.php +++ /dev/null @@ -1,6 +0,0 @@ - '关注', 2 => '扫描']], - ['性别', 'sex', 'function', function($model){ - return $model['sex'] == 1 ? '男' : '女'; - }], - ['创建时间', 'created_at', 'date', 'Y-m-d'], -]; - -$list = [ - [ - 'id' => 1, - 'type' => 1, - 'mobile' => '18888888888', - 'fans' => [ - 'openid' => '123', - 'nickname' => '昵称', - ], - 'sex' => 1, - 'create_at' => time(), - ] -]; -``` - -### 导出 - -``` -// 简单使用 -return Excel::exportData($list, $header); - -// 定制 默认导出xlsx 支持 : xlsx/xls/html/csv, 支持写入绝对路径 -return Excel::exportData($list, $header, '测试', 'xlsx', '/www/data/'); - -// 另外一种导出csv方式 -return Excel::exportCsvData($list, $header); - -``` - -### 导入 - -``` -/** - * 导入 - * - * @param $filePath 文件路径 - * @param int $startRow 开始行数 默认 1 - * @return array|bool|mixed - */ -$data = Excel::import($filePath, $startRow); -``` - -### 问题反馈 - -在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流 - -QQ群:[655084090](https://jq.qq.com/?_wv=1027&k=4BeVA2r) - diff --git a/vendor/jianyan74/php-excel/composer.json b/vendor/jianyan74/php-excel/composer.json deleted file mode 100644 index 8deecbeb..00000000 --- a/vendor/jianyan74/php-excel/composer.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "jianyan74/php-excel", - "description": "php excel 导入导出", - "keywords": ["excel", "csv", "xlsx", "xls", "html", "jianyan74"], - "license": "MIT", - "authors": [ - { - "name": "jianyan74" - } - ], - "type": "extension", - "require": { - "php": ">=7.0", - "phpoffice/phpspreadsheet": "^1.3" - }, - "autoload": { - "psr-4": { - "jianyan\\excel\\": "./src" - } - } -} \ No newline at end of file diff --git a/vendor/jianyan74/php-excel/src/Excel.php b/vendor/jianyan74/php-excel/src/Excel.php deleted file mode 100644 index 0fd51946..00000000 --- a/vendor/jianyan74/php-excel/src/Excel.php +++ /dev/null @@ -1,324 +0,0 @@ - - */ -class Excel -{ - /** - * 导出Excel - * - * @param array $list - * @param array $header - * @param string $filename - * @param string $title - * @return bool - * @throws \PhpOffice\PhpSpreadsheet\Exception - * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception - */ - public static function exportData($list = [], $header = [], $filename = '', $suffix = 'xlsx', $path = '') - { - if (!is_array ($list) || !is_array ($header)) { - return false; - } - - // 清除之前的错误输出 - ob_end_clean(); - ob_start(); - - !$filename && $filename = time(); - - // 初始化 - $spreadsheet = new Spreadsheet(); - $sheet = $spreadsheet->getActiveSheet(); - // 写入头部 - $hk = 1; - foreach ($header as $k => $v) { - $sheet->setCellValue(Coordinate::stringFromColumnIndex($hk) . '1', $v[0]); - $hk += 1; - } - - // 开始写入内容 - $column = 2; - $size = ceil(count($list) / 500); - for($i = 0; $i < $size; $i++) { - $buffer = array_slice($list, $i * 500, 500); - - foreach($buffer as $k => $row) { - $span = 1; - - foreach($header as $key => $value) { - // 解析字段 - $realData = self::formatting($header[$key], trim(self::formattingField($row, $value[1])), $row); - // 写入excel - // 加个"\t"制表符,解决导出大数字或银行卡等在excel中被科学计数的问题 - $sheet->setCellValue(Coordinate::stringFromColumnIndex($span) . $column, $realData."\t"); - $span++; - } - - $column++; - unset($buffer[$k]); - } - } - - // 直接输出下载 - switch ($suffix) - { - case 'xlsx' : - $writer = new Xlsx($spreadsheet); - if (!empty($path)) { - $writer->save($path); - } else { - header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8;"); - header("Content-Disposition: inline;filename=\"{$filename}.xlsx\""); - header('Cache-Control: max-age=0'); - $writer->save('php://output'); - } - exit(); - - break; - case 'xls' : - $writer = new Xls($spreadsheet); - if (!empty($path)) { - $writer->save($path); - } else { - header("Content-Type:application/vnd.ms-excel;charset=utf-8;"); - header("Content-Disposition:inline;filename=\"{$filename}.xls\""); - header('Cache-Control: max-age=0'); - $writer->save('php://output'); - } - exit(); - - break; - case 'csv' : - $writer = new Csv($spreadsheet); - if (!empty($path)) { - $writer->save($path); - } else { - header("Content-type:text/csv;charset=utf-8;"); - header("Content-Disposition:attachment; filename={$filename}.csv"); - header('Cache-Control: max-age=0'); - $writer->save('php://output'); - } - exit(); - - break; - case 'html' : - $writer = new Html($spreadsheet); - if (!empty($path)) { - $writer->save($path); - } else { - header("Content-Type:text/html;charset=utf-8;"); - header("Content-Disposition:attachment;filename=\"{$filename}.{$suffix}\""); - header('Cache-Control: max-age=0'); - $writer->save('php://output'); - } - exit(); - - break; - } - - return true; - } - - /** - * 导出的另外一种形式(不建议使用) - * - * @param array $list - * @param array $header - * @param string $filename - * @return bool - */ - public static function exportCsvData($list = [], $header = [], $filename = '') - { - if (!is_array ($list) || !is_array ($header)) { - return false; - } - - // 清除之前的错误输出 - ob_end_clean(); - ob_start(); - - !$filename && $filename = time(); - - $html = "\xEF\xBB\xBF"; - foreach($header as $k => $v) { - $html .= $v[0] . "\t ,"; - } - - $html .= "\n"; - - if (!empty($list)) { - $info = []; - $size = ceil(count($list) / 500); - - for($i = 0; $i < $size; $i++) { - $buffer = array_slice($list, $i * 500, 500); - - foreach($buffer as $k => $row) { - $data = []; - - foreach($header as $key => $value) { - // 解析字段 - $realData = self::formatting($header[$key], trim(self::formattingField($row, $value[1])), $row); - $data[] = str_replace(PHP_EOL, '', $realData); - } - - $info[] = implode("\t ,", $data) . "\t ,"; - unset($data, $buffer[$k]); - } - } - - $html .= implode("\n", $info); - } - - header("Content-type:text/csv"); - header("Content-Disposition:attachment; filename={$filename}.csv"); - echo $html; - exit(); - } - - /** - * 导入 - * - * @param $filePath - * @param int $startRow - * @return array|mixed - * @throws Exception - * @throws \PhpOffice\PhpSpreadsheet\Exception - * @throws \PhpOffice\PhpSpreadsheet\Reader\Exception - */ - public static function import($filePath, $startRow = 1) - { - $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); - $reader->setReadDataOnly(true); - if (!$reader->canRead($filePath)) { - $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); - // setReadDataOnly Set read data only 只读单元格的数据,不格式化 e.g. 读时间会变成一个数据等 - $reader->setReadDataOnly(true); - - if (!$reader->canRead($filePath)) { - throw new Exception('不能读取Excel'); - } - } - - $spreadsheet = $reader->load($filePath); - $sheetCount = $spreadsheet->getSheetCount();// 获取sheet的数量 - - // 获取所有的sheet表格数据 - $excleDatas = []; - $emptyRowNum = 0; - for ($i = 0; $i < $sheetCount; $i++) { - $currentSheet = $spreadsheet->getSheet($i); // 读取excel文件中的第一个工作表 - $allColumn = $currentSheet->getHighestColumn(); // 取得最大的列号 - $allColumn = Coordinate::columnIndexFromString($allColumn); // 由列名转为列数('AB'->28) - $allRow = $currentSheet->getHighestRow(); // 取得一共有多少行 - - $arr = []; - for ($currentRow = $startRow; $currentRow <= $allRow; $currentRow++) { - // 从第1列开始输出 - for ($currentColumn = 1; $currentColumn <= $allColumn; $currentColumn++) { - $val = $currentSheet->getCellByColumnAndRow($currentColumn, $currentRow)->getValue(); - $arr[$currentRow][] = trim($val); - } - - // $arr[$currentRow] = array_filter($arr[$currentRow]); - // 统计连续空行 - if (empty($arr[$currentRow]) && $emptyRowNum <= 50) { - $emptyRowNum++ ; - } else { - $emptyRowNum = 0; - } - // 防止坑队友的同事在excel里面弄出很多的空行,陷入很漫长的循环中,设置如果连续超过50个空行就退出循环,返回结果 - // 连续50行数据为空,不再读取后面行的数据,防止读满内存 - if ($emptyRowNum > 50) { - break; - } - } - - $excleDatas[$i] = $arr; // 多个sheet的数组的集合 - } - - // 这里我只需要用到第一个sheet的数据,所以只返回了第一个sheet的数据 - $returnData = $excleDatas ? array_shift($excleDatas) : []; - - // 第一行数据就是空的,为了保留其原始数据,第一行数据就不做array_fiter操作; - $returnData = $returnData && isset($returnData[$startRow]) && !empty($returnData[$startRow]) ? array_filter($returnData) : $returnData; - return $returnData; - } - - /** - * 格式化内容 - * - * @param array $array 头部规则 - * @return false|mixed|null|string 内容值 - */ - protected static function formatting(array $array, $value, $row) - { - !isset($array[2]) && $array[2] = 'text'; - - switch ($array[2]) - { - // 文本 - case 'text' : - return $value; - break; - // 日期 - case 'date' : - return !empty($value) ? date($array[3], $value) : null; - break; - // 选择框 - case 'selectd' : - return $array[3][$value] ?? null ; - break; - // 匿名函数 - case 'function' : - return isset($array[3]) ? call_user_func($array[3], $row) : null; - break; - // 默认 - default : - - break; - } - - return null; - } - - /** - * 解析字段 - * - * @param $row - * @param $field - * @return mixed - */ - protected static function formattingField($row, $field) - { - $newField = explode('.', $field); - if (count($newField) == 1) { - return $row[$field]; - } - - foreach ($newField as $item) { - if (isset($row[$item])) { - $row = $row[$item]; - } else { - break; - } - } - - return is_array($row) ? false : $row; - } -} diff --git a/vendor/league/flysystem-cached-adapter/.editorconfig b/vendor/league/flysystem-cached-adapter/.editorconfig deleted file mode 100644 index 153cf3ef..00000000 --- a/vendor/league/flysystem-cached-adapter/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -; top-most EditorConfig file -root = true - -; Unix-style newlines -[*] -end_of_line = LF - -[*.php] -indent_style = space -indent_size = 4 diff --git a/vendor/league/flysystem-cached-adapter/.php_cs b/vendor/league/flysystem-cached-adapter/.php_cs deleted file mode 100644 index 6643a32c..00000000 --- a/vendor/league/flysystem-cached-adapter/.php_cs +++ /dev/null @@ -1,7 +0,0 @@ -level(Symfony\CS\FixerInterface::PSR2_LEVEL) - ->fixers(['-yoda_conditions', 'ordered_use', 'short_array_syntax']) - ->finder(Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__.'/src/')); \ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/.scrutinizer.yml b/vendor/league/flysystem-cached-adapter/.scrutinizer.yml deleted file mode 100644 index fa39b52b..00000000 --- a/vendor/league/flysystem-cached-adapter/.scrutinizer.yml +++ /dev/null @@ -1,34 +0,0 @@ -filter: - paths: [src/*] -checks: - php: - code_rating: true - remove_extra_empty_lines: true - remove_php_closing_tag: true - remove_trailing_whitespace: true - fix_use_statements: - remove_unused: true - preserve_multiple: false - preserve_blanklines: true - order_alphabetically: true - fix_php_opening_tag: true - fix_linefeed: true - fix_line_ending: true - fix_identation_4spaces: true - fix_doc_comments: true -tools: - external_code_coverage: - timeout: 900 - runs: 6 - php_code_coverage: false - php_code_sniffer: - config: - standard: PSR2 - filter: - paths: ['src'] - php_loc: - enabled: true - excluded_dirs: [vendor, spec, stubs] - php_cpd: - enabled: true - excluded_dirs: [vendor, spec, stubs] \ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/.travis.yml b/vendor/league/flysystem-cached-adapter/.travis.yml deleted file mode 100644 index 6706449f..00000000 --- a/vendor/league/flysystem-cached-adapter/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: php - -php: - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - -matrix: - allow_failures: - - php: 5.5 - -env: - - COMPOSER_OPTS="" - - COMPOSER_OPTS="--prefer-lowest" - -install: - - if [[ "${TRAVIS_PHP_VERSION}" == "5.5" ]]; then composer require phpunit/phpunit:^4.8.36 phpspec/phpspec:^2 --prefer-dist --update-with-dependencies; fi - - if [[ "${TRAVIS_PHP_VERSION}" == "7.2" ]]; then composer require phpunit/phpunit:^6.0 --prefer-dist --update-with-dependencies; fi - - travis_retry composer update --prefer-dist $COMPOSER_OPTS - -script: - - vendor/bin/phpspec run - - vendor/bin/phpunit - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar' - - php ocular.phar code-coverage:upload --format=php-clover ./clover/phpunit.xml' diff --git a/vendor/league/flysystem-cached-adapter/LICENSE b/vendor/league/flysystem-cached-adapter/LICENSE deleted file mode 100644 index 666f6c82..00000000 --- a/vendor/league/flysystem-cached-adapter/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 Frank de Jonge - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/league/flysystem-cached-adapter/composer.json b/vendor/league/flysystem-cached-adapter/composer.json deleted file mode 100644 index df7fb7fd..00000000 --- a/vendor/league/flysystem-cached-adapter/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "league/flysystem-cached-adapter", - "description": "An adapter decorator to enable meta-data caching.", - "autoload": { - "psr-4": { - "League\\Flysystem\\Cached\\": "src/" - } - }, - "require": { - "league/flysystem": "~1.0", - "psr/cache": "^1.0.0" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7", - "mockery/mockery": "~0.9", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12" - }, - "suggest": { - "ext-phpredis": "Pure C implemented extension for PHP" - }, - "license": "MIT", - "authors": [ - { - "name": "frankdejonge", - "email": "info@frenky.net" - } - ] -} diff --git a/vendor/league/flysystem-cached-adapter/phpspec.yml b/vendor/league/flysystem-cached-adapter/phpspec.yml deleted file mode 100644 index 5eabcb21..00000000 --- a/vendor/league/flysystem-cached-adapter/phpspec.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -suites: - cached_adapter_suite: - namespace: League\Flysystem\Cached - psr4_prefix: League\Flysystem\Cached -formatter.name: pretty diff --git a/vendor/league/flysystem-cached-adapter/phpunit.php b/vendor/league/flysystem-cached-adapter/phpunit.php deleted file mode 100644 index d1095879..00000000 --- a/vendor/league/flysystem-cached-adapter/phpunit.php +++ /dev/null @@ -1,3 +0,0 @@ - - - - - ./tests/ - - - - - ./src/ - - - - - - - - diff --git a/vendor/league/flysystem-cached-adapter/readme.md b/vendor/league/flysystem-cached-adapter/readme.md deleted file mode 100644 index dd1433d9..00000000 --- a/vendor/league/flysystem-cached-adapter/readme.md +++ /dev/null @@ -1,20 +0,0 @@ -# Flysystem Cached CachedAdapter - -[![Author](http://img.shields.io/badge/author-@frankdejonge-blue.svg?style=flat-square)](https://twitter.com/frankdejonge) -[![Build Status](https://img.shields.io/travis/thephpleague/flysystem-cached-adapter/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/flysystem-cached-adapter) -[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/flysystem-cached-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/flysystem-cached-adapter/code-structure) -[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/flysystem-cached-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/flysystem-cached-adapter) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) -[![Packagist Version](https://img.shields.io/packagist/v/league/flysystem-cached-adapter.svg?style=flat-square)](https://packagist.org/packages/league/flysystem-cached-adapter) -[![Total Downloads](https://img.shields.io/packagist/dt/league/flysystem-cached-adapter.svg?style=flat-square)](https://packagist.org/packages/league/flysystem-cached-adapter) - - -The adapter decorator caches metadata and directory listings. - -```bash -composer require league/flysystem-cached-adapter -``` - -## Usage - -[Check out the docs.](https://flysystem.thephpleague.com/docs/advanced/caching/) diff --git a/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php b/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php deleted file mode 100644 index 69428d99..00000000 --- a/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php +++ /dev/null @@ -1,435 +0,0 @@ -adapter = $adapter; - $this->cache = $cache; - $this->cache->load()->shouldBeCalled(); - $this->beConstructedWith($adapter, $cache); - } - - public function it_is_initializable() - { - $this->shouldHaveType('League\Flysystem\Cached\CachedAdapter'); - $this->shouldHaveType('League\Flysystem\AdapterInterface'); - } - - public function it_should_forward_read_streams() - { - $path = 'path.txt'; - $response = ['path' => $path]; - $this->adapter->readStream($path)->willReturn($response); - $this->readStream($path)->shouldbe($response); - } - - public function it_should_cache_writes() - { - $type = 'file'; - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $response = compact('path', 'contents', 'type'); - $this->adapter->write($path, $contents, $config)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->write($path, $contents, $config)->shouldBe($response); - } - - public function it_should_cache_streamed_writes() - { - $type = 'file'; - $path = 'path.txt'; - $stream = tmpfile(); - $config = new Config(); - $response = compact('path', 'stream', 'type'); - $this->adapter->writeStream($path, $stream, $config)->willReturn($response); - $this->cache->updateObject($path, ['contents' => false] + $response, true)->shouldBeCalled(); - $this->writeStream($path, $stream, $config)->shouldBe($response); - fclose($stream); - } - - public function it_should_cache_streamed_updates() - { - $type = 'file'; - $path = 'path.txt'; - $stream = tmpfile(); - $config = new Config(); - $response = compact('path', 'stream', 'type'); - $this->adapter->updateStream($path, $stream, $config)->willReturn($response); - $this->cache->updateObject($path, ['contents' => false] + $response, true)->shouldBeCalled(); - $this->updateStream($path, $stream, $config)->shouldBe($response); - fclose($stream); - } - - public function it_should_ignore_failed_writes() - { - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $this->adapter->write($path, $contents, $config)->willReturn(false); - $this->write($path, $contents, $config)->shouldBe(false); - } - - public function it_should_ignore_failed_streamed_writes() - { - $path = 'path.txt'; - $contents = tmpfile(); - $config = new Config(); - $this->adapter->writeStream($path, $contents, $config)->willReturn(false); - $this->writeStream($path, $contents, $config)->shouldBe(false); - fclose($contents); - } - - public function it_should_cache_updated() - { - $type = 'file'; - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $response = compact('path', 'contents', 'type'); - $this->adapter->update($path, $contents, $config)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->update($path, $contents, $config)->shouldBe($response); - } - - public function it_should_ignore_failed_updates() - { - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $this->adapter->update($path, $contents, $config)->willReturn(false); - $this->update($path, $contents, $config)->shouldBe(false); - } - - public function it_should_ignore_failed_streamed_updates() - { - $path = 'path.txt'; - $contents = tmpfile(); - $config = new Config(); - $this->adapter->updateStream($path, $contents, $config)->willReturn(false); - $this->updateStream($path, $contents, $config)->shouldBe(false); - fclose($contents); - } - - public function it_should_cache_renames() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->rename($old, $new)->willReturn(true); - $this->cache->rename($old, $new)->shouldBeCalled(); - $this->rename($old, $new)->shouldBe(true); - } - - public function it_should_ignore_rename_fails() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->rename($old, $new)->willReturn(false); - $this->rename($old, $new)->shouldBe(false); - } - - public function it_should_cache_copies() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->copy($old, $new)->willReturn(true); - $this->cache->copy($old, $new)->shouldBeCalled(); - $this->copy($old, $new)->shouldBe(true); - } - - public function it_should_ignore_copy_fails() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->copy($old, $new)->willReturn(false); - $this->copy($old, $new)->shouldBe(false); - } - - public function it_should_cache_deletes() - { - $delete = 'delete.txt'; - $this->adapter->delete($delete)->willReturn(true); - $this->cache->delete($delete)->shouldBeCalled(); - $this->delete($delete)->shouldBe(true); - } - - public function it_should_ignore_delete_fails() - { - $delete = 'delete.txt'; - $this->adapter->delete($delete)->willReturn(false); - $this->delete($delete)->shouldBe(false); - } - - public function it_should_cache_dir_deletes() - { - $delete = 'delete'; - $this->adapter->deleteDir($delete)->willReturn(true); - $this->cache->deleteDir($delete)->shouldBeCalled(); - $this->deleteDir($delete)->shouldBe(true); - } - - public function it_should_ignore_delete_dir_fails() - { - $delete = 'delete'; - $this->adapter->deleteDir($delete)->willReturn(false); - $this->deleteDir($delete)->shouldBe(false); - } - - public function it_should_cache_dir_creates() - { - $dirname = 'dirname'; - $config = new Config(); - $response = ['path' => $dirname, 'type' => 'dir']; - $this->adapter->createDir($dirname, $config)->willReturn($response); - $this->cache->updateObject($dirname, $response, true)->shouldBeCalled(); - $this->createDir($dirname, $config)->shouldBe($response); - } - - public function it_should_ignore_create_dir_fails() - { - $dirname = 'dirname'; - $config = new Config(); - $this->adapter->createDir($dirname, $config)->willReturn(false); - $this->createDir($dirname, $config)->shouldBe(false); - } - - public function it_should_cache_set_visibility() - { - $path = 'path.txt'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $this->adapter->setVisibility($path, $visibility)->willReturn(true); - $this->cache->updateObject($path, ['path' => $path, 'visibility' => $visibility], true)->shouldBeCalled(); - $this->setVisibility($path, $visibility)->shouldBe(true); - } - - public function it_should_ignore_set_visibility_fails() - { - $dirname = 'delete'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $this->adapter->setVisibility($dirname, $visibility)->willReturn(false); - $this->setVisibility($dirname, $visibility)->shouldBe(false); - } - - public function it_should_indicate_missing_files() - { - $this->cache->has($path = 'path.txt')->willReturn(false); - $this->has($path)->shouldBe(false); - } - - public function it_should_indicate_file_existance() - { - $this->cache->has($path = 'path.txt')->willReturn(true); - $this->has($path)->shouldBe(true); - } - - public function it_should_cache_missing_files() - { - $this->cache->has($path = 'path.txt')->willReturn(null); - $this->adapter->has($path)->willReturn(false); - $this->cache->storeMiss($path)->shouldBeCalled(); - $this->has($path)->shouldBe(false); - } - - public function it_should_delete_when_metadata_is_missing() - { - $path = 'path.txt'; - $this->cache->has($path)->willReturn(true); - $this->cache->getSize($path)->willReturn(['path' => $path]); - $this->adapter->getSize($path)->willReturn($response = ['path' => $path, 'size' => 1024]); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->getSize($path)->shouldBe($response); - } - - public function it_should_cache_has() - { - $this->cache->has($path = 'path.txt')->willReturn(null); - $this->adapter->has($path)->willReturn(true); - $this->cache->updateObject($path, compact('path'), true)->shouldBeCalled(); - $this->has($path)->shouldBe(true); - } - - public function it_should_list_cached_contents() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(true); - $response = [['path' => 'path.txt']]; - $this->cache->listContents($dirname, $recursive)->willReturn($response); - $this->listContents($dirname, $recursive)->shouldBe($response); - } - - public function it_should_ignore_failed_list_contents() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(false); - $this->adapter->listContents($dirname, $recursive)->willReturn(false); - $this->listContents($dirname, $recursive)->shouldBe(false); - } - - public function it_should_cache_contents_listings() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(false); - $response = [['path' => 'path.txt']]; - $this->adapter->listContents($dirname, $recursive)->willReturn($response); - $this->cache->storeContents($dirname, $response, $recursive)->shouldBeCalled(); - $this->listContents($dirname, $recursive)->shouldBe($response); - } - - public function it_should_use_cached_visibility() - { - $this->make_it_use_getter_cache('getVisibility', 'path.txt', [ - 'path' => 'path.txt', - 'visibility' => AdapterInterface::VISIBILITY_PUBLIC, - ]); - } - - public function it_should_cache_get_visibility() - { - $path = 'path.txt'; - $response = ['visibility' => AdapterInterface::VISIBILITY_PUBLIC, 'path' => $path]; - $this->make_it_cache_getter('getVisibility', $path, $response); - } - - public function it_should_ignore_failed_get_visibility() - { - $path = 'path.txt'; - $this->make_it_ignore_failed_getter('getVisibility', $path); - } - - public function it_should_use_cached_timestamp() - { - $this->make_it_use_getter_cache('getTimestamp', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_cache_timestamps() - { - $this->make_it_cache_getter('getTimestamp', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_ignore_failed_get_timestamps() - { - $this->make_it_ignore_failed_getter('getTimestamp', 'path.txt'); - } - - public function it_should_cache_get_metadata() - { - $path = 'path.txt'; - $response = ['visibility' => AdapterInterface::VISIBILITY_PUBLIC, 'path' => $path]; - $this->make_it_cache_getter('getMetadata', $path, $response); - } - - public function it_should_use_cached_metadata() - { - $this->make_it_use_getter_cache('getMetadata', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_ignore_failed_get_metadata() - { - $this->make_it_ignore_failed_getter('getMetadata', 'path.txt'); - } - - public function it_should_cache_get_size() - { - $path = 'path.txt'; - $response = ['size' => 1234, 'path' => $path]; - $this->make_it_cache_getter('getSize', $path, $response); - } - - public function it_should_use_cached_size() - { - $this->make_it_use_getter_cache('getSize', 'path.txt', [ - 'path' => 'path.txt', - 'size' => 1234, - ]); - } - - public function it_should_ignore_failed_get_size() - { - $this->make_it_ignore_failed_getter('getSize', 'path.txt'); - } - - public function it_should_cache_get_mimetype() - { - $path = 'path.txt'; - $response = ['mimetype' => 'text/plain', 'path' => $path]; - $this->make_it_cache_getter('getMimetype', $path, $response); - } - - public function it_should_use_cached_mimetype() - { - $this->make_it_use_getter_cache('getMimetype', 'path.txt', [ - 'path' => 'path.txt', - 'mimetype' => 'text/plain', - ]); - } - - public function it_should_ignore_failed_get_mimetype() - { - $this->make_it_ignore_failed_getter('getMimetype', 'path.txt'); - } - - public function it_should_cache_reads() - { - $path = 'path.txt'; - $response = ['path' => $path, 'contents' => 'contents']; - $this->make_it_cache_getter('read', $path, $response); - } - - public function it_should_use_cached_file_contents() - { - $this->make_it_use_getter_cache('read', 'path.txt', [ - 'path' => 'path.txt', - 'contents' => 'contents' - ]); - } - - public function it_should_ignore_failed_reads() - { - $this->make_it_ignore_failed_getter('read', 'path.txt'); - } - - protected function make_it_use_getter_cache($method, $path, $response) - { - $this->cache->{$method}($path)->willReturn($response); - $this->{$method}($path)->shouldBe($response); - } - - protected function make_it_cache_getter($method, $path, $response) - { - $this->cache->{$method}($path)->willReturn(false); - $this->adapter->{$method}($path)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->{$method}($path)->shouldBe($response); - } - - protected function make_it_ignore_failed_getter($method, $path) - { - $this->cache->{$method}($path)->willReturn(false); - $this->adapter->{$method}($path)->willReturn(false); - $this->{$method}($path)->shouldBe(false); - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/CacheInterface.php b/vendor/league/flysystem-cached-adapter/src/CacheInterface.php deleted file mode 100644 index de3ab3d9..00000000 --- a/vendor/league/flysystem-cached-adapter/src/CacheInterface.php +++ /dev/null @@ -1,101 +0,0 @@ -adapter = $adapter; - $this->cache = $cache; - $this->cache->load(); - } - - /** - * Get the underlying Adapter implementation. - * - * @return AdapterInterface - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * Get the used Cache implementation. - * - * @return CacheInterface - */ - public function getCache() - { - return $this->cache; - } - - /** - * {@inheritdoc} - */ - public function write($path, $contents, Config $config) - { - $result = $this->adapter->write($path, $contents, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function writeStream($path, $resource, Config $config) - { - $result = $this->adapter->writeStream($path, $resource, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $contents = false; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, Config $config) - { - $result = $this->adapter->update($path, $contents, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function updateStream($path, $resource, Config $config) - { - $result = $this->adapter->updateStream($path, $resource, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $contents = false; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newPath) - { - $result = $this->adapter->rename($path, $newPath); - - if ($result !== false) { - $this->cache->rename($path, $newPath); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - $result = $this->adapter->copy($path, $newpath); - - if ($result !== false) { - $this->cache->copy($path, $newpath); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $result = $this->adapter->delete($path); - - if ($result !== false) { - $this->cache->delete($path); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - $result = $this->adapter->deleteDir($dirname); - - if ($result !== false) { - $this->cache->deleteDir($dirname); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, Config $config) - { - $result = $this->adapter->createDir($dirname, $config); - - if ($result !== false) { - $type = 'dir'; - $path = $dirname; - $this->cache->updateObject($dirname, compact('path', 'type'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function setVisibility($path, $visibility) - { - $result = $this->adapter->setVisibility($path, $visibility); - - if ($result !== false) { - $this->cache->updateObject($path, compact('path', 'visibility'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - $cacheHas = $this->cache->has($path); - - if ($cacheHas !== null) { - return $cacheHas; - } - - $adapterResponse = $this->adapter->has($path); - - if (! $adapterResponse) { - $this->cache->storeMiss($path); - } else { - $cacheEntry = is_array($adapterResponse) ? $adapterResponse : compact('path'); - $this->cache->updateObject($path, $cacheEntry, true); - } - - return $adapterResponse; - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - return $this->callWithFallback('contents', $path, 'read'); - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - return $this->adapter->readStream($path); - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - if ($this->cache->isComplete($directory, $recursive)) { - return $this->cache->listContents($directory, $recursive); - } - - $result = $this->adapter->listContents($directory, $recursive); - - if ($result !== false) { - $this->cache->storeContents($directory, $result, $recursive); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - return $this->callWithFallback(null, $path, 'getMetadata'); - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return $this->callWithFallback('size', $path, 'getSize'); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - return $this->callWithFallback('mimetype', $path, 'getMimetype'); - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - return $this->callWithFallback('timestamp', $path, 'getTimestamp'); - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - return $this->callWithFallback('visibility', $path, 'getVisibility'); - } - - /** - * Call a method and cache the response. - * - * @param string $property - * @param string $path - * @param string $method - * - * @return mixed - */ - protected function callWithFallback($property, $path, $method) - { - $result = $this->cache->{$method}($path); - - if ($result !== false && ($property === null || array_key_exists($property, $result))) { - return $result; - } - - $result = $this->adapter->{$method}($path); - - if ($result) { - $object = $result + compact('path'); - $this->cache->updateObject($path, $object, true); - } - - return $result; - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php b/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php deleted file mode 100644 index c2076d49..00000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php +++ /dev/null @@ -1,417 +0,0 @@ -autosave) { - $this->save(); - } - } - - /** - * Get the autosave setting. - * - * @return bool autosave - */ - public function getAutosave() - { - return $this->autosave; - } - - /** - * Get the autosave setting. - * - * @param bool $autosave - */ - public function setAutosave($autosave) - { - $this->autosave = $autosave; - } - - /** - * Store the contents listing. - * - * @param string $directory - * @param array $contents - * @param bool $recursive - * - * @return array contents listing - */ - public function storeContents($directory, array $contents, $recursive = false) - { - $directories = [$directory]; - - foreach ($contents as $object) { - $this->updateObject($object['path'], $object); - $object = $this->cache[$object['path']]; - - if ($recursive && $this->pathIsInDirectory($directory, $object['path'])) { - $directories[] = $object['dirname']; - } - } - - foreach (array_unique($directories) as $directory) { - $this->setComplete($directory, $recursive); - } - - $this->autosave(); - } - - /** - * Update the metadata for an object. - * - * @param string $path object path - * @param array $object object metadata - * @param bool $autosave whether to trigger the autosave routine - */ - public function updateObject($path, array $object, $autosave = false) - { - if (! $this->has($path)) { - $this->cache[$path] = Util::pathinfo($path); - } - - $this->cache[$path] = array_merge($this->cache[$path], $object); - - if ($autosave) { - $this->autosave(); - } - - $this->ensureParentDirectories($path); - } - - /** - * Store object hit miss. - * - * @param string $path - */ - public function storeMiss($path) - { - $this->cache[$path] = false; - $this->autosave(); - } - - /** - * Get the contents listing. - * - * @param string $dirname - * @param bool $recursive - * - * @return array contents listing - */ - public function listContents($dirname = '', $recursive = false) - { - $result = []; - - foreach ($this->cache as $object) { - if ($object === false) { - continue; - } - if ($object['dirname'] === $dirname) { - $result[] = $object; - } elseif ($recursive && $this->pathIsInDirectory($dirname, $object['path'])) { - $result[] = $object; - } - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - if ($path !== false && array_key_exists($path, $this->cache)) { - return $this->cache[$path] !== false; - } - - if ($this->isComplete(Util::dirname($path), false)) { - return false; - } - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - if (isset($this->cache[$path]['contents']) && $this->cache[$path]['contents'] !== false) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - if ($this->has($path)) { - $object = $this->cache[$path]; - unset($this->cache[$path]); - $object['path'] = $newpath; - $object = array_merge($object, Util::pathinfo($newpath)); - $this->cache[$newpath] = $object; - $this->autosave(); - } - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - if ($this->has($path)) { - $object = $this->cache[$path]; - $object = array_merge($object, Util::pathinfo($newpath)); - $this->updateObject($newpath, $object, true); - } - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $this->storeMiss($path); - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - foreach ($this->cache as $path => $object) { - if ($this->pathIsInDirectory($dirname, $path) || $path === $dirname) { - unset($this->cache[$path]); - } - } - - unset($this->complete[$dirname]); - - $this->autosave(); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - if (isset($this->cache[$path]['mimetype'])) { - return $this->cache[$path]; - } - - if (! $result = $this->read($path)) { - return false; - } - - $mimetype = Util::guessMimeType($path, $result['contents']); - $this->cache[$path]['mimetype'] = $mimetype; - - return $this->cache[$path]; - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - if (isset($this->cache[$path]['size'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - if (isset($this->cache[$path]['timestamp'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - if (isset($this->cache[$path]['visibility'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - if (isset($this->cache[$path]['type'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function isComplete($dirname, $recursive) - { - if (! array_key_exists($dirname, $this->complete)) { - return false; - } - - if ($recursive && $this->complete[$dirname] !== 'recursive') { - return false; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function setComplete($dirname, $recursive) - { - $this->complete[$dirname] = $recursive ? 'recursive' : true; - } - - /** - * Filter the contents from a listing. - * - * @param array $contents object listing - * - * @return array filtered contents - */ - public function cleanContents(array $contents) - { - $cachedProperties = array_flip([ - 'path', 'dirname', 'basename', 'extension', 'filename', - 'size', 'mimetype', 'visibility', 'timestamp', 'type', - ]); - - foreach ($contents as $path => $object) { - if (is_array($object)) { - $contents[$path] = array_intersect_key($object, $cachedProperties); - } - } - - return $contents; - } - - /** - * {@inheritdoc} - */ - public function flush() - { - $this->cache = []; - $this->complete = []; - $this->autosave(); - } - - /** - * {@inheritdoc} - */ - public function autosave() - { - if ($this->autosave) { - $this->save(); - } - } - - /** - * Retrieve serialized cache data. - * - * @return string serialized data - */ - public function getForStorage() - { - $cleaned = $this->cleanContents($this->cache); - - return json_encode([$cleaned, $this->complete]); - } - - /** - * Load from serialized cache data. - * - * @param string $json - */ - public function setFromStorage($json) - { - list($cache, $complete) = json_decode($json, true); - - if (json_last_error() === JSON_ERROR_NONE && is_array($cache) && is_array($complete)) { - $this->cache = $cache; - $this->complete = $complete; - } - } - - /** - * Ensure parent directories of an object. - * - * @param string $path object path - */ - public function ensureParentDirectories($path) - { - $object = $this->cache[$path]; - - while ($object['dirname'] !== '' && ! isset($this->cache[$object['dirname']])) { - $object = Util::pathinfo($object['dirname']); - $object['type'] = 'dir'; - $this->cache[$object['path']] = $object; - } - } - - /** - * Determines if the path is inside the directory. - * - * @param string $directory - * @param string $path - * - * @return bool - */ - protected function pathIsInDirectory($directory, $path) - { - return $directory === '' || strpos($path, $directory . '/') === 0; - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php b/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php deleted file mode 100644 index 3aa8b1ae..00000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php +++ /dev/null @@ -1,115 +0,0 @@ -adapter = $adapter; - $this->file = $file; - $this->setExpire($expire); - } - - /** - * Set the expiration time in seconds. - * - * @param int $expire relative expiration time - */ - protected function setExpire($expire) - { - if ($expire) { - $this->expire = $this->getTime($expire); - } - } - - /** - * Get expiration time in seconds. - * - * @param int $time relative expiration time - * - * @return int actual expiration time - */ - protected function getTime($time = 0) - { - return intval(microtime(true)) + $time; - } - - /** - * {@inheritdoc} - */ - public function setFromStorage($json) - { - list($cache, $complete, $expire) = json_decode($json, true); - - if (! $expire || $expire > $this->getTime()) { - $this->cache = $cache; - $this->complete = $complete; - } else { - $this->adapter->delete($this->file); - } - } - - /** - * {@inheritdoc} - */ - public function load() - { - if ($this->adapter->has($this->file)) { - $file = $this->adapter->read($this->file); - if ($file && !empty($file['contents'])) { - $this->setFromStorage($file['contents']); - } - } - } - - /** - * {@inheritdoc} - */ - public function getForStorage() - { - $cleaned = $this->cleanContents($this->cache); - - return json_encode([$cleaned, $this->complete, $this->expire]); - } - - /** - * {@inheritdoc} - */ - public function save() - { - $config = new Config(); - $contents = $this->getForStorage(); - - if ($this->adapter->has($this->file)) { - $this->adapter->update($this->file, $contents, $config); - } else { - $this->adapter->write($this->file, $contents, $config); - } - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php b/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php deleted file mode 100644 index f67d2717..00000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php +++ /dev/null @@ -1,59 +0,0 @@ -key = $key; - $this->expire = $expire; - $this->memcached = $memcached; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $contents = $this->memcached->get($this->key); - - if ($contents !== false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $expiration = $this->expire === null ? 0 : time() + $this->expire; - $this->memcached->set($this->key, $contents, $expiration); - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php b/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php deleted file mode 100644 index d0914fab..00000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php +++ /dev/null @@ -1,22 +0,0 @@ -client = $client ?: new Redis(); - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $contents = $this->client->get($this->key); - - if ($contents !== false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $this->client->set($this->key, $contents); - - if ($this->expire !== null) { - $this->client->expire($this->key, $this->expire); - } - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php b/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php deleted file mode 100644 index 8a295744..00000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php +++ /dev/null @@ -1,75 +0,0 @@ -client = $client ?: new Client(); - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function load() - { - if (($contents = $this->executeCommand('get', [$this->key])) !== null) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $this->executeCommand('set', [$this->key, $contents]); - - if ($this->expire !== null) { - $this->executeCommand('expire', [$this->key, $this->expire]); - } - } - - /** - * Execute a Predis command. - * - * @param string $name - * @param array $arguments - * - * @return string - */ - protected function executeCommand($name, array $arguments) - { - $command = $this->client->createCommand($name, $arguments); - - return $this->client->executeCommand($command); - } -} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php b/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php deleted file mode 100644 index 43be87e5..00000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php +++ /dev/null @@ -1,59 +0,0 @@ -pool = $pool; - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function save() - { - $item = $this->pool->getItem($this->key); - $item->set($this->getForStorage()); - $item->expiresAfter($this->expire); - $this->pool->save($item); - } - - /** - * {@inheritdoc} - */ - public function load() - { - $item = $this->pool->getItem($this->key); - if ($item->isHit()) { - $this->setFromStorage($item->get()); - } - } -} \ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php b/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php deleted file mode 100644 index e05b8322..00000000 --- a/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php +++ /dev/null @@ -1,60 +0,0 @@ -key = $key; - $this->expire = $expire; - $this->pool = $pool; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $item = $this->pool->getItem($this->key); - $contents = $item->get(); - - if ($item->isMiss() === false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $item = $this->pool->getItem($this->key); - $item->set($contents, $this->expire); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php b/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php deleted file mode 100644 index b63cba78..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php +++ /dev/null @@ -1,104 +0,0 @@ -shouldReceive('has')->once()->with('file.json')->andReturn(false); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadExpired() - { - $response = ['contents' => json_encode([[], ['' => true], 1234567890]), 'path' => 'file.json']; - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $adapter->shouldReceive('delete')->once()->with('file.json'); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = ['contents' => json_encode([[], ['' => true], 9876543210]), 'path' => 'file.json']; - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSaveExists() - { - $response = json_encode([[], [], null]); - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('update')->once()->with('file.json', $response, Mockery::any()); - $cache = new Adapter($adapter, 'file.json', null); - $cache->save(); - } - - public function testSaveNew() - { - $response = json_encode([[], [], null]); - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(false); - $adapter->shouldReceive('write')->once()->with('file.json', $response, Mockery::any()); - $cache = new Adapter($adapter, 'file.json', null); - $cache->save(); - } - - public function testStoreContentsRecursive() - { - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(false); - $adapter->shouldReceive('write')->once()->with('file.json', Mockery::any(), Mockery::any()); - - $cache = new Adapter($adapter, 'file.json', null); - - $contents = [ - ['path' => 'foo/bar', 'dirname' => 'foo'], - ['path' => 'afoo/bang', 'dirname' => 'afoo'], - ]; - - $cache->storeContents('foo', $contents, true); - - $this->assertTrue($cache->isComplete('foo', true)); - $this->assertFalse($cache->isComplete('afoo', true)); - } - - public function testDeleteDir() - { - $cache_data = [ - 'foo' => ['path' => 'foo', 'type' => 'dir', 'dirname' => ''], - 'foo/bar' => ['path' => 'foo/bar', 'type' => 'file', 'dirname' => 'foo'], - 'foobaz' => ['path' => 'foobaz', 'type' => 'file', 'dirname' => ''], - ]; - - $response = [ - 'contents' => json_encode([$cache_data, [], null]), - 'path' => 'file.json', - ]; - - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->zeroOrMoreTimes()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $adapter->shouldReceive('update')->once()->with('file.json', Mockery::any(), Mockery::any())->andReturn(true); - - $cache = new Adapter($adapter, 'file.json', null); - $cache->load(); - - $cache->deleteDir('foo', true); - - $this->assertSame(1, count($cache->listContents('', true))); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php b/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php deleted file mode 100644 index 40d4c915..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php +++ /dev/null @@ -1,16 +0,0 @@ -shouldReceive('load')->once(); - $cached_adapter = new CachedAdapter($adapter, $cache); - $this->assertInstanceOf('League\Flysystem\AdapterInterface', $cached_adapter->getAdapter()); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php b/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php deleted file mode 100644 index e3d9ad93..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php +++ /dev/null @@ -1,35 +0,0 @@ -shouldReceive('get')->once()->andReturn(false); - $cache = new Memcached($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Memcached'); - $client->shouldReceive('get')->once()->andReturn($response); - $cache = new Memcached($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $client = Mockery::mock('Memcached'); - $client->shouldReceive('set')->once()->andReturn($response); - $cache = new Memcached($client); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php b/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php deleted file mode 100644 index 3ac58fd0..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php +++ /dev/null @@ -1,255 +0,0 @@ -setAutosave(true); - $this->assertTrue($cache->getAutosave()); - $cache->setAutosave(false); - $this->assertFalse($cache->getAutosave()); - } - - public function testCacheMiss() - { - $cache = new Memory(); - $cache->storeMiss('path.txt'); - $this->assertFalse($cache->has('path.txt')); - } - - public function testIsComplete() - { - $cache = new Memory(); - $this->assertFalse($cache->isComplete('dirname', false)); - $cache->setComplete('dirname', false); - $this->assertFalse($cache->isComplete('dirname', true)); - $cache->setComplete('dirname', true); - $this->assertTrue($cache->isComplete('dirname', true)); - } - - public function testCleanContents() - { - $cache = new Memory(); - $input = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - 'invalid' => 'thing', - ]]; - - $expected = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - ]]; - - $output = $cache->cleanContents($input); - $this->assertEquals($expected, $output); - } - - public function testGetForStorage() - { - $cache = new Memory(); - $input = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - 'type' => 'file', - ]]; - - $cache->storeContents('', $input, true); - $contents = $cache->listContents('', true); - $cached = []; - foreach ($contents as $item) { - $cached[$item['path']] = $item; - } - - $this->assertEquals(json_encode([$cached, ['' => 'recursive']]), $cache->getForStorage()); - } - - public function testParentCompleteIsUsedDuringHas() - { - $cache = new Memory(); - $cache->setComplete('dirname', false); - $this->assertFalse($cache->has('dirname/path.txt')); - } - - public function testFlush() - { - $cache = new Memory(); - $cache->setComplete('dirname', true); - $cache->updateObject('path.txt', [ - 'path' => 'path.txt', - 'visibility' => 'public', - ]); - $cache->flush(); - $this->assertFalse($cache->isComplete('dirname', true)); - $this->assertNull($cache->has('path.txt')); - } - - public function testSetFromStorage() - { - $cache = new Memory(); - $json = [[ - 'path.txt' => ['path' => 'path.txt', 'type' => 'file'], - ], ['dirname' => 'recursive']]; - $jsonString = json_encode($json); - $cache->setFromStorage($jsonString); - $this->assertTrue($cache->has('path.txt')); - $this->assertTrue($cache->isComplete('dirname', true)); - } - - public function testGetMetadataFail() - { - $cache = new Memory(); - $this->assertFalse($cache->getMetadata('path.txt')); - } - - public function metaGetterProvider() - { - return [ - ['getTimestamp', 'timestamp', 12344], - ['getMimetype', 'mimetype', 'text/plain'], - ['getSize', 'size', 12], - ['getVisibility', 'visibility', 'private'], - ['read', 'contents', '__contents__'], - ]; - } - - /** - * @dataProvider metaGetterProvider - * - * @param $method - * @param $key - * @param $value - */ - public function testMetaGetters($method, $key, $value) - { - $cache = new Memory(); - $this->assertFalse($cache->{$method}('path.txt')); - $cache->updateObject('path.txt', $object = [ - 'path' => 'path.txt', - 'type' => 'file', - $key => $value, - ] + Util::pathinfo('path.txt'), true); - $this->assertEquals($object, $cache->{$method}('path.txt')); - $this->assertEquals($object, $cache->getMetadata('path.txt')); - } - - public function testGetDerivedMimetype() - { - $cache = new Memory(); - $cache->updateObject('path.txt', [ - 'contents' => 'something', - ]); - $response = $cache->getMimetype('path.txt'); - $this->assertEquals('text/plain', $response['mimetype']); - } - - public function testCopyFail() - { - $cache = new Memory(); - $cache->copy('one', 'two'); - $this->assertNull($cache->has('two')); - $this->assertNull($cache->load()); - } - - public function testStoreContents() - { - $cache = new Memory(); - $cache->storeContents('dirname', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/nested', 'type' => 'dir'], - ['path' => 'dirname/nested/deep', 'type' => 'dir'], - ['path' => 'other/nested/deep', 'type' => 'dir'], - ], true); - - $this->isTrue($cache->isComplete('other/nested', true)); - } - - public function testDelete() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $this->assertTrue($cache->has('path.txt')); - $cache->delete('path.txt'); - $this->assertFalse($cache->has('path.txt')); - } - - public function testDeleteDir() - { - $cache = new Memory(); - $cache->storeContents('dirname', [ - ['path' => 'dirname/path.txt', 'type' => 'file'], - ]); - $this->assertTrue($cache->isComplete('dirname', false)); - $this->assertTrue($cache->has('dirname/path.txt')); - $cache->deleteDir('dirname'); - $this->assertFalse($cache->isComplete('dirname', false)); - $this->assertNull($cache->has('dirname/path.txt')); - } - - public function testReadStream() - { - $cache = new Memory(); - $this->assertFalse($cache->readStream('path.txt')); - } - - public function testRename() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $cache->rename('path.txt', 'newpath.txt'); - $this->assertTrue($cache->has('newpath.txt')); - } - - public function testCopy() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $cache->copy('path.txt', 'newpath.txt'); - $this->assertTrue($cache->has('newpath.txt')); - } - - public function testComplextListContents() - { - $cache = new Memory(); - $cache->storeContents('', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/file.txt', 'type' => 'file'], - ['path' => 'other', 'type' => 'dir'], - ['path' => 'other/file.txt', 'type' => 'file'], - ['path' => 'other/nested/file.txt', 'type' => 'file'], - ]); - - $this->assertCount(3, $cache->listContents('other', true)); - } - - public function testComplextListContentsWithDeletedFile() - { - $cache = new Memory(); - $cache->storeContents('', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/file.txt', 'type' => 'file'], - ['path' => 'other', 'type' => 'dir'], - ['path' => 'other/file.txt', 'type' => 'file'], - ['path' => 'other/another_file.txt', 'type' => 'file'], - ]); - - $cache->delete('other/another_file.txt'); - $this->assertCount(4, $cache->listContents('', true)); - } - - public function testCacheMissIfContentsIsFalse() - { - $cache = new Memory(); - $cache->updateObject('path.txt', [ - 'path' => 'path.txt', - 'contents' => false, - ], true); - - $this->assertFalse($cache->read('path.txt')); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php b/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php deleted file mode 100644 index 148616ff..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php +++ /dev/null @@ -1,35 +0,0 @@ -assertEquals($cache, $cache->storeMiss('file.txt')); - $this->assertNull($cache->setComplete('', false)); - $this->assertNull($cache->load()); - $this->assertNull($cache->flush()); - $this->assertNull($cache->has('path.txt')); - $this->assertNull($cache->autosave()); - $this->assertFalse($cache->isComplete('', false)); - $this->assertFalse($cache->read('something')); - $this->assertFalse($cache->readStream('something')); - $this->assertFalse($cache->getMetadata('something')); - $this->assertFalse($cache->getMimetype('something')); - $this->assertFalse($cache->getSize('something')); - $this->assertFalse($cache->getTimestamp('something')); - $this->assertFalse($cache->getVisibility('something')); - $this->assertEmpty($cache->listContents('', false)); - $this->assertFalse($cache->rename('', '')); - $this->assertFalse($cache->copy('', '')); - $this->assertNull($cache->save()); - $object = ['path' => 'path.ext']; - $this->assertEquals($object, $cache->updateObject('path.txt', $object)); - $this->assertEquals([['path' => 'some/file.txt']], $cache->storeContents('unknwon', [ - ['path' => 'some/file.txt'], - ], false)); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php b/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php deleted file mode 100644 index d1ccb654..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php +++ /dev/null @@ -1,45 +0,0 @@ -shouldReceive('get')->with('flysystem')->once()->andReturn(false); - $cache = new PhpRedis($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('get')->with('flysystem')->once()->andReturn($response); - $cache = new PhpRedis($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('set')->with('flysystem', $data)->once(); - $cache = new PhpRedis($client); - $cache->save(); - } - - public function testSaveWithExpire() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('set')->with('flysystem', $data)->once(); - $client->shouldReceive('expire')->with('flysystem', 20)->once(); - $cache = new PhpRedis($client, 'flysystem', 20); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/PredisTests.php b/vendor/league/flysystem-cached-adapter/tests/PredisTests.php deleted file mode 100644 index e33e1046..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/PredisTests.php +++ /dev/null @@ -1,55 +0,0 @@ -shouldReceive('createCommand')->with('get', ['flysystem'])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->andReturn(null); - $cache = new Predis($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('get', ['flysystem'])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->andReturn($response); - $cache = new Predis($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('set', ['flysystem', $data])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->once(); - $cache = new Predis($client); - $cache->save(); - } - - public function testSaveWithExpire() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('set', ['flysystem', $data])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->once(); - $expireCommand = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('expire', ['flysystem', 20])->once()->andReturn($expireCommand); - $client->shouldReceive('executeCommand')->with($expireCommand)->once(); - $cache = new Predis($client, 'flysystem', 20); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php b/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php deleted file mode 100644 index d5e5700c..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php +++ /dev/null @@ -1,45 +0,0 @@ -shouldReceive('isHit')->once()->andReturn(false); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Psr6Cache($pool); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $pool = Mockery::mock('Psr\Cache\CacheItemPoolInterface'); - $item = Mockery::mock('Psr\Cache\CacheItemInterface'); - $item->shouldReceive('get')->once()->andReturn($response); - $item->shouldReceive('isHit')->once()->andReturn(true); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Psr6Cache($pool); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $ttl = 4711; - $pool = Mockery::mock('Psr\Cache\CacheItemPoolInterface'); - $item = Mockery::mock('Psr\Cache\CacheItemInterface'); - $item->shouldReceive('expiresAfter')->once()->with($ttl); - $item->shouldReceive('set')->once()->andReturn($response); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $pool->shouldReceive('save')->once()->with($item); - $cache = new Psr6Cache($pool, 'foo', $ttl); - $cache->save(); - } -} diff --git a/vendor/league/flysystem-cached-adapter/tests/StashTest.php b/vendor/league/flysystem-cached-adapter/tests/StashTest.php deleted file mode 100644 index 29e142d7..00000000 --- a/vendor/league/flysystem-cached-adapter/tests/StashTest.php +++ /dev/null @@ -1,43 +0,0 @@ -shouldReceive('get')->once()->andReturn(null); - $item->shouldReceive('isMiss')->once()->andReturn(true); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $pool = Mockery::mock('Stash\Pool'); - $item = Mockery::mock('Stash\Item'); - $item->shouldReceive('get')->once()->andReturn($response); - $item->shouldReceive('isMiss')->once()->andReturn(false); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $pool = Mockery::mock('Stash\Pool'); - $item = Mockery::mock('Stash\Item'); - $item->shouldReceive('set')->once()->andReturn($response); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->save(); - } -} diff --git a/vendor/league/flysystem/LICENSE b/vendor/league/flysystem/LICENSE deleted file mode 100644 index f2684c84..00000000 --- a/vendor/league/flysystem/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013-2019 Frank de Jonge - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/league/flysystem/composer.json b/vendor/league/flysystem/composer.json deleted file mode 100644 index 84229e9f..00000000 --- a/vendor/league/flysystem/composer.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "league/flysystem", - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "filesystem", "filesystems", "files", "storage", "dropbox", "aws", - "abstraction", "s3", "ftp", "sftp", "remote", "webdav", - "file systems", "cloud", "cloud files", "rackspace", "copy.com" - ], - "license": "MIT", - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "require": { - "php": ">=5.5.9", - "ext-fileinfo": "*" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.10" - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "League\\Flysystem\\Stub\\": "stub/" - }, - "files": [ - "tests/PHPUnitHacks.php" - ] - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "scripts": { - "phpstan": "php phpstan.php" - } -} diff --git a/vendor/league/flysystem/deprecations.md b/vendor/league/flysystem/deprecations.md deleted file mode 100644 index c336a425..00000000 --- a/vendor/league/flysystem/deprecations.md +++ /dev/null @@ -1,19 +0,0 @@ -# Deprecations - -This document lists all the planned deprecations. - -## Handlers will be removed in 2.0 - -The `Handler` type and associated calls will be removed in version 2.0. - -### Upgrade path - -You should create your own implementation for handling OOP usage, -but it's recommended to move away from using an OOP-style wrapper entirely. - -The reason for this is that it's too easy for implementation details (for -your application this is Flysystem) to leak into the application. The most -important part for Flysystem is that it improves portability and creates a -solid boundary between your application core and the infrastructure you use. -The OOP-style handling breaks this principle, therefore I want to stop -promoting it. diff --git a/vendor/league/flysystem/src/Adapter/AbstractAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractAdapter.php deleted file mode 100644 index e577ac4a..00000000 --- a/vendor/league/flysystem/src/Adapter/AbstractAdapter.php +++ /dev/null @@ -1,72 +0,0 @@ -pathPrefix = null; - - return; - } - - $this->pathPrefix = rtrim($prefix, '\\/') . $this->pathSeparator; - } - - /** - * Get the path prefix. - * - * @return string|null path prefix or null if pathPrefix is empty - */ - public function getPathPrefix() - { - return $this->pathPrefix; - } - - /** - * Prefix a path. - * - * @param string $path - * - * @return string prefixed path - */ - public function applyPathPrefix($path) - { - return $this->getPathPrefix() . ltrim($path, '\\/'); - } - - /** - * Remove a path prefix. - * - * @param string $path - * - * @return string path without the prefix - */ - public function removePathPrefix($path) - { - return substr($path, strlen($this->getPathPrefix())); - } -} diff --git a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php deleted file mode 100644 index 578b4919..00000000 --- a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php +++ /dev/null @@ -1,693 +0,0 @@ -safeStorage = new SafeStorage(); - $this->setConfig($config); - } - - /** - * Set the config. - * - * @param array $config - * - * @return $this - */ - public function setConfig(array $config) - { - foreach ($this->configurable as $setting) { - if ( ! isset($config[$setting])) { - continue; - } - - $method = 'set' . ucfirst($setting); - - if (method_exists($this, $method)) { - $this->$method($config[$setting]); - } - } - - return $this; - } - - /** - * Returns the host. - * - * @return string - */ - public function getHost() - { - return $this->host; - } - - /** - * Set the host. - * - * @param string $host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - - return $this; - } - - /** - * Set the public permission value. - * - * @param int $permPublic - * - * @return $this - */ - public function setPermPublic($permPublic) - { - $this->permPublic = $permPublic; - - return $this; - } - - /** - * Set the private permission value. - * - * @param int $permPrivate - * - * @return $this - */ - public function setPermPrivate($permPrivate) - { - $this->permPrivate = $permPrivate; - - return $this; - } - - /** - * Returns the ftp port. - * - * @return int - */ - public function getPort() - { - return $this->port; - } - - /** - * Returns the root folder to work from. - * - * @return string - */ - public function getRoot() - { - return $this->root; - } - - /** - * Set the ftp port. - * - * @param int|string $port - * - * @return $this - */ - public function setPort($port) - { - $this->port = (int) $port; - - return $this; - } - - /** - * Set the root folder to work from. - * - * @param string $root - * - * @return $this - */ - public function setRoot($root) - { - $this->root = rtrim($root, '\\/') . $this->separator; - - return $this; - } - - /** - * Returns the ftp username. - * - * @return string username - */ - public function getUsername() - { - $username = $this->safeStorage->retrieveSafely('username'); - - return $username !== null ? $username : 'anonymous'; - } - - /** - * Set ftp username. - * - * @param string $username - * - * @return $this - */ - public function setUsername($username) - { - $this->safeStorage->storeSafely('username', $username); - - return $this; - } - - /** - * Returns the password. - * - * @return string password - */ - public function getPassword() - { - return $this->safeStorage->retrieveSafely('password'); - } - - /** - * Set the ftp password. - * - * @param string $password - * - * @return $this - */ - public function setPassword($password) - { - $this->safeStorage->storeSafely('password', $password); - - return $this; - } - - /** - * Returns the amount of seconds before the connection will timeout. - * - * @return int - */ - public function getTimeout() - { - return $this->timeout; - } - - /** - * Set the amount of seconds before the connection should timeout. - * - * @param int $timeout - * - * @return $this - */ - public function setTimeout($timeout) - { - $this->timeout = (int) $timeout; - - return $this; - } - - /** - * Return the FTP system type. - * - * @return string - */ - public function getSystemType() - { - return $this->systemType; - } - - /** - * Set the FTP system type (windows or unix). - * - * @param string $systemType - * - * @return $this - */ - public function setSystemType($systemType) - { - $this->systemType = strtolower($systemType); - - return $this; - } - - /** - * True to enable timestamps for FTP servers that return unix-style listings. - * - * @param bool $bool - * - * @return $this - */ - public function setEnableTimestampsOnUnixListings($bool = false) - { - $this->enableTimestampsOnUnixListings = $bool; - - return $this; - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - return $this->listDirectoryContents($directory, $recursive); - } - - abstract protected function listDirectoryContents($directory, $recursive = false); - - /** - * Normalize a directory listing. - * - * @param array $listing - * @param string $prefix - * - * @return array directory listing - */ - protected function normalizeListing(array $listing, $prefix = '') - { - $base = $prefix; - $result = []; - $listing = $this->removeDotDirectories($listing); - - while ($item = array_shift($listing)) { - if (preg_match('#^.*:$#', $item)) { - $base = preg_replace('~^\./*|:$~', '', $item); - continue; - } - - $result[] = $this->normalizeObject($item, $base); - } - - return $this->sortListing($result); - } - - /** - * Sort a directory listing. - * - * @param array $result - * - * @return array sorted listing - */ - protected function sortListing(array $result) - { - $compare = function ($one, $two) { - return strnatcmp($one['path'], $two['path']); - }; - - usort($result, $compare); - - return $result; - } - - /** - * Normalize a file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - * - * @throws NotSupportedException - */ - protected function normalizeObject($item, $base) - { - $systemType = $this->systemType ?: $this->detectSystemType($item); - - if ($systemType === 'unix') { - return $this->normalizeUnixObject($item, $base); - } elseif ($systemType === 'windows') { - return $this->normalizeWindowsObject($item, $base); - } - - throw NotSupportedException::forFtpSystemType($systemType); - } - - /** - * Normalize a Unix file entry. - * - * Given $item contains: - * '-rw-r--r-- 1 ftp ftp 409 Aug 19 09:01 file1.txt' - * - * This function will return: - * [ - * 'type' => 'file', - * 'path' => 'file1.txt', - * 'visibility' => 'public', - * 'size' => 409, - * 'timestamp' => 1566205260 - * ] - * - * @param string $item - * @param string $base - * - * @return array normalized file array - */ - protected function normalizeUnixObject($item, $base) - { - $item = preg_replace('#\s+#', ' ', trim($item), 7); - - if (count(explode(' ', $item, 9)) !== 9) { - throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); - } - - list($permissions, /* $number */, /* $owner */, /* $group */, $size, $month, $day, $timeOrYear, $name) = explode(' ', $item, 9); - $type = $this->detectType($permissions); - $path = $base === '' ? $name : $base . $this->separator . $name; - - if ($type === 'dir') { - return compact('type', 'path'); - } - - $permissions = $this->normalizePermissions($permissions); - $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; - $size = (int) $size; - - $result = compact('type', 'path', 'visibility', 'size'); - if ($this->enableTimestampsOnUnixListings) { - $timestamp = $this->normalizeUnixTimestamp($month, $day, $timeOrYear); - $result += compact('timestamp'); - } - - return $result; - } - - /** - * Only accurate to the minute (current year), or to the day. - * - * Inadequacies in timestamp accuracy are due to limitations of the FTP 'LIST' command - * - * Note: The 'MLSD' command is a machine-readable replacement for 'LIST' - * but many FTP servers do not support it :( - * - * @param string $month e.g. 'Aug' - * @param string $day e.g. '19' - * @param string $timeOrYear e.g. '09:01' OR '2015' - * - * @return int - */ - protected function normalizeUnixTimestamp($month, $day, $timeOrYear) - { - if (is_numeric($timeOrYear)) { - $year = $timeOrYear; - $hour = '00'; - $minute = '00'; - $seconds = '00'; - } else { - $year = date('Y'); - list($hour, $minute) = explode(':', $timeOrYear); - $seconds = '00'; - } - $dateTime = DateTime::createFromFormat('Y-M-j-G:i:s', "{$year}-{$month}-{$day}-{$hour}:{$minute}:{$seconds}"); - - return $dateTime->getTimestamp(); - } - - /** - * Normalize a Windows/DOS file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - */ - protected function normalizeWindowsObject($item, $base) - { - $item = preg_replace('#\s+#', ' ', trim($item), 3); - - if (count(explode(' ', $item, 4)) !== 4) { - throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); - } - - list($date, $time, $size, $name) = explode(' ', $item, 4); - $path = $base === '' ? $name : $base . $this->separator . $name; - - // Check for the correct date/time format - $format = strlen($date) === 8 ? 'm-d-yH:iA' : 'Y-m-dH:i'; - $dt = DateTime::createFromFormat($format, $date . $time); - $timestamp = $dt ? $dt->getTimestamp() : (int) strtotime("$date $time"); - - if ($size === '') { - $type = 'dir'; - - return compact('type', 'path', 'timestamp'); - } - - $type = 'file'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $size = (int) $size; - - return compact('type', 'path', 'visibility', 'size', 'timestamp'); - } - - /** - * Get the system type from a listing item. - * - * @param string $item - * - * @return string the system type - */ - protected function detectSystemType($item) - { - return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', $item) ? 'windows' : 'unix'; - } - - /** - * Get the file type from the permissions. - * - * @param string $permissions - * - * @return string file type - */ - protected function detectType($permissions) - { - return substr($permissions, 0, 1) === 'd' ? 'dir' : 'file'; - } - - /** - * Normalize a permissions string. - * - * @param string $permissions - * - * @return int - */ - protected function normalizePermissions($permissions) - { - // remove the type identifier - $permissions = substr($permissions, 1); - - // map the string rights to the numeric counterparts - $map = ['-' => '0', 'r' => '4', 'w' => '2', 'x' => '1']; - $permissions = strtr($permissions, $map); - - // split up the permission groups - $parts = str_split($permissions, 3); - - // convert the groups - $mapper = function ($part) { - return array_sum(str_split($part)); - }; - - // converts to decimal number - return octdec(implode('', array_map($mapper, $parts))); - } - - /** - * Filter out dot-directories. - * - * @param array $list - * - * @return array - */ - public function removeDotDirectories(array $list) - { - $filter = function ($line) { - return $line !== '' && ! preg_match('#.* \.(\.)?$|^total#', $line); - }; - - return array_filter($list, $filter); - } - - /** - * @inheritdoc - */ - public function has($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - return $this->getMetadata($path); - } - - /** - * Ensure a directory exists. - * - * @param string $dirname - */ - public function ensureDirectory($dirname) - { - $dirname = (string) $dirname; - - if ($dirname !== '' && ! $this->has($dirname)) { - $this->createDir($dirname, new Config()); - } - } - - /** - * @return mixed - */ - public function getConnection() - { - $tries = 0; - - while ( ! $this->isConnected() && $tries < 3) { - $tries++; - $this->disconnect(); - $this->connect(); - } - - return $this->connection; - } - - /** - * Get the public permission value. - * - * @return int - */ - public function getPermPublic() - { - return $this->permPublic; - } - - /** - * Get the private permission value. - * - * @return int - */ - public function getPermPrivate() - { - return $this->permPrivate; - } - - /** - * Disconnect on destruction. - */ - public function __destruct() - { - $this->disconnect(); - } - - /** - * Establish a connection. - */ - abstract public function connect(); - - /** - * Close the connection. - */ - abstract public function disconnect(); - - /** - * Check if a connection is active. - * - * @return bool - */ - abstract public function isConnected(); -} diff --git a/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php b/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php deleted file mode 100644 index fd8d2161..00000000 --- a/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php +++ /dev/null @@ -1,12 +0,0 @@ -transferMode = $mode; - - return $this; - } - - /** - * Set if Ssl is enabled. - * - * @param bool $ssl - * - * @return $this - */ - public function setSsl($ssl) - { - $this->ssl = (bool) $ssl; - - return $this; - } - - /** - * Set if passive mode should be used. - * - * @param bool $passive - */ - public function setPassive($passive = true) - { - $this->passive = $passive; - } - - /** - * @param bool $ignorePassiveAddress - */ - public function setIgnorePassiveAddress($ignorePassiveAddress) - { - $this->ignorePassiveAddress = $ignorePassiveAddress; - } - - /** - * @param bool $recurseManually - */ - public function setRecurseManually($recurseManually) - { - $this->recurseManually = $recurseManually; - } - - /** - * @param bool $utf8 - */ - public function setUtf8($utf8) - { - $this->utf8 = (bool) $utf8; - } - - /** - * Connect to the FTP server. - */ - public function connect() - { - if ($this->ssl) { - $this->connection = ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout()); - } else { - $this->connection = ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout()); - } - - if ( ! $this->connection) { - throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); - } - - $this->login(); - $this->setUtf8Mode(); - $this->setConnectionPassiveMode(); - $this->setConnectionRoot(); - $this->isPureFtpd = $this->isPureFtpdServer(); - } - - /** - * Set the connection to UTF-8 mode. - */ - protected function setUtf8Mode() - { - if ($this->utf8) { - $response = ftp_raw($this->connection, "OPTS UTF8 ON"); - if (substr($response[0], 0, 3) !== '200') { - throw new RuntimeException( - 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() - ); - } - } - } - - /** - * Set the connections to passive mode. - * - * @throws RuntimeException - */ - protected function setConnectionPassiveMode() - { - if (is_bool($this->ignorePassiveAddress) && defined('FTP_USEPASVADDRESS')) { - ftp_set_option($this->connection, FTP_USEPASVADDRESS, ! $this->ignorePassiveAddress); - } - - if ( ! ftp_pasv($this->connection, $this->passive)) { - throw new RuntimeException( - 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort() - ); - } - } - - /** - * Set the connection root. - */ - protected function setConnectionRoot() - { - $root = $this->getRoot(); - $connection = $this->connection; - - if ($root && ! ftp_chdir($connection, $root)) { - throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot()); - } - - // Store absolute path for further reference. - // This is needed when creating directories and - // initial root was a relative path, else the root - // would be relative to the chdir'd path. - $this->root = ftp_pwd($connection); - } - - /** - * Login. - * - * @throws RuntimeException - */ - protected function login() - { - set_error_handler(function () { - }); - $isLoggedIn = ftp_login( - $this->connection, - $this->getUsername(), - $this->getPassword() - ); - restore_error_handler(); - - if ( ! $isLoggedIn) { - $this->disconnect(); - throw new RuntimeException( - 'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort( - ) . ', username: ' . $this->getUsername() - ); - } - } - - /** - * Disconnect from the FTP server. - */ - public function disconnect() - { - if (is_resource($this->connection)) { - ftp_close($this->connection); - } - - $this->connection = null; - } - - /** - * @inheritdoc - */ - public function write($path, $contents, Config $config) - { - $stream = fopen('php://temp', 'w+b'); - fwrite($stream, $contents); - rewind($stream); - $result = $this->writeStream($path, $stream, $config); - fclose($stream); - - if ($result === false) { - return false; - } - - $result['contents'] = $contents; - $result['mimetype'] = $config->get('mimetype') ?: Util::guessMimeType($path, $contents); - - return $result; - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, Config $config) - { - $this->ensureDirectory(Util::dirname($path)); - - if ( ! ftp_fput($this->getConnection(), $path, $resource, $this->transferMode)) { - return false; - } - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - } - - $type = 'file'; - - return compact('type', 'path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - return $this->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, Config $config) - { - return $this->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - return ftp_rename($this->getConnection(), $path, $newpath); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - return ftp_delete($this->getConnection(), $path); - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $connection = $this->getConnection(); - $contents = array_reverse($this->listDirectoryContents($dirname, false)); - - foreach ($contents as $object) { - if ($object['type'] === 'file') { - if ( ! ftp_delete($connection, $object['path'])) { - return false; - } - } elseif ( ! $this->deleteDir($object['path'])) { - return false; - } - } - - return ftp_rmdir($connection, $dirname); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - $connection = $this->getConnection(); - $directories = explode('/', $dirname); - - foreach ($directories as $directory) { - if (false === $this->createActualDirectory($directory, $connection)) { - $this->setConnectionRoot(); - - return false; - } - - ftp_chdir($connection, $directory); - } - - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $dirname]; - } - - /** - * Create a directory. - * - * @param string $directory - * @param resource $connection - * - * @return bool - */ - protected function createActualDirectory($directory, $connection) - { - // List the current directory - $listing = ftp_nlist($connection, '.') ?: []; - - foreach ($listing as $key => $item) { - if (preg_match('~^\./.*~', $item)) { - $listing[$key] = substr($item, 2); - } - } - - if (in_array($directory, $listing, true)) { - return true; - } - - return (boolean) ftp_mkdir($connection, $directory); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - if ($path === '') { - return ['type' => 'dir', 'path' => '']; - } - - if (@ftp_chdir($this->getConnection(), $path) === true) { - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $path]; - } - - $listing = $this->ftpRawlist('-A', str_replace('*', '\\*', $path)); - - if (empty($listing) || in_array('total 0', $listing, true)) { - return false; - } - - if (preg_match('/.* not found/', $listing[0])) { - return false; - } - - if (preg_match('/^total [0-9]*$/', $listing[0])) { - array_shift($listing); - } - - return $this->normalizeObject($listing[0], ''); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - if ( ! $metadata = $this->getMetadata($path)) { - return false; - } - - $metadata['mimetype'] = MimeType::detectByFilename($path); - - return $metadata; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - $timestamp = ftp_mdtm($this->getConnection(), $path); - - return ($timestamp !== -1) ? ['path' => $path, 'timestamp' => $timestamp] : false; - } - - /** - * @inheritdoc - */ - public function read($path) - { - if ( ! $object = $this->readStream($path)) { - return false; - } - - $object['contents'] = stream_get_contents($object['stream']); - fclose($object['stream']); - unset($object['stream']); - - return $object; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $stream = fopen('php://temp', 'w+b'); - $result = ftp_fget($this->getConnection(), $stream, $path, $this->transferMode); - rewind($stream); - - if ( ! $result) { - fclose($stream); - - return false; - } - - return ['type' => 'file', 'path' => $path, 'stream' => $stream]; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $mode = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? $this->getPermPublic() : $this->getPermPrivate(); - - if ( ! ftp_chmod($this->getConnection(), $mode, $path)) { - return false; - } - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - * - * @param string $directory - */ - protected function listDirectoryContents($directory, $recursive = true) - { - $directory = str_replace('*', '\\*', $directory); - - if ($recursive && $this->recurseManually) { - return $this->listDirectoryContentsRecursive($directory); - } - - $options = $recursive ? '-alnR' : '-aln'; - $listing = $this->ftpRawlist($options, $directory); - - return $listing ? $this->normalizeListing($listing, $directory) : []; - } - - /** - * @inheritdoc - * - * @param string $directory - */ - protected function listDirectoryContentsRecursive($directory) - { - $listing = $this->normalizeListing($this->ftpRawlist('-aln', $directory) ?: [], $directory); - $output = []; - - foreach ($listing as $item) { - $output[] = $item; - if ($item['type'] !== 'dir') { - continue; - } - $output = array_merge($output, $this->listDirectoryContentsRecursive($item['path'])); - } - - return $output; - } - - /** - * Check if the connection is open. - * - * @return bool - * - * @throws ErrorException - */ - public function isConnected() - { - try { - return is_resource($this->connection) && ftp_rawlist($this->connection, $this->getRoot()) !== false; - } catch (ErrorException $e) { - if (strpos($e->getMessage(), 'ftp_rawlist') === false) { - throw $e; - } - - return false; - } - } - - /** - * @return bool - */ - protected function isPureFtpdServer() - { - $response = ftp_raw($this->connection, 'HELP'); - - return stripos(implode(' ', $response), 'Pure-FTPd') !== false; - } - - /** - * The ftp_rawlist function with optional escaping. - * - * @param string $options - * @param string $path - * - * @return array - */ - protected function ftpRawlist($options, $path) - { - $connection = $this->getConnection(); - - if ($this->isPureFtpd) { - $path = str_replace(' ', '\ ', $path); - } - - return ftp_rawlist($connection, $options . ' ' . $path); - } -} diff --git a/vendor/league/flysystem/src/Adapter/Ftpd.php b/vendor/league/flysystem/src/Adapter/Ftpd.php deleted file mode 100644 index d5349e47..00000000 --- a/vendor/league/flysystem/src/Adapter/Ftpd.php +++ /dev/null @@ -1,45 +0,0 @@ - 'dir', 'path' => '']; - } - if (@ftp_chdir($this->getConnection(), $path) === true) { - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $path]; - } - - if ( ! ($object = ftp_raw($this->getConnection(), 'STAT ' . $path)) || count($object) < 3) { - return false; - } - - if (substr($object[1], 0, 5) === "ftpd:") { - return false; - } - - return $this->normalizeObject($object[1], ''); - } - - /** - * @inheritdoc - */ - protected function listDirectoryContents($directory, $recursive = true) - { - $listing = ftp_rawlist($this->getConnection(), $directory, $recursive); - - if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { - return []; - } - - return $this->normalizeListing($listing, $directory); - } -} diff --git a/vendor/league/flysystem/src/Adapter/Local.php b/vendor/league/flysystem/src/Adapter/Local.php deleted file mode 100644 index c6e6fa86..00000000 --- a/vendor/league/flysystem/src/Adapter/Local.php +++ /dev/null @@ -1,528 +0,0 @@ - [ - 'public' => 0644, - 'private' => 0600, - ], - 'dir' => [ - 'public' => 0755, - 'private' => 0700, - ], - ]; - - /** - * @var string - */ - protected $pathSeparator = DIRECTORY_SEPARATOR; - - /** - * @var array - */ - protected $permissionMap; - - /** - * @var int - */ - protected $writeFlags; - - /** - * @var int - */ - private $linkHandling; - - /** - * Constructor. - * - * @param string $root - * @param int $writeFlags - * @param int $linkHandling - * @param array $permissions - * - * @throws LogicException - */ - public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) - { - $root = is_link($root) ? realpath($root) : $root; - $this->permissionMap = array_replace_recursive(static::$permissions, $permissions); - $this->ensureDirectory($root); - - if ( ! is_dir($root) || ! is_readable($root)) { - throw new LogicException('The root path ' . $root . ' is not readable.'); - } - - $this->setPathPrefix($root); - $this->writeFlags = $writeFlags; - $this->linkHandling = $linkHandling; - } - - /** - * Ensure the root directory exists. - * - * @param string $root root directory path - * - * @return void - * - * @throws Exception in case the root directory can not be created - */ - protected function ensureDirectory($root) - { - if ( ! is_dir($root)) { - $umask = umask(0); - - if ( ! @mkdir($root, $this->permissionMap['dir']['public'], true)) { - $mkdirError = error_get_last(); - } - - umask($umask); - clearstatcache(false, $root); - - if ( ! is_dir($root)) { - $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : ''; - throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage)); - } - } - } - - /** - * @inheritdoc - */ - public function has($path) - { - $location = $this->applyPathPrefix($path); - - return file_exists($location); - } - - /** - * @inheritdoc - */ - public function write($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $this->ensureDirectory(dirname($location)); - - if (($size = file_put_contents($location, $contents, $this->writeFlags)) === false) { - return false; - } - - $type = 'file'; - $result = compact('contents', 'type', 'size', 'path'); - - if ($visibility = $config->get('visibility')) { - $result['visibility'] = $visibility; - $this->setVisibility($path, $visibility); - } - - return $result; - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, Config $config) - { - $location = $this->applyPathPrefix($path); - $this->ensureDirectory(dirname($location)); - $stream = fopen($location, 'w+b'); - - if ( ! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) { - return false; - } - - $type = 'file'; - $result = compact('type', 'path'); - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - $result['visibility'] = $visibility; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $location = $this->applyPathPrefix($path); - $stream = fopen($location, 'rb'); - - return ['type' => 'file', 'path' => $path, 'stream' => $stream]; - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, Config $config) - { - return $this->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $size = file_put_contents($location, $contents, $this->writeFlags); - - if ($size === false) { - return false; - } - - $type = 'file'; - - $result = compact('type', 'path', 'size', 'contents'); - - if ($mimetype = $config->get('mimetype') ?: Util::guessMimeType($path, $contents)) { - $result['mimetype'] = $mimetype; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function read($path) - { - $location = $this->applyPathPrefix($path); - $contents = @file_get_contents($location); - - if ($contents === false) { - return false; - } - - return ['type' => 'file', 'path' => $path, 'contents' => $contents]; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - $location = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - $parentDirectory = $this->applyPathPrefix(Util::dirname($newpath)); - $this->ensureDirectory($parentDirectory); - - return rename($location, $destination); - } - - /** - * @inheritdoc - */ - public function copy($path, $newpath) - { - $location = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - $this->ensureDirectory(dirname($destination)); - - return copy($location, $destination); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - $location = $this->applyPathPrefix($path); - - return @unlink($location); - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - $result = []; - $location = $this->applyPathPrefix($directory); - - if ( ! is_dir($location)) { - return []; - } - - $iterator = $recursive ? $this->getRecursiveDirectoryIterator($location) : $this->getDirectoryIterator($location); - - foreach ($iterator as $file) { - $path = $this->getFilePath($file); - - if (preg_match('#(^|/|\\\\)\.{1,2}$#', $path)) { - continue; - } - - $result[] = $this->normalizeFileInfo($file); - } - - return array_filter($result); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - $location = $this->applyPathPrefix($path); - clearstatcache(false, $location); - $info = new SplFileInfo($location); - - return $this->normalizeFileInfo($info); - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - $location = $this->applyPathPrefix($path); - $finfo = new Finfo(FILEINFO_MIME_TYPE); - $mimetype = $finfo->file($location); - - if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty', 'application/x-empty'])) { - $mimetype = Util\MimeType::detectByFilename($location); - } - - return ['path' => $path, 'type' => 'file', 'mimetype' => $mimetype]; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - $location = $this->applyPathPrefix($path); - clearstatcache(false, $location); - $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4)); - $type = is_dir($location) ? 'dir' : 'file'; - - foreach ($this->permissionMap[$type] as $visibility => $visibilityPermissions) { - if ($visibilityPermissions == $permissions) { - return compact('path', 'visibility'); - } - } - - $visibility = substr(sprintf('%o', fileperms($location)), -4); - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $location = $this->applyPathPrefix($path); - $type = is_dir($location) ? 'dir' : 'file'; - $success = chmod($location, $this->permissionMap[$type][$visibility]); - - if ($success === false) { - return false; - } - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - $location = $this->applyPathPrefix($dirname); - $umask = umask(0); - $visibility = $config->get('visibility', 'public'); - $return = ['path' => $dirname, 'type' => 'dir']; - - if ( ! is_dir($location)) { - if (false === @mkdir($location, $this->permissionMap['dir'][$visibility], true) - || false === is_dir($location)) { - $return = false; - } - } - - umask($umask); - - return $return; - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $location = $this->applyPathPrefix($dirname); - - if ( ! is_dir($location)) { - return false; - } - - $contents = $this->getRecursiveDirectoryIterator($location, RecursiveIteratorIterator::CHILD_FIRST); - - /** @var SplFileInfo $file */ - foreach ($contents as $file) { - $this->guardAgainstUnreadableFileInfo($file); - $this->deleteFileInfoObject($file); - } - - return rmdir($location); - } - - /** - * @param SplFileInfo $file - */ - protected function deleteFileInfoObject(SplFileInfo $file) - { - switch ($file->getType()) { - case 'dir': - rmdir($file->getRealPath()); - break; - case 'link': - unlink($file->getPathname()); - break; - default: - unlink($file->getRealPath()); - } - } - - /** - * Normalize the file info. - * - * @param SplFileInfo $file - * - * @return array|void - * - * @throws NotSupportedException - */ - protected function normalizeFileInfo(SplFileInfo $file) - { - if ( ! $file->isLink()) { - return $this->mapFileInfo($file); - } - - if ($this->linkHandling & self::DISALLOW_LINKS) { - throw NotSupportedException::forLink($file); - } - } - - /** - * Get the normalized path from a SplFileInfo object. - * - * @param SplFileInfo $file - * - * @return string - */ - protected function getFilePath(SplFileInfo $file) - { - $location = $file->getPathname(); - $path = $this->removePathPrefix($location); - - return trim(str_replace('\\', '/', $path), '/'); - } - - /** - * @param string $path - * @param int $mode - * - * @return RecursiveIteratorIterator - */ - protected function getRecursiveDirectoryIterator($path, $mode = RecursiveIteratorIterator::SELF_FIRST) - { - return new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), - $mode - ); - } - - /** - * @param string $path - * - * @return DirectoryIterator - */ - protected function getDirectoryIterator($path) - { - $iterator = new DirectoryIterator($path); - - return $iterator; - } - - /** - * @param SplFileInfo $file - * - * @return array - */ - protected function mapFileInfo(SplFileInfo $file) - { - $normalized = [ - 'type' => $file->getType(), - 'path' => $this->getFilePath($file), - ]; - - $normalized['timestamp'] = $file->getMTime(); - - if ($normalized['type'] === 'file') { - $normalized['size'] = $file->getSize(); - } - - return $normalized; - } - - /** - * @param SplFileInfo $file - * - * @throws UnreadableFileException - */ - protected function guardAgainstUnreadableFileInfo(SplFileInfo $file) - { - if ( ! $file->isReadable()) { - throw UnreadableFileException::forFileInfo($file); - } - } -} diff --git a/vendor/league/flysystem/src/Adapter/NullAdapter.php b/vendor/league/flysystem/src/Adapter/NullAdapter.php deleted file mode 100644 index 2527087f..00000000 --- a/vendor/league/flysystem/src/Adapter/NullAdapter.php +++ /dev/null @@ -1,144 +0,0 @@ -get('visibility')) { - $result['visibility'] = $visibility; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - return false; - } - - /** - * @inheritdoc - */ - public function read($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - return false; - } - - /** - * @inheritdoc - */ - public function delete($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - return []; - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - return compact('visibility'); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - return ['path' => $dirname, 'type' => 'dir']; - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - return false; - } -} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php deleted file mode 100644 index fc0a747a..00000000 --- a/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php +++ /dev/null @@ -1,33 +0,0 @@ -readStream($path); - - if ($response === false || ! is_resource($response['stream'])) { - return false; - } - - $result = $this->writeStream($newpath, $response['stream'], new Config()); - - if ($result !== false && is_resource($response['stream'])) { - fclose($response['stream']); - } - - return $result !== false; - } - - // Required abstract method - - /** - * @param string $path - * - * @return resource - */ - abstract public function readStream($path); - - /** - * @param string $path - * @param resource $resource - * @param Config $config - * - * @return resource - */ - abstract public function writeStream($path, $resource, Config $config); -} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php deleted file mode 100644 index 2b31c01d..00000000 --- a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php +++ /dev/null @@ -1,44 +0,0 @@ -read($path)) { - return false; - } - - $stream = fopen('php://temp', 'w+b'); - fwrite($stream, $data['contents']); - rewind($stream); - $data['stream'] = $stream; - unset($data['contents']); - - return $data; - } - - /** - * Reads a file. - * - * @param string $path - * - * @return array|false - * - * @see League\Flysystem\ReadInterface::read() - */ - abstract public function read($path); -} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php deleted file mode 100644 index 80424960..00000000 --- a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php +++ /dev/null @@ -1,9 +0,0 @@ -stream($path, $resource, $config, 'write'); - } - - /** - * Update a file using a stream. - * - * @param string $path - * @param resource $resource - * @param Config $config Config object or visibility setting - * - * @return mixed false of file metadata - */ - public function updateStream($path, $resource, Config $config) - { - return $this->stream($path, $resource, $config, 'update'); - } - - // Required abstract methods - abstract public function write($pash, $contents, Config $config); - abstract public function update($pash, $contents, Config $config); -} diff --git a/vendor/league/flysystem/src/Adapter/SynologyFtp.php b/vendor/league/flysystem/src/Adapter/SynologyFtp.php deleted file mode 100644 index fe0d344c..00000000 --- a/vendor/league/flysystem/src/Adapter/SynologyFtp.php +++ /dev/null @@ -1,8 +0,0 @@ -settings = $settings; - } - - /** - * Get a setting. - * - * @param string $key - * @param mixed $default - * - * @return mixed config setting or default when not found - */ - public function get($key, $default = null) - { - if ( ! array_key_exists($key, $this->settings)) { - return $this->getDefault($key, $default); - } - - return $this->settings[$key]; - } - - /** - * Check if an item exists by key. - * - * @param string $key - * - * @return bool - */ - public function has($key) - { - if (array_key_exists($key, $this->settings)) { - return true; - } - - return $this->fallback instanceof Config - ? $this->fallback->has($key) - : false; - } - - /** - * Try to retrieve a default setting from a config fallback. - * - * @param string $key - * @param mixed $default - * - * @return mixed config setting or default when not found - */ - protected function getDefault($key, $default) - { - if ( ! $this->fallback) { - return $default; - } - - return $this->fallback->get($key, $default); - } - - /** - * Set a setting. - * - * @param string $key - * @param mixed $value - * - * @return $this - */ - public function set($key, $value) - { - $this->settings[$key] = $value; - - return $this; - } - - /** - * Set the fallback. - * - * @param Config $fallback - * - * @return $this - */ - public function setFallback(Config $fallback) - { - $this->fallback = $fallback; - - return $this; - } -} diff --git a/vendor/league/flysystem/src/ConfigAwareTrait.php b/vendor/league/flysystem/src/ConfigAwareTrait.php deleted file mode 100644 index 202d605d..00000000 --- a/vendor/league/flysystem/src/ConfigAwareTrait.php +++ /dev/null @@ -1,49 +0,0 @@ -config = $config ? Util::ensureConfig($config) : new Config; - } - - /** - * Get the Config. - * - * @return Config config object - */ - public function getConfig() - { - return $this->config; - } - - /** - * Convert a config array to a Config object with the correct fallback. - * - * @param array $config - * - * @return Config - */ - protected function prepareConfig(array $config) - { - $config = new Config($config); - $config->setFallback($this->getConfig()); - - return $config; - } -} diff --git a/vendor/league/flysystem/src/Directory.php b/vendor/league/flysystem/src/Directory.php deleted file mode 100644 index d4f90a88..00000000 --- a/vendor/league/flysystem/src/Directory.php +++ /dev/null @@ -1,31 +0,0 @@ -filesystem->deleteDir($this->path); - } - - /** - * List the directory contents. - * - * @param bool $recursive - * - * @return array|bool directory contents or false - */ - public function getContents($recursive = false) - { - return $this->filesystem->listContents($this->path, $recursive); - } -} diff --git a/vendor/league/flysystem/src/Exception.php b/vendor/league/flysystem/src/Exception.php deleted file mode 100644 index d4a9907b..00000000 --- a/vendor/league/flysystem/src/Exception.php +++ /dev/null @@ -1,8 +0,0 @@ -filesystem->has($this->path); - } - - /** - * Read the file. - * - * @return string|false file contents - */ - public function read() - { - return $this->filesystem->read($this->path); - } - - /** - * Read the file as a stream. - * - * @return resource|false file stream - */ - public function readStream() - { - return $this->filesystem->readStream($this->path); - } - - /** - * Write the new file. - * - * @param string $content - * - * @return bool success boolean - */ - public function write($content) - { - return $this->filesystem->write($this->path, $content); - } - - /** - * Write the new file using a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function writeStream($resource) - { - return $this->filesystem->writeStream($this->path, $resource); - } - - /** - * Update the file contents. - * - * @param string $content - * - * @return bool success boolean - */ - public function update($content) - { - return $this->filesystem->update($this->path, $content); - } - - /** - * Update the file contents with a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function updateStream($resource) - { - return $this->filesystem->updateStream($this->path, $resource); - } - - /** - * Create the file or update if exists. - * - * @param string $content - * - * @return bool success boolean - */ - public function put($content) - { - return $this->filesystem->put($this->path, $content); - } - - /** - * Create the file or update if exists using a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function putStream($resource) - { - return $this->filesystem->putStream($this->path, $resource); - } - - /** - * Rename the file. - * - * @param string $newpath - * - * @return bool success boolean - */ - public function rename($newpath) - { - if ($this->filesystem->rename($this->path, $newpath)) { - $this->path = $newpath; - - return true; - } - - return false; - } - - /** - * Copy the file. - * - * @param string $newpath - * - * @return File|false new file or false - */ - public function copy($newpath) - { - if ($this->filesystem->copy($this->path, $newpath)) { - return new File($this->filesystem, $newpath); - } - - return false; - } - - /** - * Get the file's timestamp. - * - * @return string|false The timestamp or false on failure. - */ - public function getTimestamp() - { - return $this->filesystem->getTimestamp($this->path); - } - - /** - * Get the file's mimetype. - * - * @return string|false The file mime-type or false on failure. - */ - public function getMimetype() - { - return $this->filesystem->getMimetype($this->path); - } - - /** - * Get the file's visibility. - * - * @return string|false The visibility (public|private) or false on failure. - */ - public function getVisibility() - { - return $this->filesystem->getVisibility($this->path); - } - - /** - * Get the file's metadata. - * - * @return array|false The file metadata or false on failure. - */ - public function getMetadata() - { - return $this->filesystem->getMetadata($this->path); - } - - /** - * Get the file size. - * - * @return int|false The file size or false on failure. - */ - public function getSize() - { - return $this->filesystem->getSize($this->path); - } - - /** - * Delete the file. - * - * @return bool success boolean - */ - public function delete() - { - return $this->filesystem->delete($this->path); - } -} diff --git a/vendor/league/flysystem/src/FileExistsException.php b/vendor/league/flysystem/src/FileExistsException.php deleted file mode 100644 index c82e20c1..00000000 --- a/vendor/league/flysystem/src/FileExistsException.php +++ /dev/null @@ -1,37 +0,0 @@ -path = $path; - - parent::__construct('File already exists at path: ' . $this->getPath(), $code, $previous); - } - - /** - * Get the path which was found. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/vendor/league/flysystem/src/FileNotFoundException.php b/vendor/league/flysystem/src/FileNotFoundException.php deleted file mode 100644 index 989df69b..00000000 --- a/vendor/league/flysystem/src/FileNotFoundException.php +++ /dev/null @@ -1,37 +0,0 @@ -path = $path; - - parent::__construct('File not found at path: ' . $this->getPath(), $code, $previous); - } - - /** - * Get the path which was not found. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/vendor/league/flysystem/src/Filesystem.php b/vendor/league/flysystem/src/Filesystem.php deleted file mode 100644 index 18b590e6..00000000 --- a/vendor/league/flysystem/src/Filesystem.php +++ /dev/null @@ -1,408 +0,0 @@ -adapter = $adapter; - $this->setConfig($config); - } - - /** - * Get the Adapter. - * - * @return AdapterInterface adapter - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * @inheritdoc - */ - public function has($path) - { - $path = Util::normalizePath($path); - - return strlen($path) === 0 ? false : (bool) $this->getAdapter()->has($path); - } - - /** - * @inheritdoc - */ - public function write($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $this->assertAbsent($path); - $config = $this->prepareConfig($config); - - return (bool) $this->getAdapter()->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $this->assertAbsent($path); - $config = $this->prepareConfig($config); - - Util::rewindStream($resource); - - return (bool) $this->getAdapter()->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function put($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - - if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { - return (bool) $this->getAdapter()->update($path, $contents, $config); - } - - return (bool) $this->getAdapter()->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function putStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - Util::rewindStream($resource); - - if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { - return (bool) $this->getAdapter()->updateStream($path, $resource, $config); - } - - return (bool) $this->getAdapter()->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function readAndDelete($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - $contents = $this->read($path); - - if ($contents === false) { - return false; - } - - $this->delete($path); - - return $contents; - } - - /** - * @inheritdoc - */ - public function update($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - - $this->assertPresent($path); - - return (bool) $this->getAdapter()->update($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - $this->assertPresent($path); - Util::rewindStream($resource); - - return (bool) $this->getAdapter()->updateStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function read($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if ( ! ($object = $this->getAdapter()->read($path))) { - return false; - } - - return $object['contents']; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if ( ! $object = $this->getAdapter()->readStream($path)) { - return false; - } - - return $object['stream']; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - $path = Util::normalizePath($path); - $newpath = Util::normalizePath($newpath); - $this->assertPresent($path); - $this->assertAbsent($newpath); - - return (bool) $this->getAdapter()->rename($path, $newpath); - } - - /** - * @inheritdoc - */ - public function copy($path, $newpath) - { - $path = Util::normalizePath($path); - $newpath = Util::normalizePath($newpath); - $this->assertPresent($path); - $this->assertAbsent($newpath); - - return $this->getAdapter()->copy($path, $newpath); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return $this->getAdapter()->delete($path); - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $dirname = Util::normalizePath($dirname); - - if ($dirname === '') { - throw new RootViolationException('Root directories can not be deleted.'); - } - - return (bool) $this->getAdapter()->deleteDir($dirname); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, array $config = []) - { - $dirname = Util::normalizePath($dirname); - $config = $this->prepareConfig($config); - - return (bool) $this->getAdapter()->createDir($dirname, $config); - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - $directory = Util::normalizePath($directory); - $contents = $this->getAdapter()->listContents($directory, $recursive); - - return (new ContentListingFormatter($directory, $recursive, $this->config->get('case_sensitive', true))) - ->formatListing($contents); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getMimetype($path)) || ! array_key_exists('mimetype', $object)) { - return false; - } - - return $object['mimetype']; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getTimestamp($path)) || ! array_key_exists('timestamp', $object)) { - return false; - } - - return $object['timestamp']; - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getVisibility($path)) || ! array_key_exists('visibility', $object)) { - return false; - } - - return $object['visibility']; - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getSize($path)) || ! array_key_exists('size', $object)) { - return false; - } - - return (int) $object['size']; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return (bool) $this->getAdapter()->setVisibility($path, $visibility); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return $this->getAdapter()->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function get($path, Handler $handler = null) - { - $path = Util::normalizePath($path); - - if ( ! $handler) { - $metadata = $this->getMetadata($path); - $handler = $metadata['type'] === 'file' ? new File($this, $path) : new Directory($this, $path); - } - - $handler->setPath($path); - $handler->setFilesystem($this); - - return $handler; - } - - /** - * Assert a file is present. - * - * @param string $path path to file - * - * @throws FileNotFoundException - * - * @return void - */ - public function assertPresent($path) - { - if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) { - throw new FileNotFoundException($path); - } - } - - /** - * Assert a file is absent. - * - * @param string $path path to file - * - * @throws FileExistsException - * - * @return void - */ - public function assertAbsent($path) - { - if ($this->config->get('disable_asserts', false) === false && $this->has($path)) { - throw new FileExistsException($path); - } - } -} diff --git a/vendor/league/flysystem/src/FilesystemInterface.php b/vendor/league/flysystem/src/FilesystemInterface.php deleted file mode 100644 index 09b811b1..00000000 --- a/vendor/league/flysystem/src/FilesystemInterface.php +++ /dev/null @@ -1,284 +0,0 @@ -path = $path; - $this->filesystem = $filesystem; - } - - /** - * Check whether the entree is a directory. - * - * @return bool - */ - public function isDir() - { - return $this->getType() === 'dir'; - } - - /** - * Check whether the entree is a file. - * - * @return bool - */ - public function isFile() - { - return $this->getType() === 'file'; - } - - /** - * Retrieve the entree type (file|dir). - * - * @return string file or dir - */ - public function getType() - { - $metadata = $this->filesystem->getMetadata($this->path); - - return $metadata['type']; - } - - /** - * Set the Filesystem object. - * - * @param FilesystemInterface $filesystem - * - * @return $this - */ - public function setFilesystem(FilesystemInterface $filesystem) - { - $this->filesystem = $filesystem; - - return $this; - } - - /** - * Retrieve the Filesystem object. - * - * @return FilesystemInterface - */ - public function getFilesystem() - { - return $this->filesystem; - } - - /** - * Set the entree path. - * - * @param string $path - * - * @return $this - */ - public function setPath($path) - { - $this->path = $path; - - return $this; - } - - /** - * Retrieve the entree path. - * - * @return string path - */ - public function getPath() - { - return $this->path; - } - - /** - * Plugins pass-through. - * - * @param string $method - * @param array $arguments - * - * @return mixed - */ - public function __call($method, array $arguments) - { - array_unshift($arguments, $this->path); - $callback = [$this->filesystem, $method]; - - try { - return call_user_func_array($callback, $arguments); - } catch (BadMethodCallException $e) { - throw new BadMethodCallException( - 'Call to undefined method ' - . get_called_class() - . '::' . $method - ); - } - } -} diff --git a/vendor/league/flysystem/src/MountManager.php b/vendor/league/flysystem/src/MountManager.php deleted file mode 100644 index 620f540e..00000000 --- a/vendor/league/flysystem/src/MountManager.php +++ /dev/null @@ -1,648 +0,0 @@ - Filesystem,] - * - * @throws InvalidArgumentException - */ - public function __construct(array $filesystems = []) - { - $this->mountFilesystems($filesystems); - } - - /** - * Mount filesystems. - * - * @param FilesystemInterface[] $filesystems [:prefix => Filesystem,] - * - * @throws InvalidArgumentException - * - * @return $this - */ - public function mountFilesystems(array $filesystems) - { - foreach ($filesystems as $prefix => $filesystem) { - $this->mountFilesystem($prefix, $filesystem); - } - - return $this; - } - - /** - * Mount filesystems. - * - * @param string $prefix - * @param FilesystemInterface $filesystem - * - * @throws InvalidArgumentException - * - * @return $this - */ - public function mountFilesystem($prefix, FilesystemInterface $filesystem) - { - if ( ! is_string($prefix)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #1 to be a string.'); - } - - $this->filesystems[$prefix] = $filesystem; - - return $this; - } - - /** - * Get the filesystem with the corresponding prefix. - * - * @param string $prefix - * - * @throws FilesystemNotFoundException - * - * @return FilesystemInterface - */ - public function getFilesystem($prefix) - { - if ( ! isset($this->filesystems[$prefix])) { - throw new FilesystemNotFoundException('No filesystem mounted with prefix ' . $prefix); - } - - return $this->filesystems[$prefix]; - } - - /** - * Retrieve the prefix from an arguments array. - * - * @param array $arguments - * - * @throws InvalidArgumentException - * - * @return array [:prefix, :arguments] - */ - public function filterPrefix(array $arguments) - { - if (empty($arguments)) { - throw new InvalidArgumentException('At least one argument needed'); - } - - $path = array_shift($arguments); - - if ( ! is_string($path)) { - throw new InvalidArgumentException('First argument should be a string'); - } - - list($prefix, $path) = $this->getPrefixAndPath($path); - array_unshift($arguments, $path); - - return [$prefix, $arguments]; - } - - /** - * @param string $directory - * @param bool $recursive - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return array - */ - public function listContents($directory = '', $recursive = false) - { - list($prefix, $directory) = $this->getPrefixAndPath($directory); - $filesystem = $this->getFilesystem($prefix); - $result = $filesystem->listContents($directory, $recursive); - - foreach ($result as &$file) { - $file['filesystem'] = $prefix; - } - - return $result; - } - - /** - * Call forwarder. - * - * @param string $method - * @param array $arguments - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return mixed - */ - public function __call($method, $arguments) - { - list($prefix, $arguments) = $this->filterPrefix($arguments); - - return $this->invokePluginOnFilesystem($method, $arguments, $prefix); - } - - /** - * @param string $from - * @param string $to - * @param array $config - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * @throws FileExistsException - * - * @return bool - */ - public function copy($from, $to, array $config = []) - { - list($prefixFrom, $from) = $this->getPrefixAndPath($from); - - $buffer = $this->getFilesystem($prefixFrom)->readStream($from); - - if ($buffer === false) { - return false; - } - - list($prefixTo, $to) = $this->getPrefixAndPath($to); - - $result = $this->getFilesystem($prefixTo)->writeStream($to, $buffer, $config); - - if (is_resource($buffer)) { - fclose($buffer); - } - - return $result; - } - - /** - * List with plugin adapter. - * - * @param array $keys - * @param string $directory - * @param bool $recursive - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return array - */ - public function listWith(array $keys = [], $directory = '', $recursive = false) - { - list($prefix, $directory) = $this->getPrefixAndPath($directory); - $arguments = [$keys, $directory, $recursive]; - - return $this->invokePluginOnFilesystem('listWith', $arguments, $prefix); - } - - /** - * Move a file. - * - * @param string $from - * @param string $to - * @param array $config - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return bool - */ - public function move($from, $to, array $config = []) - { - list($prefixFrom, $pathFrom) = $this->getPrefixAndPath($from); - list($prefixTo, $pathTo) = $this->getPrefixAndPath($to); - - if ($prefixFrom === $prefixTo) { - $filesystem = $this->getFilesystem($prefixFrom); - $renamed = $filesystem->rename($pathFrom, $pathTo); - - if ($renamed && isset($config['visibility'])) { - return $filesystem->setVisibility($pathTo, $config['visibility']); - } - - return $renamed; - } - - $copied = $this->copy($from, $to, $config); - - if ($copied) { - return $this->delete($from); - } - - return false; - } - - /** - * Invoke a plugin on a filesystem mounted on a given prefix. - * - * @param string $method - * @param array $arguments - * @param string $prefix - * - * @throws FilesystemNotFoundException - * - * @return mixed - */ - public function invokePluginOnFilesystem($method, $arguments, $prefix) - { - $filesystem = $this->getFilesystem($prefix); - - try { - return $this->invokePlugin($method, $arguments, $filesystem); - } catch (PluginNotFoundException $e) { - // Let it pass, it's ok, don't panic. - } - - $callback = [$filesystem, $method]; - - return call_user_func_array($callback, $arguments); - } - - /** - * @param string $path - * - * @throws InvalidArgumentException - * - * @return string[] [:prefix, :path] - */ - protected function getPrefixAndPath($path) - { - if (strpos($path, '://') < 1) { - throw new InvalidArgumentException('No prefix detected in path: ' . $path); - } - - return explode('://', $path, 2); - } - - /** - * Check whether a file exists. - * - * @param string $path - * - * @return bool - */ - public function has($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->has($path); - } - - /** - * Read a file. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file contents or false on failure. - */ - public function read($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->read($path); - } - - /** - * Retrieves a read-stream for a path. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return resource|false The path resource or false on failure. - */ - public function readStream($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->readStream($path); - } - - /** - * Get a file's metadata. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return array|false The file metadata or false on failure. - */ - public function getMetadata($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getMetadata($path); - } - - /** - * Get a file's size. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return int|false The file size or false on failure. - */ - public function getSize($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getSize($path); - } - - /** - * Get a file's mime-type. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file mime-type or false on failure. - */ - public function getMimetype($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getMimetype($path); - } - - /** - * Get a file's timestamp. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The timestamp or false on failure. - */ - public function getTimestamp($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getTimestamp($path); - } - - /** - * Get a file's visibility. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The visibility (public|private) or false on failure. - */ - public function getVisibility($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getVisibility($path); - } - - /** - * Write a new file. - * - * @param string $path The path of the new file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function write($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->write($path, $contents, $config); - } - - /** - * Write a new file using a stream. - * - * @param string $path The path of the new file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException If $resource is not a file handle. - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function writeStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->writeStream($path, $resource, $config); - } - - /** - * Update an existing file. - * - * @param string $path The path of the existing file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function update($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->update($path, $contents, $config); - } - - /** - * Update an existing file using a stream. - * - * @param string $path The path of the existing file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException If $resource is not a file handle. - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function updateStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->updateStream($path, $resource, $config); - } - - /** - * Rename a file. - * - * @param string $path Path to the existing file. - * @param string $newpath The new path of the file. - * - * @throws FileExistsException Thrown if $newpath exists. - * @throws FileNotFoundException Thrown if $path does not exist. - * - * @return bool True on success, false on failure. - */ - public function rename($path, $newpath) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->rename($path, $newpath); - } - - /** - * Delete a file. - * - * @param string $path - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function delete($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->delete($path); - } - - /** - * Delete a directory. - * - * @param string $dirname - * - * @throws RootViolationException Thrown if $dirname is empty. - * - * @return bool True on success, false on failure. - */ - public function deleteDir($dirname) - { - list($prefix, $dirname) = $this->getPrefixAndPath($dirname); - - return $this->getFilesystem($prefix)->deleteDir($dirname); - } - - /** - * Create a directory. - * - * @param string $dirname The name of the new directory. - * @param array $config An optional configuration array. - * - * @return bool True on success, false on failure. - */ - public function createDir($dirname, array $config = []) - { - list($prefix, $dirname) = $this->getPrefixAndPath($dirname); - - return $this->getFilesystem($prefix)->createDir($dirname); - } - - /** - * Set the visibility for a file. - * - * @param string $path The path to the file. - * @param string $visibility One of 'public' or 'private'. - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function setVisibility($path, $visibility) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->setVisibility($path, $visibility); - } - - /** - * Create a file or update if exists. - * - * @param string $path The path to the file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @return bool True on success, false on failure. - */ - public function put($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->put($path, $contents, $config); - } - - /** - * Create a file or update if exists. - * - * @param string $path The path to the file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException Thrown if $resource is not a resource. - * - * @return bool True on success, false on failure. - */ - public function putStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->putStream($path, $resource, $config); - } - - /** - * Read and delete a file. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file contents, or false on failure. - */ - public function readAndDelete($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->readAndDelete($path); - } - - /** - * Get a file/directory handler. - * - * @deprecated - * - * @param string $path The path to the file. - * @param Handler $handler An optional existing handler to populate. - * - * @return Handler Either a file or directory handler. - */ - public function get($path, Handler $handler = null) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->get($path); - } -} diff --git a/vendor/league/flysystem/src/NotSupportedException.php b/vendor/league/flysystem/src/NotSupportedException.php deleted file mode 100644 index 08f47f74..00000000 --- a/vendor/league/flysystem/src/NotSupportedException.php +++ /dev/null @@ -1,37 +0,0 @@ -getPathname()); - } - - /** - * Create a new exception for a link. - * - * @param string $systemType - * - * @return static - */ - public static function forFtpSystemType($systemType) - { - $message = "The FTP system type '$systemType' is currently not supported."; - - return new static($message); - } -} diff --git a/vendor/league/flysystem/src/Plugin/AbstractPlugin.php b/vendor/league/flysystem/src/Plugin/AbstractPlugin.php deleted file mode 100644 index 0d567897..00000000 --- a/vendor/league/flysystem/src/Plugin/AbstractPlugin.php +++ /dev/null @@ -1,24 +0,0 @@ -filesystem = $filesystem; - } -} diff --git a/vendor/league/flysystem/src/Plugin/EmptyDir.php b/vendor/league/flysystem/src/Plugin/EmptyDir.php deleted file mode 100644 index b5ae7f58..00000000 --- a/vendor/league/flysystem/src/Plugin/EmptyDir.php +++ /dev/null @@ -1,34 +0,0 @@ -filesystem->listContents($dirname, false); - - foreach ($listing as $item) { - if ($item['type'] === 'dir') { - $this->filesystem->deleteDir($item['path']); - } else { - $this->filesystem->delete($item['path']); - } - } - } -} diff --git a/vendor/league/flysystem/src/Plugin/ForcedCopy.php b/vendor/league/flysystem/src/Plugin/ForcedCopy.php deleted file mode 100644 index a41e9f3a..00000000 --- a/vendor/league/flysystem/src/Plugin/ForcedCopy.php +++ /dev/null @@ -1,44 +0,0 @@ -filesystem->delete($newpath); - } catch (FileNotFoundException $e) { - // The destination path does not exist. That's ok. - $deleted = true; - } - - if ($deleted) { - return $this->filesystem->copy($path, $newpath); - } - - return false; - } -} diff --git a/vendor/league/flysystem/src/Plugin/ForcedRename.php b/vendor/league/flysystem/src/Plugin/ForcedRename.php deleted file mode 100644 index 3f51cd60..00000000 --- a/vendor/league/flysystem/src/Plugin/ForcedRename.php +++ /dev/null @@ -1,44 +0,0 @@ -filesystem->delete($newpath); - } catch (FileNotFoundException $e) { - // The destination path does not exist. That's ok. - $deleted = true; - } - - if ($deleted) { - return $this->filesystem->rename($path, $newpath); - } - - return false; - } -} diff --git a/vendor/league/flysystem/src/Plugin/GetWithMetadata.php b/vendor/league/flysystem/src/Plugin/GetWithMetadata.php deleted file mode 100644 index 6fe4f056..00000000 --- a/vendor/league/flysystem/src/Plugin/GetWithMetadata.php +++ /dev/null @@ -1,51 +0,0 @@ -filesystem->getMetadata($path); - - if ( ! $object) { - return false; - } - - $keys = array_diff($metadata, array_keys($object)); - - foreach ($keys as $key) { - if ( ! method_exists($this->filesystem, $method = 'get' . ucfirst($key))) { - throw new InvalidArgumentException('Could not fetch metadata: ' . $key); - } - - $object[$key] = $this->filesystem->{$method}($path); - } - - return $object; - } -} diff --git a/vendor/league/flysystem/src/Plugin/ListFiles.php b/vendor/league/flysystem/src/Plugin/ListFiles.php deleted file mode 100644 index 9669fe7e..00000000 --- a/vendor/league/flysystem/src/Plugin/ListFiles.php +++ /dev/null @@ -1,35 +0,0 @@ -filesystem->listContents($directory, $recursive); - - $filter = function ($object) { - return $object['type'] === 'file'; - }; - - return array_values(array_filter($contents, $filter)); - } -} diff --git a/vendor/league/flysystem/src/Plugin/ListPaths.php b/vendor/league/flysystem/src/Plugin/ListPaths.php deleted file mode 100644 index 514bdf0b..00000000 --- a/vendor/league/flysystem/src/Plugin/ListPaths.php +++ /dev/null @@ -1,36 +0,0 @@ -filesystem->listContents($directory, $recursive); - - foreach ($contents as $object) { - $result[] = $object['path']; - } - - return $result; - } -} diff --git a/vendor/league/flysystem/src/Plugin/ListWith.php b/vendor/league/flysystem/src/Plugin/ListWith.php deleted file mode 100644 index d90464e5..00000000 --- a/vendor/league/flysystem/src/Plugin/ListWith.php +++ /dev/null @@ -1,60 +0,0 @@ -filesystem->listContents($directory, $recursive); - - foreach ($contents as $index => $object) { - if ($object['type'] === 'file') { - $missingKeys = array_diff($keys, array_keys($object)); - $contents[$index] = array_reduce($missingKeys, [$this, 'getMetadataByName'], $object); - } - } - - return $contents; - } - - /** - * Get a meta-data value by key name. - * - * @param array $object - * @param string $key - * - * @return array - */ - protected function getMetadataByName(array $object, $key) - { - $method = 'get' . ucfirst($key); - - if ( ! method_exists($this->filesystem, $method)) { - throw new \InvalidArgumentException('Could not get meta-data for key: ' . $key); - } - - $object[$key] = $this->filesystem->{$method}($object['path']); - - return $object; - } -} diff --git a/vendor/league/flysystem/src/Plugin/PluggableTrait.php b/vendor/league/flysystem/src/Plugin/PluggableTrait.php deleted file mode 100644 index 922edfe5..00000000 --- a/vendor/league/flysystem/src/Plugin/PluggableTrait.php +++ /dev/null @@ -1,97 +0,0 @@ -plugins[$plugin->getMethod()] = $plugin; - - return $this; - } - - /** - * Find a specific plugin. - * - * @param string $method - * - * @throws PluginNotFoundException - * - * @return PluginInterface - */ - protected function findPlugin($method) - { - if ( ! isset($this->plugins[$method])) { - throw new PluginNotFoundException('Plugin not found for method: ' . $method); - } - - return $this->plugins[$method]; - } - - /** - * Invoke a plugin by method name. - * - * @param string $method - * @param array $arguments - * @param FilesystemInterface $filesystem - * - * @throws PluginNotFoundException - * - * @return mixed - */ - protected function invokePlugin($method, array $arguments, FilesystemInterface $filesystem) - { - $plugin = $this->findPlugin($method); - $plugin->setFilesystem($filesystem); - $callback = [$plugin, 'handle']; - - return call_user_func_array($callback, $arguments); - } - - /** - * Plugins pass-through. - * - * @param string $method - * @param array $arguments - * - * @throws BadMethodCallException - * - * @return mixed - */ - public function __call($method, array $arguments) - { - try { - return $this->invokePlugin($method, $arguments, $this); - } catch (PluginNotFoundException $e) { - throw new BadMethodCallException( - 'Call to undefined method ' - . get_class($this) - . '::' . $method - ); - } - } -} diff --git a/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php b/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php deleted file mode 100644 index fd1d7e7e..00000000 --- a/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php +++ /dev/null @@ -1,10 +0,0 @@ -hash = spl_object_hash($this); - static::$safeStorage[$this->hash] = []; - } - - public function storeSafely($key, $value) - { - static::$safeStorage[$this->hash][$key] = $value; - } - - public function retrieveSafely($key) - { - if (array_key_exists($key, static::$safeStorage[$this->hash])) { - return static::$safeStorage[$this->hash][$key]; - } - } - - public function __destruct() - { - unset(static::$safeStorage[$this->hash]); - } -} diff --git a/vendor/league/flysystem/src/UnreadableFileException.php b/vendor/league/flysystem/src/UnreadableFileException.php deleted file mode 100644 index e6680338..00000000 --- a/vendor/league/flysystem/src/UnreadableFileException.php +++ /dev/null @@ -1,18 +0,0 @@ -getRealPath() - ) - ); - } -} diff --git a/vendor/league/flysystem/src/Util.php b/vendor/league/flysystem/src/Util.php deleted file mode 100644 index 2c775402..00000000 --- a/vendor/league/flysystem/src/Util.php +++ /dev/null @@ -1,349 +0,0 @@ - '']; - } - - /** - * Normalize a dirname return value. - * - * @param string $dirname - * - * @return string normalized dirname - */ - public static function normalizeDirname($dirname) - { - return $dirname === '.' ? '' : $dirname; - } - - /** - * Get a normalized dirname from a path. - * - * @param string $path - * - * @return string dirname - */ - public static function dirname($path) - { - return static::normalizeDirname(dirname($path)); - } - - /** - * Map result arrays. - * - * @param array $object - * @param array $map - * - * @return array mapped result - */ - public static function map(array $object, array $map) - { - $result = []; - - foreach ($map as $from => $to) { - if ( ! isset($object[$from])) { - continue; - } - - $result[$to] = $object[$from]; - } - - return $result; - } - - /** - * Normalize path. - * - * @param string $path - * - * @throws LogicException - * - * @return string - */ - public static function normalizePath($path) - { - return static::normalizeRelativePath($path); - } - - /** - * Normalize relative directories in a path. - * - * @param string $path - * - * @throws LogicException - * - * @return string - */ - public static function normalizeRelativePath($path) - { - $path = str_replace('\\', '/', $path); - $path = static::removeFunkyWhiteSpace($path); - - $parts = []; - - foreach (explode('/', $path) as $part) { - switch ($part) { - case '': - case '.': - break; - - case '..': - if (empty($parts)) { - throw new LogicException( - 'Path is outside of the defined root, path: [' . $path . ']' - ); - } - array_pop($parts); - break; - - default: - $parts[] = $part; - break; - } - } - - return implode('/', $parts); - } - - /** - * Removes unprintable characters and invalid unicode characters. - * - * @param string $path - * - * @return string $path - */ - protected static function removeFunkyWhiteSpace($path) - { - // We do this check in a loop, since removing invalid unicode characters - // can lead to new characters being created. - while (preg_match('#\p{C}+|^\./#u', $path)) { - $path = preg_replace('#\p{C}+|^\./#u', '', $path); - } - - return $path; - } - - /** - * Normalize prefix. - * - * @param string $prefix - * @param string $separator - * - * @return string normalized path - */ - public static function normalizePrefix($prefix, $separator) - { - return rtrim($prefix, $separator) . $separator; - } - - /** - * Get content size. - * - * @param string $contents - * - * @return int content size - */ - public static function contentSize($contents) - { - return defined('MB_OVERLOAD_STRING') ? mb_strlen($contents, '8bit') : strlen($contents); - } - - /** - * Guess MIME Type based on the path of the file and it's content. - * - * @param string $path - * @param string|resource $content - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function guessMimeType($path, $content) - { - $mimeType = MimeType::detectByContent($content); - - if ( ! (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) { - return $mimeType; - } - - return MimeType::detectByFilename($path); - } - - /** - * Emulate directories. - * - * @param array $listing - * - * @return array listing with emulated directories - */ - public static function emulateDirectories(array $listing) - { - $directories = []; - $listedDirectories = []; - - foreach ($listing as $object) { - list($directories, $listedDirectories) = static::emulateObjectDirectories($object, $directories, $listedDirectories); - } - - $directories = array_diff(array_unique($directories), array_unique($listedDirectories)); - - foreach ($directories as $directory) { - $listing[] = static::pathinfo($directory) + ['type' => 'dir']; - } - - return $listing; - } - - /** - * Ensure a Config instance. - * - * @param null|array|Config $config - * - * @return Config config instance - * - * @throw LogicException - */ - public static function ensureConfig($config) - { - if ($config === null) { - return new Config(); - } - - if ($config instanceof Config) { - return $config; - } - - if (is_array($config)) { - return new Config($config); - } - - throw new LogicException('A config should either be an array or a Flysystem\Config object.'); - } - - /** - * Rewind a stream. - * - * @param resource $resource - */ - public static function rewindStream($resource) - { - if (ftell($resource) !== 0 && static::isSeekableStream($resource)) { - rewind($resource); - } - } - - public static function isSeekableStream($resource) - { - $metadata = stream_get_meta_data($resource); - - return $metadata['seekable']; - } - - /** - * Get the size of a stream. - * - * @param resource $resource - * - * @return int stream size - */ - public static function getStreamSize($resource) - { - $stat = fstat($resource); - - return $stat['size']; - } - - /** - * Emulate the directories of a single object. - * - * @param array $object - * @param array $directories - * @param array $listedDirectories - * - * @return array - */ - protected static function emulateObjectDirectories(array $object, array $directories, array $listedDirectories) - { - if ($object['type'] === 'dir') { - $listedDirectories[] = $object['path']; - } - - if (empty($object['dirname'])) { - return [$directories, $listedDirectories]; - } - - $parent = $object['dirname']; - - while ( ! empty($parent) && ! in_array($parent, $directories)) { - $directories[] = $parent; - $parent = static::dirname($parent); - } - - if (isset($object['type']) && $object['type'] === 'dir') { - $listedDirectories[] = $object['path']; - - return [$directories, $listedDirectories]; - } - - return [$directories, $listedDirectories]; - } - - /** - * Returns the trailing name component of the path. - * - * @param string $path - * - * @return string - */ - private static function basename($path) - { - $separators = DIRECTORY_SEPARATOR === '/' ? '/' : '\/'; - - $path = rtrim($path, $separators); - - $basename = preg_replace('#.*?([^' . preg_quote($separators, '#') . ']+$)#', '$1', $path); - - if (DIRECTORY_SEPARATOR === '/') { - return $basename; - } - // @codeCoverageIgnoreStart - // Extra Windows path munging. This is tested via AppVeyor, but code - // coverage is not reported. - - // Handle relative paths with drive letters. c:file.txt. - while (preg_match('#^[a-zA-Z]{1}:[^\\\/]#', $basename)) { - $basename = substr($basename, 2); - } - - // Remove colon for standalone drive letter names. - if (preg_match('#^[a-zA-Z]{1}:$#', $basename)) { - $basename = rtrim($basename, ':'); - } - - return $basename; - // @codeCoverageIgnoreEnd - } -} diff --git a/vendor/league/flysystem/src/Util/ContentListingFormatter.php b/vendor/league/flysystem/src/Util/ContentListingFormatter.php deleted file mode 100644 index ae0d3b91..00000000 --- a/vendor/league/flysystem/src/Util/ContentListingFormatter.php +++ /dev/null @@ -1,122 +0,0 @@ -directory = rtrim($directory, '/'); - $this->recursive = $recursive; - $this->caseSensitive = $caseSensitive; - } - - /** - * Format contents listing. - * - * @param array $listing - * - * @return array - */ - public function formatListing(array $listing) - { - $listing = array_filter(array_map([$this, 'addPathInfo'], $listing), [$this, 'isEntryOutOfScope']); - - return $this->sortListing(array_values($listing)); - } - - private function addPathInfo(array $entry) - { - return $entry + Util::pathinfo($entry['path']); - } - - /** - * Determine if the entry is out of scope. - * - * @param array $entry - * - * @return bool - */ - private function isEntryOutOfScope(array $entry) - { - if (empty($entry['path']) && $entry['path'] !== '0') { - return false; - } - - if ($this->recursive) { - return $this->residesInDirectory($entry); - } - - return $this->isDirectChild($entry); - } - - /** - * Check if the entry resides within the parent directory. - * - * @param array $entry - * - * @return bool - */ - private function residesInDirectory(array $entry) - { - if ($this->directory === '') { - return true; - } - - return $this->caseSensitive - ? strpos($entry['path'], $this->directory . '/') === 0 - : stripos($entry['path'], $this->directory . '/') === 0; - } - - /** - * Check if the entry is a direct child of the directory. - * - * @param array $entry - * - * @return bool - */ - private function isDirectChild(array $entry) - { - return $this->caseSensitive - ? $entry['dirname'] === $this->directory - : strcasecmp($this->directory, $entry['dirname']) === 0; - } - - /** - * @param array $listing - * - * @return array - */ - private function sortListing(array $listing) - { - usort($listing, function ($a, $b) { - return strcasecmp($a['path'], $b['path']); - }); - - return $listing; - } -} diff --git a/vendor/league/flysystem/src/Util/MimeType.php b/vendor/league/flysystem/src/Util/MimeType.php deleted file mode 100644 index a4bd5e2e..00000000 --- a/vendor/league/flysystem/src/Util/MimeType.php +++ /dev/null @@ -1,245 +0,0 @@ - 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'csv' => 'text/csv', - 'bin' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'class' => 'application/octet-stream', - 'psd' => 'application/x-photoshop', - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/pdf', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'xlt' => 'application/vnd.ms-excel', - 'xla' => 'application/vnd.ms-excel', - 'ppt' => 'application/powerpoint', - 'pot' => 'application/vnd.ms-powerpoint', - 'pps' => 'application/vnd.ms-powerpoint', - 'ppa' => 'application/vnd.ms-powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'rdf' => 'application/rdf+xml', - 'zip' => 'application/x-zip', - 'rar' => 'application/x-rar', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'png' => 'image/png', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'svg' => 'image/svg+xml', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'application/xml', - 'xsl' => 'application/xml', - 'dmn' => 'application/octet-stream', - 'bpmn' => 'application/octet-stream', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dot' => 'application/msword', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', - 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'word' => 'application/msword', - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => 'application/json', - 'pem' => 'application/x-x509-user-cert', - 'p10' => 'application/x-pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => 'application/x-x509-ca-cert', - 'crl' => 'application/pkix-crl', - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => 'application/pkix-cert', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gp', - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => 'video/mp4', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => 'video/x-ms-wmv', - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => 'audio/ogg', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'ics' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => 'application/x-7z-compressed', - 'cdr' => 'application/cdr', - 'wma' => 'audio/x-ms-wma', - 'jar' => 'application/java-archive', - 'tex' => 'application/x-tex', - 'latex' => 'application/x-latex', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - ]; - - /** - * Detects MIME Type based on given content. - * - * @param mixed $content - * - * @return string|null MIME Type or NULL if no mime type detected - */ - public static function detectByContent($content) - { - if ( ! class_exists('finfo') || ! is_string($content)) { - return null; - } - try { - $finfo = new finfo(FILEINFO_MIME_TYPE); - - return $finfo->buffer($content) ?: null; - // @codeCoverageIgnoreStart - } catch (ErrorException $e) { - // This is caused by an array to string conversion error. - } - } // @codeCoverageIgnoreEnd - - /** - * Detects MIME Type based on file extension. - * - * @param string $extension - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function detectByFileExtension($extension) - { - return isset(static::$extensionToMimeTypeMap[$extension]) - ? static::$extensionToMimeTypeMap[$extension] - : 'text/plain'; - } - - /** - * @param string $filename - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function detectByFilename($filename) - { - $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - - return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension); - } - - /** - * @return array Map of file extension to MIME Type - */ - public static function getExtensionToMimeTypeMap() - { - return static::$extensionToMimeTypeMap; - } -} diff --git a/vendor/league/flysystem/src/Util/StreamHasher.php b/vendor/league/flysystem/src/Util/StreamHasher.php deleted file mode 100644 index 938ec5db..00000000 --- a/vendor/league/flysystem/src/Util/StreamHasher.php +++ /dev/null @@ -1,36 +0,0 @@ -algo = $algo; - } - - /** - * @param resource $resource - * - * @return string - */ - public function hash($resource) - { - rewind($resource); - $context = hash_init($this->algo); - hash_update_stream($context, $resource); - fclose($resource); - - return hash_final($context); - } -} diff --git a/vendor/markbaker/complex/README.md b/vendor/markbaker/complex/README.md deleted file mode 100644 index c306394e..00000000 --- a/vendor/markbaker/complex/README.md +++ /dev/null @@ -1,156 +0,0 @@ -PHPComplex -========== - ---- - -PHP Class for handling Complex numbers - -Master: [![Build Status](https://travis-ci.org/MarkBaker/PHPComplex.png?branch=master)](http://travis-ci.org/MarkBaker/PHPComplex) - -Develop: [![Build Status](https://travis-ci.org/MarkBaker/PHPComplex.png?branch=develop)](http://travis-ci.org/MarkBaker/PHPComplex) - -[![Complex Numbers](https://imgs.xkcd.com/comics/complex_numbers_2x.png)](https://xkcd.com/2028/) - ---- - -The library currently provides the following operations: - - - addition - - subtraction - - multiplication - - division - - division by - - division into - -together with functions for - - - theta (polar theta angle) - - rho (polar distance/radius) - - conjugate - * negative - - inverse (1 / complex) - - cos (cosine) - - acos (inverse cosine) - - cosh (hyperbolic cosine) - - acosh (inverse hyperbolic cosine) - - sin (sine) - - asin (inverse sine) - - sinh (hyperbolic sine) - - asinh (inverse hyperbolic sine) - - sec (secant) - - asec (inverse secant) - - sech (hyperbolic secant) - - asech (inverse hyperbolic secant) - - csc (cosecant) - - acsc (inverse cosecant) - - csch (hyperbolic secant) - - acsch (inverse hyperbolic secant) - - tan (tangent) - - atan (inverse tangent) - - tanh (hyperbolic tangent) - - atanh (inverse hyperbolic tangent) - - cot (cotangent) - - acot (inverse cotangent) - - coth (hyperbolic cotangent) - - acoth (inverse hyperbolic cotangent) - - sqrt (square root) - - exp (exponential) - - ln (natural log) - - log10 (base-10 log) - - log2 (base-2 log) - - pow (raised to the power of a real number) - - ---- - -# Usage - -To create a new complex object, you can provide either the real, imaginary and suffix parts as individual values, or as an array of values passed passed to the constructor; or a string representing the value. e.g - -``` -$real = 1.23; -$imaginary = -4.56; -$suffix = 'i'; - -$complexObject = new Complex\Complex($real, $imaginary, $suffix); -``` -or -``` -$real = 1.23; -$imaginary = -4.56; -$suffix = 'i'; - -$arguments = [$real, $imaginary, $suffix]; - -$complexObject = new Complex\Complex($arguments); -``` -or -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -``` - -Complex objects are immutable: whenever you call a method or pass a complex value to a function that returns a complex value, a new Complex object will be returned, and the original will remain unchanged. -This also allows you to chain multiple methods as you would for a fluent interface (as long as they are methods that will return a Complex result). - -## Performing Mathematical Operations - -To perform mathematical operations with Complex values, you can call the appropriate method against a complex value, passing other values as arguments - -``` -$complexString1 = '1.23-4.56i'; -$complexString2 = '2.34+5.67i'; - -$complexObject = new Complex\Complex($complexString1); -echo $complexObject->add($complexString2); -``` -or pass all values to the appropriate function -``` -$complexString1 = '1.23-4.56i'; -$complexString2 = '2.34+5.67i'; - -echo Complex\add($complexString1, $complexString2); -``` -If you want to perform the same operation against multiple values (e.g. to add three or more complex numbers), then you can pass multiple arguments to any of the operations. - -You can pass these arguments as Complex objects, or as an array or string that will parse to a complex object. - -## Using functions - -When calling any of the available functions for a complex value, you can either call the relevant method for the Complex object -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -echo $complexObject->sinh(); -``` -or you can call the function as you would in procedural code, passing the Complex object as an argument -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -echo Complex\sinh($complexObject); -``` -When called procedurally using the function, you can pass in the argument as a Complex object, or as an array or string that will parse to a complex object. -``` -$complexString = '1.23-4.56i'; - -echo Complex\sinh($complexString); -``` - -In the case of the `pow()` function (the only implemented function that requires an additional argument) you need to pass both arguments when calling the function procedurally - -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -echo Complex\pow($complexObject, 2); -``` -or pass the additional argument when calling the method -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -echo $complexObject->pow(2); -``` diff --git a/vendor/markbaker/complex/classes/Autoloader.php b/vendor/markbaker/complex/classes/Autoloader.php deleted file mode 100644 index 792ecef0..00000000 --- a/vendor/markbaker/complex/classes/Autoloader.php +++ /dev/null @@ -1,53 +0,0 @@ -regex = $regex; - parent::__construct($it, $regex); - } -} - -class FilenameFilter extends FilesystemRegexFilter -{ - // Filter files against the regex - public function accept() - { - return (!$this->isFile() || preg_match($this->regex, $this->getFilename())); - } -} - - -$srcFolder = __DIR__ . DIRECTORY_SEPARATOR . 'src'; -$srcDirectory = new RecursiveDirectoryIterator($srcFolder); - -$filteredFileList = new FilenameFilter($srcDirectory, '/(?:php)$/i'); -$filteredFileList = new FilenameFilter($filteredFileList, '/^(?!.*(Complex|Exception)\.php).*$/i'); - -foreach (new RecursiveIteratorIterator($filteredFileList) as $file) { - if ($file->isFile()) { - include_once $file; - } -} diff --git a/vendor/markbaker/complex/classes/src/Complex.php b/vendor/markbaker/complex/classes/src/Complex.php deleted file mode 100644 index 4f873afc..00000000 --- a/vendor/markbaker/complex/classes/src/Complex.php +++ /dev/null @@ -1,390 +0,0 @@ -realPart = (float) $realPart; - $this->imaginaryPart = (float) $imaginaryPart; - $this->suffix = strtolower($suffix); - } - - /** - * Gets the real part of this complex number - * - * @return Float - */ - public function getReal() - { - return $this->realPart; - } - - /** - * Gets the imaginary part of this complex number - * - * @return Float - */ - public function getImaginary() - { - return $this->imaginaryPart; - } - - /** - * Gets the suffix of this complex number - * - * @return String - */ - public function getSuffix() - { - return $this->suffix; - } - - /** - * Returns true if this is a real value, false if a complex value - * - * @return Bool - */ - public function isReal() - { - return $this->imaginaryPart == 0.0; - } - - /** - * Returns true if this is a complex value, false if a real value - * - * @return Bool - */ - public function isComplex() - { - return !$this->isReal(); - } - - public function format() - { - $str = ""; - if ($this->imaginaryPart != 0.0) { - if (\abs($this->imaginaryPart) != 1.0) { - $str .= $this->imaginaryPart . $this->suffix; - } else { - $str .= (($this->imaginaryPart < 0.0) ? '-' : '') . $this->suffix; - } - } - if ($this->realPart != 0.0) { - if (($str) && ($this->imaginaryPart > 0.0)) { - $str = "+" . $str; - } - $str = $this->realPart . $str; - } - if (!$str) { - $str = "0.0"; - } - - return $str; - } - - public function __toString() - { - return $this->format(); - } - - /** - * Validates whether the argument is a valid complex number, converting scalar or array values if possible - * - * @param mixed $complex The value to validate - * @return Complex - * @throws Exception If the argument isn't a Complex number or cannot be converted to one - */ - public static function validateComplexArgument($complex) - { - if (is_scalar($complex) || is_array($complex)) { - $complex = new Complex($complex); - } elseif (!is_object($complex) || !($complex instanceof Complex)) { - throw new Exception('Value is not a valid complex number'); - } - - return $complex; - } - - /** - * Returns the reverse of this complex number - * - * @return Complex - */ - public function reverse() - { - return new Complex( - $this->imaginaryPart, - $this->realPart, - ($this->realPart == 0.0) ? null : $this->suffix - ); - } - - public function invertImaginary() - { - return new Complex( - $this->realPart, - $this->imaginaryPart * -1, - ($this->imaginaryPart == 0.0) ? null : $this->suffix - ); - } - - public function invertReal() - { - return new Complex( - $this->realPart * -1, - $this->imaginaryPart, - ($this->imaginaryPart == 0.0) ? null : $this->suffix - ); - } - - protected static $functions = [ - 'abs', - 'acos', - 'acosh', - 'acot', - 'acoth', - 'acsc', - 'acsch', - 'argument', - 'asec', - 'asech', - 'asin', - 'asinh', - 'atan', - 'atanh', - 'conjugate', - 'cos', - 'cosh', - 'cot', - 'coth', - 'csc', - 'csch', - 'exp', - 'inverse', - 'ln', - 'log2', - 'log10', - 'negative', - 'pow', - 'rho', - 'sec', - 'sech', - 'sin', - 'sinh', - 'sqrt', - 'tan', - 'tanh', - 'theta', - ]; - - protected static $operations = [ - 'add', - 'subtract', - 'multiply', - 'divideby', - 'divideinto', - ]; - - /** - * Returns the result of the function call or operation - * - * @return Complex|float - * @throws Exception|\InvalidArgumentException - */ - public function __call($functionName, $arguments) - { - $functionName = strtolower(str_replace('_', '', $functionName)); - - // Test for function calls - if (in_array($functionName, self::$functions)) { - $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}"; - return $functionName($this, ...$arguments); - } - // Test for operation calls - if (in_array($functionName, self::$operations)) { - $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}"; - return $functionName($this, ...$arguments); - } - throw new Exception('Function or Operation does not exist'); - } -} diff --git a/vendor/markbaker/complex/classes/src/Exception.php b/vendor/markbaker/complex/classes/src/Exception.php deleted file mode 100644 index a2beb732..00000000 --- a/vendor/markbaker/complex/classes/src/Exception.php +++ /dev/null @@ -1,13 +0,0 @@ -getReal() - $invsqrt->getImaginary(), - $complex->getImaginary() + $invsqrt->getReal() - ); - $log = ln($adjust); - - return new Complex( - $log->getImaginary(), - -1 * $log->getReal() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/acosh.php b/vendor/markbaker/complex/classes/src/functions/acosh.php deleted file mode 100644 index 18a992e4..00000000 --- a/vendor/markbaker/complex/classes/src/functions/acosh.php +++ /dev/null @@ -1,34 +0,0 @@ -isReal() && ($complex->getReal() > 1)) { - return new Complex(\acosh($complex->getReal())); - } - - $acosh = acos($complex) - ->reverse(); - if ($acosh->getReal() < 0.0) { - $acosh = $acosh->invertReal(); - } - - return $acosh; -} diff --git a/vendor/markbaker/complex/classes/src/functions/acot.php b/vendor/markbaker/complex/classes/src/functions/acot.php deleted file mode 100644 index 11bee466..00000000 --- a/vendor/markbaker/complex/classes/src/functions/acot.php +++ /dev/null @@ -1,25 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return asin(inverse($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/acsch.php b/vendor/markbaker/complex/classes/src/functions/acsch.php deleted file mode 100644 index bb45d347..00000000 --- a/vendor/markbaker/complex/classes/src/functions/acsch.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return asinh(inverse($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/argument.php b/vendor/markbaker/complex/classes/src/functions/argument.php deleted file mode 100644 index d7209cc4..00000000 --- a/vendor/markbaker/complex/classes/src/functions/argument.php +++ /dev/null @@ -1,28 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return acos(inverse($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/asech.php b/vendor/markbaker/complex/classes/src/functions/asech.php deleted file mode 100644 index b36c40e2..00000000 --- a/vendor/markbaker/complex/classes/src/functions/asech.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return acosh(inverse($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/asin.php b/vendor/markbaker/complex/classes/src/functions/asin.php deleted file mode 100644 index 9c982aca..00000000 --- a/vendor/markbaker/complex/classes/src/functions/asin.php +++ /dev/null @@ -1,37 +0,0 @@ -getReal() - $complex->getImaginary(), - $invsqrt->getImaginary() + $complex->getReal() - ); - $log = ln($adjust); - - return new Complex( - $log->getImaginary(), - -1 * $log->getReal() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/asinh.php b/vendor/markbaker/complex/classes/src/functions/asinh.php deleted file mode 100644 index c1243fd7..00000000 --- a/vendor/markbaker/complex/classes/src/functions/asinh.php +++ /dev/null @@ -1,33 +0,0 @@ -isReal() && ($complex->getReal() > 1)) { - return new Complex(\asinh($complex->getReal())); - } - - $asinh = clone $complex; - $asinh = $asinh->reverse() - ->invertReal(); - $asinh = asin($asinh); - return $asinh->reverse() - ->invertImaginary(); -} diff --git a/vendor/markbaker/complex/classes/src/functions/atan.php b/vendor/markbaker/complex/classes/src/functions/atan.php deleted file mode 100644 index 2c75dcf8..00000000 --- a/vendor/markbaker/complex/classes/src/functions/atan.php +++ /dev/null @@ -1,45 +0,0 @@ -isReal()) { - return new Complex(\atan($complex->getReal())); - } - - $t1Value = new Complex(-1 * $complex->getImaginary(), $complex->getReal()); - $uValue = new Complex(1, 0); - - $d1Value = clone $uValue; - $d1Value = subtract($d1Value, $t1Value); - $d2Value = add($t1Value, $uValue); - $uResult = $d1Value->divideBy($d2Value); - $uResult = ln($uResult); - - return new Complex( - (($uResult->getImaginary() == M_PI) ? -M_PI : $uResult->getImaginary()) * -0.5, - $uResult->getReal() * 0.5, - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/atanh.php b/vendor/markbaker/complex/classes/src/functions/atanh.php deleted file mode 100644 index c53f2a9a..00000000 --- a/vendor/markbaker/complex/classes/src/functions/atanh.php +++ /dev/null @@ -1,38 +0,0 @@ -isReal()) { - $real = $complex->getReal(); - if ($real >= -1.0 && $real <= 1.0) { - return new Complex(\atanh($real)); - } else { - return new Complex(\atanh(1 / $real), (($real < 0.0) ? M_PI_2 : -1 * M_PI_2)); - } - } - - $iComplex = clone $complex; - $iComplex = $iComplex->invertImaginary() - ->reverse(); - return atan($iComplex) - ->invertReal() - ->reverse(); -} diff --git a/vendor/markbaker/complex/classes/src/functions/conjugate.php b/vendor/markbaker/complex/classes/src/functions/conjugate.php deleted file mode 100644 index bd1984b7..00000000 --- a/vendor/markbaker/complex/classes/src/functions/conjugate.php +++ /dev/null @@ -1,28 +0,0 @@ -getReal(), - -1 * $complex->getImaginary(), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/cos.php b/vendor/markbaker/complex/classes/src/functions/cos.php deleted file mode 100644 index 80a4683d..00000000 --- a/vendor/markbaker/complex/classes/src/functions/cos.php +++ /dev/null @@ -1,34 +0,0 @@ -isReal()) { - return new Complex(\cos($complex->getReal())); - } - - return conjugate( - new Complex( - \cos($complex->getReal()) * \cosh($complex->getImaginary()), - \sin($complex->getReal()) * \sinh($complex->getImaginary()), - $complex->getSuffix() - ) - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/cosh.php b/vendor/markbaker/complex/classes/src/functions/cosh.php deleted file mode 100644 index a4bea653..00000000 --- a/vendor/markbaker/complex/classes/src/functions/cosh.php +++ /dev/null @@ -1,32 +0,0 @@ -isReal()) { - return new Complex(\cosh($complex->getReal())); - } - - return new Complex( - \cosh($complex->getReal()) * \cos($complex->getImaginary()), - \sinh($complex->getReal()) * \sin($complex->getImaginary()), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/cot.php b/vendor/markbaker/complex/classes/src/functions/cot.php deleted file mode 100644 index 339101e1..00000000 --- a/vendor/markbaker/complex/classes/src/functions/cot.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return new Complex(INF); - } - - return inverse(tan($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/coth.php b/vendor/markbaker/complex/classes/src/functions/coth.php deleted file mode 100644 index 7fe705a4..00000000 --- a/vendor/markbaker/complex/classes/src/functions/coth.php +++ /dev/null @@ -1,24 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return inverse(sin($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/csch.php b/vendor/markbaker/complex/classes/src/functions/csch.php deleted file mode 100644 index f4500981..00000000 --- a/vendor/markbaker/complex/classes/src/functions/csch.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return inverse(sinh($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/exp.php b/vendor/markbaker/complex/classes/src/functions/exp.php deleted file mode 100644 index 4cac6967..00000000 --- a/vendor/markbaker/complex/classes/src/functions/exp.php +++ /dev/null @@ -1,34 +0,0 @@ -getReal() == 0.0) && (\abs($complex->getImaginary()) == M_PI)) { - return new Complex(-1.0, 0.0); - } - - $rho = \exp($complex->getReal()); - - return new Complex( - $rho * \cos($complex->getImaginary()), - $rho * \sin($complex->getImaginary()), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/inverse.php b/vendor/markbaker/complex/classes/src/functions/inverse.php deleted file mode 100644 index 7d3182ad..00000000 --- a/vendor/markbaker/complex/classes/src/functions/inverse.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - return $complex->divideInto(1.0); -} diff --git a/vendor/markbaker/complex/classes/src/functions/ln.php b/vendor/markbaker/complex/classes/src/functions/ln.php deleted file mode 100644 index 39071cf6..00000000 --- a/vendor/markbaker/complex/classes/src/functions/ln.php +++ /dev/null @@ -1,33 +0,0 @@ -getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { - throw new \InvalidArgumentException(); - } - - return new Complex( - \log(rho($complex)), - theta($complex), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/log10.php b/vendor/markbaker/complex/classes/src/functions/log10.php deleted file mode 100644 index 694d3d08..00000000 --- a/vendor/markbaker/complex/classes/src/functions/log10.php +++ /dev/null @@ -1,32 +0,0 @@ -getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { - throw new \InvalidArgumentException(); - } elseif (($complex->getReal() > 0.0) && ($complex->getImaginary() == 0.0)) { - return new Complex(\log10($complex->getReal()), 0.0, $complex->getSuffix()); - } - - return ln($complex) - ->multiply(\log10(Complex::EULER)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/log2.php b/vendor/markbaker/complex/classes/src/functions/log2.php deleted file mode 100644 index 081f2c49..00000000 --- a/vendor/markbaker/complex/classes/src/functions/log2.php +++ /dev/null @@ -1,32 +0,0 @@ -getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { - throw new \InvalidArgumentException(); - } elseif (($complex->getReal() > 0.0) && ($complex->getImaginary() == 0.0)) { - return new Complex(\log($complex->getReal(), 2), 0.0, $complex->getSuffix()); - } - - return ln($complex) - ->multiply(\log(Complex::EULER, 2)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/negative.php b/vendor/markbaker/complex/classes/src/functions/negative.php deleted file mode 100644 index dbd11922..00000000 --- a/vendor/markbaker/complex/classes/src/functions/negative.php +++ /dev/null @@ -1,31 +0,0 @@ -getReal(), - -1 * $complex->getImaginary(), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/pow.php b/vendor/markbaker/complex/classes/src/functions/pow.php deleted file mode 100644 index 18ee2690..00000000 --- a/vendor/markbaker/complex/classes/src/functions/pow.php +++ /dev/null @@ -1,40 +0,0 @@ -getImaginary() == 0.0 && $complex->getReal() >= 0.0) { - return new Complex(\pow($complex->getReal(), $power)); - } - - $rValue = \sqrt(($complex->getReal() * $complex->getReal()) + ($complex->getImaginary() * $complex->getImaginary())); - $rPower = \pow($rValue, $power); - $theta = $complex->argument() * $power; - if ($theta == 0) { - return new Complex(1); - } - - return new Complex($rPower * \cos($theta), $rPower * \sin($theta), $complex->getSuffix()); -} diff --git a/vendor/markbaker/complex/classes/src/functions/rho.php b/vendor/markbaker/complex/classes/src/functions/rho.php deleted file mode 100644 index 750f3f99..00000000 --- a/vendor/markbaker/complex/classes/src/functions/rho.php +++ /dev/null @@ -1,28 +0,0 @@ -getReal() * $complex->getReal()) + - ($complex->getImaginary() * $complex->getImaginary()) - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/sec.php b/vendor/markbaker/complex/classes/src/functions/sec.php deleted file mode 100644 index 7dd43eaf..00000000 --- a/vendor/markbaker/complex/classes/src/functions/sec.php +++ /dev/null @@ -1,25 +0,0 @@ -isReal()) { - return new Complex(\sin($complex->getReal())); - } - - return new Complex( - \sin($complex->getReal()) * \cosh($complex->getImaginary()), - \cos($complex->getReal()) * \sinh($complex->getImaginary()), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/sinh.php b/vendor/markbaker/complex/classes/src/functions/sinh.php deleted file mode 100644 index 4c0f6503..00000000 --- a/vendor/markbaker/complex/classes/src/functions/sinh.php +++ /dev/null @@ -1,32 +0,0 @@ -isReal()) { - return new Complex(\sinh($complex->getReal())); - } - - return new Complex( - \sinh($complex->getReal()) * \cos($complex->getImaginary()), - \cosh($complex->getReal()) * \sin($complex->getImaginary()), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/sqrt.php b/vendor/markbaker/complex/classes/src/functions/sqrt.php deleted file mode 100644 index 9c171b88..00000000 --- a/vendor/markbaker/complex/classes/src/functions/sqrt.php +++ /dev/null @@ -1,29 +0,0 @@ -getSuffix()); -} diff --git a/vendor/markbaker/complex/classes/src/functions/tan.php b/vendor/markbaker/complex/classes/src/functions/tan.php deleted file mode 100644 index 014d7981..00000000 --- a/vendor/markbaker/complex/classes/src/functions/tan.php +++ /dev/null @@ -1,40 +0,0 @@ -isReal()) { - return new Complex(\tan($complex->getReal())); - } - - $real = $complex->getReal(); - $imaginary = $complex->getImaginary(); - $divisor = 1 + \pow(\tan($real), 2) * \pow(\tanh($imaginary), 2); - if ($divisor == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - return new Complex( - \pow(sech($imaginary)->getReal(), 2) * \tan($real) / $divisor, - \pow(sec($real)->getReal(), 2) * \tanh($imaginary) / $divisor, - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/tanh.php b/vendor/markbaker/complex/classes/src/functions/tanh.php deleted file mode 100644 index 028741d6..00000000 --- a/vendor/markbaker/complex/classes/src/functions/tanh.php +++ /dev/null @@ -1,35 +0,0 @@ -getReal(); - $imaginary = $complex->getImaginary(); - $divisor = \cos($imaginary) * \cos($imaginary) + \sinh($real) * \sinh($real); - if ($divisor == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - return new Complex( - \sinh($real) * \cosh($real) / $divisor, - 0.5 * \sin(2 * $imaginary) / $divisor, - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/theta.php b/vendor/markbaker/complex/classes/src/functions/theta.php deleted file mode 100644 index d12866cd..00000000 --- a/vendor/markbaker/complex/classes/src/functions/theta.php +++ /dev/null @@ -1,38 +0,0 @@ -getReal() == 0.0) { - if ($complex->isReal()) { - return 0.0; - } elseif ($complex->getImaginary() < 0.0) { - return M_PI / -2; - } - return M_PI / 2; - } elseif ($complex->getReal() > 0.0) { - return \atan($complex->getImaginary() / $complex->getReal()); - } elseif ($complex->getImaginary() < 0.0) { - return -(M_PI - \atan(\abs($complex->getImaginary()) / \abs($complex->getReal()))); - } - - return M_PI - \atan($complex->getImaginary() / \abs($complex->getReal())); -} diff --git a/vendor/markbaker/complex/classes/src/operations/add.php b/vendor/markbaker/complex/classes/src/operations/add.php deleted file mode 100644 index 10bd42f4..00000000 --- a/vendor/markbaker/complex/classes/src/operations/add.php +++ /dev/null @@ -1,46 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - - $real = $result->getReal() + $complex->getReal(); - $imaginary = $result->getImaginary() + $complex->getImaginary(); - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/classes/src/operations/divideby.php b/vendor/markbaker/complex/classes/src/operations/divideby.php deleted file mode 100644 index 089e0ef9..00000000 --- a/vendor/markbaker/complex/classes/src/operations/divideby.php +++ /dev/null @@ -1,56 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - $delta1 = ($result->getReal() * $complex->getReal()) + - ($result->getImaginary() * $complex->getImaginary()); - $delta2 = ($result->getImaginary() * $complex->getReal()) - - ($result->getReal() * $complex->getImaginary()); - $delta3 = ($complex->getReal() * $complex->getReal()) + - ($complex->getImaginary() * $complex->getImaginary()); - - $real = $delta1 / $delta3; - $imaginary = $delta2 / $delta3; - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/classes/src/operations/divideinto.php b/vendor/markbaker/complex/classes/src/operations/divideinto.php deleted file mode 100644 index 3dfe085e..00000000 --- a/vendor/markbaker/complex/classes/src/operations/divideinto.php +++ /dev/null @@ -1,56 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - if ($result->getReal() == 0.0 && $result->getImaginary() == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - $delta1 = ($complex->getReal() * $result->getReal()) + - ($complex->getImaginary() * $result->getImaginary()); - $delta2 = ($complex->getImaginary() * $result->getReal()) - - ($complex->getReal() * $result->getImaginary()); - $delta3 = ($result->getReal() * $result->getReal()) + - ($result->getImaginary() * $result->getImaginary()); - - $real = $delta1 / $delta3; - $imaginary = $delta2 / $delta3; - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/classes/src/operations/multiply.php b/vendor/markbaker/complex/classes/src/operations/multiply.php deleted file mode 100644 index bf2473ea..00000000 --- a/vendor/markbaker/complex/classes/src/operations/multiply.php +++ /dev/null @@ -1,48 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - - $real = ($result->getReal() * $complex->getReal()) - - ($result->getImaginary() * $complex->getImaginary()); - $imaginary = ($result->getReal() * $complex->getImaginary()) + - ($result->getImaginary() * $complex->getReal()); - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/classes/src/operations/subtract.php b/vendor/markbaker/complex/classes/src/operations/subtract.php deleted file mode 100644 index 075ef443..00000000 --- a/vendor/markbaker/complex/classes/src/operations/subtract.php +++ /dev/null @@ -1,46 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - - $real = $result->getReal() - $complex->getReal(); - $imaginary = $result->getImaginary() - $complex->getImaginary(); - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/composer.json b/vendor/markbaker/complex/composer.json deleted file mode 100644 index fdf9a08f..00000000 --- a/vendor/markbaker/complex/composer.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "name": "markbaker/complex", - "type": "library", - "description": "PHP Class for working with complex numbers", - "keywords": ["complex", "mathematics"], - "homepage": "https://github.com/MarkBaker/PHPComplex", - "license": "MIT", - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35|^5.4.0", - "phpdocumentor/phpdocumentor":"2.*", - "phpmd/phpmd": "2.*", - "sebastian/phpcpd": "2.*", - "phploc/phploc": "2.*", - "squizlabs/php_codesniffer": "^3.4.0", - "phpcompatibility/php-compatibility": "^9.0", - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0" - }, - "autoload": { - "psr-4": { - "Complex\\": "classes/src/" - }, - "files": [ - "classes/src/functions/abs.php", - "classes/src/functions/acos.php", - "classes/src/functions/acosh.php", - "classes/src/functions/acot.php", - "classes/src/functions/acoth.php", - "classes/src/functions/acsc.php", - "classes/src/functions/acsch.php", - "classes/src/functions/argument.php", - "classes/src/functions/asec.php", - "classes/src/functions/asech.php", - "classes/src/functions/asin.php", - "classes/src/functions/asinh.php", - "classes/src/functions/atan.php", - "classes/src/functions/atanh.php", - "classes/src/functions/conjugate.php", - "classes/src/functions/cos.php", - "classes/src/functions/cosh.php", - "classes/src/functions/cot.php", - "classes/src/functions/coth.php", - "classes/src/functions/csc.php", - "classes/src/functions/csch.php", - "classes/src/functions/exp.php", - "classes/src/functions/inverse.php", - "classes/src/functions/ln.php", - "classes/src/functions/log2.php", - "classes/src/functions/log10.php", - "classes/src/functions/negative.php", - "classes/src/functions/pow.php", - "classes/src/functions/rho.php", - "classes/src/functions/sec.php", - "classes/src/functions/sech.php", - "classes/src/functions/sin.php", - "classes/src/functions/sinh.php", - "classes/src/functions/sqrt.php", - "classes/src/functions/tan.php", - "classes/src/functions/tanh.php", - "classes/src/functions/theta.php", - "classes/src/operations/add.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "scripts": { - "style": [ - "phpcs --report-width=200 --report=summary,full -n" - ], - "mess": [ - "phpmd classes/src/ xml codesize,unusedcode,design,naming -n" - ], - "lines": [ - "phploc classes/src/ -n" - ], - "cpd": [ - "phpcpd classes/src/ -n" - ], - "versions": [ - "phpcs --report-width=200 --report=summary,full classes/src/ --standard=PHPCompatibility --runtime-set testVersion 5.6- -n" - ] - }, - "minimum-stability": "dev" -} \ No newline at end of file diff --git a/vendor/markbaker/complex/examples/complexTest.php b/vendor/markbaker/complex/examples/complexTest.php deleted file mode 100644 index 7dafd8a6..00000000 --- a/vendor/markbaker/complex/examples/complexTest.php +++ /dev/null @@ -1,154 +0,0 @@ -add(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->add(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->add(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->add(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->add(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->add(new Complex(0, -1)); -echo $x, PHP_EOL; - - -echo PHP_EOL, 'Subtract', PHP_EOL; - -$x = new Complex(123); -$x->subtract(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->subtract(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->subtract(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->subtract(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->subtract(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->subtract(new Complex(0, -1)); -echo $x, PHP_EOL; - - -echo PHP_EOL, 'Multiply', PHP_EOL; - -$x = new Complex(123); -$x->multiply(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->multiply(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->multiply(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->multiply(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->multiply(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->multiply(new Complex(0, -1)); -echo $x, PHP_EOL; - - -echo PHP_EOL, 'Divide By', PHP_EOL; - -$x = new Complex(123); -$x->divideBy(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->divideBy(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->divideBy(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->divideBy(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->divideBy(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->divideBy(new Complex(0, -1)); -echo $x, PHP_EOL; - - -echo PHP_EOL, 'Divide Into', PHP_EOL; - -$x = new Complex(123); -$x->divideInto(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->divideInto(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->divideInto(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->divideInto(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->divideInto(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->divideInto(new Complex(0, -1)); -echo $x, PHP_EOL; diff --git a/vendor/markbaker/complex/examples/testFunctions.php b/vendor/markbaker/complex/examples/testFunctions.php deleted file mode 100644 index 4d5ed735..00000000 --- a/vendor/markbaker/complex/examples/testFunctions.php +++ /dev/null @@ -1,52 +0,0 @@ -getMessage(), PHP_EOL; - } - } - echo PHP_EOL; - } -} diff --git a/vendor/markbaker/complex/examples/testOperations.php b/vendor/markbaker/complex/examples/testOperations.php deleted file mode 100644 index f791263e..00000000 --- a/vendor/markbaker/complex/examples/testOperations.php +++ /dev/null @@ -1,34 +0,0 @@ - ', $result, PHP_EOL; - -echo PHP_EOL; - -echo 'Subtraction', PHP_EOL; - -$result = \Complex\subtract(...$values); -echo '=> ', $result, PHP_EOL; - -echo PHP_EOL; - -echo 'Multiplication', PHP_EOL; - -$result = \Complex\multiply(...$values); -echo '=> ', $result, PHP_EOL; diff --git a/vendor/markbaker/complex/license.md b/vendor/markbaker/complex/license.md deleted file mode 100644 index 5b4b1561..00000000 --- a/vendor/markbaker/complex/license.md +++ /dev/null @@ -1,25 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright © `2017` `Mark Baker` - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the “Software”), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/markbaker/matrix/README.md b/vendor/markbaker/matrix/README.md deleted file mode 100644 index 66a1de4d..00000000 --- a/vendor/markbaker/matrix/README.md +++ /dev/null @@ -1,165 +0,0 @@ -PHPMatrix -========== - ---- - -PHP Class for handling Matrices - -Master: [![Build Status](https://travis-ci.org/MarkBaker/PHPMatrix.png?branch=master)](http://travis-ci.org/MarkBaker/PHPMatrix) - -Develop: [![Build Status](https://travis-ci.org/MarkBaker/PHPMatrix.png?branch=develop)](http://travis-ci.org/MarkBaker/PHPMatrix) - -[![Matrix Transform](https://imgs.xkcd.com/comics/matrix_transform.png)](https://xkcd.com/184/) - -Matrix Transform - ---- - -This library currently provides the following operations: - - - addition - - direct sum - - subtraction - - multiplication - - division (using [A].[B]-1) - - division by - - division into - -together with functions for - - - adjoint - - antidiagonal - - cofactors - - determinant - - diagonal - - identity - - inverse - - minors - - trace - - transpose - - -## TO DO - - - power() - - EigenValues - - EigenVectors - - Decomposition - ---- - -# Usage - -To create a new Matrix object, provide an array as the constructor argument - -``` -$grid = [ - [16, 3, 2, 13], - [ 5, 10, 11, 8], - [ 9, 6, 7, 12], - [ 4, 15, 14, 1], -]; - -$matrix = new Matrix\Matrix($grid); -``` -The `Builder` class provides helper methods for creating specific matrices, specifically an identity matrix of a specified size; or a matrix of a specified dimensions, with every cell containing a set value. -``` -$matrix = new Matrix\Builder::createFilledMatrix(1, 5, 3); -``` -Will create a matrix of 5 rows and 3 columns, filled with a `1` in every cell; while -``` -$matrix = new Matrix\Builder::createIdentityMatrix(3); -``` -will create a 3x3 identity matrix. - - -Matrix objects are immutable: whenever you call a method or pass a grid to a function that returns a matrix value, a new Matrix object will be returned, and the original will remain unchanged. This also allows you to chain multiple methods as you would for a fluent interface (as long as they are methods that will return a Matrix result). - -## Performing Mathematical Operations - -To perform mathematical operations with Matrices, you can call the appropriate method against a matrix value, passing other values as arguments - -``` -$matrix1 = new Matrix([ - [2, 7, 6], - [9, 5, 1], - [4, 3, 8], -]); -$matrix2 = new Matrix([ - [1, 2, 3], - [4, 5, 6], - [7, 8, 9], -]); - -echo $matrix1->multiply($matrix2); -``` -or pass all values to the appropriate function -``` -$matrix1 = new Matrix([ - [2, 7, 6], - [9, 5, 1], - [4, 3, 8], -]); -$matrix2 = new Matrix([ - [1, 2, 3], - [4, 5, 6], - [7, 8, 9], -]); - -echo Matrix\multiply($matrix1, $matrix2); -``` -You can pass in the arguments as Matrix objects, or as arrays. - -If you want to perform the same operation against multiple values (e.g. to add three or more matrices), then you can pass multiple arguments to any of the operations. - -## Using functions - -When calling any of the available functions for a matrix value, you can either call the relevant method for the Matrix object -``` -$grid = [ - [16, 3, 2, 13], - [ 5, 10, 11, 8], - [ 9, 6, 7, 12], - [ 4, 15, 14, 1], -]; - -$matrix = new Matrix\Matrix($grid); - -echo $matrix->trace(); -``` -or you can call the function as you would in procedural code, passing the Matrix object as an argument -``` -$grid = [ - [16, 3, 2, 13], - [ 5, 10, 11, 8], - [ 9, 6, 7, 12], - [ 4, 15, 14, 1], -]; - -$matrix = new Matrix\Matrix($grid); -echo Matrix\trace($matrix); -``` -When called procedurally using the function, you can pass in the argument as a Matrix object, or as an array. -``` -$grid = [ - [16, 3, 2, 13], - [ 5, 10, 11, 8], - [ 9, 6, 7, 12], - [ 4, 15, 14, 1], -]; - -echo Matrix\trace($grid); -``` -As an alternative, it is also possible to call the method directly from the `Functions` class. -``` -$grid = [ - [16, 3, 2, 13], - [ 5, 10, 11, 8], - [ 9, 6, 7, 12], - [ 4, 15, 14, 1], -]; - -$matrix = new Matrix\Matrix($grid); -echo Matrix\Functions::trace($matrix); -``` -Used this way, methods must be called statically, and the argument must be the Matrix object, and cannot be an array. diff --git a/vendor/markbaker/matrix/buildPhar.php b/vendor/markbaker/matrix/buildPhar.php deleted file mode 100644 index e1b8f96f..00000000 --- a/vendor/markbaker/matrix/buildPhar.php +++ /dev/null @@ -1,62 +0,0 @@ - 'Mark Baker ', - 'Description' => 'PHP Class for working with Matrix numbers', - 'Copyright' => 'Mark Baker (c) 2013-' . date('Y'), - 'Timestamp' => time(), - 'Version' => '0.1.0', - 'Date' => date('Y-m-d') -); - -// cleanup -if (file_exists($pharName)) { - echo "Removed: {$pharName}\n"; - unlink($pharName); -} - -echo "Building phar file...\n"; - -// the phar object -$phar = new Phar($pharName, null, 'Matrix'); -$phar->buildFromDirectory($sourceDir); -$phar->setStub( -<<<'EOT' -getMessage()); - exit(1); - } - - include 'phar://functions/sqrt.php'; - - __HALT_COMPILER(); -EOT -); -$phar->setMetadata($metaData); -$phar->compressFiles(Phar::GZ); - -echo "Complete.\n"; - -exit(); diff --git a/vendor/markbaker/matrix/classes/Autoloader.php b/vendor/markbaker/matrix/classes/Autoloader.php deleted file mode 100644 index 279d176e..00000000 --- a/vendor/markbaker/matrix/classes/Autoloader.php +++ /dev/null @@ -1,53 +0,0 @@ -regex = $regex; - parent::__construct($it, $regex); - } -} - -class FilenameFilter extends FilesystemRegexFilter -{ - // Filter files against the regex - public function accept() - { - return (!$this->isFile() || preg_match($this->regex, $this->getFilename())); - } -} - - -$srcFolder = __DIR__ . DIRECTORY_SEPARATOR . 'src'; -$srcDirectory = new RecursiveDirectoryIterator($srcFolder); - -$filteredFileList = new FilenameFilter($srcDirectory, '/(?:php)$/i'); -$filteredFileList = new FilenameFilter($filteredFileList, '/^(?!.*(Matrix|Exception)\.php).*$/i'); - -foreach (new RecursiveIteratorIterator($filteredFileList) as $file) { - if ($file->isFile()) { - include_once $file; - } -} diff --git a/vendor/markbaker/matrix/classes/src/Builder.php b/vendor/markbaker/matrix/classes/src/Builder.php deleted file mode 100644 index 6bc334ad..00000000 --- a/vendor/markbaker/matrix/classes/src/Builder.php +++ /dev/null @@ -1,70 +0,0 @@ -toArray(); - - for ($x = 0; $x < $dimensions; ++$x) { - $grid[$x][$x] = 1; - } - - return new Matrix($grid); - } -} diff --git a/vendor/markbaker/matrix/classes/src/Exception.php b/vendor/markbaker/matrix/classes/src/Exception.php deleted file mode 100644 index 55a428ca..00000000 --- a/vendor/markbaker/matrix/classes/src/Exception.php +++ /dev/null @@ -1,13 +0,0 @@ -isSquare()) { - throw new Exception('Adjoint can only be calculated for a square matrix'); - } - - return self::getAdjoint($matrix); - } - - /** - * Calculate the cofactors of the matrix - * - * @param Matrix $matrix The matrix whose cofactors we wish to calculate - * @return Matrix - * - * @throws Exception - */ - private static function getCofactors(Matrix $matrix) - { - $cofactors = self::getMinors($matrix); - $dimensions = $matrix->rows; - - $cof = 1; - for ($i = 0; $i < $dimensions; ++$i) { - $cofs = $cof; - for ($j = 0; $j < $dimensions; ++$j) { - $cofactors[$i][$j] *= $cofs; - $cofs = -$cofs; - } - $cof = -$cof; - } - - return new Matrix($cofactors); - } - - /** - * Return the cofactors of this matrix - * - * @param Matrix $matrix The matrix whose cofactors we wish to calculate - * @return Matrix - * - * @throws Exception - */ - public static function cofactors(Matrix $matrix) - { - if (!$matrix->isSquare()) { - throw new Exception('Cofactors can only be calculated for a square matrix'); - } - - return self::getCofactors($matrix); - } - - /** - * @param Matrix $matrix - * @param int $row - * @param int $column - * @return float - * @throws Exception - */ - private static function getDeterminantSegment(Matrix $matrix, $row, $column) - { - $tmpMatrix = $matrix->toArray(); - unset($tmpMatrix[$row]); - array_walk( - $tmpMatrix, - function (&$row) use ($column) { - unset($row[$column]); - } - ); - - return self::getDeterminant(new Matrix($tmpMatrix)); - } - - /** - * Calculate the determinant of the matrix - * - * @param Matrix $matrix The matrix whose determinant we wish to calculate - * @return float - * - * @throws Exception - */ - private static function getDeterminant(Matrix $matrix) - { - $dimensions = $matrix->rows; - $determinant = 0; - - switch ($dimensions) { - case 1: - $determinant = $matrix->getValue(1, 1); - break; - case 2: - $determinant = $matrix->getValue(1, 1) * $matrix->getValue(2, 2) - - $matrix->getValue(1, 2) * $matrix->getValue(2, 1); - break; - default: - for ($i = 1; $i <= $dimensions; ++$i) { - $det = $matrix->getValue(1, $i) * self::getDeterminantSegment($matrix, 0, $i - 1); - if (($i % 2) == 0) { - $determinant -= $det; - } else { - $determinant += $det; - } - } - break; - } - - return $determinant; - } - - /** - * Return the determinant of this matrix - * - * @param Matrix $matrix The matrix whose determinant we wish to calculate - * @return float - * @throws Exception - **/ - public static function determinant(Matrix $matrix) - { - if (!$matrix->isSquare()) { - throw new Exception('Determinant can only be calculated for a square matrix'); - } - - return self::getDeterminant($matrix); - } - - /** - * Return the diagonal of this matrix - * - * @param Matrix $matrix The matrix whose diagonal we wish to calculate - * @return Matrix - * @throws Exception - **/ - public static function diagonal(Matrix $matrix) - { - if (!$matrix->isSquare()) { - throw new Exception('Diagonal can only be extracted from a square matrix'); - } - - $dimensions = $matrix->rows; - $grid = Builder::createFilledMatrix(0, $dimensions, $dimensions) - ->toArray(); - - for ($i = 0; $i < $dimensions; ++$i) { - $grid[$i][$i] = $matrix->getValue($i + 1, $i + 1); - } - - return new Matrix($grid); - } - - /** - * Return the antidiagonal of this matrix - * - * @param Matrix $matrix The matrix whose antidiagonal we wish to calculate - * @return Matrix - * @throws Exception - **/ - public static function antidiagonal(Matrix $matrix) - { - if (!$matrix->isSquare()) { - throw new Exception('Anti-Diagonal can only be extracted from a square matrix'); - } - - $dimensions = $matrix->rows; - $grid = Builder::createFilledMatrix(0, $dimensions, $dimensions) - ->toArray(); - - for ($i = 0; $i < $dimensions; ++$i) { - $grid[$i][$dimensions - $i - 1] = $matrix->getValue($i + 1, $dimensions - $i); - } - - return new Matrix($grid); - } - - /** - * Return the identity matrix - * The identity matrix, or sometimes ambiguously called a unit matrix, of size n is the n × n square matrix - * with ones on the main diagonal and zeros elsewhere - * - * @param Matrix $matrix The matrix whose identity we wish to calculate - * @return Matrix - * @throws Exception - **/ - public static function identity(Matrix $matrix) - { - if (!$matrix->isSquare()) { - throw new Exception('Identity can only be created for a square matrix'); - } - - $dimensions = $matrix->rows; - - return Builder::createIdentityMatrix($dimensions); - } - - /** - * Return the inverse of this matrix - * - * @param Matrix $matrix The matrix whose inverse we wish to calculate - * @return Matrix - * @throws Exception - **/ - public static function inverse(Matrix $matrix) - { - if (!$matrix->isSquare()) { - throw new Exception('Inverse can only be calculated for a square matrix'); - } - - $determinant = self::getDeterminant($matrix); - if ($determinant == 0.0) { - throw new Exception('Inverse can only be calculated for a matrix with a non-zero determinant'); - } - - if ($matrix->rows == 1) { - return new Matrix([[1 / $matrix->getValue(1, 1)]]); - } - - return self::getAdjoint($matrix) - ->multiply(1 / $determinant); - } - - /** - * Calculate the minors of the matrix - * - * @param Matrix $matrix The matrix whose minors we wish to calculate - * @return array[] - * - * @throws Exception - */ - protected static function getMinors(Matrix $matrix) - { - $minors = $matrix->toArray(); - $dimensions = $matrix->rows; - if ($dimensions == 1) { - return $minors; - } - - for ($i = 0; $i < $dimensions; ++$i) { - for ($j = 0; $j < $dimensions; ++$j) { - $minors[$i][$j] = self::getDeterminantSegment($matrix, $i, $j); - } - } - - return $minors; - } - - /** - * Return the minors of the matrix - * The minor of a matrix A is the determinant of some smaller square matrix, cut down from A by removing one or - * more of its rows or columns. - * Minors obtained by removing just one row and one column from square matrices (first minors) are required for - * calculating matrix cofactors, which in turn are useful for computing both the determinant and inverse of - * square matrices. - * - * @param Matrix $matrix The matrix whose minors we wish to calculate - * @return Matrix - * @throws Exception - **/ - public static function minors(Matrix $matrix) - { - if (!$matrix->isSquare()) { - throw new Exception('Minors can only be calculated for a square matrix'); - } - - return new Matrix(self::getMinors($matrix)); - } - - /** - * Return the trace of this matrix - * The trace is defined as the sum of the elements on the main diagonal (the diagonal from the upper left to the lower right) - * of the matrix - * - * @param Matrix $matrix The matrix whose trace we wish to calculate - * @return float - * @throws Exception - **/ - public static function trace(Matrix $matrix) - { - if (!$matrix->isSquare()) { - throw new Exception('Trace can only be extracted from a square matrix'); - } - - $dimensions = $matrix->rows; - $result = 0; - for ($i = 1; $i <= $dimensions; ++$i) { - $result += $matrix->getValue($i, $i); - } - - return $result; - } - - /** - * Return the transpose of this matrix - * - * @param Matrix $matrix The matrix whose transpose we wish to calculate - * @return Matrix - **/ - public static function transpose(Matrix $matrix) - { - $array = array_values(array_merge([null], $matrix->toArray())); - $grid = call_user_func_array( - 'array_map', - $array - ); - - return new Matrix($grid); - } -} diff --git a/vendor/markbaker/matrix/classes/src/Matrix.php b/vendor/markbaker/matrix/classes/src/Matrix.php deleted file mode 100644 index a4f04951..00000000 --- a/vendor/markbaker/matrix/classes/src/Matrix.php +++ /dev/null @@ -1,400 +0,0 @@ -buildFromArray(array_values($grid)); - } - - /* - * Create a new Matrix object from an array of values - * - * @param array $grid - */ - protected function buildFromArray(array $grid) - { - $this->rows = count($grid); - $columns = array_reduce( - $grid, - function ($carry, $value) { - return max($carry, is_array($value) ? count($value) : 1); - } - ); - $this->columns = $columns; - - array_walk( - $grid, - function (&$value) use ($columns) { - if (!is_array($value)) { - $value = [$value]; - } - $value = array_pad(array_values($value), $columns, null); - } - ); - - $this->grid = $grid; - } - - /** - * Validate that a row number is a positive integer - * - * @param int $row - * @return int - * @throws Exception - */ - public static function validateRow($row) - { - if ((!is_numeric($row)) || (intval($row) < 1)) { - throw new Exception('Invalid Row'); - } - - return (int)$row; - } - - /** - * Validate that a column number is a positive integer - * - * @param int $column - * @return int - * @throws Exception - */ - public static function validateColumn($column) - { - if ((!is_numeric($column)) || (intval($column) < 1)) { - throw new Exception('Invalid Column'); - } - - return (int)$column; - } - - /** - * Validate that a row number falls within the set of rows for this matrix - * - * @param int $row - * @return int - * @throws Exception - */ - protected function validateRowInRange($row) - { - $row = static::validateRow($row); - if ($row > $this->rows) { - throw new Exception('Requested Row exceeds matrix size'); - } - - return $row; - } - - /** - * Validate that a column number falls within the set of columns for this matrix - * - * @param int $column - * @return int - * @throws Exception - */ - protected function validateColumnInRange($column) - { - $column = static::validateColumn($column); - if ($column > $this->columns) { - throw new Exception('Requested Column exceeds matrix size'); - } - - return $column; - } - - /** - * Return a new matrix as a subset of rows from this matrix, starting at row number $row, and $rowCount rows - * A $rowCount value of 0 will return all rows of the matrix from $row - * A negative $rowCount value will return rows until that many rows from the end of the matrix - * - * Note that row numbers start from 1, not from 0 - * - * @param int $row - * @param int $rowCount - * @return static - * @throws Exception - */ - public function getRows($row, $rowCount = 1) - { - $row = $this->validateRowInRange($row); - if ($rowCount === 0) { - $rowCount = $this->rows - $row + 1; - } - - return new static(array_slice($this->grid, $row - 1, (int)$rowCount)); - } - - /** - * Return a new matrix as a subset of columns from this matrix, starting at column number $column, and $columnCount columns - * A $columnCount value of 0 will return all columns of the matrix from $column - * A negative $columnCount value will return columns until that many columns from the end of the matrix - * - * Note that column numbers start from 1, not from 0 - * - * @param int $column - * @param int $columnCount - * @return Matrix - * @throws Exception - */ - public function getColumns($column, $columnCount = 1) - { - $column = $this->validateColumnInRange($column); - if ($columnCount < 1) { - $columnCount = $this->columns + $columnCount - $column + 1; - } - - $grid = []; - for ($i = $column - 1; $i < $column + $columnCount - 1; ++$i) { - $grid[] = array_column($this->grid, $i); - } - - return (new static($grid))->transpose(); - } - - /** - * Return a new matrix as a subset of rows from this matrix, dropping rows starting at row number $row, - * and $rowCount rows - * A negative $rowCount value will drop rows until that many rows from the end of the matrix - * A $rowCount value of 0 will remove all rows of the matrix from $row - * - * Note that row numbers start from 1, not from 0 - * - * @param int $row - * @param int $rowCount - * @return static - * @throws Exception - */ - public function dropRows($row, $rowCount = 1) - { - $this->validateRowInRange($row); - if ($rowCount === 0) { - $rowCount = $this->rows - $row + 1; - } - - $grid = $this->grid; - array_splice($grid, $row - 1, (int)$rowCount); - - return new static($grid); - } - - /** - * Return a new matrix as a subset of columns from this matrix, dropping columns starting at column number $column, - * and $columnCount columns - * A negative $columnCount value will drop columns until that many columns from the end of the matrix - * A $columnCount value of 0 will remove all columns of the matrix from $column - * - * Note that column numbers start from 1, not from 0 - * - * @param int $column - * @param int $columnCount - * @return static - * @throws Exception - */ - public function dropColumns($column, $columnCount = 1) - { - $this->validateColumnInRange($column); - if ($columnCount < 1) { - $columnCount = $this->columns + $columnCount - $column + 1; - } - - $grid = $this->grid; - array_walk( - $grid, - function (&$row) use ($column, $columnCount) { - array_splice($row, $column - 1, (int)$columnCount); - } - ); - - return new static($grid); - } - - /** - * Return a value from this matrix, from the "cell" identified by the row and column numbers - * Note that row and column numbers start from 1, not from 0 - * - * @param int $row - * @param int $column - * @return mixed - * @throws Exception - */ - public function getValue($row, $column) - { - $row = $this->validateRowInRange($row); - $column = $this->validateColumnInRange($column); - - return $this->grid[$row - 1][$column - 1]; - } - - /** - * Returns a Generator that will yield each row of the matrix in turn as a vector matrix - * or the value of each cell if the matrix is a vector - * - * @return \Generator|Matrix[]|mixed[] - */ - public function rows() - { - foreach ($this->grid as $i => $row) { - yield $i + 1 => ($this->columns == 1) - ? $row[0] - : new static([$row]); - } - } - - /** - * Returns a Generator that will yield each column of the matrix in turn as a vector matrix - * or the value of each cell if the matrix is a vector - * - * @return \Generator|Matrix[]|mixed[] - */ - public function columns() - { - for ($i = 0; $i < $this->columns; ++$i) { - yield $i + 1 => ($this->rows == 1) - ? $this->grid[0][$i] - : new static(array_column($this->grid, $i)); - } - } - - /** - * Identify if the row and column dimensions of this matrix are equal, - * i.e. if it is a "square" matrix - * - * @return bool - */ - public function isSquare() - { - return $this->rows == $this->columns; - } - - /** - * Identify if this matrix is a vector - * i.e. if it comprises only a single row or a single column - * - * @return bool - */ - public function isVector() - { - return $this->rows == 1 || $this->columns == 1; - } - - /** - * Return the matrix as a 2-dimensional array - * - * @return array - */ - public function toArray() - { - return $this->grid; - } - - protected static $getters = [ - 'rows', - 'columns', - ]; - - /** - * Access specific properties as read-only (no setters) - * - * @param string $propertyName - * @return mixed - * @throws Exception - */ - public function __get($propertyName) - { - $propertyName = strtolower($propertyName); - - // Test for function calls - if (in_array($propertyName, self::$getters)) { - return $this->$propertyName; - } - - throw new Exception('Property does not exist'); - } - - protected static $functions = [ - 'antidiagonal', - 'adjoint', - 'cofactors', - 'determinant', - 'diagonal', - 'identity', - 'inverse', - 'minors', - 'trace', - 'transpose', - ]; - - protected static $operations = [ - 'add', - 'subtract', - 'multiply', - 'divideby', - 'divideinto', - 'directsum', - ]; - - /** - * Returns the result of the function call or operation - * - * @param string $functionName - * @param mixed[] $arguments - * @return Matrix|float - * @throws Exception - */ - public function __call($functionName, $arguments) - { - $functionName = strtolower(str_replace('_', '', $functionName)); - - if (in_array($functionName, self::$functions) || in_array($functionName, self::$operations)) { - $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}"; - if (is_callable($functionName)) { - $arguments = array_values(array_merge([$this], $arguments)); - return call_user_func_array($functionName, $arguments); - } - } - throw new Exception('Function or Operation does not exist'); - } -} diff --git a/vendor/markbaker/matrix/classes/src/Operators/Addition.php b/vendor/markbaker/matrix/classes/src/Operators/Addition.php deleted file mode 100644 index e78c6d7d..00000000 --- a/vendor/markbaker/matrix/classes/src/Operators/Addition.php +++ /dev/null @@ -1,68 +0,0 @@ -addMatrix($value); - } elseif (is_numeric($value)) { - return $this->addScalar($value); - } - - throw new Exception('Invalid argument for addition'); - } - - /** - * Execute the addition for a scalar - * - * @param mixed $value The numeric value to add to the current base value - * @return $this The operation object, allowing multiple additions to be chained - **/ - protected function addScalar($value) - { - for ($row = 0; $row < $this->rows; ++$row) { - for ($column = 0; $column < $this->columns; ++$column) { - $this->matrix[$row][$column] += $value; - } - } - - return $this; - } - - /** - * Execute the addition for a matrix - * - * @param Matrix $value The numeric value to add to the current base value - * @return $this The operation object, allowing multiple additions to be chained - * @throws Exception If the provided argument is not appropriate for the operation - **/ - protected function addMatrix(Matrix $value) - { - $this->validateMatchingDimensions($value); - - for ($row = 0; $row < $this->rows; ++$row) { - for ($column = 0; $column < $this->columns; ++$column) { - $this->matrix[$row][$column] += $value->getValue($row + 1, $column + 1); - } - } - - return $this; - } -} diff --git a/vendor/markbaker/matrix/classes/src/Operators/DirectSum.php b/vendor/markbaker/matrix/classes/src/Operators/DirectSum.php deleted file mode 100644 index 6db0853b..00000000 --- a/vendor/markbaker/matrix/classes/src/Operators/DirectSum.php +++ /dev/null @@ -1,64 +0,0 @@ -directSumMatrix($value); - } - - throw new Exception('Invalid argument for addition'); - } - - /** - * Execute the direct sum for a matrix - * - * @param Matrix $value The numeric value to concatenate/direct sum with the current base value - * @return $this The operation object, allowing multiple additions to be chained - **/ - private function directSumMatrix($value) - { - $originalColumnCount = count($this->matrix[0]); - $originalRowCount = count($this->matrix); - $valColumnCount = $value->columns; - $valRowCount = $value->rows; - $value = $value->toArray(); - - for ($row = 0; $row < $this->rows; ++$row) { - $this->matrix[$row] = array_merge($this->matrix[$row], array_fill(0, $valColumnCount, 0)); - } - - $this->matrix = array_merge( - $this->matrix, - array_fill(0, $valRowCount, array_fill(0, $originalColumnCount, 0)) - ); - - for ($row = $originalRowCount; $row < $originalRowCount + $valRowCount; ++$row) { - array_splice( - $this->matrix[$row], - $originalColumnCount, - $valColumnCount, - $value[$row - $originalRowCount] - ); - } - - return $this; - } -} diff --git a/vendor/markbaker/matrix/classes/src/Operators/Division.php b/vendor/markbaker/matrix/classes/src/Operators/Division.php deleted file mode 100644 index 2a573f55..00000000 --- a/vendor/markbaker/matrix/classes/src/Operators/Division.php +++ /dev/null @@ -1,38 +0,0 @@ -multiplyMatrix($value); - } elseif (is_numeric($value)) { - return $this->multiplyScalar(1 / $value); - } - - throw new Exception('Invalid argument for division'); - } -} diff --git a/vendor/markbaker/matrix/classes/src/Operators/Multiplication.php b/vendor/markbaker/matrix/classes/src/Operators/Multiplication.php deleted file mode 100644 index 63df162d..00000000 --- a/vendor/markbaker/matrix/classes/src/Operators/Multiplication.php +++ /dev/null @@ -1,77 +0,0 @@ -multiplyMatrix($value); - } elseif (is_numeric($value)) { - return $this->multiplyScalar($value); - } - - throw new Exception('Invalid argument for multiplication'); - } - - /** - * Execute the multiplication for a scalar - * - * @param mixed $value The numeric value to multiply with the current base value - * @return $this The operation object, allowing multiple mutiplications to be chained - **/ - protected function multiplyScalar($value) - { - for ($row = 0; $row < $this->rows; ++$row) { - for ($column = 0; $column < $this->columns; ++$column) { - $this->matrix[$row][$column] *= $value; - } - } - - return $this; - } - - /** - * Execute the multiplication for a matrix - * - * @param Matrix $value The numeric value to multiply with the current base value - * @return $this The operation object, allowing multiple mutiplications to be chained - * @throws Exception If the provided argument is not appropriate for the operation - **/ - protected function multiplyMatrix(Matrix $value) - { - $this->validateReflectingDimensions($value); - - $newRows = $this->rows; - $newColumns = $value->columns; - $matrix = Builder::createFilledMatrix(0, $newRows, $newColumns) - ->toArray(); - for ($row = 0; $row < $newRows; ++$row) { - for ($column = 0; $column < $newColumns; ++$column) { - $columnData = $value->getColumns($column + 1)->toArray(); - foreach ($this->matrix[$row] as $key => $valueData) { - $matrix[$row][$column] += $valueData * $columnData[$key][0]; - } - } - } - $this->matrix = $matrix; - - return $this; - } -} diff --git a/vendor/markbaker/matrix/classes/src/Operators/Operator.php b/vendor/markbaker/matrix/classes/src/Operators/Operator.php deleted file mode 100644 index 87d3f3b5..00000000 --- a/vendor/markbaker/matrix/classes/src/Operators/Operator.php +++ /dev/null @@ -1,78 +0,0 @@ -rows = $matrix->rows; - $this->columns = $matrix->columns; - $this->matrix = $matrix->toArray(); - } - - /** - * Compare the dimensions of the matrices being operated on to see if they are valid for addition/subtraction - * - * @param Matrix $matrix The second Matrix object on which the operation will be performed - * @throws Exception - */ - protected function validateMatchingDimensions(Matrix $matrix) - { - if (($this->rows != $matrix->rows) || ($this->columns != $matrix->columns)) { - throw new Exception('Matrices have mismatched dimensions'); - } - } - - /** - * Compare the dimensions of the matrices being operated on to see if they are valid for multiplication/division - * - * @param Matrix $matrix The second Matrix object on which the operation will be performed - * @throws Exception - */ - protected function validateReflectingDimensions(Matrix $matrix) - { - if ($this->columns != $matrix->rows) { - throw new Exception('Matrices have mismatched dimensions'); - } - } - - /** - * Return the result of the operation - * - * @return Matrix - */ - public function result() - { - return new Matrix($this->matrix); - } -} diff --git a/vendor/markbaker/matrix/classes/src/Operators/Subtraction.php b/vendor/markbaker/matrix/classes/src/Operators/Subtraction.php deleted file mode 100644 index 57c0b147..00000000 --- a/vendor/markbaker/matrix/classes/src/Operators/Subtraction.php +++ /dev/null @@ -1,68 +0,0 @@ -subtractMatrix($value); - } elseif (is_numeric($value)) { - return $this->subtractScalar($value); - } - - throw new Exception('Invalid argument for subtraction'); - } - - /** - * Execute the subtraction for a scalar - * - * @param mixed $value The numeric value to subtracted from the current base value - * @return $this The operation object, allowing multiple additions to be chained - **/ - protected function subtractScalar($value) - { - for ($row = 0; $row < $this->rows; ++$row) { - for ($column = 0; $column < $this->columns; ++$column) { - $this->matrix[$row][$column] -= $value; - } - } - - return $this; - } - - /** - * Execute the subtraction for a matrix - * - * @param Matrix $value The numeric value to subtract from the current base value - * @return $this The operation object, allowing multiple subtractions to be chained - * @throws Exception If the provided argument is not appropriate for the operation - **/ - protected function subtractMatrix(Matrix $value) - { - $this->validateMatchingDimensions($value); - - for ($row = 0; $row < $this->rows; ++$row) { - for ($column = 0; $column < $this->columns; ++$column) { - $this->matrix[$row][$column] -= $value->getValue($row + 1, $column + 1); - } - } - - return $this; - } -} diff --git a/vendor/markbaker/matrix/classes/src/functions/adjoint.php b/vendor/markbaker/matrix/classes/src/functions/adjoint.php deleted file mode 100644 index fc1e1699..00000000 --- a/vendor/markbaker/matrix/classes/src/functions/adjoint.php +++ /dev/null @@ -1,30 +0,0 @@ - $matrixValues The matrices to add - * @return Matrix - * @throws Exception - */ -function add(...$matrixValues) -{ - if (count($matrixValues) < 2) { - throw new Exception('Addition operation requires at least 2 arguments'); - } - - $matrix = array_shift($matrixValues); - - if (is_array($matrix)) { - $matrix = new Matrix($matrix); - } - if (!$matrix instanceof Matrix) { - throw new Exception('Addition arguments must be Matrix or array'); - } - - $result = new Addition($matrix); - - foreach ($matrixValues as $matrix) { - $result->execute($matrix); - } - - return $result->result(); -} diff --git a/vendor/markbaker/matrix/classes/src/operations/directsum.php b/vendor/markbaker/matrix/classes/src/operations/directsum.php deleted file mode 100644 index 9d15b89b..00000000 --- a/vendor/markbaker/matrix/classes/src/operations/directsum.php +++ /dev/null @@ -1,44 +0,0 @@ - $matrixValues The matrices to add - * @return Matrix - * @throws Exception - */ -function directsum(...$matrixValues) -{ - if (count($matrixValues) < 2) { - throw new Exception('DirectSum operation requires at least 2 arguments'); - } - - $matrix = array_shift($matrixValues); - - if (is_array($matrix)) { - $matrix = new Matrix($matrix); - } - if (!$matrix instanceof Matrix) { - throw new Exception('DirectSum arguments must be Matrix or array'); - } - - $result = new DirectSum($matrix); - - foreach ($matrixValues as $matrix) { - $result->execute($matrix); - } - - return $result->result(); -} diff --git a/vendor/markbaker/matrix/classes/src/operations/divideby.php b/vendor/markbaker/matrix/classes/src/operations/divideby.php deleted file mode 100644 index 767d03a5..00000000 --- a/vendor/markbaker/matrix/classes/src/operations/divideby.php +++ /dev/null @@ -1,44 +0,0 @@ - $matrixValues The matrices to divide - * @return Matrix - * @throws Exception - */ -function divideby(...$matrixValues) -{ - if (count($matrixValues) < 2) { - throw new Exception('Division operation requires at least 2 arguments'); - } - - $matrix = array_shift($matrixValues); - - if (is_array($matrix)) { - $matrix = new Matrix($matrix); - } - if (!$matrix instanceof Matrix) { - throw new Exception('Division arguments must be Matrix or array'); - } - - $result = new Division($matrix); - - foreach ($matrixValues as $matrix) { - $result->execute($matrix); - } - - return $result->result(); -} diff --git a/vendor/markbaker/matrix/classes/src/operations/divideinto.php b/vendor/markbaker/matrix/classes/src/operations/divideinto.php deleted file mode 100644 index f5cb8dca..00000000 --- a/vendor/markbaker/matrix/classes/src/operations/divideinto.php +++ /dev/null @@ -1,44 +0,0 @@ - $matrixValues The numbers to divide - * @return Matrix - * @throws Exception - */ -function divideinto(...$matrixValues) -{ - if (count($matrixValues) < 2) { - throw new Exception('Division operation requires at least 2 arguments'); - } - - $matrix = array_shift($matrixValues); - - if (is_array($matrix)) { - $matrix = new Matrix($matrix); - } - if (!$matrix instanceof Matrix) { - throw new Exception('Division arguments must be Matrix or array'); - } - - $result = new Division($matrix); - - foreach ($matrixValues as $matrix) { - $result->execute($matrix); - } - - return $result->result(); -} diff --git a/vendor/markbaker/matrix/classes/src/operations/multiply.php b/vendor/markbaker/matrix/classes/src/operations/multiply.php deleted file mode 100644 index 1428f091..00000000 --- a/vendor/markbaker/matrix/classes/src/operations/multiply.php +++ /dev/null @@ -1,44 +0,0 @@ - $matrixValues The matrices to multiply - * @return Matrix - * @throws Exception - */ -function multiply(...$matrixValues) -{ - if (count($matrixValues) < 2) { - throw new Exception('Multiplication operation requires at least 2 arguments'); - } - - $matrix = array_shift($matrixValues); - - if (is_array($matrix)) { - $matrix = new Matrix($matrix); - } - if (!$matrix instanceof Matrix) { - throw new Exception('Multiplication arguments must be Matrix or array'); - } - - $result = new Multiplication($matrix); - - foreach ($matrixValues as $matrix) { - $result->execute($matrix); - } - - return $result->result(); -} diff --git a/vendor/markbaker/matrix/classes/src/operations/subtract.php b/vendor/markbaker/matrix/classes/src/operations/subtract.php deleted file mode 100644 index 3123b61e..00000000 --- a/vendor/markbaker/matrix/classes/src/operations/subtract.php +++ /dev/null @@ -1,44 +0,0 @@ - $matrixValues The matrices to subtract - * @return Matrix - * @throws Exception - */ -function subtract(...$matrixValues) -{ - if (count($matrixValues) < 2) { - throw new Exception('Subtraction operation requires at least 2 arguments'); - } - - $matrix = array_shift($matrixValues); - - if (is_array($matrix)) { - $matrix = new Matrix($matrix); - } - if (!$matrix instanceof Matrix) { - throw new Exception('Subtraction arguments must be Matrix or array'); - } - - $result = new Subtraction($matrix); - - foreach ($matrixValues as $matrix) { - $result->execute($matrix); - } - - return $result->result(); -} diff --git a/vendor/markbaker/matrix/composer.7.2.json b/vendor/markbaker/matrix/composer.7.2.json deleted file mode 100644 index 6ff324d0..00000000 --- a/vendor/markbaker/matrix/composer.7.2.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "markbaker/matrix", - "type": "library", - "description": "PHP Class for working with matrices", - "keywords": ["matrix", "vector", "mathematics"], - "homepage": "https://github.com/MarkBaker/PHPMatrix", - "license": "MIT", - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "require": { - "php": "^7.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.4@dev", - "squizlabs/php_codesniffer": "^3.0@dev", - "phpmd/phpmd": "dev-master", - "infection/infection": "0.13.x-dev", - "phpstan/phpstan": "^0.12.0@dev", - "sebastian/phpcpd": "^4.1", - "phploc/phploc": "^5.0@dev", - "phpcompatibility/php-compatibility": "dev-master", - "dealerdirect/phpcodesniffer-composer-installer": "dev-master" - }, - "autoload": { - "psr-4": { - "Matrix\\": "classes/src/" - }, - "files": [ - "classes/src/functions/adjoint.php", - "classes/src/functions/antidiagonal.php", - "classes/src/functions/cofactors.php", - "classes/src/functions/determinant.php", - "classes/src/functions/diagonal.php", - "classes/src/functions/identity.php", - "classes/src/functions/inverse.php", - "classes/src/functions/minors.php", - "classes/src/functions/trace.php", - "classes/src/functions/transpose.php", - "classes/src/operations/add.php", - "classes/src/operations/directsum.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "autoload-dev": { - "psr-4": { - "Matrix\\Test\\": "unitTests/classes/src/" - }, - "files": [ - "unitTests/classes/src/functions/adjointTest.php", - "unitTests/classes/src/functions/antidiagonalTest.php", - "unitTests/classes/src/functions/cofactorsTest.php", - "unitTests/classes/src/functions/determinantTest.php", - "unitTests/classes/src/functions/diagonalTest.php", - "unitTests/classes/src/functions/identityTest.php", - "unitTests/classes/src/functions/inverseTest.php", - "unitTests/classes/src/functions/minorsTest.php", - "unitTests/classes/src/functions/traceTest.php", - "unitTests/classes/src/functions/transposeTest.php", - "unitTests/classes/src/operations/addTest.php", - "unitTests/classes/src/operations/directsumTest.php", - "unitTests/classes/src/operations/subtractTest.php", - "unitTests/classes/src/operations/multiplyTest.php", - "unitTests/classes/src/operations/dividebyTest.php", - "unitTests/classes/src/operations/divideintoTest.php" - ] - }, - "scripts": { - "style": "phpcs --report-width=200 --report=summary,full -n", - "test": "phpunit -c phpunit.xml.dist", - "mess": "phpmd classes/src/ xml codesize,unusedcode,design,naming -n", - "lines": "phploc classes/src/ -n", - "cpd": "phpcpd classes/src/ -n", - "versions": "phpcs --report-width=200 --report=summary,full classes/src/ --standard=PHPCompatibility --runtime-set testVersion 5.6- -n", - "infection": "infection --min-msi=70 --min-covered-msi=70 --log-verbosity=all", - "phpstan": "phpstan analyse classes/src/ -c phpstan.neon --level=7 --no-progress -vvv --memory-limit=1024M", - "coverage": "phpunit -c phpunit.xml.dist --coverage-text --coverage-html ./build/coverage" - }, - "minimum-stability": "dev" -} diff --git a/vendor/markbaker/matrix/composer.json b/vendor/markbaker/matrix/composer.json deleted file mode 100644 index dae5c98c..00000000 --- a/vendor/markbaker/matrix/composer.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "markbaker/matrix", - "type": "library", - "description": "PHP Class for working with matrices", - "keywords": ["matrix", "vector", "mathematics"], - "homepage": "https://github.com/MarkBaker/PHPMatrix", - "license": "MIT", - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7", - "phpmd/phpmd": "dev-master", - "sebastian/phpcpd": "^3.0", - "phploc/phploc": "^4", - "squizlabs/php_codesniffer": "^3.0@dev", - "phpcompatibility/php-compatibility": "dev-master", - "dealerdirect/phpcodesniffer-composer-installer": "dev-master" - }, - "autoload": { - "psr-4": { - "Matrix\\": "classes/src/" - }, - "files": [ - "classes/src/functions/adjoint.php", - "classes/src/functions/antidiagonal.php", - "classes/src/functions/cofactors.php", - "classes/src/functions/determinant.php", - "classes/src/functions/diagonal.php", - "classes/src/functions/identity.php", - "classes/src/functions/inverse.php", - "classes/src/functions/minors.php", - "classes/src/functions/trace.php", - "classes/src/functions/transpose.php", - "classes/src/operations/add.php", - "classes/src/operations/directsum.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "autoload-dev": { - "psr-4": { - "Matrix\\Test\\": "unitTests/classes/src/" - }, - "files": [ - "unitTests/classes/src/functions/adjointTest.php", - "unitTests/classes/src/functions/antidiagonalTest.php", - "unitTests/classes/src/functions/cofactorsTest.php", - "unitTests/classes/src/functions/determinantTest.php", - "unitTests/classes/src/functions/diagonalTest.php", - "unitTests/classes/src/functions/identityTest.php", - "unitTests/classes/src/functions/inverseTest.php", - "unitTests/classes/src/functions/minorsTest.php", - "unitTests/classes/src/functions/traceTest.php", - "unitTests/classes/src/functions/transposeTest.php", - "unitTests/classes/src/operations/addTest.php", - "unitTests/classes/src/operations/directsumTest.php", - "unitTests/classes/src/operations/subtractTest.php", - "unitTests/classes/src/operations/multiplyTest.php", - "unitTests/classes/src/operations/dividebyTest.php", - "unitTests/classes/src/operations/divideintoTest.php" - ] - }, - "scripts": { - "style": "phpcs --report-width=200 --report=summary,full -n", - "test": "phpunit -c phpunit.xml.dist", - "mess": "phpmd classes/src/ xml codesize,unusedcode,design,naming -n", - "lines": "phploc classes/src/ -n", - "cpd": "phpcpd classes/src/ -n", - "versions": "phpcs --report-width=200 --report=summary,full classes/src/ --standard=PHPCompatibility --runtime-set testVersion 5.6- -n" - }, - "minimum-stability": "dev" -} diff --git a/vendor/markbaker/matrix/examples/test.php b/vendor/markbaker/matrix/examples/test.php deleted file mode 100644 index d8b56dcd..00000000 --- a/vendor/markbaker/matrix/examples/test.php +++ /dev/null @@ -1,19 +0,0 @@ -directsum(new Matrix\Matrix($grid2)); - -var_dump($new); diff --git a/vendor/markbaker/matrix/infection.json.dist b/vendor/markbaker/matrix/infection.json.dist deleted file mode 100644 index eddaa70a..00000000 --- a/vendor/markbaker/matrix/infection.json.dist +++ /dev/null @@ -1,17 +0,0 @@ -{ - "timeout": 1, - "source": { - "directories": [ - "classes\/src" - ] - }, - "logs": { - "text": "build/infection/text.log", - "summary": "build/infection/summary.log", - "debug": "build/infection/debug.log", - "perMutator": "build/infection/perMutator.md" - }, - "mutators": { - "@default": true - } -} diff --git a/vendor/markbaker/matrix/license.md b/vendor/markbaker/matrix/license.md deleted file mode 100644 index 7329058f..00000000 --- a/vendor/markbaker/matrix/license.md +++ /dev/null @@ -1,25 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright © `2018` `Mark Baker` - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the “Software”), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/markbaker/matrix/phpstan.neon b/vendor/markbaker/matrix/phpstan.neon deleted file mode 100644 index cda5fe87..00000000 --- a/vendor/markbaker/matrix/phpstan.neon +++ /dev/null @@ -1,4 +0,0 @@ -parameters: - ignoreErrors: - - '#Property [A-Za-z\\]+::\$[A-Za-z]+ has no typehint specified#' - - '#Method [A-Za-z\\]+::[A-Za-z]+\(\) has no return typehint specified#' diff --git a/vendor/mtdowling/jmespath.php/.gitignore b/vendor/mtdowling/jmespath.php/.gitignore deleted file mode 100644 index 34a92060..00000000 --- a/vendor/mtdowling/jmespath.php/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -vendor -composer.lock -phpunit.xml -compiled -artifacts/ diff --git a/vendor/mtdowling/jmespath.php/.travis.yml b/vendor/mtdowling/jmespath.php/.travis.yml deleted file mode 100644 index ff3963e0..00000000 --- a/vendor/mtdowling/jmespath.php/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: php - -php: - - 5.4 - - 5.5 - - 5.6 - - hhvm - -before_script: - - composer install - -script: make test - -after_script: - - make perf - - JP_PHP_COMPILE=on make perf - - JP_PHP_COMPILE=on CACHE=on make perf diff --git a/vendor/mtdowling/jmespath.php/CHANGELOG.md b/vendor/mtdowling/jmespath.php/CHANGELOG.md deleted file mode 100644 index 6f6f9151..00000000 --- a/vendor/mtdowling/jmespath.php/CHANGELOG.md +++ /dev/null @@ -1,52 +0,0 @@ -# CHANGELOG - -## 2.4.0 - 2016-12-03 - -* Added support for floats when interpreting data. -* Added a function_exists check to work around redeclaration issues. - -## 2.3.0 - 2016-01-05 - -* Added support for [JEP-9](https://github.com/jmespath/jmespath.site/blob/master/docs/proposals/improved-filters.rst), - including unary filter expressions, and `&&` filter expressions. -* Fixed various parsing issues, including not removing escaped single quotes - from raw string literals. -* Added support for the `map` function. -* Fixed several issues with code generation. - -## 2.2.0 - 2015-05-27 - -* Added support for [JEP-12](https://github.com/jmespath/jmespath.site/blob/master/docs/proposals/raw-string-literals.rst) - and raw string literals (e.g., `'foo'`). - -## 2.1.0 - 2014-01-13 - -* Added `JmesPath\Env::cleanCompileDir()` to delete any previously compiled - JMESPath expressions. - -## 2.0.0 - 2014-01-11 - -* Moving to a flattened namespace structure. -* Runtimes are now only PHP callables. -* Fixed an error in the way empty JSON literals are parsed so that they now - return an empty string to match the Python and JavaScript implementations. -* Removed functions from runtimes. Instead there is now a function dispatcher - class, FnDispatcher, that provides function implementations behind a single - dispatch function. -* Removed ExprNode in lieu of just using a PHP callable with bound variables. -* Removed debug methods from runtimes and instead into a new Debugger class. -* Heavily cleaned up function argument validation. -* Slice syntax is now properly validated (i.e., colons are followed by the - appropriate value). -* Lots of code cleanup and performance improvements. -* Added a convenient `JmesPath\search()` function. -* **IMPORTANT**: Relocating the project to https://github.com/jmespath/jmespath.php - -## 1.1.1 - 2014-10-08 - -* Added support for using ArrayAccess and Countable as arrays and objects. - -## 1.1.0 - 2014-08-06 - -* Added the ability to search data returned from json_decode() where JSON - objects are returned as stdClass objects. diff --git a/vendor/mtdowling/jmespath.php/LICENSE b/vendor/mtdowling/jmespath.php/LICENSE deleted file mode 100644 index 5c970a42..00000000 --- a/vendor/mtdowling/jmespath.php/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/mtdowling/jmespath.php/Makefile b/vendor/mtdowling/jmespath.php/Makefile deleted file mode 100644 index 96772699..00000000 --- a/vendor/mtdowling/jmespath.php/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -all: clean coverage - -test: - vendor/bin/phpunit - -coverage: - vendor/bin/phpunit --coverage-html=artifacts/coverage - -view-coverage: - open artifacts/coverage/index.html - -clean: - rm -rf artifacts/* - rm -rf compiled/* - -perf: - php bin/perf.php - -.PHONY: test coverage perf diff --git a/vendor/mtdowling/jmespath.php/README.rst b/vendor/mtdowling/jmespath.php/README.rst deleted file mode 100644 index b65ee466..00000000 --- a/vendor/mtdowling/jmespath.php/README.rst +++ /dev/null @@ -1,123 +0,0 @@ -============ -jmespath.php -============ - -JMESPath (pronounced "jaymz path") allows you to declaratively specify how to -extract elements from a JSON document. *jmespath.php* allows you to use -JMESPath in PHP applications with PHP data structures. It requires PHP 5.4 or -greater and can be installed through `Composer `_ -using the ``mtdowling/jmespath.php`` package. - -.. code-block:: php - - require 'vendor/autoload.php'; - - $expression = 'foo.*.baz'; - - $data = [ - 'foo' => [ - 'bar' => ['baz' => 1], - 'bam' => ['baz' => 2], - 'boo' => ['baz' => 3] - ] - ]; - - JmesPath\search($expression, $data); - // Returns: [1, 2, 3] - -- `JMESPath Tutorial `_ -- `JMESPath Grammar `_ -- `JMESPath Python library `_ - -PHP Usage -========= - -The ``JmesPath\search`` function can be used in most cases when using the -library. This function utilizes a JMESPath runtime based on your environment. -The runtime utilized can be configured using environment variables and may at -some point in the future automatically utilize a C extension if available. - -.. code-block:: php - - $result = JmesPath\search($expression, $data); - - // or, if you require PSR-4 compliance. - $result = JmesPath\Env::search($expression, $data); - -Runtimes --------- - -jmespath.php utilizes *runtimes*. There are currently two runtimes: -AstRuntime and CompilerRuntime. - -AstRuntime is utilized by ``JmesPath\search()`` and ``JmesPath\Env::search()`` -by default. - -AstRuntime -~~~~~~~~~~ - -The AstRuntime will parse an expression, cache the resulting AST in memory, -and interpret the AST using an external tree visitor. AstRuntime provides a -good general approach for interpreting JMESPath expressions that have a low to -moderate level of reuse. - -.. code-block:: php - - $runtime = new JmesPath\AstRuntime(); - $runtime('foo.bar', ['foo' => ['bar' => 'baz']]); - // > 'baz' - -CompilerRuntime -~~~~~~~~~~~~~~~ - -``JmesPath\CompilerRuntime`` provides the most performance for -applications that have a moderate to high level of reuse of JMESPath -expressions. The CompilerRuntime will walk a JMESPath AST and emit PHP source -code, resulting in anywhere from 7x to 60x speed improvements. - -Compiling JMESPath expressions to source code is a slower process than just -walking and interpreting a JMESPath AST (via the AstRuntime). However, -running the compiled JMESPath code results in much better performance than -walking an AST. This essentially means that there is a warm-up period when -using the ``CompilerRuntime``, but after the warm-up period, it will provide -much better performance. - -Use the CompilerRuntime if you know that you will be executing JMESPath -expressions more than once or if you can pre-compile JMESPath expressions -before executing them (for example, server-side applications). - -.. code-block:: php - - // Note: The cache directory argument is optional. - $runtime = new JmesPath\CompilerRuntime('/path/to/compile/folder'); - $runtime('foo.bar', ['foo' => ['bar' => 'baz']]); - // > 'baz' - -Environment Variables -^^^^^^^^^^^^^^^^^^^^^ - -You can utilize the CompilerRuntime in ``JmesPath\search()`` by setting -the ``JP_PHP_COMPILE`` environment variable to "on" or to a directory -on disk used to store cached expressions. - -Testing -======= - -A comprehensive list of test cases can be found at -https://github.com/jmespath/jmespath.php/tree/master/tests/compliance. -These compliance tests are utilized by jmespath.php to ensure consistency with -other implementations, and can serve as examples of the language. - -jmespath.php is tested using PHPUnit. In order to run the tests, you need to -first install the dependencies using Composer as described in the *Installation* -section. Next you just need to run the tests via make: - -.. code-block:: bash - - make test - -You can run a suite of performance tests as well: - -.. code-block:: bash - - make perf diff --git a/vendor/mtdowling/jmespath.php/bin/jp.php b/vendor/mtdowling/jmespath.php/bin/jp.php deleted file mode 100644 index f32e4ec2..00000000 --- a/vendor/mtdowling/jmespath.php/bin/jp.php +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env php -=5.4.0" - }, - - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - - "autoload": { - "psr-4": { - "JmesPath\\": "src/" - }, - "files": ["src/JmesPath.php"] - }, - - "bin": ["bin/jp.php"], - - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - } -} diff --git a/vendor/mtdowling/jmespath.php/phpunit.xml.dist b/vendor/mtdowling/jmespath.php/phpunit.xml.dist deleted file mode 100644 index 9283ca52..00000000 --- a/vendor/mtdowling/jmespath.php/phpunit.xml.dist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - tests - - - - - - src - - - - diff --git a/vendor/mtdowling/jmespath.php/src/AstRuntime.php b/vendor/mtdowling/jmespath.php/src/AstRuntime.php deleted file mode 100644 index db8a60ec..00000000 --- a/vendor/mtdowling/jmespath.php/src/AstRuntime.php +++ /dev/null @@ -1,47 +0,0 @@ -interpreter = new TreeInterpreter($fnDispatcher); - $this->parser = $parser ?: new Parser(); - } - - /** - * Returns data from the provided input that matches a given JMESPath - * expression. - * - * @param string $expression JMESPath expression to evaluate - * @param mixed $data Data to search. This data should be data that - * is similar to data returned from json_decode - * using associative arrays rather than objects. - * - * @return mixed|null Returns the matching data or null - */ - public function __invoke($expression, $data) - { - if (!isset($this->cache[$expression])) { - // Clear the AST cache when it hits 1024 entries - if (++$this->cachedCount > 1024) { - $this->cache = []; - $this->cachedCount = 0; - } - $this->cache[$expression] = $this->parser->parse($expression); - } - - return $this->interpreter->visit($this->cache[$expression], $data); - } -} diff --git a/vendor/mtdowling/jmespath.php/src/CompilerRuntime.php b/vendor/mtdowling/jmespath.php/src/CompilerRuntime.php deleted file mode 100644 index f2becb9d..00000000 --- a/vendor/mtdowling/jmespath.php/src/CompilerRuntime.php +++ /dev/null @@ -1,83 +0,0 @@ -parser = $parser ?: new Parser(); - $this->compiler = new TreeCompiler(); - $dir = $dir ?: sys_get_temp_dir(); - - if (!is_dir($dir) && !mkdir($dir, 0755, true)) { - throw new \RuntimeException("Unable to create cache directory: $dir"); - } - - $this->cacheDir = realpath($dir); - $this->interpreter = new TreeInterpreter(); - } - - /** - * Returns data from the provided input that matches a given JMESPath - * expression. - * - * @param string $expression JMESPath expression to evaluate - * @param mixed $data Data to search. This data should be data that - * is similar to data returned from json_decode - * using associative arrays rather than objects. - * - * @return mixed|null Returns the matching data or null - * @throws \RuntimeException - */ - public function __invoke($expression, $data) - { - $functionName = 'jmespath_' . md5($expression); - - if (!function_exists($functionName)) { - $filename = "{$this->cacheDir}/{$functionName}.php"; - if (!file_exists($filename)) { - $this->compile($filename, $expression, $functionName); - } - require $filename; - } - - return $functionName($this->interpreter, $data); - } - - private function compile($filename, $expression, $functionName) - { - $code = $this->compiler->visit( - $this->parser->parse($expression), - $functionName, - $expression - ); - - if (!file_put_contents($filename, $code)) { - throw new \RuntimeException(sprintf( - 'Unable to write the compiled PHP code to: %s (%s)', - $filename, - var_export(error_get_last(), true) - )); - } - } -} diff --git a/vendor/mtdowling/jmespath.php/src/DebugRuntime.php b/vendor/mtdowling/jmespath.php/src/DebugRuntime.php deleted file mode 100644 index 40525617..00000000 --- a/vendor/mtdowling/jmespath.php/src/DebugRuntime.php +++ /dev/null @@ -1,109 +0,0 @@ -runtime = $runtime; - $this->out = $output ?: STDOUT; - $this->lexer = new Lexer(); - $this->parser = new Parser($this->lexer); - } - - public function __invoke($expression, $data) - { - if ($this->runtime instanceof CompilerRuntime) { - return $this->debugCompiled($expression, $data); - } - - return $this->debugInterpreted($expression, $data); - } - - private function debugInterpreted($expression, $data) - { - return $this->debugCallback( - function () use ($expression, $data) { - $runtime = $this->runtime; - return $runtime($expression, $data); - }, - $expression, - $data - ); - } - - private function debugCompiled($expression, $data) - { - $result = $this->debugCallback( - function () use ($expression, $data) { - $runtime = $this->runtime; - return $runtime($expression, $data); - }, - $expression, - $data - ); - $this->dumpCompiledCode($expression); - - return $result; - } - - private function dumpTokens($expression) - { - $lexer = new Lexer(); - fwrite($this->out, "Tokens\n======\n\n"); - $tokens = $lexer->tokenize($expression); - - foreach ($tokens as $t) { - fprintf( - $this->out, - "%3d %-13s %s\n", $t['pos'], $t['type'], - json_encode($t['value']) - ); - } - - fwrite($this->out, "\n"); - } - - private function dumpAst($expression) - { - $parser = new Parser(); - $ast = $parser->parse($expression); - fwrite($this->out, "AST\n========\n\n"); - fwrite($this->out, json_encode($ast, JSON_PRETTY_PRINT) . "\n"); - } - - private function dumpCompiledCode($expression) - { - fwrite($this->out, "Code\n========\n\n"); - $dir = sys_get_temp_dir(); - $hash = md5($expression); - $functionName = "jmespath_{$hash}"; - $filename = "{$dir}/{$functionName}.php"; - fwrite($this->out, "File: {$filename}\n\n"); - fprintf($this->out, file_get_contents($filename)); - } - - private function debugCallback(callable $debugFn, $expression, $data) - { - fprintf($this->out, "Expression\n==========\n\n%s\n\n", $expression); - $this->dumpTokens($expression); - $this->dumpAst($expression); - fprintf($this->out, "\nData\n====\n\n%s\n\n", json_encode($data, JSON_PRETTY_PRINT)); - $startTime = microtime(true); - $result = $debugFn(); - $total = microtime(true) - $startTime; - fprintf($this->out, "\nResult\n======\n\n%s\n\n", json_encode($result, JSON_PRETTY_PRINT)); - fwrite($this->out, "Time\n====\n\n"); - fprintf($this->out, "Total time: %f ms\n\n", $total); - - return $result; - } -} diff --git a/vendor/mtdowling/jmespath.php/src/Env.php b/vendor/mtdowling/jmespath.php/src/Env.php deleted file mode 100644 index 9da5d697..00000000 --- a/vendor/mtdowling/jmespath.php/src/Env.php +++ /dev/null @@ -1,66 +0,0 @@ -{'fn_' . $fn}($args); - } - - private function fn_abs(array $args) - { - $this->validate('abs', $args, [['number']]); - return abs($args[0]); - } - - private function fn_avg(array $args) - { - $this->validate('avg', $args, [['array']]); - $sum = $this->reduce('avg:0', $args[0], ['number'], function ($a, $b) { - return $a + $b; - }); - return $args[0] ? ($sum / count($args[0])) : null; - } - - private function fn_ceil(array $args) - { - $this->validate('ceil', $args, [['number']]); - return ceil($args[0]); - } - - private function fn_contains(array $args) - { - $this->validate('contains', $args, [['string', 'array'], ['any']]); - if (is_array($args[0])) { - return in_array($args[1], $args[0]); - } elseif (is_string($args[1])) { - return strpos($args[0], $args[1]) !== false; - } else { - return null; - } - } - - private function fn_ends_with(array $args) - { - $this->validate('ends_with', $args, [['string'], ['string']]); - list($search, $suffix) = $args; - return $suffix === '' || substr($search, -strlen($suffix)) === $suffix; - } - - private function fn_floor(array $args) - { - $this->validate('floor', $args, [['number']]); - return floor($args[0]); - } - - private function fn_not_null(array $args) - { - if (!$args) { - throw new \RuntimeException( - "not_null() expects 1 or more arguments, 0 were provided" - ); - } - - return array_reduce($args, function ($carry, $item) { - return $carry !== null ? $carry : $item; - }); - } - - private function fn_join(array $args) - { - $this->validate('join', $args, [['string'], ['array']]); - $fn = function ($a, $b, $i) use ($args) { - return $i ? ($a . $args[0] . $b) : $b; - }; - return $this->reduce('join:0', $args[1], ['string'], $fn); - } - - private function fn_keys(array $args) - { - $this->validate('keys', $args, [['object']]); - return array_keys((array) $args[0]); - } - - private function fn_length(array $args) - { - $this->validate('length', $args, [['string', 'array', 'object']]); - return is_string($args[0]) ? strlen($args[0]) : count((array) $args[0]); - } - - private function fn_max(array $args) - { - $this->validate('max', $args, [['array']]); - $fn = function ($a, $b) { return $a >= $b ? $a : $b; }; - return $this->reduce('max:0', $args[0], ['number', 'string'], $fn); - } - - private function fn_max_by(array $args) - { - $this->validate('max_by', $args, [['array'], ['expression']]); - $expr = $this->wrapExpression('max_by:1', $args[1], ['number', 'string']); - $fn = function ($carry, $item, $index) use ($expr) { - return $index - ? ($expr($carry) >= $expr($item) ? $carry : $item) - : $item; - }; - return $this->reduce('max_by:1', $args[0], ['any'], $fn); - } - - private function fn_min(array $args) - { - $this->validate('min', $args, [['array']]); - $fn = function ($a, $b, $i) { return $i && $a <= $b ? $a : $b; }; - return $this->reduce('min:0', $args[0], ['number', 'string'], $fn); - } - - private function fn_min_by(array $args) - { - $this->validate('min_by', $args, [['array'], ['expression']]); - $expr = $this->wrapExpression('min_by:1', $args[1], ['number', 'string']); - $i = -1; - $fn = function ($a, $b) use ($expr, &$i) { - return ++$i ? ($expr($a) <= $expr($b) ? $a : $b) : $b; - }; - return $this->reduce('min_by:1', $args[0], ['any'], $fn); - } - - private function fn_reverse(array $args) - { - $this->validate('reverse', $args, [['array', 'string']]); - if (is_array($args[0])) { - return array_reverse($args[0]); - } elseif (is_string($args[0])) { - return strrev($args[0]); - } else { - throw new \RuntimeException('Cannot reverse provided argument'); - } - } - - private function fn_sum(array $args) - { - $this->validate('sum', $args, [['array']]); - $fn = function ($a, $b) { return $a + $b; }; - return $this->reduce('sum:0', $args[0], ['number'], $fn); - } - - private function fn_sort(array $args) - { - $this->validate('sort', $args, [['array']]); - $valid = ['string', 'number']; - return Utils::stableSort($args[0], function ($a, $b) use ($valid) { - $this->validateSeq('sort:0', $valid, $a, $b); - return strnatcmp($a, $b); - }); - } - - private function fn_sort_by(array $args) - { - $this->validate('sort_by', $args, [['array'], ['expression']]); - $expr = $args[1]; - $valid = ['string', 'number']; - return Utils::stableSort( - $args[0], - function ($a, $b) use ($expr, $valid) { - $va = $expr($a); - $vb = $expr($b); - $this->validateSeq('sort_by:0', $valid, $va, $vb); - return strnatcmp($va, $vb); - } - ); - } - - private function fn_starts_with(array $args) - { - $this->validate('starts_with', $args, [['string'], ['string']]); - list($search, $prefix) = $args; - return $prefix === '' || strpos($search, $prefix) === 0; - } - - private function fn_type(array $args) - { - $this->validateArity('type', count($args), 1); - return Utils::type($args[0]); - } - - private function fn_to_string(array $args) - { - $this->validateArity('to_string', count($args), 1); - $v = $args[0]; - if (is_string($v)) { - return $v; - } elseif (is_object($v) - && !($v instanceof \JsonSerializable) - && method_exists($v, '__toString') - ) { - return (string) $v; - } - - return json_encode($v); - } - - private function fn_to_number(array $args) - { - $this->validateArity('to_number', count($args), 1); - $value = $args[0]; - $type = Utils::type($value); - if ($type == 'number') { - return $value; - } elseif ($type == 'string' && is_numeric($value)) { - return strpos($value, '.') ? (float) $value : (int) $value; - } else { - return null; - } - } - - private function fn_values(array $args) - { - $this->validate('values', $args, [['array', 'object']]); - return array_values((array) $args[0]); - } - - private function fn_merge(array $args) - { - if (!$args) { - throw new \RuntimeException( - "merge() expects 1 or more arguments, 0 were provided" - ); - } - - return call_user_func_array('array_replace', $args); - } - - private function fn_to_array(array $args) - { - $this->validate('to_array', $args, [['any']]); - - return Utils::isArray($args[0]) ? $args[0] : [$args[0]]; - } - - private function fn_map(array $args) - { - $this->validate('map', $args, [['expression'], ['any']]); - $result = []; - foreach ($args[1] as $a) { - $result[] = $args[0]($a); - } - return $result; - } - - private function typeError($from, $msg) - { - if (strpos($from, ':')) { - list($fn, $pos) = explode(':', $from); - throw new \RuntimeException( - sprintf('Argument %d of %s %s', $pos, $fn, $msg) - ); - } else { - throw new \RuntimeException( - sprintf('Type error: %s %s', $from, $msg) - ); - } - } - - private function validateArity($from, $given, $expected) - { - if ($given != $expected) { - $err = "%s() expects {$expected} arguments, {$given} were provided"; - throw new \RuntimeException(sprintf($err, $from)); - } - } - - private function validate($from, $args, $types = []) - { - $this->validateArity($from, count($args), count($types)); - foreach ($args as $index => $value) { - if (!isset($types[$index]) || !$types[$index]) { - continue; - } - $this->validateType("{$from}:{$index}", $value, $types[$index]); - } - } - - private function validateType($from, $value, array $types) - { - if ($types[0] == 'any' - || in_array(Utils::type($value), $types) - || ($value === [] && in_array('object', $types)) - ) { - return; - } - $msg = 'must be one of the following types: ' . implode(', ', $types) - . '. ' . Utils::type($value) . ' found'; - $this->typeError($from, $msg); - } - - /** - * Validates value A and B, ensures they both are correctly typed, and of - * the same type. - * - * @param string $from String of function:argument_position - * @param array $types Array of valid value types. - * @param mixed $a Value A - * @param mixed $b Value B - */ - private function validateSeq($from, array $types, $a, $b) - { - $ta = Utils::type($a); - $tb = Utils::type($b); - - if ($ta !== $tb) { - $msg = "encountered a type mismatch in sequence: {$ta}, {$tb}"; - $this->typeError($from, $msg); - } - - $typeMatch = ($types && $types[0] == 'any') || in_array($ta, $types); - if (!$typeMatch) { - $msg = 'encountered a type error in sequence. The argument must be ' - . 'an array of ' . implode('|', $types) . ' types. ' - . "Found {$ta}, {$tb}."; - $this->typeError($from, $msg); - } - } - - /** - * Reduces and validates an array of values to a single value using a fn. - * - * @param string $from String of function:argument_position - * @param array $values Values to reduce. - * @param array $types Array of valid value types. - * @param callable $reduce Reduce function that accepts ($carry, $item). - * - * @return mixed - */ - private function reduce($from, array $values, array $types, callable $reduce) - { - $i = -1; - return array_reduce( - $values, - function ($carry, $item) use ($from, $types, $reduce, &$i) { - if (++$i > 0) { - $this->validateSeq($from, $types, $carry, $item); - } - return $reduce($carry, $item, $i); - } - ); - } - - /** - * Validates the return values of expressions as they are applied. - * - * @param string $from Function name : position - * @param callable $expr Expression function to validate. - * @param array $types Array of acceptable return type values. - * - * @return callable Returns a wrapped function - */ - private function wrapExpression($from, callable $expr, array $types) - { - list($fn, $pos) = explode(':', $from); - $from = "The expression return value of argument {$pos} of {$fn}"; - return function ($value) use ($from, $expr, $types) { - $value = $expr($value); - $this->validateType($from, $value, $types); - return $value; - }; - } - - /** @internal Pass function name validation off to runtime */ - public function __call($name, $args) - { - $name = str_replace('fn_', '', $name); - throw new \RuntimeException("Call to undefined function {$name}"); - } -} diff --git a/vendor/mtdowling/jmespath.php/src/JmesPath.php b/vendor/mtdowling/jmespath.php/src/JmesPath.php deleted file mode 100644 index e2c239a1..00000000 --- a/vendor/mtdowling/jmespath.php/src/JmesPath.php +++ /dev/null @@ -1,17 +0,0 @@ - self::STATE_LT, - '>' => self::STATE_GT, - '=' => self::STATE_EQ, - '!' => self::STATE_NOT, - '[' => self::STATE_LBRACKET, - '|' => self::STATE_PIPE, - '&' => self::STATE_AND, - '`' => self::STATE_JSON_LITERAL, - '"' => self::STATE_QUOTED_STRING, - "'" => self::STATE_STRING_LITERAL, - '-' => self::STATE_NUMBER, - '0' => self::STATE_NUMBER, - '1' => self::STATE_NUMBER, - '2' => self::STATE_NUMBER, - '3' => self::STATE_NUMBER, - '4' => self::STATE_NUMBER, - '5' => self::STATE_NUMBER, - '6' => self::STATE_NUMBER, - '7' => self::STATE_NUMBER, - '8' => self::STATE_NUMBER, - '9' => self::STATE_NUMBER, - ' ' => self::STATE_WHITESPACE, - "\t" => self::STATE_WHITESPACE, - "\n" => self::STATE_WHITESPACE, - "\r" => self::STATE_WHITESPACE, - '.' => self::STATE_SINGLE_CHAR, - '*' => self::STATE_SINGLE_CHAR, - ']' => self::STATE_SINGLE_CHAR, - ',' => self::STATE_SINGLE_CHAR, - ':' => self::STATE_SINGLE_CHAR, - '@' => self::STATE_SINGLE_CHAR, - '(' => self::STATE_SINGLE_CHAR, - ')' => self::STATE_SINGLE_CHAR, - '{' => self::STATE_SINGLE_CHAR, - '}' => self::STATE_SINGLE_CHAR, - '_' => self::STATE_IDENTIFIER, - 'A' => self::STATE_IDENTIFIER, - 'B' => self::STATE_IDENTIFIER, - 'C' => self::STATE_IDENTIFIER, - 'D' => self::STATE_IDENTIFIER, - 'E' => self::STATE_IDENTIFIER, - 'F' => self::STATE_IDENTIFIER, - 'G' => self::STATE_IDENTIFIER, - 'H' => self::STATE_IDENTIFIER, - 'I' => self::STATE_IDENTIFIER, - 'J' => self::STATE_IDENTIFIER, - 'K' => self::STATE_IDENTIFIER, - 'L' => self::STATE_IDENTIFIER, - 'M' => self::STATE_IDENTIFIER, - 'N' => self::STATE_IDENTIFIER, - 'O' => self::STATE_IDENTIFIER, - 'P' => self::STATE_IDENTIFIER, - 'Q' => self::STATE_IDENTIFIER, - 'R' => self::STATE_IDENTIFIER, - 'S' => self::STATE_IDENTIFIER, - 'T' => self::STATE_IDENTIFIER, - 'U' => self::STATE_IDENTIFIER, - 'V' => self::STATE_IDENTIFIER, - 'W' => self::STATE_IDENTIFIER, - 'X' => self::STATE_IDENTIFIER, - 'Y' => self::STATE_IDENTIFIER, - 'Z' => self::STATE_IDENTIFIER, - 'a' => self::STATE_IDENTIFIER, - 'b' => self::STATE_IDENTIFIER, - 'c' => self::STATE_IDENTIFIER, - 'd' => self::STATE_IDENTIFIER, - 'e' => self::STATE_IDENTIFIER, - 'f' => self::STATE_IDENTIFIER, - 'g' => self::STATE_IDENTIFIER, - 'h' => self::STATE_IDENTIFIER, - 'i' => self::STATE_IDENTIFIER, - 'j' => self::STATE_IDENTIFIER, - 'k' => self::STATE_IDENTIFIER, - 'l' => self::STATE_IDENTIFIER, - 'm' => self::STATE_IDENTIFIER, - 'n' => self::STATE_IDENTIFIER, - 'o' => self::STATE_IDENTIFIER, - 'p' => self::STATE_IDENTIFIER, - 'q' => self::STATE_IDENTIFIER, - 'r' => self::STATE_IDENTIFIER, - 's' => self::STATE_IDENTIFIER, - 't' => self::STATE_IDENTIFIER, - 'u' => self::STATE_IDENTIFIER, - 'v' => self::STATE_IDENTIFIER, - 'w' => self::STATE_IDENTIFIER, - 'x' => self::STATE_IDENTIFIER, - 'y' => self::STATE_IDENTIFIER, - 'z' => self::STATE_IDENTIFIER, - ]; - - /** @var array Valid identifier characters after first character */ - private $validIdentifier = [ - 'A' => true, 'B' => true, 'C' => true, 'D' => true, 'E' => true, - 'F' => true, 'G' => true, 'H' => true, 'I' => true, 'J' => true, - 'K' => true, 'L' => true, 'M' => true, 'N' => true, 'O' => true, - 'P' => true, 'Q' => true, 'R' => true, 'S' => true, 'T' => true, - 'U' => true, 'V' => true, 'W' => true, 'X' => true, 'Y' => true, - 'Z' => true, 'a' => true, 'b' => true, 'c' => true, 'd' => true, - 'e' => true, 'f' => true, 'g' => true, 'h' => true, 'i' => true, - 'j' => true, 'k' => true, 'l' => true, 'm' => true, 'n' => true, - 'o' => true, 'p' => true, 'q' => true, 'r' => true, 's' => true, - 't' => true, 'u' => true, 'v' => true, 'w' => true, 'x' => true, - 'y' => true, 'z' => true, '_' => true, '0' => true, '1' => true, - '2' => true, '3' => true, '4' => true, '5' => true, '6' => true, - '7' => true, '8' => true, '9' => true, - ]; - - /** @var array Valid number characters after the first character */ - private $numbers = [ - '0' => true, '1' => true, '2' => true, '3' => true, '4' => true, - '5' => true, '6' => true, '7' => true, '8' => true, '9' => true - ]; - - /** @var array Map of simple single character tokens */ - private $simpleTokens = [ - '.' => self::T_DOT, - '*' => self::T_STAR, - ']' => self::T_RBRACKET, - ',' => self::T_COMMA, - ':' => self::T_COLON, - '@' => self::T_CURRENT, - '(' => self::T_LPAREN, - ')' => self::T_RPAREN, - '{' => self::T_LBRACE, - '}' => self::T_RBRACE, - ]; - - /** - * Tokenize the JMESPath expression into an array of tokens hashes that - * contain a 'type', 'value', and 'key'. - * - * @param string $input JMESPath input - * - * @return array - * @throws SyntaxErrorException - */ - public function tokenize($input) - { - $tokens = []; - - if ($input === '') { - goto eof; - } - - $chars = str_split($input); - - while (false !== ($current = current($chars))) { - - // Every character must be in the transition character table. - if (!isset(self::$transitionTable[$current])) { - $tokens[] = [ - 'type' => self::T_UNKNOWN, - 'pos' => key($chars), - 'value' => $current - ]; - next($chars); - continue; - } - - $state = self::$transitionTable[$current]; - - if ($state === self::STATE_SINGLE_CHAR) { - - // Consume simple tokens like ".", ",", "@", etc. - $tokens[] = [ - 'type' => $this->simpleTokens[$current], - 'pos' => key($chars), - 'value' => $current - ]; - next($chars); - - } elseif ($state === self::STATE_IDENTIFIER) { - - // Consume identifiers - $start = key($chars); - $buffer = ''; - do { - $buffer .= $current; - $current = next($chars); - } while ($current !== false && isset($this->validIdentifier[$current])); - $tokens[] = [ - 'type' => self::T_IDENTIFIER, - 'value' => $buffer, - 'pos' => $start - ]; - - } elseif ($state === self::STATE_WHITESPACE) { - - // Skip whitespace - next($chars); - - } elseif ($state === self::STATE_LBRACKET) { - - // Consume "[", "[?", and "[]" - $position = key($chars); - $actual = next($chars); - if ($actual === ']') { - next($chars); - $tokens[] = [ - 'type' => self::T_FLATTEN, - 'pos' => $position, - 'value' => '[]' - ]; - } elseif ($actual === '?') { - next($chars); - $tokens[] = [ - 'type' => self::T_FILTER, - 'pos' => $position, - 'value' => '[?' - ]; - } else { - $tokens[] = [ - 'type' => self::T_LBRACKET, - 'pos' => $position, - 'value' => '[' - ]; - } - - } elseif ($state === self::STATE_STRING_LITERAL) { - - // Consume raw string literals - $t = $this->inside($chars, "'", self::T_LITERAL); - $t['value'] = str_replace("\\'", "'", $t['value']); - $tokens[] = $t; - - } elseif ($state === self::STATE_PIPE) { - - // Consume pipe and OR - $tokens[] = $this->matchOr($chars, '|', '|', self::T_OR, self::T_PIPE); - - } elseif ($state == self::STATE_JSON_LITERAL) { - - // Consume JSON literals - $token = $this->inside($chars, '`', self::T_LITERAL); - if ($token['type'] === self::T_LITERAL) { - $token['value'] = str_replace('\\`', '`', $token['value']); - $token = $this->parseJson($token); - } - $tokens[] = $token; - - } elseif ($state == self::STATE_NUMBER) { - - // Consume numbers - $start = key($chars); - $buffer = ''; - do { - $buffer .= $current; - $current = next($chars); - } while ($current !== false && isset($this->numbers[$current])); - $tokens[] = [ - 'type' => self::T_NUMBER, - 'value' => (int)$buffer, - 'pos' => $start - ]; - - } elseif ($state === self::STATE_QUOTED_STRING) { - - // Consume quoted identifiers - $token = $this->inside($chars, '"', self::T_QUOTED_IDENTIFIER); - if ($token['type'] === self::T_QUOTED_IDENTIFIER) { - $token['value'] = '"' . $token['value'] . '"'; - $token = $this->parseJson($token); - } - $tokens[] = $token; - - } elseif ($state === self::STATE_EQ) { - - // Consume equals - $tokens[] = $this->matchOr($chars, '=', '=', self::T_COMPARATOR, self::T_UNKNOWN); - - } elseif ($state == self::STATE_AND) { - - $tokens[] = $this->matchOr($chars, '&', '&', self::T_AND, self::T_EXPREF); - - } elseif ($state === self::STATE_NOT) { - - // Consume not equal - $tokens[] = $this->matchOr($chars, '!', '=', self::T_COMPARATOR, self::T_NOT); - - } else { - - // either '<' or '>' - // Consume less than and greater than - $tokens[] = $this->matchOr($chars, $current, '=', self::T_COMPARATOR, self::T_COMPARATOR); - - } - } - - eof: - $tokens[] = [ - 'type' => self::T_EOF, - 'pos' => strlen($input), - 'value' => null - ]; - - return $tokens; - } - - /** - * Returns a token based on whether or not the next token matches the - * expected value. If it does, a token of "$type" is returned. Otherwise, - * a token of "$orElse" type is returned. - * - * @param array $chars Array of characters by reference. - * @param string $current The current character. - * @param string $expected Expected character. - * @param string $type Expected result type. - * @param string $orElse Otherwise return a token of this type. - * - * @return array Returns a conditional token. - */ - private function matchOr(array &$chars, $current, $expected, $type, $orElse) - { - if (next($chars) === $expected) { - next($chars); - return [ - 'type' => $type, - 'pos' => key($chars) - 1, - 'value' => $current . $expected - ]; - } - - return [ - 'type' => $orElse, - 'pos' => key($chars) - 1, - 'value' => $current - ]; - } - - /** - * Returns a token the is the result of consuming inside of delimiter - * characters. Escaped delimiters will be adjusted before returning a - * value. If the token is not closed, "unknown" is returned. - * - * @param array $chars Array of characters by reference. - * @param string $delim The delimiter character. - * @param string $type Token type. - * - * @return array Returns the consumed token. - */ - private function inside(array &$chars, $delim, $type) - { - $position = key($chars); - $current = next($chars); - $buffer = ''; - - while ($current !== $delim) { - if ($current === '\\') { - $buffer .= '\\'; - $current = next($chars); - } - if ($current === false) { - // Unclosed delimiter - return [ - 'type' => self::T_UNKNOWN, - 'value' => $buffer, - 'pos' => $position - ]; - } - $buffer .= $current; - $current = next($chars); - } - - next($chars); - - return ['type' => $type, 'value' => $buffer, 'pos' => $position]; - } - - /** - * Parses a JSON token or sets the token type to "unknown" on error. - * - * @param array $token Token that needs parsing. - * - * @return array Returns a token with a parsed value. - */ - private function parseJson(array $token) - { - $value = json_decode($token['value'], true); - - if ($error = json_last_error()) { - // Legacy support for elided quotes. Try to parse again by adding - // quotes around the bad input value. - $value = json_decode('"' . $token['value'] . '"', true); - if ($error = json_last_error()) { - $token['type'] = self::T_UNKNOWN; - return $token; - } - } - - $token['value'] = $value; - return $token; - } -} diff --git a/vendor/mtdowling/jmespath.php/src/Parser.php b/vendor/mtdowling/jmespath.php/src/Parser.php deleted file mode 100644 index 3b0b29ad..00000000 --- a/vendor/mtdowling/jmespath.php/src/Parser.php +++ /dev/null @@ -1,518 +0,0 @@ - T::T_EOF]; - private static $currentNode = ['type' => T::T_CURRENT]; - - private static $bp = [ - T::T_EOF => 0, - T::T_QUOTED_IDENTIFIER => 0, - T::T_IDENTIFIER => 0, - T::T_RBRACKET => 0, - T::T_RPAREN => 0, - T::T_COMMA => 0, - T::T_RBRACE => 0, - T::T_NUMBER => 0, - T::T_CURRENT => 0, - T::T_EXPREF => 0, - T::T_COLON => 0, - T::T_PIPE => 1, - T::T_OR => 2, - T::T_AND => 3, - T::T_COMPARATOR => 5, - T::T_FLATTEN => 9, - T::T_STAR => 20, - T::T_FILTER => 21, - T::T_DOT => 40, - T::T_NOT => 45, - T::T_LBRACE => 50, - T::T_LBRACKET => 55, - T::T_LPAREN => 60, - ]; - - /** @var array Acceptable tokens after a dot token */ - private static $afterDot = [ - T::T_IDENTIFIER => true, // foo.bar - T::T_QUOTED_IDENTIFIER => true, // foo."bar" - T::T_STAR => true, // foo.* - T::T_LBRACE => true, // foo[1] - T::T_LBRACKET => true, // foo{a: 0} - T::T_FILTER => true, // foo.[?bar==10] - ]; - - /** - * @param Lexer $lexer Lexer used to tokenize expressions - */ - public function __construct(Lexer $lexer = null) - { - $this->lexer = $lexer ?: new Lexer(); - } - - /** - * Parses a JMESPath expression into an AST - * - * @param string $expression JMESPath expression to compile - * - * @return array Returns an array based AST - * @throws SyntaxErrorException - */ - public function parse($expression) - { - $this->expression = $expression; - $this->tokens = $this->lexer->tokenize($expression); - $this->tpos = -1; - $this->next(); - $result = $this->expr(); - - if ($this->token['type'] === T::T_EOF) { - return $result; - } - - throw $this->syntax('Did not reach the end of the token stream'); - } - - /** - * Parses an expression while rbp < lbp. - * - * @param int $rbp Right bound precedence - * - * @return array - */ - private function expr($rbp = 0) - { - $left = $this->{"nud_{$this->token['type']}"}(); - while ($rbp < self::$bp[$this->token['type']]) { - $left = $this->{"led_{$this->token['type']}"}($left); - } - - return $left; - } - - private function nud_identifier() - { - $token = $this->token; - $this->next(); - return ['type' => 'field', 'value' => $token['value']]; - } - - private function nud_quoted_identifier() - { - $token = $this->token; - $this->next(); - $this->assertNotToken(T::T_LPAREN); - return ['type' => 'field', 'value' => $token['value']]; - } - - private function nud_current() - { - $this->next(); - return self::$currentNode; - } - - private function nud_literal() - { - $token = $this->token; - $this->next(); - return ['type' => 'literal', 'value' => $token['value']]; - } - - private function nud_expref() - { - $this->next(); - return ['type' => T::T_EXPREF, 'children' => [$this->expr(self::$bp[T::T_EXPREF])]]; - } - - private function nud_not() - { - $this->next(); - return ['type' => T::T_NOT, 'children' => [$this->expr(self::$bp[T::T_NOT])]]; - } - - private function nud_lparen() { - $this->next(); - $result = $this->expr(0); - if ($this->token['type'] !== T::T_RPAREN) { - throw $this->syntax('Unclosed `(`'); - } - $this->next(); - return $result; - } - - private function nud_lbrace() - { - static $validKeys = [T::T_QUOTED_IDENTIFIER => true, T::T_IDENTIFIER => true]; - $this->next($validKeys); - $pairs = []; - - do { - $pairs[] = $this->parseKeyValuePair(); - if ($this->token['type'] == T::T_COMMA) { - $this->next($validKeys); - } - } while ($this->token['type'] !== T::T_RBRACE); - - $this->next(); - - return['type' => 'multi_select_hash', 'children' => $pairs]; - } - - private function nud_flatten() - { - return $this->led_flatten(self::$currentNode); - } - - private function nud_filter() - { - return $this->led_filter(self::$currentNode); - } - - private function nud_star() - { - return $this->parseWildcardObject(self::$currentNode); - } - - private function nud_lbracket() - { - $this->next(); - $type = $this->token['type']; - if ($type == T::T_NUMBER || $type == T::T_COLON) { - return $this->parseArrayIndexExpression(); - } elseif ($type == T::T_STAR && $this->lookahead() == T::T_RBRACKET) { - return $this->parseWildcardArray(); - } else { - return $this->parseMultiSelectList(); - } - } - - private function led_lbracket(array $left) - { - static $nextTypes = [T::T_NUMBER => true, T::T_COLON => true, T::T_STAR => true]; - $this->next($nextTypes); - switch ($this->token['type']) { - case T::T_NUMBER: - case T::T_COLON: - return [ - 'type' => 'subexpression', - 'children' => [$left, $this->parseArrayIndexExpression()] - ]; - default: - return $this->parseWildcardArray($left); - } - } - - private function led_flatten(array $left) - { - $this->next(); - - return [ - 'type' => 'projection', - 'from' => 'array', - 'children' => [ - ['type' => T::T_FLATTEN, 'children' => [$left]], - $this->parseProjection(self::$bp[T::T_FLATTEN]) - ] - ]; - } - - private function led_dot(array $left) - { - $this->next(self::$afterDot); - - if ($this->token['type'] == T::T_STAR) { - return $this->parseWildcardObject($left); - } - - return [ - 'type' => 'subexpression', - 'children' => [$left, $this->parseDot(self::$bp[T::T_DOT])] - ]; - } - - private function led_or(array $left) - { - $this->next(); - return [ - 'type' => T::T_OR, - 'children' => [$left, $this->expr(self::$bp[T::T_OR])] - ]; - } - - private function led_and(array $left) - { - $this->next(); - return [ - 'type' => T::T_AND, - 'children' => [$left, $this->expr(self::$bp[T::T_AND])] - ]; - } - - private function led_pipe(array $left) - { - $this->next(); - return [ - 'type' => T::T_PIPE, - 'children' => [$left, $this->expr(self::$bp[T::T_PIPE])] - ]; - } - - private function led_lparen(array $left) - { - $args = []; - $this->next(); - - while ($this->token['type'] != T::T_RPAREN) { - $args[] = $this->expr(0); - if ($this->token['type'] == T::T_COMMA) { - $this->next(); - } - } - - $this->next(); - - return [ - 'type' => 'function', - 'value' => $left['value'], - 'children' => $args - ]; - } - - private function led_filter(array $left) - { - $this->next(); - $expression = $this->expr(); - if ($this->token['type'] != T::T_RBRACKET) { - throw $this->syntax('Expected a closing rbracket for the filter'); - } - - $this->next(); - $rhs = $this->parseProjection(self::$bp[T::T_FILTER]); - - return [ - 'type' => 'projection', - 'from' => 'array', - 'children' => [ - $left ?: self::$currentNode, - [ - 'type' => 'condition', - 'children' => [$expression, $rhs] - ] - ] - ]; - } - - private function led_comparator(array $left) - { - $token = $this->token; - $this->next(); - - return [ - 'type' => T::T_COMPARATOR, - 'value' => $token['value'], - 'children' => [$left, $this->expr(self::$bp[T::T_COMPARATOR])] - ]; - } - - private function parseProjection($bp) - { - $type = $this->token['type']; - if (self::$bp[$type] < 10) { - return self::$currentNode; - } elseif ($type == T::T_DOT) { - $this->next(self::$afterDot); - return $this->parseDot($bp); - } elseif ($type == T::T_LBRACKET || $type == T::T_FILTER) { - return $this->expr($bp); - } - - throw $this->syntax('Syntax error after projection'); - } - - private function parseDot($bp) - { - if ($this->token['type'] == T::T_LBRACKET) { - $this->next(); - return $this->parseMultiSelectList(); - } - - return $this->expr($bp); - } - - private function parseKeyValuePair() - { - static $validColon = [T::T_COLON => true]; - $key = $this->token['value']; - $this->next($validColon); - $this->next(); - - return [ - 'type' => 'key_val_pair', - 'value' => $key, - 'children' => [$this->expr()] - ]; - } - - private function parseWildcardObject(array $left = null) - { - $this->next(); - - return [ - 'type' => 'projection', - 'from' => 'object', - 'children' => [ - $left ?: self::$currentNode, - $this->parseProjection(self::$bp[T::T_STAR]) - ] - ]; - } - - private function parseWildcardArray(array $left = null) - { - static $getRbracket = [T::T_RBRACKET => true]; - $this->next($getRbracket); - $this->next(); - - return [ - 'type' => 'projection', - 'from' => 'array', - 'children' => [ - $left ?: self::$currentNode, - $this->parseProjection(self::$bp[T::T_STAR]) - ] - ]; - } - - /** - * Parses an array index expression (e.g., [0], [1:2:3] - */ - private function parseArrayIndexExpression() - { - static $matchNext = [ - T::T_NUMBER => true, - T::T_COLON => true, - T::T_RBRACKET => true - ]; - - $pos = 0; - $parts = [null, null, null]; - $expected = $matchNext; - - do { - if ($this->token['type'] == T::T_COLON) { - $pos++; - $expected = $matchNext; - } elseif ($this->token['type'] == T::T_NUMBER) { - $parts[$pos] = $this->token['value']; - $expected = [T::T_COLON => true, T::T_RBRACKET => true]; - } - $this->next($expected); - } while ($this->token['type'] != T::T_RBRACKET); - - // Consume the closing bracket - $this->next(); - - if ($pos === 0) { - // No colons were found so this is a simple index extraction - return ['type' => 'index', 'value' => $parts[0]]; - } - - if ($pos > 2) { - throw $this->syntax('Invalid array slice syntax: too many colons'); - } - - // Sliced array from start (e.g., [2:]) - return [ - 'type' => 'projection', - 'from' => 'array', - 'children' => [ - ['type' => 'slice', 'value' => $parts], - $this->parseProjection(self::$bp[T::T_STAR]) - ] - ]; - } - - private function parseMultiSelectList() - { - $nodes = []; - - do { - $nodes[] = $this->expr(); - if ($this->token['type'] == T::T_COMMA) { - $this->next(); - $this->assertNotToken(T::T_RBRACKET); - } - } while ($this->token['type'] !== T::T_RBRACKET); - $this->next(); - - return ['type' => 'multi_select_list', 'children' => $nodes]; - } - - private function syntax($msg) - { - return new SyntaxErrorException($msg, $this->token, $this->expression); - } - - private function lookahead() - { - return (!isset($this->tokens[$this->tpos + 1])) - ? T::T_EOF - : $this->tokens[$this->tpos + 1]['type']; - } - - private function next(array $match = null) - { - if (!isset($this->tokens[$this->tpos + 1])) { - $this->token = self::$nullToken; - } else { - $this->token = $this->tokens[++$this->tpos]; - } - - if ($match && !isset($match[$this->token['type']])) { - throw $this->syntax($match); - } - } - - private function assertNotToken($type) - { - if ($this->token['type'] == $type) { - throw $this->syntax("Token {$this->tpos} not allowed to be $type"); - } - } - - /** - * @internal Handles undefined tokens without paying the cost of validation - */ - public function __call($method, $args) - { - $prefix = substr($method, 0, 4); - if ($prefix == 'nud_' || $prefix == 'led_') { - $token = substr($method, 4); - $message = "Unexpected \"$token\" token ($method). Expected one of" - . " the following tokens: " - . implode(', ', array_map(function ($i) { - return '"' . substr($i, 4) . '"'; - }, array_filter( - get_class_methods($this), - function ($i) use ($prefix) { - return strpos($i, $prefix) === 0; - } - ))); - throw $this->syntax($message); - } - - throw new \BadMethodCallException("Call to undefined method $method"); - } -} diff --git a/vendor/mtdowling/jmespath.php/src/SyntaxErrorException.php b/vendor/mtdowling/jmespath.php/src/SyntaxErrorException.php deleted file mode 100644 index 65be17ec..00000000 --- a/vendor/mtdowling/jmespath.php/src/SyntaxErrorException.php +++ /dev/null @@ -1,36 +0,0 @@ -createTokenMessage($token, $expectedTypesOrMessage); - parent::__construct($message); - } - - private function createTokenMessage(array $token, array $valid) - { - return sprintf( - 'Expected one of the following: %s; found %s "%s"', - implode(', ', array_keys($valid)), - $token['type'], - $token['value'] - ); - } -} diff --git a/vendor/mtdowling/jmespath.php/src/TreeCompiler.php b/vendor/mtdowling/jmespath.php/src/TreeCompiler.php deleted file mode 100644 index afb0d9c7..00000000 --- a/vendor/mtdowling/jmespath.php/src/TreeCompiler.php +++ /dev/null @@ -1,419 +0,0 @@ -vars = []; - $this->source = $this->indentation = ''; - $this->write("write('use JmesPath\\TreeInterpreter as Ti;') - ->write('use JmesPath\\FnDispatcher as Fn;') - ->write('use JmesPath\\Utils;') - ->write('') - ->write('function %s(Ti $interpreter, $value) {', $fnName) - ->indent() - ->dispatch($ast) - ->write('') - ->write('return $value;') - ->outdent() - ->write('}'); - - return $this->source; - } - - /** - * @param array $node - * @return mixed - */ - private function dispatch(array $node) - { - return $this->{"visit_{$node['type']}"}($node); - } - - /** - * Creates a monotonically incrementing unique variable name by prefix. - * - * @param string $prefix Variable name prefix - * - * @return string - */ - private function makeVar($prefix) - { - if (!isset($this->vars[$prefix])) { - $this->vars[$prefix] = 0; - return '$' . $prefix; - } - - return '$' . $prefix . ++$this->vars[$prefix]; - } - - /** - * Writes the given line of source code. Pass positional arguments to write - * that match the format of sprintf. - * - * @param string $str String to write - * @return $this - */ - private function write($str) - { - $this->source .= $this->indentation; - if (func_num_args() == 1) { - $this->source .= $str . "\n"; - return $this; - } - $this->source .= vsprintf($str, array_slice(func_get_args(), 1)) . "\n"; - return $this; - } - - /** - * Decreases the indentation level of code being written - * @return $this - */ - private function outdent() - { - $this->indentation = substr($this->indentation, 0, -4); - return $this; - } - - /** - * Increases the indentation level of code being written - * @return $this - */ - private function indent() - { - $this->indentation .= ' '; - return $this; - } - - private function visit_or(array $node) - { - $a = $this->makeVar('beforeOr'); - return $this - ->write('%s = $value;', $a) - ->dispatch($node['children'][0]) - ->write('if (!$value && $value !== "0" && $value !== 0) {') - ->indent() - ->write('$value = %s;', $a) - ->dispatch($node['children'][1]) - ->outdent() - ->write('}'); - } - - private function visit_and(array $node) - { - $a = $this->makeVar('beforeAnd'); - return $this - ->write('%s = $value;', $a) - ->dispatch($node['children'][0]) - ->write('if ($value || $value === "0" || $value === 0) {') - ->indent() - ->write('$value = %s;', $a) - ->dispatch($node['children'][1]) - ->outdent() - ->write('}'); - } - - private function visit_not(array $node) - { - return $this - ->write('// Visiting not node') - ->dispatch($node['children'][0]) - ->write('// Applying boolean not to result of not node') - ->write('$value = !Utils::isTruthy($value);'); - } - - private function visit_subexpression(array $node) - { - return $this - ->dispatch($node['children'][0]) - ->write('if ($value !== null) {') - ->indent() - ->dispatch($node['children'][1]) - ->outdent() - ->write('}'); - } - - private function visit_field(array $node) - { - $arr = '$value[' . var_export($node['value'], true) . ']'; - $obj = '$value->{' . var_export($node['value'], true) . '}'; - $this->write('if (is_array($value) || $value instanceof \\ArrayAccess) {') - ->indent() - ->write('$value = isset(%s) ? %s : null;', $arr, $arr) - ->outdent() - ->write('} elseif ($value instanceof \\stdClass) {') - ->indent() - ->write('$value = isset(%s) ? %s : null;', $obj, $obj) - ->outdent() - ->write("} else {") - ->indent() - ->write('$value = null;') - ->outdent() - ->write("}"); - - return $this; - } - - private function visit_index(array $node) - { - if ($node['value'] >= 0) { - $check = '$value[' . $node['value'] . ']'; - return $this->write( - '$value = (is_array($value) || $value instanceof \\ArrayAccess)' - . ' && isset(%s) ? %s : null;', - $check, $check - ); - } - - $a = $this->makeVar('count'); - return $this - ->write('if (is_array($value) || ($value instanceof \\ArrayAccess && $value instanceof \\Countable)) {') - ->indent() - ->write('%s = count($value) + %s;', $a, $node['value']) - ->write('$value = isset($value[%s]) ? $value[%s] : null;', $a, $a) - ->outdent() - ->write('} else {') - ->indent() - ->write('$value = null;') - ->outdent() - ->write('}'); - } - - private function visit_literal(array $node) - { - return $this->write('$value = %s;', var_export($node['value'], true)); - } - - private function visit_pipe(array $node) - { - return $this - ->dispatch($node['children'][0]) - ->dispatch($node['children'][1]); - } - - private function visit_multi_select_list(array $node) - { - return $this->visit_multi_select_hash($node); - } - - private function visit_multi_select_hash(array $node) - { - $listVal = $this->makeVar('list'); - $value = $this->makeVar('prev'); - $this->write('if ($value !== null) {') - ->indent() - ->write('%s = [];', $listVal) - ->write('%s = $value;', $value); - - $first = true; - foreach ($node['children'] as $child) { - if (!$first) { - $this->write('$value = %s;', $value); - } - $first = false; - if ($node['type'] == 'multi_select_hash') { - $this->dispatch($child['children'][0]); - $key = var_export($child['value'], true); - $this->write('%s[%s] = $value;', $listVal, $key); - } else { - $this->dispatch($child); - $this->write('%s[] = $value;', $listVal); - } - } - - return $this - ->write('$value = %s;', $listVal) - ->outdent() - ->write('}'); - } - - private function visit_function(array $node) - { - $value = $this->makeVar('val'); - $args = $this->makeVar('args'); - $this->write('%s = $value;', $value) - ->write('%s = [];', $args); - - foreach ($node['children'] as $arg) { - $this->dispatch($arg); - $this->write('%s[] = $value;', $args) - ->write('$value = %s;', $value); - } - - return $this->write( - '$value = Fn::getInstance()->__invoke("%s", %s);', - $node['value'], $args - ); - } - - private function visit_slice(array $node) - { - return $this - ->write('$value = !is_string($value) && !Utils::isArray($value)') - ->write(' ? null : Utils::slice($value, %s, %s, %s);', - var_export($node['value'][0], true), - var_export($node['value'][1], true), - var_export($node['value'][2], true) - ); - } - - private function visit_current(array $node) - { - return $this->write('// Visiting current node (no-op)'); - } - - private function visit_expref(array $node) - { - $child = var_export($node['children'][0], true); - return $this->write('$value = function ($value) use ($interpreter) {') - ->indent() - ->write('return $interpreter->visit(%s, $value);', $child) - ->outdent() - ->write('};'); - } - - private function visit_flatten(array $node) - { - $this->dispatch($node['children'][0]); - $merged = $this->makeVar('merged'); - $val = $this->makeVar('val'); - - $this - ->write('// Visiting merge node') - ->write('if (!Utils::isArray($value)) {') - ->indent() - ->write('$value = null;') - ->outdent() - ->write('} else {') - ->indent() - ->write('%s = [];', $merged) - ->write('foreach ($value as %s) {', $val) - ->indent() - ->write('if (is_array(%s) && isset(%s[0])) {', $val, $val) - ->indent() - ->write('%s = array_merge(%s, %s);', $merged, $merged, $val) - ->outdent() - ->write('} elseif (%s !== []) {', $val) - ->indent() - ->write('%s[] = %s;', $merged, $val) - ->outdent() - ->write('}') - ->outdent() - ->write('}') - ->write('$value = %s;', $merged) - ->outdent() - ->write('}'); - - return $this; - } - - private function visit_projection(array $node) - { - $val = $this->makeVar('val'); - $collected = $this->makeVar('collected'); - $this->write('// Visiting projection node') - ->dispatch($node['children'][0]) - ->write(''); - - if (!isset($node['from'])) { - $this->write('if (!is_array($value) || !($value instanceof \stdClass)) { $value = null; }'); - } elseif ($node['from'] == 'object') { - $this->write('if (!Utils::isObject($value)) { $value = null; }'); - } elseif ($node['from'] == 'array') { - $this->write('if (!Utils::isArray($value)) { $value = null; }'); - } - - $this->write('if ($value !== null) {') - ->indent() - ->write('%s = [];', $collected) - ->write('foreach ((array) $value as %s) {', $val) - ->indent() - ->write('$value = %s;', $val) - ->dispatch($node['children'][1]) - ->write('if ($value !== null) {') - ->indent() - ->write('%s[] = $value;', $collected) - ->outdent() - ->write('}') - ->outdent() - ->write('}') - ->write('$value = %s;', $collected) - ->outdent() - ->write('}'); - - return $this; - } - - private function visit_condition(array $node) - { - $value = $this->makeVar('beforeCondition'); - return $this - ->write('%s = $value;', $value) - ->write('// Visiting condition node') - ->dispatch($node['children'][0]) - ->write('// Checking result of condition node') - ->write('if (Utils::isTruthy($value)) {') - ->indent() - ->write('$value = %s;', $value) - ->dispatch($node['children'][1]) - ->outdent() - ->write('} else {') - ->indent() - ->write('$value = null;') - ->outdent() - ->write('}'); - } - - private function visit_comparator(array $node) - { - $value = $this->makeVar('val'); - $a = $this->makeVar('left'); - $b = $this->makeVar('right'); - - $this - ->write('// Visiting comparator node') - ->write('%s = $value;', $value) - ->dispatch($node['children'][0]) - ->write('%s = $value;', $a) - ->write('$value = %s;', $value) - ->dispatch($node['children'][1]) - ->write('%s = $value;', $b); - - if ($node['value'] == '==') { - $this->write('$value = Utils::isEqual(%s, %s);', $a, $b); - } elseif ($node['value'] == '!=') { - $this->write('$value = !Utils::isEqual(%s, %s);', $a, $b); - } else { - $this->write( - '$value = (is_int(%s) || is_float(%s)) && (is_int(%s) || is_float(%s)) && %s %s %s;', - $a, $a, $b, $b, $a, $node['value'], $b - ); - } - - return $this; - } - - /** @internal */ - public function __call($method, $args) - { - throw new \RuntimeException( - sprintf('Invalid node encountered: %s', json_encode($args[0])) - ); - } -} diff --git a/vendor/mtdowling/jmespath.php/src/TreeInterpreter.php b/vendor/mtdowling/jmespath.php/src/TreeInterpreter.php deleted file mode 100644 index cdfdd99a..00000000 --- a/vendor/mtdowling/jmespath.php/src/TreeInterpreter.php +++ /dev/null @@ -1,235 +0,0 @@ -fnDispatcher = $fnDispatcher ?: FnDispatcher::getInstance(); - } - - /** - * Visits each node in a JMESPath AST and returns the evaluated result. - * - * @param array $node JMESPath AST node - * @param mixed $data Data to evaluate - * - * @return mixed - */ - public function visit(array $node, $data) - { - return $this->dispatch($node, $data); - } - - /** - * Recursively traverses an AST using depth-first, pre-order traversal. - * The evaluation logic for each node type is embedded into a large switch - * statement to avoid the cost of "double dispatch". - * @return mixed - */ - private function dispatch(array $node, $value) - { - $dispatcher = $this->fnDispatcher; - - switch ($node['type']) { - - case 'field': - if (is_array($value) || $value instanceof \ArrayAccess) { - return isset($value[$node['value']]) ? $value[$node['value']] : null; - } elseif ($value instanceof \stdClass) { - return isset($value->{$node['value']}) ? $value->{$node['value']} : null; - } - return null; - - case 'subexpression': - return $this->dispatch( - $node['children'][1], - $this->dispatch($node['children'][0], $value) - ); - - case 'index': - if (!Utils::isArray($value)) { - return null; - } - $idx = $node['value'] >= 0 - ? $node['value'] - : $node['value'] + count($value); - return isset($value[$idx]) ? $value[$idx] : null; - - case 'projection': - $left = $this->dispatch($node['children'][0], $value); - switch ($node['from']) { - case 'object': - if (!Utils::isObject($left)) { - return null; - } - break; - case 'array': - if (!Utils::isArray($left)) { - return null; - } - break; - default: - if (!is_array($left) || !($left instanceof \stdClass)) { - return null; - } - } - - $collected = []; - foreach ((array) $left as $val) { - $result = $this->dispatch($node['children'][1], $val); - if ($result !== null) { - $collected[] = $result; - } - } - - return $collected; - - case 'flatten': - static $skipElement = []; - $value = $this->dispatch($node['children'][0], $value); - - if (!Utils::isArray($value)) { - return null; - } - - $merged = []; - foreach ($value as $values) { - // Only merge up arrays lists and not hashes - if (is_array($values) && isset($values[0])) { - $merged = array_merge($merged, $values); - } elseif ($values !== $skipElement) { - $merged[] = $values; - } - } - - return $merged; - - case 'literal': - return $node['value']; - - case 'current': - return $value; - - case 'or': - $result = $this->dispatch($node['children'][0], $value); - return Utils::isTruthy($result) - ? $result - : $this->dispatch($node['children'][1], $value); - - case 'and': - $result = $this->dispatch($node['children'][0], $value); - return Utils::isTruthy($result) - ? $this->dispatch($node['children'][1], $value) - : $result; - - case 'not': - return !Utils::isTruthy( - $this->dispatch($node['children'][0], $value) - ); - - case 'pipe': - return $this->dispatch( - $node['children'][1], - $this->dispatch($node['children'][0], $value) - ); - - case 'multi_select_list': - if ($value === null) { - return null; - } - - $collected = []; - foreach ($node['children'] as $node) { - $collected[] = $this->dispatch($node, $value); - } - - return $collected; - - case 'multi_select_hash': - if ($value === null) { - return null; - } - - $collected = []; - foreach ($node['children'] as $node) { - $collected[$node['value']] = $this->dispatch( - $node['children'][0], - $value - ); - } - - return $collected; - - case 'comparator': - $left = $this->dispatch($node['children'][0], $value); - $right = $this->dispatch($node['children'][1], $value); - if ($node['value'] == '==') { - return Utils::isEqual($left, $right); - } elseif ($node['value'] == '!=') { - return !Utils::isEqual($left, $right); - } else { - return self::relativeCmp($left, $right, $node['value']); - } - - case 'condition': - return Utils::isTruthy($this->dispatch($node['children'][0], $value)) - ? $this->dispatch($node['children'][1], $value) - : null; - - case 'function': - $args = []; - foreach ($node['children'] as $arg) { - $args[] = $this->dispatch($arg, $value); - } - return $dispatcher($node['value'], $args); - - case 'slice': - return is_string($value) || Utils::isArray($value) - ? Utils::slice( - $value, - $node['value'][0], - $node['value'][1], - $node['value'][2] - ) : null; - - case 'expref': - $apply = $node['children'][0]; - return function ($value) use ($apply) { - return $this->visit($apply, $value); - }; - - default: - throw new \RuntimeException("Unknown node type: {$node['type']}"); - } - } - - /** - * @return bool - */ - private static function relativeCmp($left, $right, $cmp) - { - if (!(is_int($left) || is_float($left)) || !(is_int($right) || is_float($right))) { - return false; - } - - switch ($cmp) { - case '>': return $left > $right; - case '>=': return $left >= $right; - case '<': return $left < $right; - case '<=': return $left <= $right; - default: throw new \RuntimeException("Invalid comparison: $cmp"); - } - } -} diff --git a/vendor/mtdowling/jmespath.php/src/Utils.php b/vendor/mtdowling/jmespath.php/src/Utils.php deleted file mode 100644 index 4d0bf95d..00000000 --- a/vendor/mtdowling/jmespath.php/src/Utils.php +++ /dev/null @@ -1,229 +0,0 @@ - 'boolean', - 'string' => 'string', - 'NULL' => 'null', - 'double' => 'number', - 'float' => 'number', - 'integer' => 'number' - ]; - - /** - * Returns true if the value is truthy - * - * @param mixed $value Value to check - * - * @return bool - */ - public static function isTruthy($value) - { - if (!$value) { - return $value === 0 || $value === '0'; - } elseif ($value instanceof \stdClass) { - return (bool) get_object_vars($value); - } else { - return true; - } - } - - /** - * Gets the JMESPath type equivalent of a PHP variable. - * - * @param mixed $arg PHP variable - * @return string Returns the JSON data type - * @throws \InvalidArgumentException when an unknown type is given. - */ - public static function type($arg) - { - $type = gettype($arg); - if (isset(self::$typeMap[$type])) { - return self::$typeMap[$type]; - } elseif ($type === 'array') { - if (empty($arg)) { - return 'array'; - } - reset($arg); - return key($arg) === 0 ? 'array' : 'object'; - } elseif ($arg instanceof \stdClass) { - return 'object'; - } elseif ($arg instanceof \Closure) { - return 'expression'; - } elseif ($arg instanceof \ArrayAccess - && $arg instanceof \Countable - ) { - return count($arg) == 0 || $arg->offsetExists(0) - ? 'array' - : 'object'; - } elseif (method_exists($arg, '__toString')) { - return 'string'; - } - - throw new \InvalidArgumentException( - 'Unable to determine JMESPath type from ' . get_class($arg) - ); - } - - /** - * Determine if the provided value is a JMESPath compatible object. - * - * @param mixed $value - * - * @return bool - */ - public static function isObject($value) - { - if (is_array($value)) { - return !$value || array_keys($value)[0] !== 0; - } - - // Handle array-like values. Must be empty or offset 0 does not exist - return $value instanceof \Countable && $value instanceof \ArrayAccess - ? count($value) == 0 || !$value->offsetExists(0) - : $value instanceof \stdClass; - } - - /** - * Determine if the provided value is a JMESPath compatible array. - * - * @param mixed $value - * - * @return bool - */ - public static function isArray($value) - { - if (is_array($value)) { - return !$value || array_keys($value)[0] === 0; - } - - // Handle array-like values. Must be empty or offset 0 exists. - return $value instanceof \Countable && $value instanceof \ArrayAccess - ? count($value) == 0 || $value->offsetExists(0) - : false; - } - - /** - * JSON aware value comparison function. - * - * @param mixed $a First value to compare - * @param mixed $b Second value to compare - * - * @return bool - */ - public static function isEqual($a, $b) - { - if ($a === $b) { - return true; - } elseif ($a instanceof \stdClass) { - return self::isEqual((array) $a, $b); - } elseif ($b instanceof \stdClass) { - return self::isEqual($a, (array) $b); - } else { - return false; - } - } - - /** - * JMESPath requires a stable sorting algorithm, so here we'll implement - * a simple Schwartzian transform that uses array index positions as tie - * breakers. - * - * @param array $data List or map of data to sort - * @param callable $sortFn Callable used to sort values - * - * @return array Returns the sorted array - * @link http://en.wikipedia.org/wiki/Schwartzian_transform - */ - public static function stableSort(array $data, callable $sortFn) - { - // Decorate each item by creating an array of [value, index] - array_walk($data, function (&$v, $k) { $v = [$v, $k]; }); - // Sort by the sort function and use the index as a tie-breaker - uasort($data, function ($a, $b) use ($sortFn) { - return $sortFn($a[0], $b[0]) ?: ($a[1] < $b[1] ? -1 : 1); - }); - - // Undecorate each item and return the resulting sorted array - return array_map(function ($v) { return $v[0]; }, array_values($data)); - } - - /** - * Creates a Python-style slice of a string or array. - * - * @param array|string $value Value to slice - * @param int|null $start Starting position - * @param int|null $stop Stop position - * @param int $step Step (1, 2, -1, -2, etc.) - * - * @return array|string - * @throws \InvalidArgumentException - */ - public static function slice($value, $start = null, $stop = null, $step = 1) - { - if (!is_array($value) && !is_string($value)) { - throw new \InvalidArgumentException('Expects string or array'); - } - - return self::sliceIndices($value, $start, $stop, $step); - } - - private static function adjustEndpoint($length, $endpoint, $step) - { - if ($endpoint < 0) { - $endpoint += $length; - if ($endpoint < 0) { - $endpoint = $step < 0 ? -1 : 0; - } - } elseif ($endpoint >= $length) { - $endpoint = $step < 0 ? $length - 1 : $length; - } - - return $endpoint; - } - - private static function adjustSlice($length, $start, $stop, $step) - { - if ($step === null) { - $step = 1; - } elseif ($step === 0) { - throw new \RuntimeException('step cannot be 0'); - } - - if ($start === null) { - $start = $step < 0 ? $length - 1 : 0; - } else { - $start = self::adjustEndpoint($length, $start, $step); - } - - if ($stop === null) { - $stop = $step < 0 ? -1 : $length; - } else { - $stop = self::adjustEndpoint($length, $stop, $step); - } - - return [$start, $stop, $step]; - } - - private static function sliceIndices($subject, $start, $stop, $step) - { - $type = gettype($subject); - $len = $type == 'string' ? strlen($subject) : count($subject); - list($start, $stop, $step) = self::adjustSlice($len, $start, $stop, $step); - - $result = []; - if ($step > 0) { - for ($i = $start; $i < $stop; $i += $step) { - $result[] = $subject[$i]; - } - } else { - for ($i = $start; $i > $stop; $i += $step) { - $result[] = $subject[$i]; - } - } - - return $type == 'string' ? implode($result, '') : $result; - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/ComplianceTest.php b/vendor/mtdowling/jmespath.php/tests/ComplianceTest.php deleted file mode 100644 index 5f27f39a..00000000 --- a/vendor/mtdowling/jmespath.php/tests/ComplianceTest.php +++ /dev/null @@ -1,136 +0,0 @@ -getMessage(), - $e->getFile(), - $e->getLine() - ); - } - - $file = __DIR__ . '/compliance/' . $file . '.json'; - $failure .= "\n{$compiledStr}php bin/jp.php --file {$file} --suite {$suite} --case {$case}\n\n" - . "Expected: " . $this->prettyJson($result) . "\n\n"; - $failure .= 'Associative? ' . var_export($asAssoc, true) . "\n\n"; - - if (!$error && $failed) { - $this->fail("Should not have failed\n{$failure}=> {$failed} {$failureMsg}"); - } elseif ($error && !$failed) { - $this->fail("Should have failed\n{$failure}"); - } - - $this->assertEquals( - $this->convertAssoc($result), - $this->convertAssoc($evalResult), - $failure - ); - } - - public function complianceProvider() - { - $cases = []; - - $files = array_map(function ($f) { - return basename($f, '.json'); - }, glob(__DIR__ . '/compliance/*.json')); - - foreach ($files as $name) { - $contents = file_get_contents(__DIR__ . "/compliance/{$name}.json"); - foreach ([true, false] as $asAssoc) { - $json = json_decode($contents, true); - $jsonObj = json_decode($contents); - foreach ($json as $suiteNumber => $suite) { - $given = $asAssoc ? $suite['given'] : $jsonObj[$suiteNumber]->given; - foreach ($suite['cases'] as $caseNumber => $case) { - $caseData = [ - $given, - $case['expression'], - isset($case['result']) ? $case['result'] : null, - isset($case['error']) ? $case['error'] : false, - $name, - $suiteNumber, - $caseNumber, - false, - $asAssoc - ]; - $cases[] = $caseData; - $caseData[7] = true; - $cases[] = $caseData; - } - } - } - } - - return $cases; - } - - private function convertAssoc($data) - { - if ($data instanceof \stdClass) { - return $this->convertAssoc((array) $data); - } elseif (is_array($data)) { - return array_map([$this, 'convertAssoc'], $data); - } else { - return $data; - } - } - - private function prettyJson($json) - { - if (defined('JSON_PRETTY_PRINT')) { - return json_encode($json, JSON_PRETTY_PRINT); - } - - return json_encode($json); - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/EnvTest.php b/vendor/mtdowling/jmespath.php/tests/EnvTest.php deleted file mode 100644 index 0a2bcaad..00000000 --- a/vendor/mtdowling/jmespath.php/tests/EnvTest.php +++ /dev/null @@ -1,31 +0,0 @@ - 123); - $this->assertEquals(123, Env::search('foo', $data)); - $this->assertEquals(123, Env::search('foo', $data)); - } - - public function testSearchesWithFunction() - { - $data = array('foo' => 123); - $this->assertEquals(123, \JmesPath\search('foo', $data)); - } - - public function testCleansCompileDir() - { - $dir = sys_get_temp_dir(); - $runtime = new CompilerRuntime($dir); - $runtime('@ | @ | @[0][0][0]', []); - $this->assertNotEmpty(glob($dir . '/jmespath_*.php')); - $this->assertGreaterThan(0, Env::cleanCompileDir()); - $this->assertEmpty(glob($dir . '/jmespath_*.php')); - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/FnDispatcherTest.php b/vendor/mtdowling/jmespath.php/tests/FnDispatcherTest.php deleted file mode 100644 index 7252b3e0..00000000 --- a/vendor/mtdowling/jmespath.php/tests/FnDispatcherTest.php +++ /dev/null @@ -1,41 +0,0 @@ -assertEquals('foo', $fn('to_string', ['foo'])); - $this->assertEquals('1', $fn('to_string', [1])); - $this->assertEquals('["foo"]', $fn('to_string', [['foo']])); - $std = new \stdClass(); - $std->foo = 'bar'; - $this->assertEquals('{"foo":"bar"}', $fn('to_string', [$std])); - $this->assertEquals('foo', $fn('to_string', [new _TestStringClass()])); - $this->assertEquals('"foo"', $fn('to_string', [new _TestJsonStringClass()])); - } -} - -class _TestStringClass -{ - public function __toString() - { - return 'foo'; - } -} - -class _TestJsonStringClass implements \JsonSerializable -{ - public function __toString() - { - return 'no!'; - } - - public function jsonSerialize() - { - return 'foo'; - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/LexerTest.php b/vendor/mtdowling/jmespath.php/tests/LexerTest.php deleted file mode 100644 index 3c026da0..00000000 --- a/vendor/mtdowling/jmespath.php/tests/LexerTest.php +++ /dev/null @@ -1,88 +0,0 @@ -tokenize($input); - $this->assertEquals($tokens[0]['type'], $type); - } - - public function testTokenizesJsonLiterals() - { - $l = new Lexer(); - $tokens = $l->tokenize('`null`, `false`, `true`, `"abc"`, `"ab\\"c"`,' - . '`0`, `0.45`, `-0.5`'); - $this->assertNull($tokens[0]['value']); - $this->assertFalse($tokens[2]['value']); - $this->assertTrue($tokens[4]['value']); - $this->assertEquals('abc', $tokens[6]['value']); - $this->assertEquals('ab"c', $tokens[8]['value']); - $this->assertSame(0, $tokens[10]['value']); - $this->assertSame(0.45, $tokens[12]['value']); - $this->assertSame(-0.5, $tokens[14]['value']); - } - - public function testTokenizesJsonNumbers() - { - $l = new Lexer(); - $tokens = $l->tokenize('`10`, `1.2`, `-10.20e-10`, `1.2E+2`'); - $this->assertEquals(10, $tokens[0]['value']); - $this->assertEquals(1.2, $tokens[2]['value']); - $this->assertEquals(-1.02E-9, $tokens[4]['value']); - $this->assertEquals(120, $tokens[6]['value']); - } - - public function testCanWorkWithElidedJsonLiterals() - { - $l = new Lexer(); - $tokens = $l->tokenize('`foo`'); - $this->assertEquals('foo', $tokens[0]['value']); - $this->assertEquals('literal', $tokens[0]['type']); - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/ParserTest.php b/vendor/mtdowling/jmespath.php/tests/ParserTest.php deleted file mode 100644 index e9288da1..00000000 --- a/vendor/mtdowling/jmespath.php/tests/ParserTest.php +++ /dev/null @@ -1,50 +0,0 @@ -parse('.bar'); - } - - /** - * @expectedException \JmesPath\SyntaxErrorException - * @expectedExceptionMessage Syntax error at character 1 - */ - public function testThrowsSyntaxErrorForInvalidSequence() - { - $p = new Parser(new Lexer()); - $p->parse('a,'); - } - - /** - * @expectedException \JmesPath\SyntaxErrorException - * @expectedExceptionMessage Syntax error at character 2 - */ - public function testMatchesAfterFirstToken() - { - $p = new Parser(new Lexer()); - $p->parse('a.,'); - } - - /** - * @expectedException \JmesPath\SyntaxErrorException - * @expectedExceptionMessage Unexpected "eof" token - */ - public function testHandlesEmptyExpressions() - { - (new Parser(new Lexer()))->parse(''); - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/SyntaxErrorExceptionTest.php b/vendor/mtdowling/jmespath.php/tests/SyntaxErrorExceptionTest.php deleted file mode 100644 index 3ba6b6f3..00000000 --- a/vendor/mtdowling/jmespath.php/tests/SyntaxErrorExceptionTest.php +++ /dev/null @@ -1,42 +0,0 @@ - 'comma', 'pos' => 3, 'value' => ','], - 'abc,def' - ); - $expected = <<assertContains($expected, $e->getMessage()); - } - - public function testCreatesWithArray() - { - $e = new SyntaxErrorException( - ['dot' => true, 'eof' => true], - ['type' => 'comma', 'pos' => 3, 'value' => ','], - 'abc,def' - ); - $expected = <<assertContains($expected, $e->getMessage()); - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/TreeCompilerTest.php b/vendor/mtdowling/jmespath.php/tests/TreeCompilerTest.php deleted file mode 100644 index 62b70751..00000000 --- a/vendor/mtdowling/jmespath.php/tests/TreeCompilerTest.php +++ /dev/null @@ -1,23 +0,0 @@ -visit( - ['type' => 'field', 'value' => 'foo'], - 'testing', - 'foo' - ); - $this->assertContains('assertContains('$value = isset($value->{\'foo\'}) ? $value->{\'foo\'} : null;', $source); - $this->assertContains('$value = isset($value[\'foo\']) ? $value[\'foo\'] : null;', $source); - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/TreeInterpreterTest.php b/vendor/mtdowling/jmespath.php/tests/TreeInterpreterTest.php deleted file mode 100644 index 2599eb00..00000000 --- a/vendor/mtdowling/jmespath.php/tests/TreeInterpreterTest.php +++ /dev/null @@ -1,71 +0,0 @@ -assertNull($t->visit(array( - 'type' => 'flatten', - 'children' => array( - array('type' => 'literal', 'value' => 1), - array('type' => 'literal', 'value' => 1) - ) - ), array(), array( - 'runtime' => new AstRuntime() - ))); - } - - public function testWorksWithArrayObjectAsObject() - { - $runtime = new AstRuntime(); - $this->assertEquals('baz', $runtime('foo.bar', new \ArrayObject([ - 'foo' => new \ArrayObject(['bar' => 'baz']) - ]))); - } - - public function testWorksWithArrayObjectAsArray() - { - $runtime = new AstRuntime(); - $this->assertEquals('baz', $runtime('foo[0].bar', new \ArrayObject([ - 'foo' => new \ArrayObject([new \ArrayObject(['bar' => 'baz'])]) - ]))); - } - - public function testWorksWithArrayProjections() - { - $runtime = new AstRuntime(); - $this->assertEquals( - ['baz'], - $runtime('foo[*].bar', new \ArrayObject([ - 'foo' => new \ArrayObject([ - new \ArrayObject([ - 'bar' => 'baz' - ]) - ]) - ])) - ); - } - - public function testWorksWithObjectProjections() - { - $runtime = new AstRuntime(); - $this->assertEquals( - ['baz'], - $runtime('foo.*.bar', new \ArrayObject([ - 'foo' => new \ArrayObject([ - 'abc' => new \ArrayObject([ - 'bar' => 'baz' - ]) - ]) - ])) - ); - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/UtilsTest.php b/vendor/mtdowling/jmespath.php/tests/UtilsTest.php deleted file mode 100644 index 249bc774..00000000 --- a/vendor/mtdowling/jmespath.php/tests/UtilsTest.php +++ /dev/null @@ -1,130 +0,0 @@ - 1], 'object'], - [new \stdClass(), 'object'], - [function () {}, 'expression'], - [new \ArrayObject(), 'array'], - [new \ArrayObject([1, 2]), 'array'], - [new \ArrayObject(['foo' => 'bar']), 'object'], - [new _TestStr(), 'string'] - ]; - } - - /** - * @dataProvider typeProvider - */ - public function testGetsTypes($given, $type) - { - $this->assertEquals($type, Utils::type($given)); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testThrowsForInvalidArg() - { - Utils::type(new _TestClass()); - } - - public function isArrayProvider() - { - return [ - [[], true], - [[1, 2], true], - [['a' => 1], false], - [new _TestClass(), false], - [new \ArrayObject(['a' => 'b']), false], - [new \ArrayObject([1]), true], - [new \stdClass(), false] - ]; - } - - /** - * @dataProvider isArrayProvider - */ - public function testChecksIfArray($given, $result) - { - $this->assertSame($result, Utils::isArray($given)); - } - - public function isObjectProvider() - { - return [ - [[], true], - [[1, 2], false], - [['a' => 1], true], - [new _TestClass(), false], - [new \ArrayObject(['a' => 'b']), true], - [new \ArrayObject([1]), false], - [new \stdClass(), true] - ]; - } - - /** - * @dataProvider isObjectProvider - */ - public function testChecksIfObject($given, $result) - { - $this->assertSame($result, Utils::isObject($given)); - } - - public function testHasStableSort() - { - $data = [new _TestStr(), new _TestStr(), 0, 10, 2]; - $result = Utils::stableSort($data, function ($a, $b) { - $a = (int) (string) $a; - $b = (int) (string) $b; - return $a > $b ? -1 : ($a == $b ? 0 : 1); - }); - $this->assertSame($data[0], $result[0]); - $this->assertSame($data[1], $result[1]); - $this->assertEquals(10, $result[2]); - $this->assertEquals(2, $result[3]); - $this->assertEquals(0, $result[4]); - } - - public function testSlicesArrays() - { - $this->assertEquals([3, 2, 1], Utils::slice([1, 2, 3], null, null, -1)); - $this->assertEquals([1, 3], Utils::slice([1, 2, 3], null, null, 2)); - $this->assertEquals([2, 3], Utils::slice([1, 2, 3], 1)); - } - - public function testSlicesStrings() - { - $this->assertEquals('cba', Utils::slice('abc', null, null, -1)); - $this->assertEquals('ac', Utils::slice('abc', null, null, 2)); - $this->assertEquals('bc', Utils::slice('abc', 1)); - } -} - -class _TestClass implements \ArrayAccess -{ - public function offsetExists($offset) {} - public function offsetGet($offset) {} - public function offsetSet($offset, $value) {} - public function offsetUnset($offset) {} -} - -class _TestStr -{ - public function __toString() - { - return '100'; - } -} diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/basic.json b/vendor/mtdowling/jmespath.php/tests/compliance/basic.json deleted file mode 100644 index d550e969..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/basic.json +++ /dev/null @@ -1,96 +0,0 @@ -[{ - "given": - {"foo": {"bar": {"baz": "correct"}}}, - "cases": [ - { - "expression": "foo", - "result": {"bar": {"baz": "correct"}} - }, - { - "expression": "foo.bar", - "result": {"baz": "correct"} - }, - { - "expression": "foo.bar.baz", - "result": "correct" - }, - { - "expression": "foo\n.\nbar\n.baz", - "result": "correct" - }, - { - "expression": "foo.bar.baz.bad", - "result": null - }, - { - "expression": "foo.bar.bad", - "result": null - }, - { - "expression": "foo.bad", - "result": null - }, - { - "expression": "bad", - "result": null - }, - { - "expression": "bad.morebad.morebad", - "result": null - } - ] -}, -{ - "given": - {"foo": {"bar": ["one", "two", "three"]}}, - "cases": [ - { - "expression": "foo", - "result": {"bar": ["one", "two", "three"]} - }, - { - "expression": "foo.bar", - "result": ["one", "two", "three"] - } - ] -}, -{ - "given": ["one", "two", "three"], - "cases": [ - { - "expression": "one", - "result": null - }, - { - "expression": "two", - "result": null - }, - { - "expression": "three", - "result": null - }, - { - "expression": "one.two", - "result": null - } - ] -}, -{ - "given": - {"foo": {"1": ["one", "two", "three"], "-1": "bar"}}, - "cases": [ - { - "expression": "foo.\"1\"", - "result": ["one", "two", "three"] - }, - { - "expression": "foo.\"1\"[0]", - "result": "one" - }, - { - "expression": "foo.\"-1\"", - "result": "bar" - } - ] -} -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/boolean.json b/vendor/mtdowling/jmespath.php/tests/compliance/boolean.json deleted file mode 100644 index e3fa196b..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/boolean.json +++ /dev/null @@ -1,257 +0,0 @@ -[ - { - "given": { - "outer": { - "foo": "foo", - "bar": "bar", - "baz": "baz" - } - }, - "cases": [ - { - "expression": "outer.foo || outer.bar", - "result": "foo" - }, - { - "expression": "outer.foo||outer.bar", - "result": "foo" - }, - { - "expression": "outer.bar || outer.baz", - "result": "bar" - }, - { - "expression": "outer.bar||outer.baz", - "result": "bar" - }, - { - "expression": "outer.bad || outer.foo", - "result": "foo" - }, - { - "expression": "outer.bad||outer.foo", - "result": "foo" - }, - { - "expression": "outer.foo || outer.bad", - "result": "foo" - }, - { - "expression": "outer.foo||outer.bad", - "result": "foo" - }, - { - "expression": "outer.bad || outer.alsobad", - "result": null - }, - { - "expression": "outer.bad||outer.alsobad", - "result": null - } - ] - }, - { - "given": { - "outer": { - "foo": "foo", - "bool": false, - "empty_list": [], - "empty_string": "" - } - }, - "cases": [ - { - "expression": "outer.empty_string || outer.foo", - "result": "foo" - }, - { - "expression": "outer.nokey || outer.bool || outer.empty_list || outer.empty_string || outer.foo", - "result": "foo" - } - ] - }, - { - "given": { - "True": true, - "False": false, - "Number": 5, - "EmptyList": [], - "Zero": 0 - }, - "cases": [ - { - "expression": "True && False", - "result": false - }, - { - "expression": "False && True", - "result": false - }, - { - "expression": "True && True", - "result": true - }, - { - "expression": "False && False", - "result": false - }, - { - "expression": "True && Number", - "result": 5 - }, - { - "expression": "Number && True", - "result": true - }, - { - "expression": "Number && False", - "result": false - }, - { - "expression": "Number && EmptyList", - "result": [] - }, - { - "expression": "Number && True", - "result": true - }, - { - "expression": "EmptyList && True", - "result": [] - }, - { - "expression": "EmptyList && False", - "result": [] - }, - { - "expression": "True || False", - "result": true - }, - { - "expression": "True || True", - "result": true - }, - { - "expression": "False || True", - "result": true - }, - { - "expression": "False || False", - "result": false - }, - { - "expression": "Number || EmptyList", - "result": 5 - }, - { - "expression": "Number || True", - "result": 5 - }, - { - "expression": "Number || True && False", - "result": 5 - }, - { - "expression": "(Number || True) && False", - "result": false - }, - { - "expression": "Number || (True && False)", - "result": 5 - }, - { - "expression": "!True", - "result": false - }, - { - "expression": "!False", - "result": true - }, - { - "expression": "!Number", - "result": false - }, - { - "expression": "!EmptyList", - "result": true - }, - { - "expression": "True && !False", - "result": true - }, - { - "expression": "True && !EmptyList", - "result": true - }, - { - "expression": "!False && !EmptyList", - "result": true - }, - { - "expression": "!(True && False)", - "result": true - }, - { - "expression": "!Zero", - "result": false - }, - { - "expression": "!!Zero", - "result": true - } - ] - }, - { - "given": { - "one": 1, - "two": 2, - "three": 3 - }, - "cases": [ - { - "expression": "one < two", - "result": true - }, - { - "expression": "one <= two", - "result": true - }, - { - "expression": "one == one", - "result": true - }, - { - "expression": "one == two", - "result": false - }, - { - "expression": "one > two", - "result": false - }, - { - "expression": "one >= two", - "result": false - }, - { - "expression": "one != two", - "result": true - }, - { - "expression": "one < two && three > one", - "result": true - }, - { - "expression": "one < two || three > one", - "result": true - }, - { - "expression": "one < two || three < one", - "result": true - }, - { - "expression": "two < one || three < one", - "result": false - } - ] - } -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/current.json b/vendor/mtdowling/jmespath.php/tests/compliance/current.json deleted file mode 100644 index 0c26248d..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/current.json +++ /dev/null @@ -1,25 +0,0 @@ -[ - { - "given": { - "foo": [{"name": "a"}, {"name": "b"}], - "bar": {"baz": "qux"} - }, - "cases": [ - { - "expression": "@", - "result": { - "foo": [{"name": "a"}, {"name": "b"}], - "bar": {"baz": "qux"} - } - }, - { - "expression": "@.bar", - "result": {"baz": "qux"} - }, - { - "expression": "@.foo[0]", - "result": {"name": "a"} - } - ] - } -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/escape.json b/vendor/mtdowling/jmespath.php/tests/compliance/escape.json deleted file mode 100644 index 4a62d951..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/escape.json +++ /dev/null @@ -1,46 +0,0 @@ -[{ - "given": { - "foo.bar": "dot", - "foo bar": "space", - "foo\nbar": "newline", - "foo\"bar": "doublequote", - "c:\\\\windows\\path": "windows", - "/unix/path": "unix", - "\"\"\"": "threequotes", - "bar": {"baz": "qux"} - }, - "cases": [ - { - "expression": "\"foo.bar\"", - "result": "dot" - }, - { - "expression": "\"foo bar\"", - "result": "space" - }, - { - "expression": "\"foo\\nbar\"", - "result": "newline" - }, - { - "expression": "\"foo\\\"bar\"", - "result": "doublequote" - }, - { - "expression": "\"c:\\\\\\\\windows\\\\path\"", - "result": "windows" - }, - { - "expression": "\"/unix/path\"", - "result": "unix" - }, - { - "expression": "\"\\\"\\\"\\\"\"", - "result": "threequotes" - }, - { - "expression": "\"bar\".\"baz\"", - "result": "qux" - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/filters.json b/vendor/mtdowling/jmespath.php/tests/compliance/filters.json deleted file mode 100644 index c4fa26a9..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/filters.json +++ /dev/null @@ -1,512 +0,0 @@ -[ - { - "given": {"foo": [{"name": "a"}, {"name": "b"}]}, - "cases": [ - { - "comment": "Matching a literal", - "expression": "foo[?name == 'a']", - "result": [{"name": "a"}] - } - ] - }, - { - "given": {"foo": [0, 1], "bar": [2, 3]}, - "cases": [ - { - "comment": "Matching a literal", - "expression": "*[?[0] == `0`]", - "result": [[], []] - } - ] - }, - { - "given": {"foo": [{"first": "foo", "last": "bar"}, - {"first": "foo", "last": "foo"}, - {"first": "foo", "last": "baz"}]}, - "cases": [ - { - "comment": "Matching an expression", - "expression": "foo[?first == last]", - "result": [{"first": "foo", "last": "foo"}] - }, - { - "comment": "Verify projection created from filter", - "expression": "foo[?first == last].first", - "result": ["foo"] - } - ] - }, - { - "given": {"foo": [{"age": 20}, - {"age": 25}, - {"age": 30}]}, - "cases": [ - { - "comment": "Greater than with a number", - "expression": "foo[?age > `25`]", - "result": [{"age": 30}] - }, - { - "expression": "foo[?age >= `25`]", - "result": [{"age": 25}, {"age": 30}] - }, - { - "comment": "Greater than with a number", - "expression": "foo[?age > `30`]", - "result": [] - }, - { - "comment": "Greater than with a number", - "expression": "foo[?age < `25`]", - "result": [{"age": 20}] - }, - { - "comment": "Greater than with a number", - "expression": "foo[?age <= `25`]", - "result": [{"age": 20}, {"age": 25}] - }, - { - "comment": "Greater than with a number", - "expression": "foo[?age < `20`]", - "result": [] - }, - { - "expression": "foo[?age == `20`]", - "result": [{"age": 20}] - }, - { - "expression": "foo[?age != `20`]", - "result": [{"age": 25}, {"age": 30}] - } - ] - }, - { - "given": {"foo": [{"weight": 33.3}, - {"weight": 44.4}, - {"weight": 55.5}]}, - "cases": [ - { - "comment": "Greater than with a number", - "expression": "foo[?weight > `44.4`]", - "result": [{"weight": 55.5}] - }, - { - "expression": "foo[?weight >= `44.4`]", - "result": [{"weight": 44.4}, {"weight": 55.5}] - }, - { - "comment": "Greater than with a number", - "expression": "foo[?weight > `55.5`]", - "result": [] - }, - { - "comment": "Greater than with a number", - "expression": "foo[?weight < `44.4`]", - "result": [{"weight": 33.3}] - }, - { - "comment": "Greater than with a number", - "expression": "foo[?weight <= `44.4`]", - "result": [{"weight": 33.3}, {"weight": 44.4}] - }, - { - "comment": "Greater than with a number", - "expression": "foo[?weight < `33.3`]", - "result": [] - }, - { - "expression": "foo[?weight == `33.3`]", - "result": [{"weight": 33.3}] - }, - { - "expression": "foo[?weight != `33.3`]", - "result": [{"weight": 44.4}, {"weight": 55.5}] - } - ] - }, - { - "given": {"foo": [{"top": {"name": "a"}}, - {"top": {"name": "b"}}]}, - "cases": [ - { - "comment": "Filter with subexpression", - "expression": "foo[?top.name == 'a']", - "result": [{"top": {"name": "a"}}] - } - ] - }, - { - "given": {"foo": [{"top": {"first": "foo", "last": "bar"}}, - {"top": {"first": "foo", "last": "foo"}}, - {"top": {"first": "foo", "last": "baz"}}]}, - "cases": [ - { - "comment": "Matching an expression", - "expression": "foo[?top.first == top.last]", - "result": [{"top": {"first": "foo", "last": "foo"}}] - }, - { - "comment": "Matching a JSON array", - "expression": "foo[?top == `{\"first\": \"foo\", \"last\": \"bar\"}`]", - "result": [{"top": {"first": "foo", "last": "bar"}}] - } - ] - }, - { - "given": {"foo": [ - {"key": true}, - {"key": false}, - {"key": 0}, - {"key": 1}, - {"key": [0]}, - {"key": {"bar": [0]}}, - {"key": null}, - {"key": [1]}, - {"key": {"a":2}} - ]}, - "cases": [ - { - "expression": "foo[?key == `true`]", - "result": [{"key": true}] - }, - { - "expression": "foo[?key == `false`]", - "result": [{"key": false}] - }, - { - "expression": "foo[?key == `0`]", - "result": [{"key": 0}] - }, - { - "expression": "foo[?key == `1`]", - "result": [{"key": 1}] - }, - { - "expression": "foo[?key == `[0]`]", - "result": [{"key": [0]}] - }, - { - "expression": "foo[?key == `{\"bar\": [0]}`]", - "result": [{"key": {"bar": [0]}}] - }, - { - "expression": "foo[?key == `null`]", - "result": [{"key": null}] - }, - { - "expression": "foo[?key == `[1]`]", - "result": [{"key": [1]}] - }, - { - "expression": "foo[?key == `{\"a\":2}`]", - "result": [{"key": {"a":2}}] - }, - { - "expression": "foo[?`true` == key]", - "result": [{"key": true}] - }, - { - "expression": "foo[?`false` == key]", - "result": [{"key": false}] - }, - { - "expression": "foo[?`0` == key]", - "result": [{"key": 0}] - }, - { - "expression": "foo[?`1` == key]", - "result": [{"key": 1}] - }, - { - "expression": "foo[?`[0]` == key]", - "result": [{"key": [0]}] - }, - { - "expression": "foo[?`{\"bar\": [0]}` == key]", - "result": [{"key": {"bar": [0]}}] - }, - { - "expression": "foo[?`null` == key]", - "result": [{"key": null}] - }, - { - "expression": "foo[?`[1]` == key]", - "result": [{"key": [1]}] - }, - { - "expression": "foo[?`{\"a\":2}` == key]", - "result": [{"key": {"a":2}}] - }, - { - "expression": "foo[?key != `true`]", - "result": [{"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?key != `false`]", - "result": [{"key": true}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?key != `0`]", - "result": [{"key": true}, {"key": false}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?key != `1`]", - "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?key != `null`]", - "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?key != `[1]`]", - "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": {"a":2}}] - }, - { - "expression": "foo[?key != `{\"a\":2}`]", - "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}] - }, - { - "expression": "foo[?`true` != key]", - "result": [{"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?`false` != key]", - "result": [{"key": true}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?`0` != key]", - "result": [{"key": true}, {"key": false}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?`1` != key]", - "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?`null` != key]", - "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": [1]}, {"key": {"a":2}}] - }, - { - "expression": "foo[?`[1]` != key]", - "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": {"a":2}}] - }, - { - "expression": "foo[?`{\"a\":2}` != key]", - "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, - {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}] - } - ] - }, - { - "given": {"reservations": [ - {"instances": [ - {"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, - {"foo": 1, "bar": 2}, {"foo": 2, "bar": 1}]}]}, - "cases": [ - { - "expression": "reservations[].instances[?bar==`1`]", - "result": [[{"foo": 2, "bar": 1}]] - }, - { - "expression": "reservations[*].instances[?bar==`1`]", - "result": [[{"foo": 2, "bar": 1}]] - }, - { - "expression": "reservations[].instances[?bar==`1`][]", - "result": [{"foo": 2, "bar": 1}] - } - ] - }, - { - "given": { - "baz": "other", - "foo": [ - {"bar": 1}, {"bar": 2}, {"bar": 3}, {"bar": 4}, {"bar": 1, "baz": 2} - ] - }, - "cases": [ - { - "expression": "foo[?bar==`1`].bar[0]", - "result": [] - } - ] - }, - { - "given": { - "foo": [ - {"a": 1, "b": {"c": "x"}}, - {"a": 1, "b": {"c": "y"}}, - {"a": 1, "b": {"c": "z"}}, - {"a": 2, "b": {"c": "z"}}, - {"a": 1, "baz": 2} - ] - }, - "cases": [ - { - "expression": "foo[?a==`1`].b.c", - "result": ["x", "y", "z"] - } - ] - }, - { - "given": {"foo": [{"name": "a"}, {"name": "b"}, {"name": "c"}]}, - "cases": [ - { - "comment": "Filter with or expression", - "expression": "foo[?name == 'a' || name == 'b']", - "result": [{"name": "a"}, {"name": "b"}] - }, - { - "expression": "foo[?name == 'a' || name == 'e']", - "result": [{"name": "a"}] - }, - { - "expression": "foo[?name == 'a' || name == 'b' || name == 'c']", - "result": [{"name": "a"}, {"name": "b"}, {"name": "c"}] - } - ] - }, - { - "given": {"foo": [{"a": 1, "b": 2}, {"a": 1, "b": 3}]}, - "cases": [ - { - "comment": "Filter with and expression", - "expression": "foo[?a == `1` && b == `2`]", - "result": [{"a": 1, "b": 2}] - }, - { - "expression": "foo[?a == `1` && b == `4`]", - "result": [] - } - ] - }, - { - "given": {"foo": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}]}, - "cases": [ - { - "comment": "Filter with Or and And expressions", - "expression": "foo[?c == `3` || a == `1` && b == `4`]", - "result": [{"a": 1, "b": 2, "c": 3}] - }, - { - "expression": "foo[?b == `2` || a == `3` && b == `4`]", - "result": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}] - }, - { - "expression": "foo[?a == `3` && b == `4` || b == `2`]", - "result": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}] - }, - { - "expression": "foo[?(a == `3` && b == `4`) || b == `2`]", - "result": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}] - }, - { - "expression": "foo[?((a == `3` && b == `4`)) || b == `2`]", - "result": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}] - }, - { - "expression": "foo[?a == `3` && (b == `4` || b == `2`)]", - "result": [{"a": 3, "b": 4}] - }, - { - "expression": "foo[?a == `3` && ((b == `4` || b == `2`))]", - "result": [{"a": 3, "b": 4}] - } - ] - }, - { - "given": {"foo": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}]}, - "cases": [ - { - "comment": "Verify precedence of or/and expressions", - "expression": "foo[?a == `1` || b ==`2` && c == `5`]", - "result": [{"a": 1, "b": 2, "c": 3}] - }, - { - "comment": "Parentheses can alter precedence", - "expression": "foo[?(a == `1` || b ==`2`) && c == `5`]", - "result": [] - }, - { - "comment": "Not expressions combined with and/or", - "expression": "foo[?!(a == `1` || b ==`2`)]", - "result": [{"a": 3, "b": 4}] - } - ] - }, - { - "given": { - "foo": [ - {"key": true}, - {"key": false}, - {"key": []}, - {"key": {}}, - {"key": [0]}, - {"key": {"a": "b"}}, - {"key": 0}, - {"key": 1}, - {"key": null}, - {"notkey": true} - ] - }, - "cases": [ - { - "comment": "Unary filter expression", - "expression": "foo[?key]", - "result": [ - {"key": true}, {"key": [0]}, {"key": {"a": "b"}}, - {"key": 0}, {"key": 1} - ] - }, - { - "comment": "Unary not filter expression", - "expression": "foo[?!key]", - "result": [ - {"key": false}, {"key": []}, {"key": {}}, - {"key": null}, {"notkey": true} - ] - }, - { - "comment": "Equality with null RHS", - "expression": "foo[?key == `null`]", - "result": [ - {"key": null}, {"notkey": true} - ] - } - ] - }, - { - "given": { - "foo": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - "cases": [ - { - "comment": "Using @ in a filter expression", - "expression": "foo[?@ < `5`]", - "result": [0, 1, 2, 3, 4] - }, - { - "comment": "Using @ in a filter expression", - "expression": "foo[?`5` > @]", - "result": [0, 1, 2, 3, 4] - }, - { - "comment": "Using @ in a filter expression", - "expression": "foo[?@ == @]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - } - ] - } -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/functions.json b/vendor/mtdowling/jmespath.php/tests/compliance/functions.json deleted file mode 100644 index 79295aee..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/functions.json +++ /dev/null @@ -1,821 +0,0 @@ -[{ - "given": - { - "foo": -1, - "zero": 0, - "numbers": [-1, 3, 4, 5], - "array": [-1, 3, 4, 5, "a", "100"], - "strings": ["a", "b", "c"], - "decimals": [1.01, 1.2, -1.5], - "str": "Str", - "false": false, - "empty_list": [], - "empty_hash": {}, - "objects": {"foo": "bar", "bar": "baz"}, - "null_key": null - }, - "cases": [ - { - "expression": "abs(foo)", - "result": 1 - }, - { - "expression": "abs(foo)", - "result": 1 - }, - { - "expression": "abs(str)", - "error": "invalid-type" - }, - { - "expression": "abs(array[1])", - "result": 3 - }, - { - "expression": "abs(array[1])", - "result": 3 - }, - { - "expression": "abs(`false`)", - "error": "invalid-type" - }, - { - "expression": "abs(`-24`)", - "result": 24 - }, - { - "expression": "abs(`-24`)", - "result": 24 - }, - { - "expression": "abs(`1`, `2`)", - "error": "invalid-arity" - }, - { - "expression": "abs()", - "error": "invalid-arity" - }, - { - "expression": "unknown_function(`1`, `2`)", - "error": "unknown-function" - }, - { - "expression": "avg(numbers)", - "result": 2.75 - }, - { - "expression": "avg(array)", - "error": "invalid-type" - }, - { - "expression": "avg('abc')", - "error": "invalid-type" - }, - { - "expression": "avg(foo)", - "error": "invalid-type" - }, - { - "expression": "avg(@)", - "error": "invalid-type" - }, - { - "expression": "avg(strings)", - "error": "invalid-type" - }, - { - "expression": "ceil(`1.2`)", - "result": 2 - }, - { - "expression": "ceil(decimals[0])", - "result": 2 - }, - { - "expression": "ceil(decimals[1])", - "result": 2 - }, - { - "expression": "ceil(decimals[2])", - "result": -1 - }, - { - "expression": "ceil('string')", - "error": "invalid-type" - }, - { - "expression": "contains('abc', 'a')", - "result": true - }, - { - "expression": "contains('abc', 'd')", - "result": false - }, - { - "expression": "contains(`false`, 'd')", - "error": "invalid-type" - }, - { - "expression": "contains(strings, 'a')", - "result": true - }, - { - "expression": "contains(decimals, `1.2`)", - "result": true - }, - { - "expression": "contains(decimals, `false`)", - "result": false - }, - { - "expression": "ends_with(str, 'r')", - "result": true - }, - { - "expression": "ends_with(str, 'tr')", - "result": true - }, - { - "expression": "ends_with(str, 'Str')", - "result": true - }, - { - "expression": "ends_with(str, 'SStr')", - "result": false - }, - { - "expression": "ends_with(str, 'foo')", - "result": false - }, - { - "expression": "ends_with(str, `0`)", - "error": "invalid-type" - }, - { - "expression": "floor(`1.2`)", - "result": 1 - }, - { - "expression": "floor('string')", - "error": "invalid-type" - }, - { - "expression": "floor(decimals[0])", - "result": 1 - }, - { - "expression": "floor(foo)", - "result": -1 - }, - { - "expression": "floor(str)", - "error": "invalid-type" - }, - { - "expression": "length('abc')", - "result": 3 - }, - { - "expression": "length('')", - "result": 0 - }, - { - "expression": "length(@)", - "result": 12 - }, - { - "expression": "length(strings[0])", - "result": 1 - }, - { - "expression": "length(str)", - "result": 3 - }, - { - "expression": "length(array)", - "result": 6 - }, - { - "expression": "length(objects)", - "result": 2 - }, - { - "expression": "length(`false`)", - "error": "invalid-type" - }, - { - "expression": "length(foo)", - "error": "invalid-type" - }, - { - "expression": "length(strings[0])", - "result": 1 - }, - { - "expression": "max(numbers)", - "result": 5 - }, - { - "expression": "max(decimals)", - "result": 1.2 - }, - { - "expression": "max(strings)", - "result": "c" - }, - { - "expression": "max(abc)", - "error": "invalid-type" - }, - { - "expression": "max(array)", - "error": "invalid-type" - }, - { - "expression": "max(decimals)", - "result": 1.2 - }, - { - "expression": "max(empty_list)", - "result": null - }, - { - "expression": "merge(`{}`)", - "result": {} - }, - { - "expression": "merge(`{}`, `{}`)", - "result": {} - }, - { - "expression": "merge(`{\"a\": 1}`, `{\"b\": 2}`)", - "result": {"a": 1, "b": 2} - }, - { - "expression": "merge(`{\"a\": 1}`, `{\"a\": 2}`)", - "result": {"a": 2} - }, - { - "expression": "merge(`{\"a\": 1, \"b\": 2}`, `{\"a\": 2, \"c\": 3}`, `{\"d\": 4}`)", - "result": {"a": 2, "b": 2, "c": 3, "d": 4} - }, - { - "expression": "min(numbers)", - "result": -1 - }, - { - "expression": "min(decimals)", - "result": -1.5 - }, - { - "expression": "min(abc)", - "error": "invalid-type" - }, - { - "expression": "min(array)", - "error": "invalid-type" - }, - { - "expression": "min(empty_list)", - "result": null - }, - { - "expression": "min(decimals)", - "result": -1.5 - }, - { - "expression": "min(strings)", - "result": "a" - }, - { - "expression": "type('abc')", - "result": "string" - }, - { - "expression": "type(`1.0`)", - "result": "number" - }, - { - "expression": "type(`2`)", - "result": "number" - }, - { - "expression": "type(`true`)", - "result": "boolean" - }, - { - "expression": "type(`false`)", - "result": "boolean" - }, - { - "expression": "type(`null`)", - "result": "null" - }, - { - "expression": "type(`[0]`)", - "result": "array" - }, - { - "expression": "type(`{\"a\": \"b\"}`)", - "result": "object" - }, - { - "expression": "type(@)", - "result": "object" - }, - { - "expression": "sort(keys(objects))", - "result": ["bar", "foo"] - }, - { - "expression": "keys(foo)", - "error": "invalid-type" - }, - { - "expression": "keys(strings)", - "error": "invalid-type" - }, - { - "expression": "keys(`false`)", - "error": "invalid-type" - }, - { - "expression": "sort(values(objects))", - "result": ["bar", "baz"] - }, - { - "expression": "keys(empty_hash)", - "result": [] - }, - { - "expression": "values(foo)", - "error": "invalid-type" - }, - { - "expression": "join(', ', strings)", - "result": "a, b, c" - }, - { - "expression": "join(', ', strings)", - "result": "a, b, c" - }, - { - "expression": "join(',', `[\"a\", \"b\"]`)", - "result": "a,b" - }, - { - "expression": "join(',', `[\"a\", 0]`)", - "error": "invalid-type" - }, - { - "expression": "join(', ', str)", - "error": "invalid-type" - }, - { - "expression": "join('|', strings)", - "result": "a|b|c" - }, - { - "expression": "join(`2`, strings)", - "error": "invalid-type" - }, - { - "expression": "join('|', decimals)", - "error": "invalid-type" - }, - { - "expression": "join('|', decimals[].to_string(@))", - "result": "1.01|1.2|-1.5" - }, - { - "expression": "join('|', empty_list)", - "result": "" - }, - { - "expression": "reverse(numbers)", - "result": [5, 4, 3, -1] - }, - { - "expression": "reverse(array)", - "result": ["100", "a", 5, 4, 3, -1] - }, - { - "expression": "reverse(`[]`)", - "result": [] - }, - { - "expression": "reverse('')", - "result": "" - }, - { - "expression": "reverse('hello world')", - "result": "dlrow olleh" - }, - { - "expression": "starts_with(str, 'S')", - "result": true - }, - { - "expression": "starts_with(str, 'St')", - "result": true - }, - { - "expression": "starts_with(str, 'Str')", - "result": true - }, - { - "expression": "starts_with(str, 'String')", - "result": false - }, - { - "expression": "starts_with(str, `0`)", - "error": "invalid-type" - }, - { - "expression": "sum(numbers)", - "result": 11 - }, - { - "expression": "sum(decimals)", - "result": 0.71 - }, - { - "expression": "sum(array)", - "error": "invalid-type" - }, - { - "expression": "sum(array[].to_number(@))", - "result": 111 - }, - { - "expression": "sum(`[]`)", - "result": 0 - }, - { - "expression": "to_array('foo')", - "result": ["foo"] - }, - { - "expression": "to_array(`0`)", - "result": [0] - }, - { - "expression": "to_array(objects)", - "result": [{"foo": "bar", "bar": "baz"}] - }, - { - "expression": "to_array(`[1, 2, 3]`)", - "result": [1, 2, 3] - }, - { - "expression": "to_array(false)", - "result": [false] - }, - { - "expression": "to_string('foo')", - "result": "foo" - }, - { - "expression": "to_string(`1.2`)", - "result": "1.2" - }, - { - "expression": "to_string(`[0, 1]`)", - "result": "[0,1]" - }, - { - "expression": "to_number('1.0')", - "result": 1.0 - }, - { - "expression": "to_number('1.1')", - "result": 1.1 - }, - { - "expression": "to_number('4')", - "result": 4 - }, - { - "expression": "to_number('notanumber')", - "result": null - }, - { - "expression": "to_number(`false`)", - "result": null - }, - { - "expression": "to_number(`null`)", - "result": null - }, - { - "expression": "to_number(`[0]`)", - "result": null - }, - { - "expression": "to_number(`{\"foo\": 0}`)", - "result": null - }, - { - "expression": "\"to_string\"(`1.0`)", - "error": "syntax" - }, - { - "expression": "sort(numbers)", - "result": [-1, 3, 4, 5] - }, - { - "expression": "sort(strings)", - "result": ["a", "b", "c"] - }, - { - "expression": "sort(decimals)", - "result": [-1.5, 1.01, 1.2] - }, - { - "expression": "sort(array)", - "error": "invalid-type" - }, - { - "expression": "sort(abc)", - "error": "invalid-type" - }, - { - "expression": "sort(empty_list)", - "result": [] - }, - { - "expression": "sort(@)", - "error": "invalid-type" - }, - { - "expression": "not_null(unknown_key, str)", - "result": "Str" - }, - { - "expression": "not_null(unknown_key, foo.bar, empty_list, str)", - "result": [] - }, - { - "expression": "not_null(unknown_key, null_key, empty_list, str)", - "result": [] - }, - { - "expression": "not_null(all, expressions, are_null)", - "result": null - }, - { - "expression": "not_null()", - "error": "invalid-arity" - }, - { - "description": "function projection on single arg function", - "expression": "numbers[].to_string(@)", - "result": ["-1", "3", "4", "5"] - }, - { - "description": "function projection on single arg function", - "expression": "array[].to_number(@)", - "result": [-1, 3, 4, 5, 100] - } - ] -}, { - "given": - { - "foo": [ - {"b": "b", "a": "a"}, - {"c": "c", "b": "b"}, - {"d": "d", "c": "c"}, - {"e": "e", "d": "d"}, - {"f": "f", "e": "e"} - ] - }, - "cases": [ - { - "description": "function projection on variadic function", - "expression": "foo[].not_null(f, e, d, c, b, a)", - "result": ["b", "c", "d", "e", "f"] - } - ] -}, { - "given": - { - "people": [ - {"age": 20, "age_str": "20", "bool": true, "name": "a", "extra": "foo"}, - {"age": 40, "age_str": "40", "bool": false, "name": "b", "extra": "bar"}, - {"age": 30, "age_str": "30", "bool": true, "name": "c"}, - {"age": 50, "age_str": "50", "bool": false, "name": "d"}, - {"age": 10, "age_str": "10", "bool": true, "name": 3} - ] - }, - "cases": [ - { - "description": "sort by field expression", - "expression": "sort_by(people, &age)", - "result": [ - {"age": 10, "age_str": "10", "bool": true, "name": 3}, - {"age": 20, "age_str": "20", "bool": true, "name": "a", "extra": "foo"}, - {"age": 30, "age_str": "30", "bool": true, "name": "c"}, - {"age": 40, "age_str": "40", "bool": false, "name": "b", "extra": "bar"}, - {"age": 50, "age_str": "50", "bool": false, "name": "d"} - ] - }, - { - "expression": "sort_by(people, &age_str)", - "result": [ - {"age": 10, "age_str": "10", "bool": true, "name": 3}, - {"age": 20, "age_str": "20", "bool": true, "name": "a", "extra": "foo"}, - {"age": 30, "age_str": "30", "bool": true, "name": "c"}, - {"age": 40, "age_str": "40", "bool": false, "name": "b", "extra": "bar"}, - {"age": 50, "age_str": "50", "bool": false, "name": "d"} - ] - }, - { - "description": "sort by function expression", - "expression": "sort_by(people, &to_number(age_str))", - "result": [ - {"age": 10, "age_str": "10", "bool": true, "name": 3}, - {"age": 20, "age_str": "20", "bool": true, "name": "a", "extra": "foo"}, - {"age": 30, "age_str": "30", "bool": true, "name": "c"}, - {"age": 40, "age_str": "40", "bool": false, "name": "b", "extra": "bar"}, - {"age": 50, "age_str": "50", "bool": false, "name": "d"} - ] - }, - { - "description": "function projection on sort_by function", - "expression": "sort_by(people, &age)[].name", - "result": [3, "a", "c", "b", "d"] - }, - { - "expression": "sort_by(people, &extra)", - "error": "invalid-type" - }, - { - "expression": "sort_by(people, &bool)", - "error": "invalid-type" - }, - { - "expression": "sort_by(people, &name)", - "error": "invalid-type" - }, - { - "expression": "sort_by(people, name)", - "error": "invalid-type" - }, - { - "expression": "sort_by(people, &age)[].extra", - "result": ["foo", "bar"] - }, - { - "expression": "sort_by(`[]`, &age)", - "result": [] - }, - { - "expression": "max_by(people, &age)", - "result": {"age": 50, "age_str": "50", "bool": false, "name": "d"} - }, - { - "expression": "max_by(people, &age_str)", - "result": {"age": 50, "age_str": "50", "bool": false, "name": "d"} - }, - { - "expression": "max_by(people, &bool)", - "error": "invalid-type" - }, - { - "expression": "max_by(people, &extra)", - "error": "invalid-type" - }, - { - "expression": "max_by(people, &to_number(age_str))", - "result": {"age": 50, "age_str": "50", "bool": false, "name": "d"} - }, - { - "expression": "min_by(people, &age)", - "result": {"age": 10, "age_str": "10", "bool": true, "name": 3} - }, - { - "expression": "min_by(people, &age_str)", - "result": {"age": 10, "age_str": "10", "bool": true, "name": 3} - }, - { - "expression": "min_by(people, &bool)", - "error": "invalid-type" - }, - { - "expression": "min_by(people, &extra)", - "error": "invalid-type" - }, - { - "expression": "min_by(people, &to_number(age_str))", - "result": {"age": 10, "age_str": "10", "bool": true, "name": 3} - } - ] -}, { - "given": - { - "people": [ - {"age": 10, "order": "1"}, - {"age": 10, "order": "2"}, - {"age": 10, "order": "3"}, - {"age": 10, "order": "4"}, - {"age": 10, "order": "5"}, - {"age": 10, "order": "6"}, - {"age": 10, "order": "7"}, - {"age": 10, "order": "8"}, - {"age": 10, "order": "9"}, - {"age": 10, "order": "10"}, - {"age": 10, "order": "11"} - ] - }, - "cases": [ - { - "description": "stable sort order", - "expression": "sort_by(people, &age)", - "result": [ - {"age": 10, "order": "1"}, - {"age": 10, "order": "2"}, - {"age": 10, "order": "3"}, - {"age": 10, "order": "4"}, - {"age": 10, "order": "5"}, - {"age": 10, "order": "6"}, - {"age": 10, "order": "7"}, - {"age": 10, "order": "8"}, - {"age": 10, "order": "9"}, - {"age": 10, "order": "10"}, - {"age": 10, "order": "11"} - ] - } - ] -}, { - "given": - { - "people": [ - {"a": 10, "b": 1, "c": "z"}, - {"a": 10, "b": 2, "c": null}, - {"a": 10, "b": 3}, - {"a": 10, "b": 4, "c": "z"}, - {"a": 10, "b": 5, "c": null}, - {"a": 10, "b": 6}, - {"a": 10, "b": 7, "c": "z"}, - {"a": 10, "b": 8, "c": null}, - {"a": 10, "b": 9} - ], - "empty": [] - }, - "cases": [ - { - "expression": "map(&a, people)", - "result": [10, 10, 10, 10, 10, 10, 10, 10, 10] - }, - { - "expression": "map(&c, people)", - "result": ["z", null, null, "z", null, null, "z", null, null] - }, - { - "expression": "map(&a, badkey)", - "error": "invalid-type" - }, - { - "expression": "map(&foo, empty)", - "result": [] - } - ] -}, { - "given": { - "array": [ - { - "foo": {"bar": "yes1"} - }, - { - "foo": {"bar": "yes2"} - }, - { - "foo1": {"bar": "no"} - } - ]}, - "cases": [ - { - "expression": "map(&foo.bar, array)", - "result": ["yes1", "yes2", null] - }, - { - "expression": "map(&foo1.bar, array)", - "result": [null, null, "no"] - }, - { - "expression": "map(&foo.bar.baz, array)", - "result": [null, null, null] - } - ] -}, { - "given": { - "array": [[1, 2, 3, [4]], [5, 6, 7, [8, 9]]] - }, - "cases": [ - { - "expression": "map(&[], array)", - "result": [[1, 2, 3, 4], [5, 6, 7, 8, 9]] - } - ] -} -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/identifiers.json b/vendor/mtdowling/jmespath.php/tests/compliance/identifiers.json deleted file mode 100644 index 7998a41a..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/identifiers.json +++ /dev/null @@ -1,1377 +0,0 @@ -[ - { - "given": { - "__L": true - }, - "cases": [ - { - "expression": "__L", - "result": true - } - ] - }, - { - "given": { - "!\r": true - }, - "cases": [ - { - "expression": "\"!\\r\"", - "result": true - } - ] - }, - { - "given": { - "Y_1623": true - }, - "cases": [ - { - "expression": "Y_1623", - "result": true - } - ] - }, - { - "given": { - "x": true - }, - "cases": [ - { - "expression": "x", - "result": true - } - ] - }, - { - "given": { - "\tF\uCebb": true - }, - "cases": [ - { - "expression": "\"\\tF\\uCebb\"", - "result": true - } - ] - }, - { - "given": { - " \t": true - }, - "cases": [ - { - "expression": "\" \\t\"", - "result": true - } - ] - }, - { - "given": { - " ": true - }, - "cases": [ - { - "expression": "\" \"", - "result": true - } - ] - }, - { - "given": { - "v2": true - }, - "cases": [ - { - "expression": "v2", - "result": true - } - ] - }, - { - "given": { - "\t": true - }, - "cases": [ - { - "expression": "\"\\t\"", - "result": true - } - ] - }, - { - "given": { - "_X": true - }, - "cases": [ - { - "expression": "_X", - "result": true - } - ] - }, - { - "given": { - "\t4\ud9da\udd15": true - }, - "cases": [ - { - "expression": "\"\\t4\\ud9da\\udd15\"", - "result": true - } - ] - }, - { - "given": { - "v24_W": true - }, - "cases": [ - { - "expression": "v24_W", - "result": true - } - ] - }, - { - "given": { - "H": true - }, - "cases": [ - { - "expression": "\"H\"", - "result": true - } - ] - }, - { - "given": { - "\f": true - }, - "cases": [ - { - "expression": "\"\\f\"", - "result": true - } - ] - }, - { - "given": { - "E4": true - }, - "cases": [ - { - "expression": "\"E4\"", - "result": true - } - ] - }, - { - "given": { - "!": true - }, - "cases": [ - { - "expression": "\"!\"", - "result": true - } - ] - }, - { - "given": { - "tM": true - }, - "cases": [ - { - "expression": "tM", - "result": true - } - ] - }, - { - "given": { - " [": true - }, - "cases": [ - { - "expression": "\" [\"", - "result": true - } - ] - }, - { - "given": { - "R!": true - }, - "cases": [ - { - "expression": "\"R!\"", - "result": true - } - ] - }, - { - "given": { - "_6W": true - }, - "cases": [ - { - "expression": "_6W", - "result": true - } - ] - }, - { - "given": { - "\uaBA1\r": true - }, - "cases": [ - { - "expression": "\"\\uaBA1\\r\"", - "result": true - } - ] - }, - { - "given": { - "tL7": true - }, - "cases": [ - { - "expression": "tL7", - "result": true - } - ] - }, - { - "given": { - "<": true - }, - "cases": [ - { - "expression": "\">\"", - "result": true - } - ] - }, - { - "given": { - "hvu": true - }, - "cases": [ - { - "expression": "hvu", - "result": true - } - ] - }, - { - "given": { - "; !": true - }, - "cases": [ - { - "expression": "\"; !\"", - "result": true - } - ] - }, - { - "given": { - "hU": true - }, - "cases": [ - { - "expression": "hU", - "result": true - } - ] - }, - { - "given": { - "!I\n\/": true - }, - "cases": [ - { - "expression": "\"!I\\n\\/\"", - "result": true - } - ] - }, - { - "given": { - "\uEEbF": true - }, - "cases": [ - { - "expression": "\"\\uEEbF\"", - "result": true - } - ] - }, - { - "given": { - "U)\t": true - }, - "cases": [ - { - "expression": "\"U)\\t\"", - "result": true - } - ] - }, - { - "given": { - "fa0_9": true - }, - "cases": [ - { - "expression": "fa0_9", - "result": true - } - ] - }, - { - "given": { - "/": true - }, - "cases": [ - { - "expression": "\"/\"", - "result": true - } - ] - }, - { - "given": { - "Gy": true - }, - "cases": [ - { - "expression": "Gy", - "result": true - } - ] - }, - { - "given": { - "\b": true - }, - "cases": [ - { - "expression": "\"\\b\"", - "result": true - } - ] - }, - { - "given": { - "<": true - }, - "cases": [ - { - "expression": "\"<\"", - "result": true - } - ] - }, - { - "given": { - "\t": true - }, - "cases": [ - { - "expression": "\"\\t\"", - "result": true - } - ] - }, - { - "given": { - "\t&\\\r": true - }, - "cases": [ - { - "expression": "\"\\t&\\\\\\r\"", - "result": true - } - ] - }, - { - "given": { - "#": true - }, - "cases": [ - { - "expression": "\"#\"", - "result": true - } - ] - }, - { - "given": { - "B__": true - }, - "cases": [ - { - "expression": "B__", - "result": true - } - ] - }, - { - "given": { - "\nS \n": true - }, - "cases": [ - { - "expression": "\"\\nS \\n\"", - "result": true - } - ] - }, - { - "given": { - "Bp": true - }, - "cases": [ - { - "expression": "Bp", - "result": true - } - ] - }, - { - "given": { - ",\t;": true - }, - "cases": [ - { - "expression": "\",\\t;\"", - "result": true - } - ] - }, - { - "given": { - "B_q": true - }, - "cases": [ - { - "expression": "B_q", - "result": true - } - ] - }, - { - "given": { - "\/+\t\n\b!Z": true - }, - "cases": [ - { - "expression": "\"\\/+\\t\\n\\b!Z\"", - "result": true - } - ] - }, - { - "given": { - "\udadd\udfc7\\ueFAc": true - }, - "cases": [ - { - "expression": "\"\udadd\udfc7\\\\ueFAc\"", - "result": true - } - ] - }, - { - "given": { - ":\f": true - }, - "cases": [ - { - "expression": "\":\\f\"", - "result": true - } - ] - }, - { - "given": { - "\/": true - }, - "cases": [ - { - "expression": "\"\\/\"", - "result": true - } - ] - }, - { - "given": { - "_BW_6Hg_Gl": true - }, - "cases": [ - { - "expression": "_BW_6Hg_Gl", - "result": true - } - ] - }, - { - "given": { - "\udbcf\udc02": true - }, - "cases": [ - { - "expression": "\"\udbcf\udc02\"", - "result": true - } - ] - }, - { - "given": { - "zs1DC": true - }, - "cases": [ - { - "expression": "zs1DC", - "result": true - } - ] - }, - { - "given": { - "__434": true - }, - "cases": [ - { - "expression": "__434", - "result": true - } - ] - }, - { - "given": { - "\udb94\udd41": true - }, - "cases": [ - { - "expression": "\"\udb94\udd41\"", - "result": true - } - ] - }, - { - "given": { - "Z_5": true - }, - "cases": [ - { - "expression": "Z_5", - "result": true - } - ] - }, - { - "given": { - "z_M_": true - }, - "cases": [ - { - "expression": "z_M_", - "result": true - } - ] - }, - { - "given": { - "YU_2": true - }, - "cases": [ - { - "expression": "YU_2", - "result": true - } - ] - }, - { - "given": { - "_0": true - }, - "cases": [ - { - "expression": "_0", - "result": true - } - ] - }, - { - "given": { - "\b+": true - }, - "cases": [ - { - "expression": "\"\\b+\"", - "result": true - } - ] - }, - { - "given": { - "\"": true - }, - "cases": [ - { - "expression": "\"\\\"\"", - "result": true - } - ] - }, - { - "given": { - "D7": true - }, - "cases": [ - { - "expression": "D7", - "result": true - } - ] - }, - { - "given": { - "_62L": true - }, - "cases": [ - { - "expression": "_62L", - "result": true - } - ] - }, - { - "given": { - "\tK\t": true - }, - "cases": [ - { - "expression": "\"\\tK\\t\"", - "result": true - } - ] - }, - { - "given": { - "\n\\\f": true - }, - "cases": [ - { - "expression": "\"\\n\\\\\\f\"", - "result": true - } - ] - }, - { - "given": { - "I_": true - }, - "cases": [ - { - "expression": "I_", - "result": true - } - ] - }, - { - "given": { - "W_a0_": true - }, - "cases": [ - { - "expression": "W_a0_", - "result": true - } - ] - }, - { - "given": { - "BQ": true - }, - "cases": [ - { - "expression": "BQ", - "result": true - } - ] - }, - { - "given": { - "\tX$\uABBb": true - }, - "cases": [ - { - "expression": "\"\\tX$\\uABBb\"", - "result": true - } - ] - }, - { - "given": { - "Z9": true - }, - "cases": [ - { - "expression": "Z9", - "result": true - } - ] - }, - { - "given": { - "\b%\"\uda38\udd0f": true - }, - "cases": [ - { - "expression": "\"\\b%\\\"\uda38\udd0f\"", - "result": true - } - ] - }, - { - "given": { - "_F": true - }, - "cases": [ - { - "expression": "_F", - "result": true - } - ] - }, - { - "given": { - "!,": true - }, - "cases": [ - { - "expression": "\"!,\"", - "result": true - } - ] - }, - { - "given": { - "\"!": true - }, - "cases": [ - { - "expression": "\"\\\"!\"", - "result": true - } - ] - }, - { - "given": { - "Hh": true - }, - "cases": [ - { - "expression": "Hh", - "result": true - } - ] - }, - { - "given": { - "&": true - }, - "cases": [ - { - "expression": "\"&\"", - "result": true - } - ] - }, - { - "given": { - "9\r\\R": true - }, - "cases": [ - { - "expression": "\"9\\r\\\\R\"", - "result": true - } - ] - }, - { - "given": { - "M_k": true - }, - "cases": [ - { - "expression": "M_k", - "result": true - } - ] - }, - { - "given": { - "!\b\n\udb06\ude52\"\"": true - }, - "cases": [ - { - "expression": "\"!\\b\\n\udb06\ude52\\\"\\\"\"", - "result": true - } - ] - }, - { - "given": { - "6": true - }, - "cases": [ - { - "expression": "\"6\"", - "result": true - } - ] - }, - { - "given": { - "_7": true - }, - "cases": [ - { - "expression": "_7", - "result": true - } - ] - }, - { - "given": { - "0": true - }, - "cases": [ - { - "expression": "\"0\"", - "result": true - } - ] - }, - { - "given": { - "\\8\\": true - }, - "cases": [ - { - "expression": "\"\\\\8\\\\\"", - "result": true - } - ] - }, - { - "given": { - "b7eo": true - }, - "cases": [ - { - "expression": "b7eo", - "result": true - } - ] - }, - { - "given": { - "xIUo9": true - }, - "cases": [ - { - "expression": "xIUo9", - "result": true - } - ] - }, - { - "given": { - "5": true - }, - "cases": [ - { - "expression": "\"5\"", - "result": true - } - ] - }, - { - "given": { - "?": true - }, - "cases": [ - { - "expression": "\"?\"", - "result": true - } - ] - }, - { - "given": { - "sU": true - }, - "cases": [ - { - "expression": "sU", - "result": true - } - ] - }, - { - "given": { - "VH2&H\\\/": true - }, - "cases": [ - { - "expression": "\"VH2&H\\\\\\/\"", - "result": true - } - ] - }, - { - "given": { - "_C": true - }, - "cases": [ - { - "expression": "_C", - "result": true - } - ] - }, - { - "given": { - "_": true - }, - "cases": [ - { - "expression": "_", - "result": true - } - ] - }, - { - "given": { - "<\t": true - }, - "cases": [ - { - "expression": "\"<\\t\"", - "result": true - } - ] - }, - { - "given": { - "\uD834\uDD1E": true - }, - "cases": [ - { - "expression": "\"\\uD834\\uDD1E\"", - "result": true - } - ] - } -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/indices.json b/vendor/mtdowling/jmespath.php/tests/compliance/indices.json deleted file mode 100644 index aa03b35d..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/indices.json +++ /dev/null @@ -1,346 +0,0 @@ -[{ - "given": - {"foo": {"bar": ["zero", "one", "two"]}}, - "cases": [ - { - "expression": "foo.bar[0]", - "result": "zero" - }, - { - "expression": "foo.bar[1]", - "result": "one" - }, - { - "expression": "foo.bar[2]", - "result": "two" - }, - { - "expression": "foo.bar[3]", - "result": null - }, - { - "expression": "foo.bar[-1]", - "result": "two" - }, - { - "expression": "foo.bar[-2]", - "result": "one" - }, - { - "expression": "foo.bar[-3]", - "result": "zero" - }, - { - "expression": "foo.bar[-4]", - "result": null - } - ] -}, -{ - "given": - {"foo": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}]}, - "cases": [ - { - "expression": "foo.bar", - "result": null - }, - { - "expression": "foo[0].bar", - "result": "one" - }, - { - "expression": "foo[1].bar", - "result": "two" - }, - { - "expression": "foo[2].bar", - "result": "three" - }, - { - "expression": "foo[3].notbar", - "result": "four" - }, - { - "expression": "foo[3].bar", - "result": null - }, - { - "expression": "foo[0]", - "result": {"bar": "one"} - }, - { - "expression": "foo[1]", - "result": {"bar": "two"} - }, - { - "expression": "foo[2]", - "result": {"bar": "three"} - }, - { - "expression": "foo[3]", - "result": {"notbar": "four"} - }, - { - "expression": "foo[4]", - "result": null - } - ] -}, -{ - "given": [ - "one", "two", "three" - ], - "cases": [ - { - "expression": "[0]", - "result": "one" - }, - { - "expression": "[1]", - "result": "two" - }, - { - "expression": "[2]", - "result": "three" - }, - { - "expression": "[-1]", - "result": "three" - }, - { - "expression": "[-2]", - "result": "two" - }, - { - "expression": "[-3]", - "result": "one" - } - ] -}, -{ - "given": {"reservations": [ - {"instances": [{"foo": 1}, {"foo": 2}]} - ]}, - "cases": [ - { - "expression": "reservations[].instances[].foo", - "result": [1, 2] - }, - { - "expression": "reservations[].instances[].bar", - "result": [] - }, - { - "expression": "reservations[].notinstances[].foo", - "result": [] - }, - { - "expression": "reservations[].notinstances[].foo", - "result": [] - } - ] -}, -{ - "given": {"reservations": [{ - "instances": [ - {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]}, - {"foo": [{"bar": 5}, {"bar": 6}, {"notbar": [7]}, {"bar": 8}]}, - {"foo": "bar"}, - {"notfoo": [{"bar": 20}, {"bar": 21}, {"notbar": [7]}, {"bar": 22}]}, - {"bar": [{"baz": [1]}, {"baz": [2]}, {"baz": [3]}, {"baz": [4]}]}, - {"baz": [{"baz": [1, 2]}, {"baz": []}, {"baz": []}, {"baz": [3, 4]}]}, - {"qux": [{"baz": []}, {"baz": [1, 2, 3]}, {"baz": [4]}, {"baz": []}]} - ], - "otherkey": {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]} - }, { - "instances": [ - {"a": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]}, - {"b": [{"bar": 5}, {"bar": 6}, {"notbar": [7]}, {"bar": 8}]}, - {"c": "bar"}, - {"notfoo": [{"bar": 23}, {"bar": 24}, {"notbar": [7]}, {"bar": 25}]}, - {"qux": [{"baz": []}, {"baz": [1, 2, 3]}, {"baz": [4]}, {"baz": []}]} - ], - "otherkey": {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]} - } - ]}, - "cases": [ - { - "expression": "reservations[].instances[].foo[].bar", - "result": [1, 2, 4, 5, 6, 8] - }, - { - "expression": "reservations[].instances[].foo[].baz", - "result": [] - }, - { - "expression": "reservations[].instances[].notfoo[].bar", - "result": [20, 21, 22, 23, 24, 25] - }, - { - "expression": "reservations[].instances[].notfoo[].notbar", - "result": [[7], [7]] - }, - { - "expression": "reservations[].notinstances[].foo", - "result": [] - }, - { - "expression": "reservations[].instances[].foo[].notbar", - "result": [3, [7]] - }, - { - "expression": "reservations[].instances[].bar[].baz", - "result": [[1], [2], [3], [4]] - }, - { - "expression": "reservations[].instances[].baz[].baz", - "result": [[1, 2], [], [], [3, 4]] - }, - { - "expression": "reservations[].instances[].qux[].baz", - "result": [[], [1, 2, 3], [4], [], [], [1, 2, 3], [4], []] - }, - { - "expression": "reservations[].instances[].qux[].baz[]", - "result": [1, 2, 3, 4, 1, 2, 3, 4] - } - ] -}, -{ - "given": { - "foo": [ - [["one", "two"], ["three", "four"]], - [["five", "six"], ["seven", "eight"]], - [["nine"], ["ten"]] - ] - }, - "cases": [ - { - "expression": "foo[]", - "result": [["one", "two"], ["three", "four"], ["five", "six"], - ["seven", "eight"], ["nine"], ["ten"]] - }, - { - "expression": "foo[][0]", - "result": ["one", "three", "five", "seven", "nine", "ten"] - }, - { - "expression": "foo[][1]", - "result": ["two", "four", "six", "eight"] - }, - { - "expression": "foo[][0][0]", - "result": [] - }, - { - "expression": "foo[][2][2]", - "result": [] - }, - { - "expression": "foo[][0][0][100]", - "result": [] - } - ] -}, -{ - "given": { - "foo": [{ - "bar": [ - { - "qux": 2, - "baz": 1 - }, - { - "qux": 4, - "baz": 3 - } - ] - }, - { - "bar": [ - { - "qux": 6, - "baz": 5 - }, - { - "qux": 8, - "baz": 7 - } - ] - } - ] - }, - "cases": [ - { - "expression": "foo", - "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]}, - {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}] - }, - { - "expression": "foo[]", - "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]}, - {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}] - }, - { - "expression": "foo[].bar", - "result": [[{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}], - [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]] - }, - { - "expression": "foo[].bar[]", - "result": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}, - {"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}] - }, - { - "expression": "foo[].bar[].baz", - "result": [1, 3, 5, 7] - } - ] -}, -{ - "given": { - "string": "string", - "hash": {"foo": "bar", "bar": "baz"}, - "number": 23, - "nullvalue": null - }, - "cases": [ - { - "expression": "string[]", - "result": null - }, - { - "expression": "hash[]", - "result": null - }, - { - "expression": "number[]", - "result": null - }, - { - "expression": "nullvalue[]", - "result": null - }, - { - "expression": "string[].foo", - "result": null - }, - { - "expression": "hash[].foo", - "result": null - }, - { - "expression": "number[].foo", - "result": null - }, - { - "expression": "nullvalue[].foo", - "result": null - }, - { - "expression": "nullvalue[].foo[].bar", - "result": null - } - ] -} -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/literal.json b/vendor/mtdowling/jmespath.php/tests/compliance/literal.json deleted file mode 100644 index b796d36d..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/literal.json +++ /dev/null @@ -1,190 +0,0 @@ -[ - { - "given": { - "foo": [{"name": "a"}, {"name": "b"}], - "bar": {"baz": "qux"} - }, - "cases": [ - { - "expression": "`\"foo\"`", - "result": "foo" - }, - { - "comment": "Interpret escaped unicode.", - "expression": "`\"\\u03a6\"`", - "result": "Φ" - }, - { - "expression": "`\"✓\"`", - "result": "✓" - }, - { - "expression": "`[1, 2, 3]`", - "result": [1, 2, 3] - }, - { - "expression": "`{\"a\": \"b\"}`", - "result": {"a": "b"} - }, - { - "expression": "`true`", - "result": true - }, - { - "expression": "`false`", - "result": false - }, - { - "expression": "`null`", - "result": null - }, - { - "expression": "`0`", - "result": 0 - }, - { - "expression": "`1`", - "result": 1 - }, - { - "expression": "`2`", - "result": 2 - }, - { - "expression": "`3`", - "result": 3 - }, - { - "expression": "`4`", - "result": 4 - }, - { - "expression": "`5`", - "result": 5 - }, - { - "expression": "`6`", - "result": 6 - }, - { - "expression": "`7`", - "result": 7 - }, - { - "expression": "`8`", - "result": 8 - }, - { - "expression": "`9`", - "result": 9 - }, - { - "comment": "Escaping a backtick in quotes", - "expression": "`\"foo\\`bar\"`", - "result": "foo`bar" - }, - { - "comment": "Double quote in literal", - "expression": "`\"foo\\\"bar\"`", - "result": "foo\"bar" - }, - { - "expression": "`\"1\\`\"`", - "result": "1`" - }, - { - "comment": "Multiple literal expressions with escapes", - "expression": "`\"\\\\\"`.{a:`\"b\"`}", - "result": {"a": "b"} - }, - { - "comment": "literal . identifier", - "expression": "`{\"a\": \"b\"}`.a", - "result": "b" - }, - { - "comment": "literal . identifier . identifier", - "expression": "`{\"a\": {\"b\": \"c\"}}`.a.b", - "result": "c" - }, - { - "comment": "literal . identifier bracket-expr", - "expression": "`[0, 1, 2]`[1]", - "result": 1 - } - ] - }, - { - "comment": "Literals", - "given": {"type": "object"}, - "cases": [ - { - "comment": "Literal with leading whitespace", - "expression": "` {\"foo\": true}`", - "result": {"foo": true} - }, - { - "comment": "Literal with trailing whitespace", - "expression": "`{\"foo\": true} `", - "result": {"foo": true} - }, - { - "comment": "Literal on RHS of subexpr not allowed", - "expression": "foo.`\"bar\"`", - "error": "syntax" - } - ] - }, - { - "comment": "Raw String Literals", - "given": {}, - "cases": [ - { - "expression": "'foo'", - "result": "foo" - }, - { - "expression": "' foo '", - "result": " foo " - }, - { - "expression": "'0'", - "result": "0" - }, - { - "expression": "'newline\n'", - "result": "newline\n" - }, - { - "expression": "'\n'", - "result": "\n" - }, - { - "expression": "'✓'", - "result": "✓" - }, - { - "expression": "'𝄞'", - "result": "𝄞" - }, - { - "expression": "' [foo] '", - "result": " [foo] " - }, - { - "expression": "'[foo]'", - "result": "[foo]" - }, - { - "comment": "Do not interpret escaped unicode.", - "expression": "'\\u03a6'", - "result": "\\u03a6" - }, - { - "comment": "Can escape the single quote", - "expression": "'foo\\'bar'", - "result": "foo'bar" - } - ] - } -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/multiselect.json b/vendor/mtdowling/jmespath.php/tests/compliance/multiselect.json deleted file mode 100644 index 8f2a481e..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/multiselect.json +++ /dev/null @@ -1,393 +0,0 @@ -[{ - "given": { - "foo": { - "bar": "bar", - "baz": "baz", - "qux": "qux", - "nested": { - "one": { - "a": "first", - "b": "second", - "c": "third" - }, - "two": { - "a": "first", - "b": "second", - "c": "third" - }, - "three": { - "a": "first", - "b": "second", - "c": {"inner": "third"} - } - } - }, - "bar": 1, - "baz": 2, - "qux\"": 3 - }, - "cases": [ - { - "expression": "foo.{bar: bar}", - "result": {"bar": "bar"} - }, - { - "expression": "foo.{\"bar\": bar}", - "result": {"bar": "bar"} - }, - { - "expression": "foo.{\"foo.bar\": bar}", - "result": {"foo.bar": "bar"} - }, - { - "expression": "foo.{bar: bar, baz: baz}", - "result": {"bar": "bar", "baz": "baz"} - }, - { - "expression": "foo.{\"bar\": bar, \"baz\": baz}", - "result": {"bar": "bar", "baz": "baz"} - }, - { - "expression": "{\"baz\": baz, \"qux\\\"\": \"qux\\\"\"}", - "result": {"baz": 2, "qux\"": 3} - }, - { - "expression": "foo.{bar:bar,baz:baz}", - "result": {"bar": "bar", "baz": "baz"} - }, - { - "expression": "foo.{bar: bar,qux: qux}", - "result": {"bar": "bar", "qux": "qux"} - }, - { - "expression": "foo.{bar: bar, noexist: noexist}", - "result": {"bar": "bar", "noexist": null} - }, - { - "expression": "foo.{noexist: noexist, alsonoexist: alsonoexist}", - "result": {"noexist": null, "alsonoexist": null} - }, - { - "expression": "foo.badkey.{nokey: nokey, alsonokey: alsonokey}", - "result": null - }, - { - "expression": "foo.nested.*.{a: a,b: b}", - "result": [{"a": "first", "b": "second"}, - {"a": "first", "b": "second"}, - {"a": "first", "b": "second"}] - }, - { - "expression": "foo.nested.three.{a: a, cinner: c.inner}", - "result": {"a": "first", "cinner": "third"} - }, - { - "expression": "foo.nested.three.{a: a, c: c.inner.bad.key}", - "result": {"a": "first", "c": null} - }, - { - "expression": "foo.{a: nested.one.a, b: nested.two.b}", - "result": {"a": "first", "b": "second"} - }, - { - "expression": "{bar: bar, baz: baz}", - "result": {"bar": 1, "baz": 2} - }, - { - "expression": "{bar: bar}", - "result": {"bar": 1} - }, - { - "expression": "{otherkey: bar}", - "result": {"otherkey": 1} - }, - { - "expression": "{no: no, exist: exist}", - "result": {"no": null, "exist": null} - }, - { - "expression": "foo.[bar]", - "result": ["bar"] - }, - { - "expression": "foo.[bar,baz]", - "result": ["bar", "baz"] - }, - { - "expression": "foo.[bar,qux]", - "result": ["bar", "qux"] - }, - { - "expression": "foo.[bar,noexist]", - "result": ["bar", null] - }, - { - "expression": "foo.[noexist,alsonoexist]", - "result": [null, null] - } - ] -}, { - "given": { - "foo": {"bar": 1, "baz": [2, 3, 4]} - }, - "cases": [ - { - "expression": "foo.{bar:bar,baz:baz}", - "result": {"bar": 1, "baz": [2, 3, 4]} - }, - { - "expression": "foo.[bar,baz[0]]", - "result": [1, 2] - }, - { - "expression": "foo.[bar,baz[1]]", - "result": [1, 3] - }, - { - "expression": "foo.[bar,baz[2]]", - "result": [1, 4] - }, - { - "expression": "foo.[bar,baz[3]]", - "result": [1, null] - }, - { - "expression": "foo.[bar[0],baz[3]]", - "result": [null, null] - } - ] -}, { - "given": { - "foo": {"bar": 1, "baz": 2} - }, - "cases": [ - { - "expression": "foo.{bar: bar, baz: baz}", - "result": {"bar": 1, "baz": 2} - }, - { - "expression": "foo.[bar,baz]", - "result": [1, 2] - } - ] -}, { - "given": { - "foo": { - "bar": {"baz": [{"common": "first", "one": 1}, - {"common": "second", "two": 2}]}, - "ignoreme": 1, - "includeme": true - } - }, - "cases": [ - { - "expression": "foo.{bar: bar.baz[1],includeme: includeme}", - "result": {"bar": {"common": "second", "two": 2}, "includeme": true} - }, - { - "expression": "foo.{\"bar.baz.two\": bar.baz[1].two, includeme: includeme}", - "result": {"bar.baz.two": 2, "includeme": true} - }, - { - "expression": "foo.[includeme, bar.baz[*].common]", - "result": [true, ["first", "second"]] - }, - { - "expression": "foo.[includeme, bar.baz[*].none]", - "result": [true, []] - }, - { - "expression": "foo.[includeme, bar.baz[].common]", - "result": [true, ["first", "second"]] - } - ] -}, { - "given": { - "reservations": [{ - "instances": [ - {"id": "id1", - "name": "first"}, - {"id": "id2", - "name": "second"} - ]}, { - "instances": [ - {"id": "id3", - "name": "third"}, - {"id": "id4", - "name": "fourth"} - ]} - ]}, - "cases": [ - { - "expression": "reservations[*].instances[*].{id: id, name: name}", - "result": [[{"id": "id1", "name": "first"}, {"id": "id2", "name": "second"}], - [{"id": "id3", "name": "third"}, {"id": "id4", "name": "fourth"}]] - }, - { - "expression": "reservations[].instances[].{id: id, name: name}", - "result": [{"id": "id1", "name": "first"}, - {"id": "id2", "name": "second"}, - {"id": "id3", "name": "third"}, - {"id": "id4", "name": "fourth"}] - }, - { - "expression": "reservations[].instances[].[id, name]", - "result": [["id1", "first"], - ["id2", "second"], - ["id3", "third"], - ["id4", "fourth"]] - } - ] -}, -{ - "given": { - "foo": [{ - "bar": [ - { - "qux": 2, - "baz": 1 - }, - { - "qux": 4, - "baz": 3 - } - ] - }, - { - "bar": [ - { - "qux": 6, - "baz": 5 - }, - { - "qux": 8, - "baz": 7 - } - ] - } - ] - }, - "cases": [ - { - "expression": "foo", - "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]}, - {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}] - }, - { - "expression": "foo[]", - "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]}, - {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}] - }, - { - "expression": "foo[].bar", - "result": [[{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}], - [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]] - }, - { - "expression": "foo[].bar[]", - "result": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}, - {"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}] - }, - { - "expression": "foo[].bar[].[baz, qux]", - "result": [[1, 2], [3, 4], [5, 6], [7, 8]] - }, - { - "expression": "foo[].bar[].[baz]", - "result": [[1], [3], [5], [7]] - }, - { - "expression": "foo[].bar[].[baz, qux][]", - "result": [1, 2, 3, 4, 5, 6, 7, 8] - } - ] -}, -{ - "given": { - "foo": { - "baz": [ - { - "bar": "abc" - }, { - "bar": "def" - } - ], - "qux": ["zero"] - } - }, - "cases": [ - { - "expression": "foo.[baz[*].bar, qux[0]]", - "result": [["abc", "def"], "zero"] - } - ] -}, -{ - "given": { - "foo": { - "baz": [ - { - "bar": "a", - "bam": "b", - "boo": "c" - }, { - "bar": "d", - "bam": "e", - "boo": "f" - } - ], - "qux": ["zero"] - } - }, - "cases": [ - { - "expression": "foo.[baz[*].[bar, boo], qux[0]]", - "result": [[["a", "c" ], ["d", "f" ]], "zero"] - } - ] -}, -{ - "given": { - "foo": { - "baz": [ - { - "bar": "a", - "bam": "b", - "boo": "c" - }, { - "bar": "d", - "bam": "e", - "boo": "f" - } - ], - "qux": ["zero"] - } - }, - "cases": [ - { - "expression": "foo.[baz[*].not_there || baz[*].bar, qux[0]]", - "result": [["a", "d"], "zero"] - } - ] -}, -{ - "given": {"type": "object"}, - "cases": [ - { - "comment": "Nested multiselect", - "expression": "[[*],*]", - "result": [null, ["object"]] - } - ] -}, -{ - "given": [], - "cases": [ - { - "comment": "Nested multiselect", - "expression": "[[*]]", - "result": [[]] - } - ] -} -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/perf/basic.json b/vendor/mtdowling/jmespath.php/tests/compliance/perf/basic.json deleted file mode 100644 index 0e70fd13..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/perf/basic.json +++ /dev/null @@ -1,27 +0,0 @@ -[{ - "description": "Basic minimal case", - "given": - {"foo": {"bar": {"baz": "correct"}}}, - "cases": [ - { - "name": "single_expression", - "expression": "foo", - "result": {"bar": {"baz": "correct"}} - }, - { - "name": "single_dot_expression", - "expression": "foo.bar", - "result": {"baz": "correct"} - }, - { - "name": "double_dot_expression", - "expression": "foo.bar.baz", - "result": "correct" - }, - { - "name": "dot_no_match", - "expression": "foo.bar.baz.bad", - "result": null - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/perf/deep_hierarchy.json b/vendor/mtdowling/jmespath.php/tests/compliance/perf/deep_hierarchy.json deleted file mode 100644 index aecffe24..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/perf/deep_hierarchy.json +++ /dev/null @@ -1,27 +0,0 @@ -[{ - "description": "Deeply nested dict", - "given": - {"j49": {"j48": {"j47": {"j46": {"j45": {"j44": {"j43": {"j42": {"j41": {"j40": {"j39": {"j38": {"j37": {"j36": {"j35": {"j34": {"j33": {"j32": {"j31": {"j30": {"j29": {"j28": {"j27": {"j26": {"j25": {"j24": {"j23": {"j22": {"j21": {"j20": {"j19": {"j18": {"j17": {"j16": {"j15": {"j14": {"j13": {"j12": {"j11": {"j10": {"j9": {"j8": {"j7": {"j6": {"j5": {"j4": {"j3": {"j2": {"j1": {"j0": {}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, - "cases": [ - { - "name": "deep_nesting_10", - "expression": "j49.j48.j47.j46.j45.j44.j43.j42.j41.j40", - "result": {"j39": {"j38": {"j37": {"j36": {"j35": {"j34": {"j33": {"j32": {"j31": {"j30": {"j29": {"j28": {"j27": {"j26": {"j25": {"j24": {"j23": {"j22": {"j21": {"j20": {"j19": {"j18": {"j17": {"j16": {"j15": {"j14": {"j13": {"j12": {"j11": {"j10": {"j9": {"j8": {"j7": {"j6": {"j5": {"j4": {"j3": {"j2": {"j1": {"j0": {}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} - }, - { - "name": "deep_nesting_50", - "expression": "j49.j48.j47.j46.j45.j44.j43.j42.j41.j40.j39.j38.j37.j36.j35.j34.j33.j32.j31.j30.j29.j28.j27.j26.j25.j24.j23.j22.j21.j20.j19.j18.j17.j16.j15.j14.j13.j12.j11.j10.j9.j8.j7.j6.j5.j4.j3.j2.j1.j0", - "result": {} - }, - { - "name": "deep_nesting_50_pipe", - "expression": "j49|j48|j47|j46|j45|j44|j43|j42|j41|j40|j39|j38|j37|j36|j35|j34|j33|j32|j31|j30|j29|j28|j27|j26|j25|j24|j23|j22|j21|j20|j19|j18|j17|j16|j15|j14|j13|j12|j11|j10|j9|j8|j7|j6|j5|j4|j3|j2|j1|j0", - "result": {} - }, - { - "name": "deep_nesting_50_index", - "expression": "[49][48][47][46][45][44][43][42][41][40][39][38][37][36][35][34][33][32][31][30][29][28][27][26][25][24][23][22][21][20][19][18][17][16][15][14][13][12][11][10][9][8][7][6][5][4][3][2][1][0]", - "result": null - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/perf/deep_projection.json b/vendor/mtdowling/jmespath.php/tests/compliance/perf/deep_projection.json deleted file mode 100644 index fecd6af6..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/perf/deep_projection.json +++ /dev/null @@ -1,12 +0,0 @@ -[{ - "description": "Deep projections", - "given": - {"a": []}, - "cases": [ - { - "name": "deep_projection_104", - "expression": "a[*].b[*].c[*].d[*].e[*].f[*].g[*].h[*].i[*].j[*].k[*].l[*].m[*].n[*].o[*].p[*].q[*].r[*].s[*].t[*].u[*].v[*].w[*].x[*].y[*].z[*].a[*].b[*].c[*].d[*].e[*].f[*].g[*].h[*].i[*].j[*].k[*].l[*].m[*].n[*].o[*].p[*].q[*].r[*].s[*].t[*].u[*].v[*].w[*].x[*].y[*].z[*].a[*].b[*].c[*].d[*].e[*].f[*].g[*].h[*].i[*].j[*].k[*].l[*].m[*].n[*].o[*].p[*].q[*].r[*].s[*].t[*].u[*].v[*].w[*].x[*].y[*].z[*].a[*].b[*].c[*].d[*].e[*].f[*].g[*].h[*].i[*].j[*].k[*].l[*].m[*].n[*].o[*].p[*].q[*].r[*].s[*].t[*].u[*].v[*].w[*].x[*].y[*].z[*]", - "result": [] - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/perf/functions.json b/vendor/mtdowling/jmespath.php/tests/compliance/perf/functions.json deleted file mode 100644 index 01222835..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/perf/functions.json +++ /dev/null @@ -1,17 +0,0 @@ -[{ - "description": "Deep projections", - "given": - [749, 222, 102, 148, 869, 848, 326, 644, 402, 150, 361, 827, 741, 60, 842, 943, 214, 519, 134, 866, 621, 851, 59, 580, 760, 576, 951, 989, 266, 259, 809, 643, 292, 731, 129, 970, 589, 430, 690, 715, 901, 491, 276, 88, 738, 282, 547, 349, 236, 879, 403, 557, 554, 23, 649, 720, 531, 2, 601, 152, 530, 477, 568, 122, 811, 75, 181, 203, 683, 152, 794, 155, 54, 314, 957, 468, 740, 532, 504, 806, 927, 827, 840, 100, 519, 357, 536, 398, 417, 543, 599, 383, 144, 772, 988, 184, 118, 921, 497, 193, 320, 919, 583, 346, 575, 143, 866, 907, 570, 255, 539, 164, 764, 256, 315, 305, 960, 587, 804, 577, 667, 869, 563, 956, 677, 469, 934, 52, 323, 933, 398, 305, 138, 133, 443, 419, 717, 838, 287, 177, 192, 210, 892, 319, 470, 76, 643, 737, 135, 425, 586, 882, 844, 113, 268, 323, 938, 569, 374, 295, 648, 27, 703, 530, 667, 118, 176, 972, 611, 60, 47, 19, 500, 344, 332, 452, 647, 388, 188, 235, 151, 353, 219, 766, 626, 885, 456, 182, 363, 617, 236, 285, 152, 87, 666, 429, 599, 762, 13, 778, 634, 43, 199, 361, 300, 370, 957, 488, 359, 354, 972, 368, 482, 88, 766, 709, 804, 637, 368, 950, 752, 932, 638, 291, 177, 739, 740, 357, 928, 964, 621, 472, 813, 36, 271, 642, 3, 771, 397, 670, 324, 244, 827, 194, 693, 846, 351, 668, 911, 600, 682, 735, 26, 876, 581, 915, 184, 263, 857, 960, 5, 523, 932, 694, 457, 739, 897, 28, 794, 885, 77, 768, 39, 763, 748, 792, 60, 582, 667, 909, 820, 898, 569, 252, 583, 237, 677, 613, 914, 956, 541, 297, 853, 581, 118, 888, 368, 156, 582, 183], - "cases": [ - { - "name": "min sort with slice", - "expression": "sort(@)[:3]", - "result": [2, 3, 5] - }, - { - "name": "max sort with slice", - "expression": "sort(@)[-3:]", - "result": [972, 988, 989] - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/perf/multiwildcard.json b/vendor/mtdowling/jmespath.php/tests/compliance/perf/multiwildcard.json deleted file mode 100644 index c2a2c0b1..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/perf/multiwildcard.json +++ /dev/null @@ -1,22 +0,0 @@ -[{ - "description": "Multiple wildcards in an expression", - "given": { - "foo": [ - {"bar": [{"kind": "basic"}, {"kind": "intermediate"}]}, - {"bar": [{"kind": "advanced"}, {"kind": "expert"}]} - ] - - }, - "cases": [ - { - "name": "multi_wildcard_field", - "expression": "foo[*].bar[*].kind", - "result": [["basic", "intermediate"], ["advanced", "expert"]] - }, - { - "name": "wildcard_with_index", - "expression": "foo[*].bar[0].kind", - "result": ["basic", "advanced"] - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/perf/wildcardindex.json b/vendor/mtdowling/jmespath.php/tests/compliance/perf/wildcardindex.json deleted file mode 100644 index 57208f93..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/perf/wildcardindex.json +++ /dev/null @@ -1,17 +0,0 @@ -[{ - "description": "Multiple wildcards", - "given": - {"foo": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}]}, - "cases": [ - { - "name": "wildcard_with_field_match", - "expression": "foo[*].bar", - "result": ["one", "two", "three"] - }, - { - "name": "wildcard_with_field_match2", - "expression": "foo[*].notbar", - "result": ["four"] - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/pipe.json b/vendor/mtdowling/jmespath.php/tests/compliance/pipe.json deleted file mode 100644 index b10c0a49..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/pipe.json +++ /dev/null @@ -1,131 +0,0 @@ -[{ - "given": { - "foo": { - "bar": { - "baz": "subkey" - }, - "other": { - "baz": "subkey" - }, - "other2": { - "baz": "subkey" - }, - "other3": { - "notbaz": ["a", "b", "c"] - }, - "other4": { - "notbaz": ["a", "b", "c"] - } - } - }, - "cases": [ - { - "expression": "foo.*.baz | [0]", - "result": "subkey" - }, - { - "expression": "foo.*.baz | [1]", - "result": "subkey" - }, - { - "expression": "foo.*.baz | [2]", - "result": "subkey" - }, - { - "expression": "foo.bar.* | [0]", - "result": "subkey" - }, - { - "expression": "foo.*.notbaz | [*]", - "result": [["a", "b", "c"], ["a", "b", "c"]] - }, - { - "expression": "{\"a\": foo.bar, \"b\": foo.other} | *.baz", - "result": ["subkey", "subkey"] - } - ] -}, { - "given": { - "foo": { - "bar": { - "baz": "one" - }, - "other": { - "baz": "two" - }, - "other2": { - "baz": "three" - }, - "other3": { - "notbaz": ["a", "b", "c"] - }, - "other4": { - "notbaz": ["d", "e", "f"] - } - } - }, - "cases": [ - { - "expression": "foo | bar", - "result": {"baz": "one"} - }, - { - "expression": "foo | bar | baz", - "result": "one" - }, - { - "expression": "foo|bar| baz", - "result": "one" - }, - { - "expression": "not_there | [0]", - "result": null - }, - { - "expression": "not_there | [0]", - "result": null - }, - { - "expression": "[foo.bar, foo.other] | [0]", - "result": {"baz": "one"} - }, - { - "expression": "{\"a\": foo.bar, \"b\": foo.other} | a", - "result": {"baz": "one"} - }, - { - "expression": "{\"a\": foo.bar, \"b\": foo.other} | b", - "result": {"baz": "two"} - }, - { - "expression": "foo.bam || foo.bar | baz", - "result": "one" - }, - { - "expression": "foo | not_there || bar", - "result": {"baz": "one"} - } - ] -}, { - "given": { - "foo": [{ - "bar": [{ - "baz": "one" - }, { - "baz": "two" - }] - }, { - "bar": [{ - "baz": "three" - }, { - "baz": "four" - }] - }] - }, - "cases": [ - { - "expression": "foo[*].bar[*] | [0][0]", - "result": {"baz": "one"} - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/slice.json b/vendor/mtdowling/jmespath.php/tests/compliance/slice.json deleted file mode 100644 index 35947727..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/slice.json +++ /dev/null @@ -1,187 +0,0 @@ -[{ - "given": { - "foo": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], - "bar": { - "baz": 1 - } - }, - "cases": [ - { - "expression": "bar[0:10]", - "result": null - }, - { - "expression": "foo[0:10:1]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[0:10]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[0:10:]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[0::1]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[0::]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[0:]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[:10:1]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[::1]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[:10:]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[::]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[:]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[1:9]", - "result": [1, 2, 3, 4, 5, 6, 7, 8] - }, - { - "expression": "foo[0:10:2]", - "result": [0, 2, 4, 6, 8] - }, - { - "expression": "foo[5:]", - "result": [5, 6, 7, 8, 9] - }, - { - "expression": "foo[5::2]", - "result": [5, 7, 9] - }, - { - "expression": "foo[::2]", - "result": [0, 2, 4, 6, 8] - }, - { - "expression": "foo[::-1]", - "result": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] - }, - { - "expression": "foo[1::2]", - "result": [1, 3, 5, 7, 9] - }, - { - "expression": "foo[10:0:-1]", - "result": [9, 8, 7, 6, 5, 4, 3, 2, 1] - }, - { - "expression": "foo[10:5:-1]", - "result": [9, 8, 7, 6] - }, - { - "expression": "foo[8:2:-2]", - "result": [8, 6, 4] - }, - { - "expression": "foo[0:20]", - "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - "expression": "foo[10:-20:-1]", - "result": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] - }, - { - "expression": "foo[10:-20]", - "result": [] - }, - { - "expression": "foo[-4:-1]", - "result": [6, 7, 8] - }, - { - "expression": "foo[:-5:-1]", - "result": [9, 8, 7, 6] - }, - { - "expression": "foo[8:2:0]", - "error": "invalid-value" - }, - { - "expression": "foo[8:2:0:1]", - "error": "syntax" - }, - { - "expression": "foo[8:2&]", - "error": "syntax" - }, - { - "expression": "foo[2:a:3]", - "error": "syntax" - } - ] -}, { - "given": { - "foo": [{"a": 1}, {"a": 2}, {"a": 3}], - "bar": [{"a": {"b": 1}}, {"a": {"b": 2}}, - {"a": {"b": 3}}], - "baz": 50 - }, - "cases": [ - { - "expression": "foo[:2].a", - "result": [1, 2] - }, - { - "expression": "foo[:2].b", - "result": [] - }, - { - "expression": "foo[:2].a.b", - "result": [] - }, - { - "expression": "bar[::-1].a.b", - "result": [3, 2, 1] - }, - { - "expression": "bar[:2].a.b", - "result": [1, 2] - }, - { - "expression": "baz[:2].a", - "result": null - } - ] -}, { - "given": [{"a": 1}, {"a": 2}, {"a": 3}], - "cases": [ - { - "expression": "[:]", - "result": [{"a": 1}, {"a": 2}, {"a": 3}] - }, - { - "expression": "[:2].a", - "result": [1, 2] - }, - { - "expression": "[::-1].a", - "result": [3, 2, 1] - }, - { - "expression": "[:2].b", - "result": [] - } - ] -}] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/syntax.json b/vendor/mtdowling/jmespath.php/tests/compliance/syntax.json deleted file mode 100644 index 8b17f88d..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/syntax.json +++ /dev/null @@ -1,616 +0,0 @@ -[{ - "comment": "Dot syntax", - "given": {"type": "object"}, - "cases": [ - { - "expression": "foo.bar", - "result": null - }, - { - "expression": "foo.1", - "error": "syntax" - }, - { - "expression": "foo.-11", - "error": "syntax" - }, - { - "expression": "foo", - "result": null - }, - { - "expression": "foo.", - "error": "syntax" - }, - { - "expression": "foo.", - "error": "syntax" - }, - { - "expression": ".foo", - "error": "syntax" - }, - { - "expression": "foo..bar", - "error": "syntax" - }, - { - "expression": "foo.bar.", - "error": "syntax" - }, - { - "expression": "foo[.]", - "error": "syntax" - } - ] -}, - { - "comment": "Simple token errors", - "given": {"type": "object"}, - "cases": [ - { - "expression": ".", - "error": "syntax" - }, - { - "expression": ":", - "error": "syntax" - }, - { - "expression": ",", - "error": "syntax" - }, - { - "expression": "]", - "error": "syntax" - }, - { - "expression": "[", - "error": "syntax" - }, - { - "expression": "}", - "error": "syntax" - }, - { - "expression": "{", - "error": "syntax" - }, - { - "expression": ")", - "error": "syntax" - }, - { - "expression": "(", - "error": "syntax" - }, - { - "expression": "((&", - "error": "syntax" - }, - { - "expression": "a[", - "error": "syntax" - }, - { - "expression": "a]", - "error": "syntax" - }, - { - "expression": "a][", - "error": "syntax" - }, - { - "expression": "!", - "error": "syntax" - } - ] - }, - { - "comment": "Boolean syntax errors", - "given": {"type": "object"}, - "cases": [ - { - "expression": "![!(!", - "error": "syntax" - } - ] - }, - { - "comment": "Wildcard syntax", - "given": {"type": "object"}, - "cases": [ - { - "expression": "*", - "result": ["object"] - }, - { - "expression": "*.*", - "result": [] - }, - { - "expression": "*.foo", - "result": [] - }, - { - "expression": "*[0]", - "result": [] - }, - { - "expression": ".*", - "error": "syntax" - }, - { - "expression": "*foo", - "error": "syntax" - }, - { - "expression": "*0", - "error": "syntax" - }, - { - "expression": "foo[*]bar", - "error": "syntax" - }, - { - "expression": "foo[*]*", - "error": "syntax" - } - ] - }, - { - "comment": "Flatten syntax", - "given": {"type": "object"}, - "cases": [ - { - "expression": "[]", - "result": null - } - ] - }, - { - "comment": "Simple bracket syntax", - "given": {"type": "object"}, - "cases": [ - { - "expression": "[0]", - "result": null - }, - { - "expression": "[*]", - "result": null - }, - { - "expression": "*.[0]", - "error": "syntax" - }, - { - "expression": "*.[\"0\"]", - "result": [[null]] - }, - { - "expression": "[*].bar", - "result": null - }, - { - "expression": "[*][0]", - "result": null - }, - { - "expression": "foo[#]", - "error": "syntax" - } - ] - }, - { - "comment": "Multi-select list syntax", - "given": {"type": "object"}, - "cases": [ - { - "expression": "foo[0]", - "result": null - }, - { - "comment": "Valid multi-select of a list", - "expression": "foo[0, 1]", - "error": "syntax" - }, - { - "expression": "foo.[0]", - "error": "syntax" - }, - { - "expression": "foo.[*]", - "result": null - }, - { - "comment": "Multi-select of a list with trailing comma", - "expression": "foo[0, ]", - "error": "syntax" - }, - { - "comment": "Multi-select of a list with trailing comma and no close", - "expression": "foo[0,", - "error": "syntax" - }, - { - "comment": "Multi-select of a list with trailing comma and no close", - "expression": "foo.[a", - "error": "syntax" - }, - { - "comment": "Multi-select of a list with extra comma", - "expression": "foo[0,, 1]", - "error": "syntax" - }, - { - "comment": "Multi-select of a list using an identifier index", - "expression": "foo[abc]", - "error": "syntax" - }, - { - "comment": "Multi-select of a list using identifier indices", - "expression": "foo[abc, def]", - "error": "syntax" - }, - { - "comment": "Multi-select of a list using an identifier index", - "expression": "foo[abc, 1]", - "error": "syntax" - }, - { - "comment": "Multi-select of a list using an identifier index with trailing comma", - "expression": "foo[abc, ]", - "error": "syntax" - }, - { - "comment": "Valid multi-select of a hash using an identifier index", - "expression": "foo.[abc]", - "result": null - }, - { - "comment": "Valid multi-select of a hash", - "expression": "foo.[abc, def]", - "result": null - }, - { - "comment": "Multi-select of a hash using a numeric index", - "expression": "foo.[abc, 1]", - "error": "syntax" - }, - { - "comment": "Multi-select of a hash with a trailing comma", - "expression": "foo.[abc, ]", - "error": "syntax" - }, - { - "comment": "Multi-select of a hash with extra commas", - "expression": "foo.[abc,, def]", - "error": "syntax" - }, - { - "comment": "Multi-select of a hash using number indices", - "expression": "foo.[0, 1]", - "error": "syntax" - } - ] - }, - { - "comment": "Multi-select hash syntax", - "given": {"type": "object"}, - "cases": [ - { - "comment": "No key or value", - "expression": "a{}", - "error": "syntax" - }, - { - "comment": "No closing token", - "expression": "a{", - "error": "syntax" - }, - { - "comment": "Not a key value pair", - "expression": "a{foo}", - "error": "syntax" - }, - { - "comment": "Missing value and closing character", - "expression": "a{foo:", - "error": "syntax" - }, - { - "comment": "Missing closing character", - "expression": "a{foo: 0", - "error": "syntax" - }, - { - "comment": "Missing value", - "expression": "a{foo:}", - "error": "syntax" - }, - { - "comment": "Trailing comma and no closing character", - "expression": "a{foo: 0, ", - "error": "syntax" - }, - { - "comment": "Missing value with trailing comma", - "expression": "a{foo: ,}", - "error": "syntax" - }, - { - "comment": "Accessing Array using an identifier", - "expression": "a{foo: bar}", - "error": "syntax" - }, - { - "expression": "a{foo: 0}", - "error": "syntax" - }, - { - "comment": "Missing key-value pair", - "expression": "a.{}", - "error": "syntax" - }, - { - "comment": "Not a key-value pair", - "expression": "a.{foo}", - "error": "syntax" - }, - { - "comment": "Missing value", - "expression": "a.{foo:}", - "error": "syntax" - }, - { - "comment": "Missing value with trailing comma", - "expression": "a.{foo: ,}", - "error": "syntax" - }, - { - "comment": "Valid multi-select hash extraction", - "expression": "a.{foo: bar}", - "result": null - }, - { - "comment": "Valid multi-select hash extraction", - "expression": "a.{foo: bar, baz: bam}", - "result": null - }, - { - "comment": "Trailing comma", - "expression": "a.{foo: bar, }", - "error": "syntax" - }, - { - "comment": "Missing key in second key-value pair", - "expression": "a.{foo: bar, baz}", - "error": "syntax" - }, - { - "comment": "Missing value in second key-value pair", - "expression": "a.{foo: bar, baz:}", - "error": "syntax" - }, - { - "comment": "Trailing comma", - "expression": "a.{foo: bar, baz: bam, }", - "error": "syntax" - }, - { - "comment": "Nested multi select", - "expression": "{\"\\\\\":{\" \":*}}", - "result": {"\\": {" ": ["object"]}} - } - ] - }, - { - "comment": "Or expressions", - "given": {"type": "object"}, - "cases": [ - { - "expression": "foo || bar", - "result": null - }, - { - "expression": "foo ||", - "error": "syntax" - }, - { - "expression": "foo.|| bar", - "error": "syntax" - }, - { - "expression": " || foo", - "error": "syntax" - }, - { - "expression": "foo || || foo", - "error": "syntax" - }, - { - "expression": "foo.[a || b]", - "result": null - }, - { - "expression": "foo.[a ||]", - "error": "syntax" - }, - { - "expression": "\"foo", - "error": "syntax" - } - ] - }, - { - "comment": "Filter expressions", - "given": {"type": "object"}, - "cases": [ - { - "expression": "foo[?bar==`\"baz\"`]", - "result": null - }, - { - "expression": "foo[? bar == `\"baz\"` ]", - "result": null - }, - { - "expression": "foo[ ?bar==`\"baz\"`]", - "error": "syntax" - }, - { - "expression": "foo[?bar==]", - "error": "syntax" - }, - { - "expression": "foo[?==]", - "error": "syntax" - }, - { - "expression": "foo[?==bar]", - "error": "syntax" - }, - { - "expression": "foo[?bar==baz?]", - "error": "syntax" - }, - { - "expression": "foo[?a.b.c==d.e.f]", - "result": null - }, - { - "expression": "foo[?bar==`[0, 1, 2]`]", - "result": null - }, - { - "expression": "foo[?bar==`[\"a\", \"b\", \"c\"]`]", - "result": null - }, - { - "comment": "Literal char not escaped", - "expression": "foo[?bar==`[\"foo`bar\"]`]", - "error": "syntax" - }, - { - "comment": "Literal char escaped", - "expression": "foo[?bar==`[\"foo\\`bar\"]`]", - "result": null - }, - { - "comment": "Unknown comparator", - "expression": "foo[?bar<>baz]", - "error": "syntax" - }, - { - "comment": "Unknown comparator", - "expression": "foo[?bar^baz]", - "error": "syntax" - }, - { - "expression": "foo[bar==baz]", - "error": "syntax" - }, - { - "comment": "Quoted identifier in filter expression no spaces", - "expression": "[?\"\\\\\">`\"foo\"`]", - "result": null - }, - { - "comment": "Quoted identifier in filter expression with spaces", - "expression": "[?\"\\\\\" > `\"foo\"`]", - "result": null - } - ] - }, - { - "comment": "Filter expression errors", - "given": {"type": "object"}, - "cases": [ - { - "expression": "bar.`\"anything\"`", - "error": "syntax" - }, - { - "expression": "bar.baz.noexists.`\"literal\"`", - "error": "syntax" - }, - { - "comment": "Literal wildcard projection", - "expression": "foo[*].`\"literal\"`", - "error": "syntax" - }, - { - "expression": "foo[*].name.`\"literal\"`", - "error": "syntax" - }, - { - "expression": "foo[].name.`\"literal\"`", - "error": "syntax" - }, - { - "expression": "foo[].name.`\"literal\"`.`\"subliteral\"`", - "error": "syntax" - }, - { - "comment": "Projecting a literal onto an empty list", - "expression": "foo[*].name.noexist.`\"literal\"`", - "error": "syntax" - }, - { - "expression": "foo[].name.noexist.`\"literal\"`", - "error": "syntax" - }, - { - "expression": "twolen[*].`\"foo\"`", - "error": "syntax" - }, - { - "comment": "Two level projection of a literal", - "expression": "twolen[*].threelen[*].`\"bar\"`", - "error": "syntax" - }, - { - "comment": "Two level flattened projection of a literal", - "expression": "twolen[].threelen[].`\"bar\"`", - "error": "syntax" - } - ] - }, - { - "comment": "Identifiers", - "given": {"type": "object"}, - "cases": [ - { - "expression": "foo", - "result": null - }, - { - "expression": "\"foo\"", - "result": null - }, - { - "expression": "\"\\\\\"", - "result": null - } - ] - }, - { - "comment": "Combined syntax", - "given": [], - "cases": [ - { - "expression": "*||*|*|*", - "result": [] - }, - { - "expression": "*[]||[*]", - "result": [] - }, - { - "expression": "[*.*]", - "result": [[]] - } - ] - } -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/unicode.json b/vendor/mtdowling/jmespath.php/tests/compliance/unicode.json deleted file mode 100644 index 6b07b0b6..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/unicode.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "given": {"foo": [{"✓": "✓"}, {"✓": "✗"}]}, - "cases": [ - { - "expression": "foo[].\"✓\"", - "result": ["✓", "✗"] - } - ] - }, - { - "given": {"☯": true}, - "cases": [ - { - "expression": "\"☯\"", - "result": true - } - ] - }, - { - "given": {"♪♫•*¨*•.¸¸❤¸¸.•*¨*•♫♪": true}, - "cases": [ - { - "expression": "\"♪♫•*¨*•.¸¸❤¸¸.•*¨*•♫♪\"", - "result": true - } - ] - }, - { - "given": {"☃": true}, - "cases": [ - { - "expression": "\"☃\"", - "result": true - } - ] - } -] diff --git a/vendor/mtdowling/jmespath.php/tests/compliance/wildcard.json b/vendor/mtdowling/jmespath.php/tests/compliance/wildcard.json deleted file mode 100644 index 3bcec302..00000000 --- a/vendor/mtdowling/jmespath.php/tests/compliance/wildcard.json +++ /dev/null @@ -1,460 +0,0 @@ -[{ - "given": { - "foo": { - "bar": { - "baz": "val" - }, - "other": { - "baz": "val" - }, - "other2": { - "baz": "val" - }, - "other3": { - "notbaz": ["a", "b", "c"] - }, - "other4": { - "notbaz": ["a", "b", "c"] - }, - "other5": { - "other": { - "a": 1, - "b": 1, - "c": 1 - } - } - } - }, - "cases": [ - { - "expression": "foo.*.baz", - "result": ["val", "val", "val"] - }, - { - "expression": "foo.bar.*", - "result": ["val"] - }, - { - "expression": "foo.*.notbaz", - "result": [["a", "b", "c"], ["a", "b", "c"]] - }, - { - "expression": "foo.*.notbaz[0]", - "result": ["a", "a"] - }, - { - "expression": "foo.*.notbaz[-1]", - "result": ["c", "c"] - } - ] -}, { - "given": { - "foo": { - "first-1": { - "second-1": "val" - }, - "first-2": { - "second-1": "val" - }, - "first-3": { - "second-1": "val" - } - } - }, - "cases": [ - { - "expression": "foo.*", - "result": [{"second-1": "val"}, {"second-1": "val"}, - {"second-1": "val"}] - }, - { - "expression": "foo.*.*", - "result": [["val"], ["val"], ["val"]] - }, - { - "expression": "foo.*.*.*", - "result": [[], [], []] - }, - { - "expression": "foo.*.*.*.*", - "result": [[], [], []] - } - ] -}, { - "given": { - "foo": { - "bar": "one" - }, - "other": { - "bar": "one" - }, - "nomatch": { - "notbar": "three" - } - }, - "cases": [ - { - "expression": "*.bar", - "result": ["one", "one"] - } - ] -}, { - "given": { - "top1": { - "sub1": {"foo": "one"} - }, - "top2": { - "sub1": {"foo": "one"} - } - }, - "cases": [ - { - "expression": "*", - "result": [{"sub1": {"foo": "one"}}, - {"sub1": {"foo": "one"}}] - }, - { - "expression": "*.sub1", - "result": [{"foo": "one"}, - {"foo": "one"}] - }, - { - "expression": "*.*", - "result": [[{"foo": "one"}], - [{"foo": "one"}]] - }, - { - "expression": "*.*.foo[]", - "result": ["one", "one"] - }, - { - "expression": "*.sub1.foo", - "result": ["one", "one"] - } - ] -}, -{ - "given": - {"foo": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}]}, - "cases": [ - { - "expression": "foo[*].bar", - "result": ["one", "two", "three"] - }, - { - "expression": "foo[*].notbar", - "result": ["four"] - } - ] -}, -{ - "given": - [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}], - "cases": [ - { - "expression": "[*]", - "result": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}] - }, - { - "expression": "[*].bar", - "result": ["one", "two", "three"] - }, - { - "expression": "[*].notbar", - "result": ["four"] - } - ] -}, -{ - "given": { - "foo": { - "bar": [ - {"baz": ["one", "two", "three"]}, - {"baz": ["four", "five", "six"]}, - {"baz": ["seven", "eight", "nine"]} - ] - } - }, - "cases": [ - { - "expression": "foo.bar[*].baz", - "result": [["one", "two", "three"], ["four", "five", "six"], ["seven", "eight", "nine"]] - }, - { - "expression": "foo.bar[*].baz[0]", - "result": ["one", "four", "seven"] - }, - { - "expression": "foo.bar[*].baz[1]", - "result": ["two", "five", "eight"] - }, - { - "expression": "foo.bar[*].baz[2]", - "result": ["three", "six", "nine"] - }, - { - "expression": "foo.bar[*].baz[3]", - "result": [] - } - ] -}, -{ - "given": { - "foo": { - "bar": [["one", "two"], ["three", "four"]] - } - }, - "cases": [ - { - "expression": "foo.bar[*]", - "result": [["one", "two"], ["three", "four"]] - }, - { - "expression": "foo.bar[0]", - "result": ["one", "two"] - }, - { - "expression": "foo.bar[0][0]", - "result": "one" - }, - { - "expression": "foo.bar[0][0][0]", - "result": null - }, - { - "expression": "foo.bar[0][0][0][0]", - "result": null - }, - { - "expression": "foo[0][0]", - "result": null - } - ] -}, -{ - "given": { - "foo": [ - {"bar": [{"kind": "basic"}, {"kind": "intermediate"}]}, - {"bar": [{"kind": "advanced"}, {"kind": "expert"}]}, - {"bar": "string"} - ] - - }, - "cases": [ - { - "expression": "foo[*].bar[*].kind", - "result": [["basic", "intermediate"], ["advanced", "expert"]] - }, - { - "expression": "foo[*].bar[0].kind", - "result": ["basic", "advanced"] - } - ] -}, -{ - "given": { - "foo": [ - {"bar": {"kind": "basic"}}, - {"bar": {"kind": "intermediate"}}, - {"bar": {"kind": "advanced"}}, - {"bar": {"kind": "expert"}}, - {"bar": "string"} - ] - }, - "cases": [ - { - "expression": "foo[*].bar.kind", - "result": ["basic", "intermediate", "advanced", "expert"] - } - ] -}, -{ - "given": { - "foo": [{"bar": ["one", "two"]}, {"bar": ["three", "four"]}, {"bar": ["five"]}] - }, - "cases": [ - { - "expression": "foo[*].bar[0]", - "result": ["one", "three", "five"] - }, - { - "expression": "foo[*].bar[1]", - "result": ["two", "four"] - }, - { - "expression": "foo[*].bar[2]", - "result": [] - } - ] -}, -{ - "given": { - "foo": [{"bar": []}, {"bar": []}, {"bar": []}] - }, - "cases": [ - { - "expression": "foo[*].bar[0]", - "result": [] - } - ] -}, -{ - "given": { - "foo": [["one", "two"], ["three", "four"], ["five"]] - }, - "cases": [ - { - "expression": "foo[*][0]", - "result": ["one", "three", "five"] - }, - { - "expression": "foo[*][1]", - "result": ["two", "four"] - } - ] -}, -{ - "given": { - "foo": [ - [ - ["one", "two"], ["three", "four"] - ], [ - ["five", "six"], ["seven", "eight"] - ], [ - ["nine"], ["ten"] - ] - ] - }, - "cases": [ - { - "expression": "foo[*][0]", - "result": [["one", "two"], ["five", "six"], ["nine"]] - }, - { - "expression": "foo[*][1]", - "result": [["three", "four"], ["seven", "eight"], ["ten"]] - }, - { - "expression": "foo[*][0][0]", - "result": ["one", "five", "nine"] - }, - { - "expression": "foo[*][1][0]", - "result": ["three", "seven", "ten"] - }, - { - "expression": "foo[*][0][1]", - "result": ["two", "six"] - }, - { - "expression": "foo[*][1][1]", - "result": ["four", "eight"] - }, - { - "expression": "foo[*][2]", - "result": [] - }, - { - "expression": "foo[*][2][2]", - "result": [] - }, - { - "expression": "bar[*]", - "result": null - }, - { - "expression": "bar[*].baz[*]", - "result": null - } - ] -}, -{ - "given": { - "string": "string", - "hash": {"foo": "bar", "bar": "baz"}, - "number": 23, - "nullvalue": null - }, - "cases": [ - { - "expression": "string[*]", - "result": null - }, - { - "expression": "hash[*]", - "result": null - }, - { - "expression": "number[*]", - "result": null - }, - { - "expression": "nullvalue[*]", - "result": null - }, - { - "expression": "string[*].foo", - "result": null - }, - { - "expression": "hash[*].foo", - "result": null - }, - { - "expression": "number[*].foo", - "result": null - }, - { - "expression": "nullvalue[*].foo", - "result": null - }, - { - "expression": "nullvalue[*].foo[*].bar", - "result": null - } - ] -}, -{ - "given": { - "string": "string", - "hash": {"foo": "val", "bar": "val"}, - "number": 23, - "array": [1, 2, 3], - "nullvalue": null - }, - "cases": [ - { - "expression": "string.*", - "result": null - }, - { - "expression": "hash.*", - "result": ["val", "val"] - }, - { - "expression": "number.*", - "result": null - }, - { - "expression": "array.*", - "result": null - }, - { - "expression": "nullvalue.*", - "result": null - } - ] -}, -{ - "given": { - "a": [0, 1, 2], - "b": [0, 1, 2] - }, - "cases": [ - { - "expression": "*[0]", - "result": [0, 0] - } - ] -} -] diff --git a/vendor/phpoffice/phpspreadsheet/.gitattributes b/vendor/phpoffice/phpspreadsheet/.gitattributes deleted file mode 100644 index 0375f558..00000000 --- a/vendor/phpoffice/phpspreadsheet/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/tests export-ignore -README.md export-ignore -*.min.js binary -/.github export-ignore diff --git a/vendor/phpoffice/phpspreadsheet/.gitignore b/vendor/phpoffice/phpspreadsheet/.gitignore deleted file mode 100644 index 0723541d..00000000 --- a/vendor/phpoffice/phpspreadsheet/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -/tests/codeCoverage -/analysis -/vendor/ -/phpunit.xml - -## IDE support -*.buildpath -*.project -/.settings -/.idea diff --git a/vendor/phpoffice/phpspreadsheet/.php_cs.dist b/vendor/phpoffice/phpspreadsheet/.php_cs.dist deleted file mode 100644 index 23216924..00000000 --- a/vendor/phpoffice/phpspreadsheet/.php_cs.dist +++ /dev/null @@ -1,183 +0,0 @@ -exclude(['vendor', 'tests/data/Calculation']) - ->in('samples') - ->in('src') - ->in('tests/PhpSpreadsheetTests') - ; - -return PhpCsFixer\Config::create() - ->setRiskyAllowed(true) - ->setFinder($finder) - ->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__)) - ->setRules([ - 'align_multiline_comment' => true, - 'array_syntax' => ['syntax' => 'short'], - 'backtick_to_shell_exec' => true, - 'binary_operator_spaces' => true, - 'blank_line_after_namespace' => true, - 'blank_line_after_opening_tag' => true, - 'blank_line_before_statement' => true, - 'braces' => true, - 'cast_spaces' => true, - 'class_attributes_separation' => ['elements' => ['method', 'property']], // const are often grouped with other related const - 'class_definition' => true, - 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE - 'combine_consecutive_issets' => true, - 'combine_consecutive_unsets' => true, - 'compact_nullable_typehint' => true, - 'concat_space' => ['spacing' => 'one'], - 'declare_equal_normalize' => true, - 'declare_strict_types' => false, // Too early to adopt strict types - 'dir_constant' => true, - 'doctrine_annotation_array_assignment' => true, - 'doctrine_annotation_braces' => true, - 'doctrine_annotation_indentation' => true, - 'doctrine_annotation_spaces' => true, - 'elseif' => true, - 'encoding' => true, - 'ereg_to_preg' => true, - 'escape_implicit_backslashes' => true, - 'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read - 'explicit_string_variable' => false, // I feel it makes the code actually harder to read - 'final_internal_class' => true, - 'full_opening_tag' => true, - 'function_declaration' => true, - 'function_to_constant' => true, - 'function_typehint_space' => true, - 'general_phpdoc_annotation_remove' => false, // No use for that - 'hash_to_slash_comment' => true, - 'header_comment' => false, // We don't use common header in all our files - 'heredoc_to_nowdoc' => false, // Not sure about this one - 'include' => true, - 'increment_style' => true, - 'indentation_type' => true, - 'is_null' => ['use_yoda_style' => false], - 'linebreak_after_opening_tag' => true, - 'line_ending' => true, - 'list_syntax' => ['syntax' => 'short'], - 'lowercase_cast' => true, - 'lowercase_constants' => true, - 'lowercase_keywords' => true, - 'magic_constant_casing' => true, - 'mb_str_functions' => false, // No, too dangerous to change that - 'method_argument_space' => true, - 'method_chaining_indentation' => true, - 'method_separation' => true, - 'modernize_types_casting' => true, - 'multiline_comment_opening_closing' => true, - 'native_function_casing' => true, - 'native_function_invocation' => false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now - 'new_with_braces' => true, - 'no_alias_functions' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace - 'no_break_comment' => true, - 'no_closing_tag' => true, - 'no_empty_comment' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_blank_lines' => true, - 'no_homoglyph_names' => true, - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_mixed_echo_print' => true, - 'no_multiline_whitespace_around_double_arrow' => true, - 'no_multiline_whitespace_before_semicolons' => true, - 'non_printable_character' => true, - 'no_null_property_initialization' => true, - 'no_php4_constructor' => true, - 'normalize_index_brace' => true, - 'no_short_bool_cast' => true, - 'no_short_echo_tag' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'no_spaces_after_function_name' => true, - 'no_spaces_around_offset' => true, - 'no_spaces_inside_parenthesis' => true, - 'no_superfluous_elseif' => false, // Might be risky on a huge code base - 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces - 'not_operator_with_successor_space' => false, // idem - 'no_trailing_comma_in_list_call' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_trailing_whitespace_in_comment' => true, - 'no_trailing_whitespace' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unneeded_curly_braces' => true, - 'no_unneeded_final_method' => true, - 'no_unreachable_default_argument_value' => true, - 'no_unused_imports' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'no_whitespace_before_comma_in_array' => true, - 'no_whitespace_in_blank_line' => true, - 'object_operator_without_whitespace' => true, - 'ordered_class_elements' => false, // We prefer to keep some freedom - 'ordered_imports' => true, - 'phpdoc_add_missing_param_annotation' => true, - 'phpdoc_align' => false, // Waste of time - 'phpdoc_annotation_without_dot' => true, - 'phpdoc_indent' => true, - 'phpdoc_inline_tag' => true, - 'phpdoc_no_access' => true, - 'phpdoc_no_alias_tag' => true, - 'phpdoc_no_empty_return' => true, - 'phpdoc_no_package' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_order' => true, - 'phpdoc_return_self_reference' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_summary' => true, - 'phpdoc_to_comment' => true, - 'phpdoc_trim' => true, - 'phpdoc_types_order' => true, - 'phpdoc_types' => true, - 'phpdoc_var_without_name' => true, - 'php_unit_construct' => true, - 'php_unit_dedicate_assert' => true, - 'php_unit_expectation' => true, - 'php_unit_fqcn_annotation' => true, - 'php_unit_mock' => true, - 'php_unit_namespaced' => true, - 'php_unit_no_expectation_annotation' => true, - 'php_unit_strict' => false, // We sometime actually need assertEquals - 'php_unit_test_annotation' => true, - 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage - 'pow_to_exponentiation' => false, - 'protected_to_private' => true, - 'psr0' => true, - 'psr4' => true, - 'random_api_migration' => false, // This breaks our unit tests - 'return_type_declaration' => true, - 'self_accessor' => true, - 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` - 'short_scalar_cast' => true, - 'silenced_deprecation_error' => true, - 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null - 'single_blank_line_at_eof' => true, - 'single_blank_line_before_namespace' => true, - 'single_class_element_per_statement' => true, - 'single_import_per_statement' => true, - 'single_line_after_imports' => true, - 'single_line_comment_style' => true, - 'single_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()` - 'strict_comparison' => false, // No, too dangerous to change that - 'strict_param' => false, // No, too dangerous to change that - 'switch_case_semicolon_to_colon' => true, - 'switch_case_space' => true, - 'ternary_operator_spaces' => true, - 'ternary_to_null_coalescing' => true, - 'trailing_comma_in_multiline_array' => true, - 'trim_array_spaces' => true, - 'unary_operator_spaces' => true, - 'visibility_required' => true, - 'void_return' => false, // Cannot use that with PHP 5.6 - 'whitespace_after_comma_in_array' => true, - 'yoda_style' => false, - ]); diff --git a/vendor/phpoffice/phpspreadsheet/.scrutinizer.yml b/vendor/phpoffice/phpspreadsheet/.scrutinizer.yml deleted file mode 100644 index 748f3ac3..00000000 --- a/vendor/phpoffice/phpspreadsheet/.scrutinizer.yml +++ /dev/null @@ -1,27 +0,0 @@ -checks: - php: true - -coding_style: - php: - spaces: - before_parentheses: - closure_definition: true - around_operators: - concatenation: true - -build: - nodes: - analysis: - tests: - override: - - php-scrutinizer-run - -tools: - external_code_coverage: - timeout: 3600 - -build_failure_conditions: - - 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed - - 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity - - 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection - - 'patches.label("Unused Use Statements").new.exists' # No new unused imports patches allowed diff --git a/vendor/phpoffice/phpspreadsheet/.travis.yml b/vendor/phpoffice/phpspreadsheet/.travis.yml deleted file mode 100644 index 82e25cee..00000000 --- a/vendor/phpoffice/phpspreadsheet/.travis.yml +++ /dev/null @@ -1,57 +0,0 @@ -language: php -dist: bionic - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -cache: - directories: - - vendor - - $HOME/.composer/cache - -before_script: - # Deactivate xdebug - - phpenv config-rm xdebug.ini - - composer install --ignore-platform-reqs - -script: - - ./vendor/bin/phpunit - -jobs: - include: - - - stage: Code style - php: 7.2 - script: - - ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run - - ./vendor/bin/phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PSR2 -n - - - stage: Coverage - php: 7.2 - script: - - pecl install pcov - - composer require pcov/clobber --dev - - ./vendor/bin/pcov clobber - - ./vendor/bin/phpunit --coverage-clover coverage-clover.xml - after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover tests/coverage-clover.xml - - - stage: API documentations - if: tag is present - php: 7.4 - before_script: - - curl -O https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.0.0-rc/phpDocumentor.phar - script: - - php phpDocumentor.phar --directory src/ --target docs/api - deploy: - provider: pages - skip-cleanup: true - local-dir: docs/api - github-token: $GITHUB_TOKEN - on: - all_branches: true - condition: $TRAVIS_BRANCH =~ ^master$ diff --git a/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md b/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md deleted file mode 100644 index 3c299020..00000000 --- a/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md +++ /dev/null @@ -1,1593 +0,0 @@ -# Changelog for PHPExcel - -This is the historic changelog of the project when it was still called PHPExcel. -It exists only for historical purposes and versions mentioned here should not be -confused with PhpSpreadsheet versions. - -## [1.8.1] - 2015-04-30 - -### Bugfixes - -- Fix for Writing an Open Document cell with non-numeric formula - @goncons [#397](https://github.com/PHPOffice/PHPExcel/issues/397) -- Avoid potential divide by zero in basedrawing - @sarciszewski [#329](https://github.com/PHPOffice/PHPExcel/issues/329) -- XML External Entity (XXE) Processing, different behaviour between simplexml_load_string() and simplexml_load_file(). - @ymaerschalck [#405](https://github.com/PHPOffice/PHPExcel/issues/405) -- Fix to ensure that current cell is maintained when executing formula calculations - @MarkBaker -- Keep/set the value on Reader _loadSheetsOnly as NULL, courtesy of Restless-ET - @MarkBaker [#350](https://github.com/PHPOffice/PHPExcel/issues/350) -- Loading an Excel 2007 spreadsheet throws an "Autofilter must be set on a range of cells" exception - @MarkBaker [CodePlex #18105](https://phpexcel.codeplex.com/workitem/18105) -- Fix to autoloader registration for backward compatibility with PHP 5.2.0 not accepting the prepend flag - @MarkBaker [#388](https://github.com/PHPOffice/PHPExcel/issues/388) -- DOM loadHTMLFile() failing with options flags when using PHP < 5.4.0 - @MarkBaker [#384](https://github.com/PHPOffice/PHPExcel/issues/384) -- Fix for percentage operator in formulae for BIFF Writer - @MarkBaker -- Fix to getStyle() call for cell object - @MarkBaker -- Discard Autofilters in Excel2007 Reader when filter range isn't a valid range - @MarkBaker -- Fix invalid NA return in VLOOKUP - @frozenstupidity [#423](https://github.com/PHPOffice/PHPExcel/issues/423) -- "No Impact" conditional formatting fix for NumberFormat - @wiseloren [CodePlex #21454](https://phpexcel.codeplex.com/workitem/21454) -- Bug in Excel2003XML reader, parsing merged cells - @bobwitlox [#467](https://github.com/PHPOffice/PHPExcel/issues/467) -- Fix for CEIL() and FLOOR() when number argument is zero - @MarkBaker [#302](https://github.com/PHPOffice/PHPExcel/issues/302) - -### General - -- Remove cells cleanly when calling RemoveRow() or RemoveColumn() - @MarkBaker -- Small performance improvement for autosize columns - @MarkBaker -- Change the getter/setter for zeroHeight to camel case - @frost-nzcr4 [#379](https://github.com/PHPOffice/PHPExcel/issues/379) -- DefaultValueBinder is too much aggressive when converting string to numeric - @MarkBaker [#394](https://github.com/PHPOffice/PHPExcel/issues/394) -- Default precalculate formulas to false for writers - @MarkBaker -- Set default Cyclic Reference behaviour to 1 to eliminate exception when using a single cyclic iteration in formulae - @MarkBaker - -### Features - -- Some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE - @MarkBaker [#396](https://github.com/PHPOffice/PHPExcel/issues/396) -- Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines - @WiktrzGE [#404](https://github.com/PHPOffice/PHPExcel/issues/404) -- ODS read/write comments in the cell - @frost-nzcr4 [#403](https://github.com/PHPOffice/PHPExcel/issues/403) -- Additional Mac CJK codepage definitions - @CQD [#389](https://github.com/PHPOffice/PHPExcel/issues/389) -- Update Worksheet.php getStyleByColumnAndRow() to allow a range of cells rather than just a single cell - @bolovincev [#269](https://github.com/PHPOffice/PHPExcel/issues/269) -- New methods added for testing cell status within merge groups - @MarkBaker -- Handling merge cells in HTML Reader - @cifren/MBaker [#205](https://github.com/PHPOffice/PHPExcel/issues/205) -- Helper to convert basic HTML markup to a Rich Text object - @MarkBaker -- Improved Iterators - @MarkBaker - - New Column Iterator - - Support for row and column ranges - - Improved handling for next/prev - -### Security - -- XML filescan in XML-based Readers to prevent XML Entity Expansion (XEE) - @MarkBaker - - (see http://projects.webappsec.org/w/page/13247002/XML%20Entity%20Expansion for an explanation of XEE injection) attacks - - Reference CVE-2015-3542 - Identification of problem courtesy of Dawid Golunski (Pentest Ltd.) - -## [1.8.0] - 2014-03-02 - -### Bugfixes - -- Undefined variable: fileHandle in CSV Reader - @MarkBaker [CodePlex #19830](https://phpexcel.codeplex.com/workitem/19830) -- Out of memory in style/supervisor.php - @MarkBaker [CodePlex #19968](https://phpexcel.codeplex.com/workitem/19968) -- Style error with merged cells in PDF Writer - @MarkBaker -- Problem with cloning worksheets - @MarkBaker -- Bug fix reading Open Office files - @tavoarcila [#259](https://github.com/PHPOffice/PHPExcel/issues/259) -- Serious bug in absolute cell reference used in shared formula - @MarkBaker [CodePlex #20397](https://phpexcel.codeplex.com/workitem/20397) - - Would also have affected insert/delete column/row- CHOOSE() returns "#VALUE!" if the 1st entry is chosen - @RomanSyroeshko [#267](https://github.com/PHPOffice/PHPExcel/issues/267) -- When duplicating styles, styles shifted by one column to the right - @Gemorroj [#268](https://github.com/PHPOffice/PHPExcel/issues/268) - - Fix also applied to duplicating conditional styles- Fix for formulae that reference a sheet whose name begins with a digit: - @IndrekHaav [#212](https://github.com/PHPOffice/PHPExcel/issues/212) - - these were erroneously identified as numeric values, causing the parser to throw an undefined variable error.- Fixed undefined variable error due to $styleArray being used before it's initialised - @IndrekHaav [CodePlex #16208](https://phpexcel.codeplex.com/workitem/16208) -- ISTEXT() return wrong result if referencing an empty but formatted cell - @PowerKiKi [#273](https://github.com/PHPOffice/PHPExcel/issues/273) -- Binary comparison of strings are case insensitive - @PowerKiKi [#270](https://github.com/PHPOffice/PHPExcel/issues/270), [#31](https://github.com/PHPOffice/PHPExcel/issues/31) -- Insert New Row/Column Before is not correctly updating formula references - @MarkBaker [#275](https://github.com/PHPOffice/PHPExcel/issues/275) -- Passing an array of cells to _generateRow() in the HTML/PDF Writer causes caching problems with last cell in the range - @MarkBaker [#257](https://github.com/PHPOffice/PHPExcel/issues/257) -- Fix to empty worksheet garbage collection when using cell caching - @MarkBaker [#193](https://github.com/PHPOffice/PHPExcel/issues/193) -- Excel2007 does not correctly mark rows as hidden - @Jazzo [#248](https://github.com/PHPOffice/PHPExcel/issues/248) -- Fixed typo in Chart/Layout set/getYMode() - @Roy Shahbazian [#299](https://github.com/PHPOffice/PHPExcel/issues/299) -- Fatal error: Call to a member function cellExists() line: 3327 in calculation.php if referenced worksheet doesn't exist - @EliuFlorez [#279](https://github.com/PHPOffice/PHPExcel/issues/279) -- AdvancedValueBinder "Division by zero"-error - @MarkBaker [#290](https://github.com/PHPOffice/PHPExcel/issues/290) -- Adding Sheet to Workbook Bug - @MarkBaker [CodePlex #20604](https://phpexcel.codeplex.com/workitem/20604) -- Calculation engine incorrectly evaluates empty cells as #VALUE - @MarkBaker [CodePlex #20703](https://phpexcel.codeplex.com/workitem/20703) -- Formula references to cell on another sheet in ODS files - @MarkBaker [CodePlex #20760](https://phpexcel.codeplex.com/workitem/20760) - -### Features - -- LibreOffice created XLSX files results in an empty file. - @MarkBaker [#321](https://github.com/PHPOffice/PHPExcel/issues/321), [#158](https://github.com/PHPOffice/PHPExcel/issues/158), [CodePlex #17824](https://phpexcel.codeplex.com/workitem/17824) -- Implementation of the Excel HLOOKUP() function - @amerov -- Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only) - @MarkBaker -- Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer - @MarkBaker -- Add support for reading protected (RC4 encrypted) .xls files - @trvrnrth [#261](https://github.com/PHPOffice/PHPExcel/issues/261) - -### General - -- Adding support for macros, Ribbon in Excel 2007 - @LWol [#252](https://github.com/PHPOffice/PHPExcel/issues/252) -- Remove array_shift in ReferenceHelper::insertNewBefore improves column or row delete speed - @cdhutch [CodePlex #20055](https://phpexcel.codeplex.com/workitem/20055) -- Improve stock chart handling and rendering, with help from Swashata Ghosh - @MarkBaker -- Fix to calculation properties for Excel2007 so that the opening application will only recalculate on load if it's actually required - @MarkBaker -- Modified Excel2007 Writer to default preCalculateFormulas to false - @MarkBaker - - Note that autosize columns will still recalculate affected formulae internally- Functionality to getHighestRow() for a specified column, and getHighestColumn() for a specified row - @dresenhista [#242](https://github.com/PHPOffice/PHPExcel/issues/242) -- Modify PHPExcel_Reader_Excel2007 to use zipClass from PHPExcel_Settings::getZipClass() - @adamriyadi [#247](https://github.com/PHPOffice/PHPExcel/issues/247) - - This allows the use of PCLZip when reading for people that don't have access to ZipArchive -### Security - -- Convert properties to string in OOCalc reader - @infojunkie [#276](https://github.com/PHPOffice/PHPExcel/issues/276) -- Disable libxml external entity loading by default. - @maartenba [#322](https://github.com/PHPOffice/PHPExcel/issues/322) - - This is to prevent XML External Entity Processing (XXE) injection attacks (see https://websec.io/2012/08/27/Preventing-XEE-in-PHP.html for an explanation of XXE injection). - - Reference CVE-2014-2054 - -## [1.7.9] - 2013-06-02 - -### Features - -- Include charts option for HTML Writer - @MarkBaker -- Added composer file - @MarkBaker -- cache_in_memory_gzip "eats" last worksheet line, cache_in_memory doesn't - @MarkBaker [CodePlex #18844](https://phpexcel.codeplex.com/workitem/18844) -- echo statements in HTML.php - @MarkBaker [#104](https://github.com/PHPOffice/PHPExcel/issues/104) - -### Bugfixes - -- Added getStyle() method to Cell object - @MarkBaker -- Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check) - @Asker [CodePlex #18777](https://phpexcel.codeplex.com/workitem/18777) -- CSV files without a file extension being identified as HTML - @MarkBaker [CodePlex #18794](https://phpexcel.codeplex.com/workitem/18794) -- Wrong check for maximum number of rows in Excel5 Writer - @AndreKR [#66](https://github.com/PHPOffice/PHPExcel/issues/66) -- Cache directory for DiscISAM cache storage cannot be set - @MarkBaker [#67](https://github.com/PHPOffice/PHPExcel/issues/67) -- Fix to Excel2007 Reader for hyperlinks with an anchor fragment (following a #), otherwise they were treated as sheet references - @MarkBaker [CodePlex #17976](https://phpexcel.codeplex.com/workitem/17976) -- getSheetNames() fails on numeric (floating point style) names with trailing zeroes - @MarkBaker [CodePlex #18963](https://phpexcel.codeplex.com/workitem/18963) -- Modify cell's getCalculatedValue() method to return the content of RichText objects rather than the RichText object itself - @MarkBaker -- Fixed formula/formatting bug when removing rows - @techhead [#70](https://github.com/PHPOffice/PHPExcel/issues/70) -- Fix to cellExists for non-existent namedRanges - @alexgann [#63](https://github.com/PHPOffice/PHPExcel/issues/63) -- Sheet View in Excel5 Writer - @Progi1984 [#22](https://github.com/PHPOffice/PHPExcel/issues/22) -- PHPExcel_Worksheet::getCellCollection() may not return last cached cell - @amironov [#82](https://github.com/PHPOffice/PHPExcel/issues/82) -- Rich Text containing UTF-8 characters creating unreadable content with Excel5 Writer - @teso [CodePlex #18551](https://phpexcel.codeplex.com/workitem/18551) -- Work item GH-8/CP11704 : Conditional formatting in Excel 5 Writer - @Progi1984 -- canRead() Error for GoogleDocs ODS files: in ODS files from Google Docs there is no mimetype file - @MarkBaker [#113](https://github.com/PHPOffice/PHPExcel/issues/113) -- "Sheet index is out of bounds." Exception - @MarkBaker [#80](https://github.com/PHPOffice/PHPExcel/issues/80) -- Fixed number format fatal error - @ccorliss [#105](https://github.com/PHPOffice/PHPExcel/issues/105) -- Add DROP TABLE in destructor for SQLite and SQLite3 cache controllers - @MarkBaker -- Fix merged-cell borders on HTML/PDF output - @alexgann [#154](https://github.com/PHPOffice/PHPExcel/issues/154) -- Fix: Hyperlinks break when removing rows - @Shanto [#161](https://github.com/PHPOffice/PHPExcel/issues/161) -- Fix Extra Table Row From Images and Charts - @neclimdul [#166](https://github.com/PHPOffice/PHPExcel/issues/166) - -### General - -- Single cell print area - @MarkBaker [#130](https://github.com/PHPOffice/PHPExcel/issues/130) -- Improved AdvancedValueBinder for currency - @kea [#69](https://github.com/PHPOffice/PHPExcel/issues/69) -- Fix for environments where there is no access to /tmp but to upload_tmp_dir - @MarkBaker - - Provided an option to set the sys_get_temp_dir() call to use the upload_tmp_dir; though by default the standard temp directory will still be used- Search style by identity in PHPExcel_Worksheet::duplicateStyle() - @amironov [#84](https://github.com/PHPOffice/PHPExcel/issues/84) -- Fill SheetView IO in Excel5 - @karak [#85](https://github.com/PHPOffice/PHPExcel/issues/85) -- Memory and Speed improvements in PHPExcel_Reader_Excel5 - @cfhay [CodePlex #18958](https://phpexcel.codeplex.com/workitem/18958) -- Modify listWorksheetNames() and listWorksheetInfo to use XMLReader with streamed XML rather than SimpleXML - @MarkBaker [#78](https://github.com/PHPOffice/PHPExcel/issues/78) -- Restructuring of PHPExcel Exceptions - @dbonsch -- Refactor Calculation Engine from singleton to a Multiton - @MarkBaker - - Ensures that calculation cache is maintained independently for different workbooks - -## [1.7.8] - 2012-10-12 - -### Features - -- Phar builder script to add phar file as a distribution option - @kkamkou -- Refactor PDF Writer to allow use with a choice of PDF Rendering library - @MarkBaker - - rather than restricting to tcPDF - - Current options are tcPDF, mPDF, DomPDF - - tcPDF Library has now been removed from the deployment bundle- Initial version of HTML Reader - @MarkBaker -- Implement support for AutoFilter in PHPExcel_Writer_Excel5 - @Progi1984 -- Modified ERF and ERFC Engineering functions to accept Excel 2010's modified acceptance of negative arguments - @MarkBaker -- Support SheetView `view` attribute (Excel2007) - @k1LoW -- Excel compatibility option added for writing CSV files - @MarkBaker - - While Excel 2010 can read CSV files with a simple UTF-8 BOM, Excel2007 and earlier require UTF-16LE encoded tab-separated files. - - The new setExcelCompatibility(TRUE) option for the CSV Writer will generate files with this formatting for easy import into Excel2007 and below.- Language implementations for Turkish (tr) - @MarkBaker -- Added fraction tests to advanced value binder - @MarkBaker - -### General - -- Allow call to font setUnderline() for underline format to specify a simple boolean for UNDERLINE_NONE or UNDERLINE_SINGLE - @MarkBaker -- Add Currency detection to the Advanced Value Binder - @alexgann -- setCellValueExplicitByColumnAndRow() do not return PHPExcel_Worksheet - @MarkBaker [CodePlex #18404](https://phpexcel.codeplex.com/workitem/18404) -- Reader factory doesn't read anymore XLTX and XLT files - @MarkBaker [CodePlex #18324](https://phpexcel.codeplex.com/workitem/18324) -- Magic __toString() method added to Cell object to return raw data value as a string - @MarkBaker -- Add cell indent to html rendering - @alexgann - -### Bugfixes - -- ZeroHeight for rows in sheet format - @Raghav1981 -- OOCalc cells containing inside the tag - @cyberconte -- Fix to listWorksheetInfo() method for OOCalc Reader - @schir1964 -- Support for "e" (epoch) date format mask - @MarkBaker - - Rendered as a 4-digit CE year in non-Excel outputs- Background color cell is always black when editing cell - @MarkBaker -- Allow "no impact" to formats on Conditional Formatting - @MarkBaker -- OOCalc Reader fix for NULL cells - @wackonline -- Fix to excel2007 Chart Writer when a $plotSeriesValues is empty - @seltzlab -- Various fixes to Chart handling - @MarkBaker -- Error loading xlsx file with column breaks - @MarkBaker [CodePlex #18370](https://phpexcel.codeplex.com/workitem/18370) -- OOCalc Reader now handles percentage and currency data types - @MarkBaker -- mb_stripos empty delimiter - @MarkBaker -- getNestingLevel() Error on Excel5 Read - @takaakik -- Fix to Excel5 Reader when cell annotations are defined before their referenced text objects - @MarkBaker -- OOCalc Reader modified to process number-rows-repeated - @MarkBaker -- Chart Title compatibility on Excel 2007 - @MarkBaker [CodePlex #18377](https://phpexcel.codeplex.com/workitem/18377) -- Chart Refresh returning cell reference rather than values - @MarkBaker [CodePlex #18146](https://phpexcel.codeplex.com/workitem/18146) -- Autoshape being identified in twoCellAnchor when includeCharts is TRUE triggering load error - @MarkBaker [CodePlex #18145](https://phpexcel.codeplex.com/workitem/18145) -- v-type texts for series labels now recognised and parsed correctly - @MarkBaker [CodePlex #18325](https://phpexcel.codeplex.com/workitem/18325) -- load file failed if the file has no extensionType - @wolf5x [CodePlex #18492](https://phpexcel.codeplex.com/workitem/18492) -- Pattern fill colours in Excel2007 Style Writer - @dverspui -- Excel2007 Writer order of font style elements to conform with Excel2003 using compatibility pack - @MarkBaker -- Problems with $_activeSheetIndex when decreased below 0. - @MarkBaker [CodePlex #18425](https://phpexcel.codeplex.com/workitem/18425) -- PHPExcel_CachedObjectStorage_SQLite3::cacheMethodIsAvailable() uses class_exists - autoloader throws error - @MarkBaker [CodePlex #18597](https://phpexcel.codeplex.com/workitem/18597) -- Cannot access private property PHPExcel_CachedObjectStorageFactory::$_cacheStorageMethod - @MarkBaker [CodePlex #18598](https://phpexcel.codeplex.com/workitem/18598) -- Data titles for charts - @MarkBaker [CodePlex #18397](https://phpexcel.codeplex.com/workitem/18397) - - PHPExcel_Chart_Layout now has methods for getting/setting switches for displaying/hiding chart data labels- Discard single cell merge ranges when reading (stupid that Excel allows them in the first place) - @MarkBaker -- Discard hidden autoFilter named ranges - @MarkBaker - -## [1.7.7] - 2012-05-19 - -### Bugfixes - -- Support for Rich-Text in PHPExcel_Writer_Excel5 - @Progi1984 [CodePlex #8916](https://phpexcel.codeplex.com/workitem/8916) -- Change iterators to implement Iterator rather than extend CachingIterator, as a fix for PHP 5.4. changes in SPL - @MarkBaker -- Invalid cell coordinate in Autofilter for Excel2007 Writer - @MarkBaker [CodePlex #15459](https://phpexcel.codeplex.com/workitem/15459) -- PCLZip library issue - @MarkBaker [CodePlex #15518](https://phpexcel.codeplex.com/workitem/15518) -- Excel2007 Reader canRead function bug - @MarkBaker [CodePlex #15537](https://phpexcel.codeplex.com/workitem/15537) -- Support for Excel functions whose return can be used as either a value or as a cell reference depending on its context within a formula - @MarkBaker -- ini_set() call in Calculation class destructor - @gilles06 [CodePlex #15707](https://phpexcel.codeplex.com/workitem/15707) -- RangeToArray strange array keys - @MarkBaker [CodePlex #15786](https://phpexcel.codeplex.com/workitem/15786) -- INDIRECT() function doesn't work with named ranges - @MarkBaker [CodePlex #15762](https://phpexcel.codeplex.com/workitem/15762) -- Locale-specific fix to text functions when passing a boolean argument instead of a string - @MarkBaker -- reader/CSV fails on this file - @MarkBaker [CodePlex #16246](https://phpexcel.codeplex.com/workitem/16246) - - auto_detect_line_endings now set in CSV reader- $arguments improperly used in CachedObjectStorage/PHPTemp.php - @MarkBaker [CodePlex #16212](https://phpexcel.codeplex.com/workitem/16212) -- Bug In Cache System (cell reference when throwing caching errors) - @MarkBaker [CodePlex #16643](https://phpexcel.codeplex.com/workitem/16643) -- PHP Invalid index notice on writing excel file when active sheet has been deleted - @MarkBaker [CodePlex #16895](https://phpexcel.codeplex.com/workitem/16895) -- External links in Excel2010 files cause Fatal error - @MarkBaker [CodePlex #16956](https://phpexcel.codeplex.com/workitem/16956) -- Previous calculation engine error conditions trigger cyclic reference errors - @MarkBaker [CodePlex #16960](https://phpexcel.codeplex.com/workitem/16960) -- PHPExcel_Style::applyFromArray() returns null rather than style object in advanced mode - @mkopinsky [CodePlex #16266](https://phpexcel.codeplex.com/workitem/16266) -- Cell::getFormattedValue returns RichText object instead of string - @fauvel [CodePlex #16958](https://phpexcel.codeplex.com/workitem/16958) -- Indexed colors do not refer to Excel's indexed colors? - @MarkBaker [CodePlex #17166](https://phpexcel.codeplex.com/workitem/17166) -- Indexed colors should be consistent with Excel and start from 1 (current index starts at 0) - @MarkBaker [CodePlex #17199](https://phpexcel.codeplex.com/workitem/17199) -- Named Range definition in .xls when sheet reeference is quote wrapped - @MarkBaker [CodePlex #17262](https://phpexcel.codeplex.com/workitem/17262) -- duplicateStyle() method doesn't duplicate conditional formats - @MarkBaker [CodePlex #17403](https://phpexcel.codeplex.com/workitem/17403) - - Added an equivalent duplicateConditionalStyle() method for duplicating conditional styles- =sumproduct(A,B) <> =sumproduct(B,A) in xlsx - @bnr [CodePlex #17501](https://phpexcel.codeplex.com/workitem/17501) - -### Features - -- OOCalc cells contain same data bug? - @cyberconte [CodePlex #17471](https://phpexcel.codeplex.com/workitem/17471) -- listWorksheetInfo() method added to Readers... courtesy of Christopher Mullins - @schir1964 -- Options for cell caching using Igbinary and SQLite/SQlite3. - @MarkBaker -- Additional row iterator options: allow a start row to be defined in the constructor; seek(), and prev() methods added. - @MarkBaker -- Implement document properties in Excel5 writer - @Progi1984 [CodePlex #9759](https://phpexcel.codeplex.com/workitem/9759) - -### General - -- Implement chart functionality (EXPERIMENTAL) - @MarkBaker [CodePlex #16](https://phpexcel.codeplex.com/workitem/16) - - Initial definition of chart objects. - - Reading Chart definitions through the Excel2007 Reader - - Facility to render charts to images using the 3rd-party jpgraph library - - Writing Charts using the Excel2007 Writer- Fix to build to ensure that Examples are included with the documentation - @MarkBaker -- Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed - @MarkBaker -- Improved memory usage in CSV Writer - @MarkBaker -- Improved speed and memory usage in Excel5 Writer - @MarkBaker -- Experimental - @MarkBaker - - Added getHighestDataColumn(), getHighestDataRow(), getHighestRowAndColumn() and calculateWorksheetDataDimension() methods for the worksheet that return the highest row and column that have cell records- Support for Rich-Text in PHPExcel_Writer_Excel5 - @Progi1984 [CodePlex #8916](https://phpexcel.codeplex.com/workitem/8916) -- Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC) - @MarkBaker [CodePlex #15405](https://phpexcel.codeplex.com/workitem/15405) -- Locale file paths not fit for windows - @MarkBaker [CodePlex #15461](https://phpexcel.codeplex.com/workitem/15461) -- Add file directory as a cache option for cache_to_discISAM - @MarkBaker [CodePlex #16643](https://phpexcel.codeplex.com/workitem/16643) -- Datatype.php & constant TYPE_NULL - @MarkBaker [CodePlex #16923](https://phpexcel.codeplex.com/workitem/16923) -- Ensure use of system temp directory for all temporary work files, unless explicitly specified - @MarkBaker -- [Patch] faster stringFromColumnIndex() - @char101 [CodePlex #16359](https://phpexcel.codeplex.com/workitem/16359) -- Fix for projects that still use old autoloaders - @whit1206 [CodePlex #16028](https://phpexcel.codeplex.com/workitem/16028) -- Unknown codepage: 10007 - @atz [CodePlex #17024](https://phpexcel.codeplex.com/workitem/17024) - - Additional Mac codepages - -## [1.7.6] - 2011-02-27 - -### Features - -- Provide option to use PCLZip as an alternative to ZipArchive. - @MarkBaker - - This allows the writing of Excel2007 files, even without ZipArchive enabled (it does require zlib), or when php_zip is one of the buggy PHP 5.2.6 or 5.2.8 versions - - It can be enabled using PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP); - - Note that it is not yet implemented as an alternative to ZipArchive for those Readers that are extracting from zips- Added listWorksheetNames() method to Readers that support multiple worksheets in a workbook, allowing a user to extract a list of all the worksheet names from a file without parsing/loading the whole file. - @MarkBaker [CodePlex #14979](https://phpexcel.codeplex.com/workitem/14979) -- Speed boost and memory reduction in the Worksheet toArray() method. - @MarkBaker -- Added new rangeToArray() and namedRangeToArray() methods to the PHPExcel_Worksheet object. - @MarkBaker - - Functionally, these are identical to the toArray() method, except that they take an additional first parameter of a Range (e.g. 'B2:C3') or a Named Range name. - - Modified the toArray() method so that it actually uses rangeToArray().- Added support for cell comments in the OOCalc, Gnumeric and Excel2003XML Readers, and in the Excel5 Reader - @MarkBaker -- Improved toFormattedString() handling for Currency and Accounting formats to render currency symbols - @MarkBaker - -### Bugfixes - -- Implement more Excel calculation functions - @MarkBaker - - Implemented the DAVERAGE(), DCOUNT(), DCOUNTA(), DGET(), DMAX(), DMIN(), DPRODUCT(), DSTDEV(), DSTDEVP(), DSUM(), DVAR() and DVARP() Database functions- Simple =IF() formula disappears - @MarkBaker [CodePlex #14888](https://phpexcel.codeplex.com/workitem/14888) -- PHP Warning: preg_match(): Compilation failed: PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X - @MarkBaker [CodePlex #14898](https://phpexcel.codeplex.com/workitem/14898) -- VLOOKUP choking on parameters in PHPExcel.1.7.5/PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #14901](https://phpexcel.codeplex.com/workitem/14901) -- PHPExcel_Cell::isInRange() incorrect results - offset by one column - @MarkBaker [CodePlex #14973](https://phpexcel.codeplex.com/workitem/14973) -- Treat CodePage of 0 as CP1251 (for .xls files written by applications that don't set the CodePage correctly, such as Apple Numbers) - @MarkBaker -- Need method for removing autoFilter - @MarkBaker [CodePlex #11583](https://phpexcel.codeplex.com/workitem/11583) -- coordinateFromString throws exception for rows greater than 99,999 - @MarkBaker [CodePlex #15029](https://phpexcel.codeplex.com/workitem/15029) -- PHPExcel Excel2007 Reader colour problems with solidfill - @MarkBaker [CodePlex #14999](https://phpexcel.codeplex.com/workitem/14999) -- Formatting get lost and edit a template XLSX file - @MarkBaker [CodePlex #13215](https://phpexcel.codeplex.com/workitem/13215) -- Excel 2007 Reader /writer lost fontcolor - @MarkBaker [CodePlex #14029](https://phpexcel.codeplex.com/workitem/14029) -- file that makes cells go black - @MarkBaker [CodePlex #13374](https://phpexcel.codeplex.com/workitem/13374) -- Minor patchfix for Excel2003XML Reader when XML is defined with a charset attribute - @MarkBaker -- PHPExcel_Worksheet->toArray() index problem - @MarkBaker [CodePlex #15089](https://phpexcel.codeplex.com/workitem/15089) -- Merge cells 'un-merge' when using an existing spreadsheet - @MarkBaker [CodePlex #15094](https://phpexcel.codeplex.com/workitem/15094) -- Worksheet fromArray() only working with 2-D arrays - @MarkBaker [CodePlex #15129](https://phpexcel.codeplex.com/workitem/15129) -- rangeToarray function modified for non-existent cells - @xkeshav [CodePlex #15172](https://phpexcel.codeplex.com/workitem/15172) -- Images not getting copyied with the ->clone function - @MarkBaker [CodePlex #14980](https://phpexcel.codeplex.com/workitem/14980) -- AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't - @MarkBaker [CodePlex #11576](https://phpexcel.codeplex.com/workitem/11576) -- Fix Excel5 Writer so that it only writes column dimensions for columns that are actually used rather than the full range (A to IV) - @MarkBaker -- FreezePane causing damaged or modified error - @MarkBaker [CodePlex #15198](https://phpexcel.codeplex.com/workitem/15198) - - The freezePaneByColumnAndRow() method row argument should default to 1 rather than 0. - - Default row argument for all __ByColumnAndRow() methods should be 1- Column reference rather than cell reference in Print Area definition - @MarkBaker [CodePlex #15121](https://phpexcel.codeplex.com/workitem/15121) - - Fix Excel2007 Writer to handle print areas that are defined as row or column ranges rather than just as cell ranges- Reduced false positives from isDateTimeFormatCode() method by suppressing testing within quoted strings - @MarkBaker -- Caching and tmp partition exhaustion - @MarkBaker [CodePlex #15312](https://phpexcel.codeplex.com/workitem/15312) -- Writing to Variable No Longer Works. $_tmp_dir Missing in PHPExcel\PHPExcel\Shared\OLE\PPS\Root.php - @MarkBaker [CodePlex #15308](https://phpexcel.codeplex.com/workitem/15308) -- Named ranges with dot don't get parsed properly - @MarkBaker [CodePlex #15379](https://phpexcel.codeplex.com/workitem/15379) -- insertNewRowBefore fails to consistently update references - @MarkBaker [CodePlex #15096](https://phpexcel.codeplex.com/workitem/15096) -- "i" is not a valid character for Excel date format masks (in isDateTimeFormatCode() method) - @MarkBaker -- PHPExcel_ReferenceHelper::insertNewBefore() is missing an 'Update worksheet: comments' section - @MKunert [CodePlex #15421](https://phpexcel.codeplex.com/workitem/15421) - -### General - -- Full column/row references in named ranges not supported by updateCellReference() - @MarkBaker [CodePlex #15409](https://phpexcel.codeplex.com/workitem/15409) -- Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer. - @MarkBaker -- Improved performance (speed), for PHP to Excel date conversions - @MarkBaker -- Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes. - @MarkBaker -- Removed Serialized Reader/Writer as these no longer work. - @MarkBaker - -## [1.7.5] - 2010-12-10 - -### Features - -- Implement Gnumeric File Format - @MarkBaker [CodePlex #8769](https://phpexcel.codeplex.com/workitem/8769) - - Initial work on Gnumeric Reader (Worksheet Data, Document Properties and basic Formatting)- Support for Extended Workbook Properties in Excel2007, Excel5 and OOCalc Readers; support for User-defined Workbook Properties in Excel2007 and OOCalc Readers - @MarkBaker -- Support for Extended and User-defined Workbook Properties in Excel2007 Writer - @MarkBaker -- Provided a setGenerateSheetNavigationBlock(false); option to suppress generation of the sheet navigation block when writing multiple worksheets to HTML - @MarkBaker -- Advanced Value Binder now recognises TRUE/FALSE strings (locale-specific) and converts to boolean - @MarkBaker -- PHPExcel_Worksheet->toArray() is returning truncated values - @MarkBaker [CodePlex #14301](https://phpexcel.codeplex.com/workitem/14301) -- Configure PDF Writer margins based on Excel Worksheet Margin Settings value - @MarkBaker -- Added Contiguous flag for the CSV Reader, when working with Read Filters - @MarkBaker -- Added getFormattedValue() method for cell object - @MarkBaker -- Added strictNullComparison argument to the worksheet fromArray() method - @MarkBaker - -### Bugfixes - -- Fix to toFormattedString() method in PHPExcel_Style_NumberFormat to handle fractions with a # code for the integer part - @MarkBaker -- NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php - @MarkBaker [CodePlex #14143](https://phpexcel.codeplex.com/workitem/14143) -- Excel5 : Formula : String constant containing double quotation mark - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Formula : Percent - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Formula : Error constant - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Formula : Concatenation operator - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Worksheet clone broken for CachedObjectStorage_Memory - @MarkBaker [CodePlex #14146](https://phpexcel.codeplex.com/workitem/14146) -- PHPExcel_Reader_Excel2007 fails when gradient fill without type is present in a file - @MarkBaker [CodePlex #12998](https://phpexcel.codeplex.com/workitem/12998) -- @ format for numeric strings in XLSX to CSV conversion - @MarkBaker [CodePlex #14176](https://phpexcel.codeplex.com/workitem/14176) -- Advanced Value Binder Not Working? - @MarkBaker [CodePlex #14223](https://phpexcel.codeplex.com/workitem/14223) -- unassigned object variable in PHPExcel->removeCellXfByIndex - @MarkBaker [CodePlex #14226](https://phpexcel.codeplex.com/workitem/14226) -- problem with getting cell values from another worksheet... (if cell doesn't exist) - @MarkBaker [CodePlex #14236](https://phpexcel.codeplex.com/workitem/14236) -- Setting cell values to one char strings & Trouble reading one character string (thanks gorfou) - @MarkBaker -- Worksheet title exception when duplicate worksheet is being renamed but exceeds the 31 character limit - @MarkBaker [CodePlex #14256](https://phpexcel.codeplex.com/workitem/14256) -- Named range with sheet name that contains the $ throws exception when getting the cell - @MarkBaker [CodePlex #14086](https://phpexcel.codeplex.com/workitem/14086) -- Added autoloader to DefaultValueBinder and AdvancedValueBinder - @MarkBaker -- Modified PHPExcel_Shared_Date::isDateTimeFormatCode() to return false if format code begins with "_" or with "0 " to prevent false positives - @MarkBaker - - These leading characters are most commonly associated with number, currency or accounting (or occasionally fraction) formats- BUG : Excel5 and setReadFilter ? - @MarkBaker [CodePlex #14374](https://phpexcel.codeplex.com/workitem/14374) -- Wrong exception message while deleting column - @MarkBaker [CodePlex #14425](https://phpexcel.codeplex.com/workitem/14425) -- Formula evaluation fails with Japanese sheet refs - @MarkBaker [CodePlex #14679](https://phpexcel.codeplex.com/workitem/14679) -- PHPExcel_Writer_PDF does not handle cell borders correctly - @MarkBaker [CodePlex #13559](https://phpexcel.codeplex.com/workitem/13559) -- Style : applyFromArray() for 'allborders' not working - @MarkBaker [CodePlex #14831](https://phpexcel.codeplex.com/workitem/14831) - -### General - -- Using $this when not in object context in Excel5 Reader - @MarkBaker [CodePlex #14837](https://phpexcel.codeplex.com/workitem/14837) -- Removes a unnecessary loop through each cell when applying conditional formatting to a range. - @MarkBaker -- Removed spurious PHP end tags (?>) - @MarkBaker -- Improved performance (speed) and reduced memory overheads, particularly for the Writers, but across the whole library. - @MarkBaker - -## [1.7.4] - 2010-08-26 - -### Bugfixes - -- Excel5 : Formula : Power - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Formula : Unary plus - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Just write the Escher stream if necessary in Worksheet - @Progi1984 -- Syntax errors in memcache.php 1.7.3c - @MarkBaker [CodePlex #13433](https://phpexcel.codeplex.com/workitem/13433) -- Support for row or column ranges in the calculation engine, e.g. =SUM(C:C) or =SUM(1:2) - @MarkBaker - - Also support in the calculation engine for absolute row or column ranges e.g. =SUM($C:$E) or =SUM($3:5)- Picture problem with Excel 2003 - @Erik Tilt [CodePlex #13455](https://phpexcel.codeplex.com/workitem/13455) -- Wrong variable used in addExternalSheet in PHPExcel.php - @MarkBaker [CodePlex #13484](https://phpexcel.codeplex.com/workitem/13484) -- "Invalid cell coordinate" error when formula access data from an other sheet - @MarkBaker [CodePlex #13515](https://phpexcel.codeplex.com/workitem/13515) -- (related to Work item 13515) Calculation engine confusing cell range worksheet when referencing cells in a different worksheet to the formula - @MarkBaker -- Wrong var naming in Worksheet->garbageCollect() - @MarkBaker [CodePlex #13752](https://phpexcel.codeplex.com/workitem/13752) -- PHPExcel_Style_*::__clone() methods cause cloning loops? - @MarkBaker [CodePlex #13764](https://phpexcel.codeplex.com/workitem/13764) -- Recent builds causing problems loading xlsx files? (ZipArchive issue?) - @MarkBaker [CodePlex #11488](https://phpexcel.codeplex.com/workitem/11488) -- cache_to_apc causes fatal error when processing large data sets - @MarkBaker [CodePlex #13856](https://phpexcel.codeplex.com/workitem/13856) -- OOCalc reader misses first line if it's a 'table-header-row' - @MarkBaker [CodePlex #13880](https://phpexcel.codeplex.com/workitem/13880) -- using cache with copy or clone bug? - @MarkBaker [CodePlex #14011](https://phpexcel.codeplex.com/workitem/14011) - - Fixed $worksheet->copy() or clone $worksheet when using cache_in_memory, cache_in_memory_gzip, cache_in_memory_serialized, cache_to_discISAM, cache_to_phpTemp, cache_to_apc and cache_to_memcache; - - Fixed but untested when using cache_to_wincache. -### Features - -- Standard Deviation functions returning DIV/0 Error when Standard Deviation is zero - @MarkBaker [CodePlex #13450](https://phpexcel.codeplex.com/workitem/13450) -- Support for print area with several ranges in the Excel2007 reader, and improved features for editing print area with several ranges - @MarkBaker -- Improved Cell Exception Reporting - @MarkBaker [CodePlex #13769](https://phpexcel.codeplex.com/workitem/13769) - -### General - -- Fixed problems with reading Excel2007 Properties - @MarkBaker -- PHP Strict Standards: Non-static method PHPExcel_Shared_String::utf16_decode() should not be called statically - @MarkBaker -- Array functions were ignored when loading an existing file containing them, and as a result, they would lose their 'cse' status. - @MarkBaker -- Minor memory tweaks to Excel2007 Writer - @MarkBaker -- Modified ReferenceHelper updateFormulaReferences() method to handle updates to row and column cell ranges (including absolute references e.g. =SUM(A:$E) or =SUM($5:5), and range/cell references that reference a worksheet by name), and to provide both performance and memory improvements. - @MarkBaker -- Modified Excel2007 Reader so that ReferenceHelper class is instantiated only once rather than for every shared formula in a workbook. - @MarkBaker -- Correct handling for additional (synonym) formula tokens in Excel5 Reader - @MarkBaker -- Additional reading of some Excel2007 Extended Properties (Company, Manager) - @MarkBaker - -## [1.7.3c] - 2010-06-01 - -### Bugfixes - -- Fatal error: Class 'ZipArchive' not found... ...Reader/Excel2007.php on line 217 - @MarkBaker [CodePlex #13012](https://phpexcel.codeplex.com/workitem/13012) -- PHPExcel_Writer_Excel2007 error after 1.7.3b - @MarkBaker [CodePlex #13398](https://phpexcel.codeplex.com/workitem/13398) - -## [1.7.3b] - 2010-05-31 - -### Bugfixes - -- Infinite loop when reading - @MarkBaker [CodePlex #12903](https://phpexcel.codeplex.com/workitem/12903) -- Wrong method chaining on PHPExcel_Worksheet class - @MarkBaker [CodePlex #13381](https://phpexcel.codeplex.com/workitem/13381) - -## [1.7.3] - 2010-05-17 - -### General - -- Applied patch 4990 (modified) - @Erik Tilt -- Applied patch 5568 (modified) - @MarkBaker -- Applied patch 5943 - @MarkBaker -- Upgrade build script to use Phing - @MarkBaker [CodePlex #13042](https://phpexcel.codeplex.com/workitem/13042) -- Replacing var with public/private - @Erik Tilt [CodePlex #11586](https://phpexcel.codeplex.com/workitem/11586) -- Applied Anthony's Sterling's Class Autoloader to reduce memory overhead by "Lazy Loading" of classes - @MarkBaker -- Modification to functions that accept a date parameter to support string values containing ordinals as per Excel (English language only) - @MarkBaker -- Modify PHPExcel_Style_NumberFormat::toFormattedString() to handle dates that fall outside of PHP's 32-bit date range - @MarkBaker -- Applied patch 5207 - @MarkBaker - -### Features - -- PHPExcel developer documentation: Set page margins - @Erik Tilt [CodePlex #11970](https://phpexcel.codeplex.com/workitem/11970) -- Special characters and accents in SYLK reader - @Erik Tilt [CodePlex #11038](https://phpexcel.codeplex.com/workitem/11038) -- Implement more Excel calculation functions - @MarkBaker - - Implemented the COUPDAYS(), COUPDAYBS(), COUPDAYSNC(), COUPNCD(), COUPPCD() and PRICE() Financial functions - - Implemented the N() and TYPE() Information functions - - Implemented the HYPERLINK() Lookup and Reference function- Horizontal page break support in PHPExcel_Writer_PDF - @Erik Tilt [CodePlex #11526](https://phpexcel.codeplex.com/workitem/11526) -- Introduce method setActiveSheetIndexByName() - @Erik Tilt [CodePlex #11529](https://phpexcel.codeplex.com/workitem/11529) -- AdvancedValueBinder.php: Automatically wrap text when there is new line in string (ALT+"Enter") - @Erik Tilt [CodePlex #11550](https://phpexcel.codeplex.com/workitem/11550) -- Data validation support in PHPExcel_Reader_Excel5 and PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10300](https://phpexcel.codeplex.com/workitem/10300) -- Improve autosize calculation - @MarkBaker [CodePlex #11616](https://phpexcel.codeplex.com/workitem/11616) -- Methods to translate locale-specific function names in formulae - @MarkBaker - - Language implementations for Czech (cs), Danish (da), German (de), English (uk), Spanish (es), Finnish (fi), French (fr), Hungarian (hu), Italian (it), Dutch (nl), Norwegian (no), Polish (pl), Portuguese (pt), Brazilian Portuguese (pt_br), Russian (ru) and Swedish (sv)- Implement document properties in Excel5 reader/writer - @Erik Tilt [CodePlex #9759](https://phpexcel.codeplex.com/workitem/9759) - - Fixed so far for PHPExcel_Reader_Excel5- Show/hide row and column headers in worksheet - @Erik Tilt [CodePlex #11849](https://phpexcel.codeplex.com/workitem/11849) -- Can't set font on writing PDF (by key) - @Erik Tilt [CodePlex #11919](https://phpexcel.codeplex.com/workitem/11919) -- Thousands scale (1000^n) support in PHPExcel_Style_NumberFormat::toFormattedString - @Erik Tilt [CodePlex #12096](https://phpexcel.codeplex.com/workitem/12096) -- Implement repeating rows in PDF and HTML writer - @Erik Tilt -- Sheet tabs in PHPExcel_Writer_HTML - @Erik Tilt [CodePlex #12289](https://phpexcel.codeplex.com/workitem/12289) -- Add Wincache CachedObjectProvider - @MarkBaker [CodePlex #13041](https://phpexcel.codeplex.com/workitem/13041) -- Configure PDF Writer paper size based on Excel Page Settings value, and provided methods to override paper size and page orientation with the writer - @MarkBaker - - Note PHPExcel defaults to Letter size, while the previous PDF writer enforced A4 size, so PDF writer will now default to Letter- Initial implementation of cell caching: allowing larger workbooks to be managed, but at a cost in speed - @MarkBaker - -### Bugfixes - -- Added an identify() method to the IO Factory that identifies the reader which will be used to load a particular file without actually loading it. - @MarkBaker -- Warning messages with INDEX function having 2 arguments - @MarkBaker [CodePlex #10979](https://phpexcel.codeplex.com/workitem/10979) -- setValue('=') should result in string instead of formula - @Erik Tilt [CodePlex #11473](https://phpexcel.codeplex.com/workitem/11473) -- method _raiseFormulaError should no be private - @MarkBaker [CodePlex #11471](https://phpexcel.codeplex.com/workitem/11471) -- Fatal error: Call to undefined function mb_substr() in ...Classes\PHPExcel\Reader\Excel5.php on line 2903 - @Erik Tilt [CodePlex #11485](https://phpexcel.codeplex.com/workitem/11485) -- getBold(), getItallic(), getStrikeThrough() not always working with PHPExcel_Reader_Excel2007 - @Erik Tilt [CodePlex #11487](https://phpexcel.codeplex.com/workitem/11487) -- AdvancedValueBinder.php not working correctly for $cell->setValue('hh:mm:ss') - @Erik Tilt [CodePlex #11492](https://phpexcel.codeplex.com/workitem/11492) -- Fixed leap year handling for the YEARFRAC() Date/Time function when basis ia 1 (Actual/actual) - @MarkBaker -- Warning messages - @MarkBaker [CodePlex #11490](https://phpexcel.codeplex.com/workitem/11490) - - Calculation Engine code modified to enforce strict standards for pass by reference- PHPExcel_Cell_AdvancedValueBinder doesnt work for dates in far future - @Erik Tilt [CodePlex #11483](https://phpexcel.codeplex.com/workitem/11483) -- MSODRAWING bug with long CONTINUE record in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #11528](https://phpexcel.codeplex.com/workitem/11528) -- PHPExcel_Reader_Excel2007 reads print titles as named range when there is more than one sheet - @Erik Tilt [CodePlex #11571](https://phpexcel.codeplex.com/workitem/11571) -- missing @return in phpdocblock in reader classes - @Erik Tilt [CodePlex #11561](https://phpexcel.codeplex.com/workitem/11561) -- AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't - @Erik Tilt [CodePlex #11576](https://phpexcel.codeplex.com/workitem/11576) -- Small numbers escape treatment in PHPExcel_Style_NumberFormat::toFormattedString() - @Erik Tilt [CodePlex #11588](https://phpexcel.codeplex.com/workitem/11588) -- Blank styled cells are not blank in output by HTML writer due to   - @Erik Tilt [CodePlex #11590](https://phpexcel.codeplex.com/workitem/11590) -- Calculation engine bug: Existing, blank cell + number gives #NUM - @MarkBaker [CodePlex #11587](https://phpexcel.codeplex.com/workitem/11587) -- AutoSize only measures length of first line in cell with multiple lines (ALT+Enter) - @Erik Tilt [CodePlex #11608](https://phpexcel.codeplex.com/workitem/11608) -- Fatal error running Tests/12serializedfileformat.php (PHPExcel 1.7.2) - @Erik Tilt [CodePlex #11608](https://phpexcel.codeplex.com/workitem/11608) -- Fixed various errors in the WORKDAY() and NETWORKDAYS() Date/Time functions (particularly related to holidays) - @MarkBaker -- Uncaught exception 'Exception' with message 'Valid scale is between 10 and 400.' in Classes/PHPExcel/Worksheet/SheetView.php:115 - @Erik Tilt [CodePlex #11660](https://phpexcel.codeplex.com/workitem/11660) -- "Unrecognized token 39 in formula" with PHPExcel_Reader_Excel5 (occuring with add-in functions) - @Erik Tilt [CodePlex #11551](https://phpexcel.codeplex.com/workitem/11551) -- Excel2007 reader not reading PHPExcel_Style_Conditional::CONDITION_EXPRESSION - @Erik Tilt [CodePlex #11668](https://phpexcel.codeplex.com/workitem/11668) -- Fix to the BESSELI(), BESSELJ(), BESSELK(), BESSELY() and COMPLEX() Engineering functions to use correct default values for parameters - @MarkBaker -- DATEVALUE function not working for pure time values + allow DATEVALUE() function to handle partial dates (e.g. "1-Jun" or "12/2010") - @MarkBaker [CodePlex #11525](https://phpexcel.codeplex.com/workitem/11525) -- Fix for empty quoted strings in formulae - @MarkBaker -- Trap for division by zero in Bessel functions - @MarkBaker -- Fix to OOCalc Reader to convert semi-colon (;) argument separator in formulae to a comma (,) - @MarkBaker -- PHPExcel_Writer_Excel5_Parser cannot parse formula like =SUM(C$5:C5) - @Erik Tilt [CodePlex #11693](https://phpexcel.codeplex.com/workitem/11693) -- Fix to OOCalc Reader to handle dates that fall outside 32-bit PHP's date range - @MarkBaker -- File->sys_get_temp_dir() can fail in safe mode - @Erik Tilt [CodePlex #11692](https://phpexcel.codeplex.com/workitem/11692) -- Sheet references in Excel5 writer do not work when referenced sheet title contains non-Latin symbols - @Erik Tilt [CodePlex #11727](https://phpexcel.codeplex.com/workitem/11727) -- Bug in HTML writer can result in missing rows in output - @Erik Tilt [CodePlex #11743](https://phpexcel.codeplex.com/workitem/11743) -- setShowGridLines(true) not working with PHPExcel_Writer_PDF - @Erik Tilt [CodePlex #11674](https://phpexcel.codeplex.com/workitem/11674) -- PHPExcel_Worksheet_RowIterator initial position incorrect - @Erik Tilt [CodePlex #11836](https://phpexcel.codeplex.com/workitem/11836) -- PHPExcel_Worksheet_HeaderFooterDrawing Strict Exception thrown (by jshaw86) - @Erik Tilt [CodePlex #11835](https://phpexcel.codeplex.com/workitem/11835) -- Parts of worksheet lost when there are embedded charts (Excel5 reader) - @Erik Tilt [CodePlex #11850](https://phpexcel.codeplex.com/workitem/11850) -- VLOOKUP() function error when lookup value is passed as a cell reference rather than an absolute value - @MarkBaker -- First segment of Rich-Text not read correctly by PHPExcel_Reader_Excel2007 - @Erik Tilt [CodePlex #12041](https://phpexcel.codeplex.com/workitem/12041) -- Fatal Error with getCell('name') when name matches the pattern for a cell reference - @MarkBaker [CodePlex #12048](https://phpexcel.codeplex.com/workitem/12048) -- excel5 writer appears to be swapping image locations - @Erik Tilt [CodePlex #12039](https://phpexcel.codeplex.com/workitem/12039) -- Undefined index: host in ZipStreamWrapper.php, line 94 and line 101 - @Erik Tilt [CodePlex #11954](https://phpexcel.codeplex.com/workitem/11954) -- BIFF8 File Format problem (too short COLINFO record) - @Erik Tilt [CodePlex #11672](https://phpexcel.codeplex.com/workitem/11672) -- Column width sometimes changed after read/write with Excel2007 reader/writer - @Erik Tilt [CodePlex #12121](https://phpexcel.codeplex.com/workitem/12121) -- Worksheet.php throws a fatal error when styling is turned off via setReadDataOnly on the reader - @Erik Tilt [CodePlex #11964](https://phpexcel.codeplex.com/workitem/11964) -- Checking for Circular References in Formulae - @MarkBaker [CodePlex #11851](https://phpexcel.codeplex.com/workitem/11851) - - Calculation Engine code now traps for cyclic references, raising an error or throwing an exception, or allows 1 or more iterations through cyclic references, based on a configuration setting- PNG transparency using Excel2007 writer - @Erik Tilt [CodePlex #12244](https://phpexcel.codeplex.com/workitem/12244) -- Custom readfilter error when cell formulas reference excluded cells (Excel5 reader) - @Erik Tilt [CodePlex #12221](https://phpexcel.codeplex.com/workitem/12221) -- Protection problem in XLS - @Erik Tilt [CodePlex #12288](https://phpexcel.codeplex.com/workitem/12288) -- getColumnDimension()->setAutoSize() incorrect on cells with Number Formatting - @Erik Tilt [CodePlex #12300](https://phpexcel.codeplex.com/workitem/12300) -- Notices reading Excel file with Add-in funcitons (PHPExcel_Reader_Excel5) - @Erik Tilt [CodePlex #12378](https://phpexcel.codeplex.com/workitem/12378) -- Excel5 reader not reading formulas with deleted sheet references - @Erik Tilt [CodePlex #12380](https://phpexcel.codeplex.com/workitem/12380) -- Named range (defined name) scope problems for in PHPExcel - @Erik Tilt [CodePlex #12404](https://phpexcel.codeplex.com/workitem/12404) -- PHP Parse error: syntax error, unexpected T_PUBLIC in PHPExcel/Calculation.php on line 3482 - @Erik Tilt [CodePlex #12423](https://phpexcel.codeplex.com/workitem/12423) -- Named ranges don't appear in name box using Excel5 writer - @Erik Tilt [CodePlex #12505](https://phpexcel.codeplex.com/workitem/12505) -- Many merged cells + autoSize column -> slows down the writer - @Erik Tilt [CodePlex #12509](https://phpexcel.codeplex.com/workitem/12509) -- Incorrect fallback order comment in Shared/Strings.php ConvertEncoding() - @Erik Tilt [CodePlex #12539](https://phpexcel.codeplex.com/workitem/12539) -- IBM AIX iconv() will not work, should revert to mbstring etc. instead - @Erik Tilt [CodePlex #12538](https://phpexcel.codeplex.com/workitem/12538) -- Excel5 writer and mbstring functions overload - @Erik Tilt [CodePlex #12568](https://phpexcel.codeplex.com/workitem/12568) -- OFFSET needs to flattenSingleValue the $rows and $columns args - @MarkBaker [CodePlex #12672](https://phpexcel.codeplex.com/workitem/12672) -- Formula with DMAX(): Notice: Undefined offset: 2 in ...\PHPExcel\Calculation.php on line 2365 - @MarkBaker [CodePlex #12546](https://phpexcel.codeplex.com/workitem/12546) - - Note that the Database functions have not yet been implemented- Call to a member function getParent() on a non-object in Classes\\PHPExcel\\Calculation.php Title is required - @MarkBaker [CodePlex #12839](https://phpexcel.codeplex.com/workitem/12839) -- Cyclic Reference in Formula - @MarkBaker [CodePlex #12935](https://phpexcel.codeplex.com/workitem/12935) -- Memory error...data validation? - @MarkBaker [CodePlex #13025](https://phpexcel.codeplex.com/workitem/13025) - -## [1.7.2] - 2010-01-11 - -### General - -- Applied patch 4362 - @Erik Tilt -- Applied patch 4363 (modified) - @Erik Tilt -- 1.7.1 Extremely Slow - Refactored PHPExcel_Calculation_Functions::flattenArray() method and set calculation cache timer default to 2.5 seconds - @MarkBaker [CodePlex #10874](https://phpexcel.codeplex.com/workitem/10874) -- Allow formulae to contain line breaks - @MarkBaker -- split() function deprecated in PHP 5.3.0 - @Erik Tilt [CodePlex #10910](https://phpexcel.codeplex.com/workitem/10910) -- sys_get_temp_dir() requires PHP 5.2.1, not PHP 5.2 [provide fallback function for PHP 5.2.0] - @Erik Tilt -- Implementation of the ISPMT() Financial function by Matt Groves - @MarkBaker -- Put the example of formula with more arguments in documentation - @MarkBaker [CodePlex #11052](https://phpexcel.codeplex.com/workitem/11052) - -### Features - -- Improved accuracy for the GAMMAINV() Statistical Function - @MarkBaker -- XFEXT record support to fix colors change from Excel5 reader, and copy/paste color change with Excel5 writer - @Erik Tilt [CodePlex #10409](https://phpexcel.codeplex.com/workitem/10409) - - Excel5 reader reads RGB color information in XFEXT records for borders, font color and fill color- Implement more Excel calculation functions - @MarkBaker - - Implemented the FVSCHEDULE(), XNPV(), IRR(), MIRR(), XIRR() and RATE() Financial functions - - Implemented the SUMPRODUCT() Mathematical function - - Implemented the ZTEST() Statistical Function- Multiple print areas in one sheet - @Erik Tilt [CodePlex #10919](https://phpexcel.codeplex.com/workitem/10919) -- Store calculated values in output by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10930](https://phpexcel.codeplex.com/workitem/10930) -- Sheet protection options in Excel5 reader/writer - @Erik Tilt [CodePlex #10939](https://phpexcel.codeplex.com/workitem/10939) -- Modification of the COUNT(), AVERAGE(), AVERAGEA(), DEVSQ, AVEDEV(), STDEV(), STDEVA(), STDEVP(), STDEVPA(), VARA() and VARPA() SKEW() and KURT() functions to correctly handle boolean values depending on whether they're passed in as values, values within a matrix or values within a range of cells. - @MarkBaker -- Cell range selection - @Erik Tilt -- Root-relative path handling - @MarkBaker [CodePlex #10266](https://phpexcel.codeplex.com/workitem/10266) - -### Bugfixes - -- Named Ranges not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #11315](https://phpexcel.codeplex.com/workitem/11315) -- Excel2007 Reader fails to load Apache POI generated Excel - @MarkBaker [CodePlex #11206](https://phpexcel.codeplex.com/workitem/11206) -- Number format is broken when system's thousands separator is empty - @MarkBaker [CodePlex #11154](https://phpexcel.codeplex.com/workitem/11154) -- ReferenceHelper::updateNamedFormulas throws errors if oldName is empty - @MarkBaker [CodePlex #11401](https://phpexcel.codeplex.com/workitem/11401) -- parse_url() fails to parse path to an image in xlsx - @MarkBaker [CodePlex #11296](https://phpexcel.codeplex.com/workitem/11296) -- Workaround for iconv_substr() bug in PHP 5.2.0 - @Erik Tilt [CodePlex #10876](https://phpexcel.codeplex.com/workitem/10876) -- 1 pixel error for image width and height with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10877](https://phpexcel.codeplex.com/workitem/10877) -- Fix to GEOMEAN() Statistical function - @MarkBaker -- setValue('-') and setValue('.') sets numeric 0 instead of 1-character string - @Erik Tilt [CodePlex #10884](https://phpexcel.codeplex.com/workitem/10884) -- Row height sometimes much too low after read with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10885](https://phpexcel.codeplex.com/workitem/10885) -- Diagonal border. Miscellaneous missing support. - @Erik Tilt [CodePlex #10888](https://phpexcel.codeplex.com/workitem/10888) - - Constant PHPExcel_Style_Borders::DIAGONAL_BOTH added to support double-diagonal (cross) - - PHPExcel_Reader_Excel2007 not always reading diagonal borders (only recognizes 'true' and not '1') - - PHPExcel_Reader_Excel5 support for diagonal borders - - PHPExcel_Writer_Excel5 support for diagonal borders- Session bug: Fatal error: Call to a member function bindValue() on a non-object in ...\Classes\PHPExcel\Cell.php on line 217 - @Erik Tilt [CodePlex #10894](https://phpexcel.codeplex.com/workitem/10894) -- Colors messed up saving twice with same instance of PHPExcel_Writer_Excel5 (regression since 1.7.0) - @Erik Tilt [CodePlex #10896](https://phpexcel.codeplex.com/workitem/10896) -- Method PHPExcel_Worksheet::setDefaultStyle is not working - @Erik Tilt [CodePlex #10917](https://phpexcel.codeplex.com/workitem/10917) -- PHPExcel_Reader_CSV::canRead() sometimes says false when it shouldn't - @Erik Tilt [CodePlex #10897](https://phpexcel.codeplex.com/workitem/10897) -- Changes in workbook not picked up between two saves with PHPExcel_Writer_Excel2007 - @Erik Tilt [CodePlex #10922](https://phpexcel.codeplex.com/workitem/10922) -- Decimal and thousands separators missing in HTML and PDF output - @Erik Tilt [CodePlex #10913](https://phpexcel.codeplex.com/workitem/10913) -- Notices with PHPExcel_Reader_Excel5 and named array constants - @Erik Tilt [CodePlex #10936](https://phpexcel.codeplex.com/workitem/10936) -- Calculation engine limitation on 32-bit platform with integers > 2147483647 - @MarkBaker [CodePlex #10938](https://phpexcel.codeplex.com/workitem/10938) -- Shared(?) formulae containing absolute cell references not read correctly using Excel5 Reader - @Erik Tilt [CodePlex #10959](https://phpexcel.codeplex.com/workitem/10959) -- Warning messages with intersection operator involving single cell - @MarkBaker [CodePlex #10962](https://phpexcel.codeplex.com/workitem/10962) -- Infinite loop in Excel5 reader caused by zero-length string in SST - @Erik Tilt [CodePlex #10980](https://phpexcel.codeplex.com/workitem/10980) -- Remove unnecessary cell sorting to improve speed by approx. 18% in HTML and PDF writers - @Erik Tilt [CodePlex #10983](https://phpexcel.codeplex.com/workitem/10983) -- Cannot read A1 cell content - OO_Reader - @MarkBaker [CodePlex #10977](https://phpexcel.codeplex.com/workitem/10977) -- Transliteration failed, invalid encoding - @Erik Tilt [CodePlex #11000](https://phpexcel.codeplex.com/workitem/11000) - -## [1.7.1] - 2009-11-02 - -### General - -- ereg() function deprecated in PHP 5.3.0 - @Erik Tilt [CodePlex #10687](https://phpexcel.codeplex.com/workitem/10687) -- Writer Interface Inconsequence - setTempDir and setUseDiskCaching - @MarkBaker [CodePlex #10739](https://phpexcel.codeplex.com/workitem/10739) - -### Features - -- Upgrade to TCPDF 4.8.009 - @Erik Tilt -- Support for row and column styles (feature request) - @Erik Tilt - - Basic implementation for Excel2007/Excel5 reader/writer- Hyperlink to local file in Excel5 reader/writer - @Erik Tilt [CodePlex #10459](https://phpexcel.codeplex.com/workitem/10459) -- Color Tab (Color Sheet's name) - @MarkBaker [CodePlex #10472](https://phpexcel.codeplex.com/workitem/10472) -- Border style "double" support in PHPExcel_Writer_HTML - @Erik Tilt [CodePlex #10488](https://phpexcel.codeplex.com/workitem/10488) -- Multi-section number format support in HTML/PDF/CSV writers - @Erik Tilt [CodePlex #10492](https://phpexcel.codeplex.com/workitem/10492) -- Some additional performance tweaks in the calculation engine - @MarkBaker -- Fix result of DB() and DDB() Financial functions to 2dp when in Gnumeric Compatibility mode - @MarkBaker -- Added AMORDEGRC(), AMORLINC() and COUPNUM() Financial function (no validation of parameters yet) - @MarkBaker -- Improved accuracy of TBILLEQ(), TBILLPRICE() and TBILLYIELD() Financial functions when in Excel or Gnumeric mode - @MarkBaker -- Added INDIRECT() Lookup/Reference function (only supports full addresses at the moment) - @MarkBaker -- PHPExcel_Reader_CSV::canRead() improvements - @MarkBaker [CodePlex #10498](https://phpexcel.codeplex.com/workitem/10498) -- Input encoding option for PHPExcel_Reader_CSV - @Erik Tilt [CodePlex #10500](https://phpexcel.codeplex.com/workitem/10500) -- Colored number format support, e.g. [Red], in HTML/PDF output - @Erik Tilt [CodePlex #10493](https://phpexcel.codeplex.com/workitem/10493) -- Color Tab (Color Sheet's name) [Excel5 reader/writer support] - @Erik Tilt [CodePlex #10559](https://phpexcel.codeplex.com/workitem/10559) -- Initial version of SYLK (slk) and Excel 2003 XML Readers (Cell data and basic cell formatting) - @MarkBaker -- Initial version of Open Office Calc (ods) Reader (Cell data only) - @MarkBaker -- Initial use of "pass by reference" in the calculation engine for ROW() and COLUMN() Lookup/Reference functions - @MarkBaker -- COLUMNS() and ROWS() Lookup/Reference functions, and SUBSTITUTE() Text function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- AdvancedValueBinder(): Re-enable zero-padded string-to-number conversion, e.g '0004' -> 4 - @Erik Tilt [CodePlex #10502](https://phpexcel.codeplex.com/workitem/10502) -- Make PHP type match Excel datatype - @Erik Tilt [CodePlex #10600](https://phpexcel.codeplex.com/workitem/10600) -- Change first page number on header - @MarkBaker [CodePlex #10630](https://phpexcel.codeplex.com/workitem/10630) -- Applied patch 3941 - @MarkBaker -- Hidden sheets - @MB,ET [CodePlex #10745](https://phpexcel.codeplex.com/workitem/10745) -- mbstring fallback when iconv is broken - @Erik Tilt [CodePlex #10761](https://phpexcel.codeplex.com/workitem/10761) -- Note, can't yet handle comparison of two matrices - @MarkBaker -- Improved handling for validation and error trapping in a number of functions - @MarkBaker -- Improved support for fraction number formatting - @MarkBaker -- Support Reading CSV with Byte Order Mark (BOM) - @Erik Tilt [CodePlex #10455](https://phpexcel.codeplex.com/workitem/10455) - -### Bugfixes - -- addExternalSheet() at specified index - @Erik Tilt [CodePlex #10860](https://phpexcel.codeplex.com/workitem/10860) -- Named range can no longer be passed to worksheet->getCell() - @MarkBaker [CodePlex #10684](https://phpexcel.codeplex.com/workitem/10684) -- RichText HTML entities no longer working in PHPExcel 1.7.0 - @Erik Tilt [CodePlex #10455](https://phpexcel.codeplex.com/workitem/10455) -- Fit-to-width value of 1 is lost after read/write of Excel2007 spreadsheet [+ support for simultaneous scale/fitToPage] - @Erik Tilt -- Performance issue identified by profiling - @MarkBaker [CodePlex #10469](https://phpexcel.codeplex.com/workitem/10469) -- setSelectedCell is wrong - @Erik Tilt [CodePlex #10473](https://phpexcel.codeplex.com/workitem/10473) -- Images get squeezed/stretched with (Mac) Verdana 10 Excel files using Excel5 reader/writer - @Erik Tilt [CodePlex #10481](https://phpexcel.codeplex.com/workitem/10481) -- Error in argument count for DATEDIF() function - @MarkBaker [CodePlex #10482](https://phpexcel.codeplex.com/workitem/10482) -- updateFormulaReferences is buggy - @MarkBaker [CodePlex #10452](https://phpexcel.codeplex.com/workitem/10452) -- CellIterator returns null Cell if onlyExistingCells is set and key() is in use - @MarkBaker [CodePlex #10485](https://phpexcel.codeplex.com/workitem/10485) -- Wrong RegEx for parsing cell references in formulas - @MarkBaker [CodePlex #10453](https://phpexcel.codeplex.com/workitem/10453) -- Optimisation subverted to devastating effect if IterateOnlyExistingCells is clear - @MarkBaker [CodePlex #10486](https://phpexcel.codeplex.com/workitem/10486) -- Fatal error: Uncaught exception 'Exception' with message 'Unrecognized token 6C in formula'... with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10494](https://phpexcel.codeplex.com/workitem/10494) -- Fractions stored as text are not treated as numbers by PHPExcel's calculation engine - @MarkBaker [CodePlex #10490](https://phpexcel.codeplex.com/workitem/10490) -- AutoFit (autosize) row height not working in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10503](https://phpexcel.codeplex.com/workitem/10503) -- Fixed problem with null values breaking the calculation stack - @MarkBaker -- Date number formats sometimes fail with PHPExcel_Style_NumberFormat::toFormattedString, e.g. [$-40047]mmmm d yyyy - @Erik Tilt [CodePlex #10524](https://phpexcel.codeplex.com/workitem/10524) -- Fixed minor problem with DATEDIFF YM calculation - @MarkBaker -- Applied patch 3695 - @MarkBaker -- setAutosize() and Date cells not working properly - @Erik Tilt [CodePlex #10536](https://phpexcel.codeplex.com/workitem/10536) -- Time value hour offset in output by HTML/PDF/CSV writers (system timezone problem) - @Erik Tilt [CodePlex #10556](https://phpexcel.codeplex.com/workitem/10556) -- Control characters 0x14-0x1F are not treated by PHPExcel - @Erik Tilt [CodePlex #10558](https://phpexcel.codeplex.com/workitem/10558) -- PHPExcel_Writer_Excel5 not working when open_basedir restriction is in effect - @Erik Tilt [CodePlex #10560](https://phpexcel.codeplex.com/workitem/10560) -- IF formula calculation problem in PHPExcel 1.7.0 (string comparisons) - @MarkBaker [CodePlex #10563](https://phpexcel.codeplex.com/workitem/10563) -- Improved CODE() Text function result for UTF-8 characters - @MarkBaker -- Empty rows are collapsed with HTML/PDF writer - @Erik Tilt [CodePlex #10568](https://phpexcel.codeplex.com/workitem/10568) -- Gaps between rows in output by PHPExcel_Writer_PDF (Upgrading to TCPDF 4.7.003) - @Erik Tilt [CodePlex #10569](https://phpexcel.codeplex.com/workitem/10569) -- Problem reading formulas (Excel5 reader problem with "fake" shared formulas) - @Erik Tilt [CodePlex #10575](https://phpexcel.codeplex.com/workitem/10575) -- Error type in formula: "_raiseFormulaError message is Formula Error: An unexpected error occured" - @MarkBaker [CodePlex #10588](https://phpexcel.codeplex.com/workitem/10588) -- Miscellaneous column width problems in Excel5/Excel2007 writer - @Erik Tilt [CodePlex #10599](https://phpexcel.codeplex.com/workitem/10599) -- Reader/Excel5 'Unrecognized token 2D in formula' in latest version - @Erik Tilt [CodePlex #10615](https://phpexcel.codeplex.com/workitem/10615) -- on php 5.3 PHPExcel 1.7 Excel 5 reader fails in _getNextToken, token = 2C, throws exception - @Erik Tilt [CodePlex #10623](https://phpexcel.codeplex.com/workitem/10623) -- Fatal error when altering styles after workbook has been saved - @Erik Tilt [CodePlex #10617](https://phpexcel.codeplex.com/workitem/10617) -- Images vertically stretched or squeezed when default font size is changed (PHPExcel_Writer_Excel5) - @Erik Tilt [CodePlex #10661](https://phpexcel.codeplex.com/workitem/10661) -- Styles not read in "manipulated" Excel2007 workbook - @Erik Tilt [CodePlex #10676](https://phpexcel.codeplex.com/workitem/10676) -- Windows 7 says corrupt file by PHPExcel_Writer_Excel5 when opening in Excel - @Erik Tilt [CodePlex #10059](https://phpexcel.codeplex.com/workitem/10059) -- Calculations sometimes not working with cell references to other sheets - @MarkBaker [CodePlex #10708](https://phpexcel.codeplex.com/workitem/10708) -- Problem with merged cells after insertNewRowBefore() - @Erik Tilt [CodePlex #10706](https://phpexcel.codeplex.com/workitem/10706) -- Applied patch 4023 - @MarkBaker -- Fix to SUMIF() and COUNTIF() Statistical functions for when condition is a match against a string value - @MarkBaker -- PHPExcel_Cell::coordinateFromString should throw exception for bad string parameter - @Erik Tilt [CodePlex #10721](https://phpexcel.codeplex.com/workitem/10721) -- EucrosiaUPC (Thai font) not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10723](https://phpexcel.codeplex.com/workitem/10723) -- Improved the return of calculated results when the result value is an array - @MarkBaker -- Allow calculation engine to support Functions prefixed with @ within formulae - @MarkBaker -- Intersection operator (space operator) fatal error with calculation engine - @MarkBaker [CodePlex #10632](https://phpexcel.codeplex.com/workitem/10632) -- Chinese, Japanese, Korean characters show as squares in PDF - @Erik Tilt [CodePlex #10742](https://phpexcel.codeplex.com/workitem/10742) -- sheet title allows invalid characters - @Erik Tilt [CodePlex #10756](https://phpexcel.codeplex.com/workitem/10756) -- Sheet!$A$1 as function argument in formula causes infinite loop in Excel5 writer - @Erik Tilt [CodePlex #10757](https://phpexcel.codeplex.com/workitem/10757) -- Cell range involving name not working with calculation engine - Modified calculation parser to handle range operator (:), but doesn't currently handle worksheet references with spaces or other non-alphameric characters, or trap erroneous references - @MarkBaker [CodePlex #10740](https://phpexcel.codeplex.com/workitem/10740) -- DATE function problem with calculation engine (says too few arguments given) - @MarkBaker [CodePlex #10798](https://phpexcel.codeplex.com/workitem/10798) -- Blank cell can cause wrong calculated value - @MarkBaker [CodePlex #10799](https://phpexcel.codeplex.com/workitem/10799) -- Modified ROW() and COLUMN() Lookup/Reference Functions to return an array when passed a cell range, plus some additional work on INDEX() - @MarkBaker -- Images not showing in Excel 97 using PHPExcel_Writer_Excel5 (patch by Jordi Gutiérrez Hermoso) - @Erik Tilt [CodePlex #10817](https://phpexcel.codeplex.com/workitem/10817) -- When figures are contained in the excel sheet, Reader was stopped - @Erik Tilt [CodePlex #10785](https://phpexcel.codeplex.com/workitem/10785) -- Formulas changed after insertNewRowBefore() - @MarkBaker [CodePlex #10818](https://phpexcel.codeplex.com/workitem/10818) -- Cell range row offset problem with shared formulas using PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10825](https://phpexcel.codeplex.com/workitem/10825) -- Warning: Call-time pass-by-reference has been deprecated - @MarkBaker [CodePlex #10832](https://phpexcel.codeplex.com/workitem/10832) -- Image should "Move but don't size with cells" instead of "Move and size with cells" with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10849](https://phpexcel.codeplex.com/workitem/10849) -- Opening a Excel5 generated XLS in Excel 2007 results in header/footer entry not showing on input - @Erik Tilt [CodePlex #10856](https://phpexcel.codeplex.com/workitem/10856) -- addExternalSheet() not returning worksheet - @Erik Tilt [CodePlex #10859](https://phpexcel.codeplex.com/workitem/10859) -- Invalid results in formulas with named ranges - @MarkBaker [CodePlex #10629](https://phpexcel.codeplex.com/workitem/10629) - -## [1.7.0] - 2009-08-10 - -### General - -- Expand documentation: Number formats - @Erik Tilt -- Class 'PHPExcel_Cell_AdvancedValueBinder' not found - @Erik Tilt - -### Features - -- Change return type of date functions to PHPExcel_Calculation_Functions::RETURNDATE_EXCEL - @MarkBaker -- New RPN and stack-based calculation engine for improved performance of formula calculation - @MarkBaker - - Faster (anything between 2 and 12 times faster than the old parser, depending on the complexity and nature of the formula) - - Significantly more memory efficient when formulae reference cells across worksheets - - Correct behaviour when referencing Named Ranges that exist on several worksheets - - Support for Excel ^ (Exponential) and % (Percentage) operators - - Support for matrices within basic arithmetic formulae (e.g. ={1,2,3;4,5,6;7,8,9}/2) - - Better trapping/handling of NaN and infinity results (return #NUM! error) - - Improved handling of empty parameters for Excel functions - - Optional logging of calculation steps- New calculation engine can be accessed independently of workbooks (for use as a standalone calculator) - @MarkBaker -- Implement more Excel calculation functions - @MarkBaker - - Initial implementation of the COUNTIF() and SUMIF() Statistical functions - - Added ACCRINT() Financial function- Modifications to number format handling for dddd and ddd masks in dates, use of thousand separators even when locale only implements it for money, and basic fraction masks (0 ?/? and ?/?) - @MarkBaker -- Support arbitrary fixed number of decimals in PHPExcel_Style_NumberFormat::toFormattedString() - @Erik Tilt -- Improving performance and memory on data dumps - @Erik Tilt - - Various style optimizations (merging from branch wi6857-memory) - - Moving hyperlink and dataValidation properties from cell to worksheet for lower PHP memory usage- Provide fluent interfaces where possible - @MarkBaker -- Make easy way to apply a border to a rectangular selection - @Erik Tilt -- Support for system window colors in PHPExcel_Reader_Excel5 - @Erik Tilt -- Horizontal center across selection - @Erik Tilt -- Merged cells record, write to full record size in PHPExcel_Writer_Excel5 - @Erik Tilt -- Add page break between sheets in exported PDF - @MarkBaker -- Sanitization of UTF-8 input for cell values - @Erik Tilt -- Read cached calculated value with PHPExcel_Reader_Excel5 - @Erik Tilt -- Miscellaneous CSS improvements for PHPExcel_Writer_HTML - @Erik Tilt -- getProperties: setCompany feature request - @Erik Tilt -- Insert worksheet at a specified index - @MarkBaker -- Change worksheet index - @MarkBaker -- Readfilter for CSV reader - @MarkBaker -- Check value of mbstring.func_overload when saving with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10172](https://phpexcel.codeplex.com/workitem/10172) -- Eliminate dependency of an include path pointing to class directory - @Erik Tilt [CodePlex #10251](https://phpexcel.codeplex.com/workitem/10251) -- Method for getting the correct reader for a certain file (contribution) - @Erik Tilt [CodePlex #10292](https://phpexcel.codeplex.com/workitem/10292) -- Choosing specific row in fromArray method - @Erik Tilt [CodePlex #10287](https://phpexcel.codeplex.com/workitem/10287) -- Shared formula support in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10319](https://phpexcel.codeplex.com/workitem/10319) - -### Bugfixes - -- Right-to-left column direction in worksheet - @MB,ET [CodePlex #10345](https://phpexcel.codeplex.com/workitem/10345) -- PHPExcel_Reader_Excel5 not reading PHPExcel_Style_NumberFormat::FORMAT_NUMBER ('0') - @Erik Tilt -- Fractional row height in locale other than English results in corrupt output using PHPExcel_Writer_Excel2007 - @Erik Tilt -- Fractional (decimal) numbers not inserted correctly when locale is other than English - @Erik Tilt -- Fractional calculated value in locale other than English results in corrupt output using PHPExcel_Writer_Excel2007 - @Erik Tilt -- Locale aware decimal and thousands separator in exported formats HTML, CSV, PDF - @Erik Tilt -- Cannot Add Image with Space on its Name - @MarkBaker -- Black line at top of every page in output by PHPExcel_Writer_PDF - @Erik Tilt -- Border styles and border colors not showing in HTML output (regression since 1.6.4) - @Erik Tilt -- Hidden screen gridlines setting in worksheet not read by PHPExcel_Reader_Excel2007 - @Erik Tilt -- Some valid sheet names causes corrupt output using PHPExcel_Writer_Excel2007 - @MarkBaker -- More than 32,767 characters in a cell gives corrupt Excel file - @Erik Tilt -- Images not getting copyied with the ->copy() function - @Erik Tilt -- Bad calculation of column width setAutoSize(true) function - @Erik Tilt -- Dates are sometimes offset by 1 day in output by HTML and PDF writers depending on system timezone setting - @Erik Tilt -- Wingdings symbol fonts not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10003](https://phpexcel.codeplex.com/workitem/10003) -- White space string prefix stripped by PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #10010](https://phpexcel.codeplex.com/workitem/10010) -- The name of the Workbook stream MUST be "Workbook", not "Book" - @Erik Tilt [CodePlex #10023](https://phpexcel.codeplex.com/workitem/10023) -- Avoid message "Microsoft Excel recalculates formulas..." when closing xls file from Excel - @Erik Tilt [CodePlex #10030](https://phpexcel.codeplex.com/workitem/10030) -- Non-unique newline representation causes problems with LEN formula - @Erik Tilt [CodePlex #10031](https://phpexcel.codeplex.com/workitem/10031) -- Newline in cell not showing with PHPExcel_Writer_HTML and PHPExcel_Writer_PDF - @Erik Tilt [CodePlex #10033](https://phpexcel.codeplex.com/workitem/10033) -- Rich-Text strings get prefixed by   when output by HTML writer - @Erik Tilt [CodePlex #10046](https://phpexcel.codeplex.com/workitem/10046) -- Leading spaces do not appear in output by HTML/PDF writers - @Erik Tilt [CodePlex #10052](https://phpexcel.codeplex.com/workitem/10052) -- Empty Apache POI-generated file can not be read - @MarkBaker [CodePlex #10061](https://phpexcel.codeplex.com/workitem/10061) -- Column width not scaling correctly with font size in HTML and PDF writers - @Erik Tilt [CodePlex #10068](https://phpexcel.codeplex.com/workitem/10068) -- Inaccurate row heights with HTML writer - @Erik Tilt [CodePlex #10069](https://phpexcel.codeplex.com/workitem/10069) -- Reference helper - @MarkBaker -- Excel 5 Named ranges should not be local to the worksheet, but accessible from all worksheets - @MarkBaker -- Row heights are ignored by PHPExcel_Writer_PDF - @Erik Tilt [CodePlex #10088](https://phpexcel.codeplex.com/workitem/10088) -- Write raw XML - @MarkBaker -- removeRow(), removeColumn() not always clearing cell values - @Erik Tilt [CodePlex #10098](https://phpexcel.codeplex.com/workitem/10098) -- Problem reading certain hyperlink records with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10142](https://phpexcel.codeplex.com/workitem/10142) -- Hyperlink cell range read failure with PHPExcel_Reader_Excel2007 - @Erik Tilt [CodePlex #10143](https://phpexcel.codeplex.com/workitem/10143) -- 'Column string index can not be empty.' - @MarkBaker [CodePlex #10149](https://phpexcel.codeplex.com/workitem/10149) -- getHighestColumn() sometimes says there are 256 columns with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10204](https://phpexcel.codeplex.com/workitem/10204) -- extractSheetTitle fails when sheet title contains exclamation mark (!) - @Erik Tilt [CodePlex #10220](https://phpexcel.codeplex.com/workitem/10220) -- setTitle() sometimes erroneously appends integer to sheet name - @Erik Tilt [CodePlex #10221](https://phpexcel.codeplex.com/workitem/10221) -- Mac BIFF5 Excel file read failure (missing support for Mac OS Roman character set) - @Erik Tilt [CodePlex #10229](https://phpexcel.codeplex.com/workitem/10229) -- BIFF5 header and footer incorrectly read by PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10230](https://phpexcel.codeplex.com/workitem/10230) -- iconv notices when reading hyperlinks with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10259](https://phpexcel.codeplex.com/workitem/10259) -- Excel5 reader OLE read failure with small Mac BIFF5 Excel files - @Erik Tilt [CodePlex #10252](https://phpexcel.codeplex.com/workitem/10252) -- Problem in reading formula : IF( IF ) with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10272](https://phpexcel.codeplex.com/workitem/10272) -- Error reading formulas referencing external sheets with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10274](https://phpexcel.codeplex.com/workitem/10274) -- Image horizontally stretched when default font size is increased (PHPExcel_Writer_Excel5) - @Erik Tilt [CodePlex #10291](https://phpexcel.codeplex.com/workitem/10291) -- Undefined offset in Reader\Excel5.php on line 3572 - @Erik Tilt [CodePlex #10333](https://phpexcel.codeplex.com/workitem/10333) -- PDF output different then XLS (copied data) - @MarkBaker [CodePlex #10340](https://phpexcel.codeplex.com/workitem/10340) -- Internal hyperlinks with UTF-8 sheet names not working in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10352](https://phpexcel.codeplex.com/workitem/10352) -- String shared formula result read error with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10361](https://phpexcel.codeplex.com/workitem/10361) -- Uncaught exception 'Exception' with message 'Valid scale is between 10 and 400.' in Classes/PHPExcel/Worksheet/PageSetup.php:338 - @Erik Tilt [CodePlex #10363](https://phpexcel.codeplex.com/workitem/10363) -- Using setLoadSheetsOnly fails if you do not use setReadDataOnly(true) and sheet is not the first sheet - @Erik Tilt [CodePlex #10355](https://phpexcel.codeplex.com/workitem/10355) -- getCalculatedValue() sometimes incorrect with IF formula and 0-values - @MarkBaker [CodePlex #10362](https://phpexcel.codeplex.com/workitem/10362) -- Excel Reader 2007 problem with "shared" formulae when "master" is an error - @MarkBaker -- Named Range Bug, using the same range name on different worksheets - @MarkBaker -- Java code in JAMA classes - @MarkBaker -- getCalculatedValue() not working with some formulas involving error types - @MarkBaker -- evaluation of both return values in an IF() statement returning an error if either result was an error, irrespective of the IF evaluation - @MarkBaker -- Power in formulas: new calculation engine no longer treats ^ as a bitwise XOR operator - @MarkBaker -- Bugfixes and improvements to many of the Excel functions in PHPExcel - @MarkBaker - - Added optional "places" parameter in the BIN2HEX(), BIN2OCT, DEC2BIN(), DEC2OCT(), DEC2HEX(), HEX2BIN(), HEX2OCT(), OCT2BIN() and OCT2HEX() Engineering Functions - - Trap for unbalanced matrix sizes in MDETERM() and MINVERSE() Mathematic and Trigonometric functions - - Fix for default characters parameter value for LEFT() and RIGHT() Text functions - - Fix for GCD() and LCB() Mathematical functions when the parameters include a zero (0) value - - Fix for BIN2OCT() Engineering Function for 2s complement values (which were returning hex values) - - Fix for BESSELK() and BESSELY() Engineering functions - - Fix for IMDIV() Engineering Function when result imaginary component is positive (wasn't setting the sign) - - Fix for ERF() Engineering Function when called with an upper limit value for the integration - - Fix to DATE() Date/Time Function for year value of 0 - - Set ISPMT() function as category FINANCIAL - - Fix for DOLLARDE() and DOLLARFR() Financial functions - - Fix to EFFECT() Financial function (treating $nominal_rate value as a variable name rather than a value) - - Fix to CRITBINOM() Statistical function (CurrentValue and EssentiallyZero treated as constants rather than variables) - - Note that an Error in the function logic can still lead to a permanent loop - - Fix to MOD() Mathematical function to work with floating point results - - Fix for QUOTIENT() Mathematical function - - Fix to HOUR(), MINUTE() and SECOND() Date/Time functions to return an error when passing in a floating point value of 1.0 or greater, or less than 0 - - LOG() Function now correctly returns base-10 log when called with only one parameter, rather than the natural log as the default base - - Modified text functions to handle multibyte character set (UTF-8). - -## [1.6.7] - 2009-04-22 - -### BREAKING CHANGE - -In previous versions of PHPExcel up to and including 1.6.6, -when a cell had a date-like number format code, it was possible to enter a date -directly using an integer PHP-time without converting to Excel date format. -Starting with PHPExcel 1.6.7 this is no longer supported. Refer to the developer -documentation for more information on entering dates into a cell. - -### General - -- Deprecate misspelled setStriketrough() and getStriketrough() methods - @MarkBaker [CodePlex #9416](https://phpexcel.codeplex.com/workitem/9416) - -### Features - -- Performance improvement when saving file - @MarkBaker [CodePlex #9526](https://phpexcel.codeplex.com/workitem/9526) -- Check that sheet title has maximum 31 characters - @MarkBaker [CodePlex #9598](https://phpexcel.codeplex.com/workitem/9598) -- True support for Excel built-in number format codes - @MB, ET [CodePlex #9631](https://phpexcel.codeplex.com/workitem/9631) -- Ability to read defect BIFF5 Excel file without CODEPAGE record - @Erik Tilt [CodePlex #9683](https://phpexcel.codeplex.com/workitem/9683) -- Auto-detect which reader to invoke - @MarkBaker [CodePlex #9701](https://phpexcel.codeplex.com/workitem/9701) -- Deprecate insertion of dates using PHP-time (Unix time) [request for removal of feature] - @Erik Tilt [CodePlex #9214](https://phpexcel.codeplex.com/workitem/9214) -- Support for entering time values like '9:45', '09:45' using AdvancedValueBinder - @Erik Tilt [CodePlex #9747](https://phpexcel.codeplex.com/workitem/9747) - -### Bugfixes - -- DataType dependent horizontal alignment in HTML and PDF writer - @Erik Tilt [CodePlex #9797](https://phpexcel.codeplex.com/workitem/9797) -- Cloning data validation object causes script to stop - @MarkBaker [CodePlex #9375](https://phpexcel.codeplex.com/workitem/9375) -- Simultaneous repeating rows and repeating columns not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9400](https://phpexcel.codeplex.com/workitem/9400) -- Simultaneous repeating rows and repeating columns not working with PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #9399](https://phpexcel.codeplex.com/workitem/9399) -- Row outline level not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9437](https://phpexcel.codeplex.com/workitem/9437) -- Occasional notices with PHPExcel_Reader_Excel5 when Excel file contains drawing elements - @Erik Tilt [CodePlex #9452](https://phpexcel.codeplex.com/workitem/9452) -- PHPExcel_Reader_Excel5 fails as a whole when workbook contains images other than JPEG/PNG - @Erik Tilt [CodePlex #9453](https://phpexcel.codeplex.com/workitem/9453) -- Excel5 writer checks for iconv but does not necessarily use it - @Erik Tilt [CodePlex #9444](https://phpexcel.codeplex.com/workitem/9444) -- Altering a style on copied worksheet alters also the original - @Erik Tilt [CodePlex #9463](https://phpexcel.codeplex.com/workitem/9463) -- Formulas are incorrectly updated when a sheet is renamed - @MarkBaker [CodePlex #9480](https://phpexcel.codeplex.com/workitem/9480) -- PHPExcel_Worksheet::extractSheetTitle not treating single quotes correctly - @MarkBaker [CodePlex #9513](https://phpexcel.codeplex.com/workitem/9513) -- PHP Warning raised in function array_key_exists - @MarkBaker [CodePlex #9477](https://phpexcel.codeplex.com/workitem/9477) -- getAlignWithMargins() gives wrong value when using PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9599](https://phpexcel.codeplex.com/workitem/9599) -- getScaleWithDocument() gives wrong value when using PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9600](https://phpexcel.codeplex.com/workitem/9600) -- PHPExcel_Reader_Excel2007 not reading the first user-defined number format - @MarkBaker [CodePlex #9630](https://phpexcel.codeplex.com/workitem/9630) -- Print area converted to uppercase after read with PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9647](https://phpexcel.codeplex.com/workitem/9647) -- Incorrect reading of scope for named range using PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9661](https://phpexcel.codeplex.com/workitem/9661) -- Error with pattern (getFillType) and rbg (getRGB) - @MarkBaker [CodePlex #9690](https://phpexcel.codeplex.com/workitem/9690) -- AdvancedValueBinder affected by system timezone setting when inserting date values - @Erik Tilt [CodePlex #9712](https://phpexcel.codeplex.com/workitem/9712) -- PHPExcel_Reader_Excel2007 not reading value of active sheet index - @Erik Tilt [CodePlex #9743](https://phpexcel.codeplex.com/workitem/9743) -- getARGB() sometimes returns SimpleXMLElement object instead of string with PHPExcel_Reader_Excel2007 - @Erik Tilt [CodePlex #9742](https://phpexcel.codeplex.com/workitem/9742) -- Negative image offset causes defects in 14excel5.xls and 20readexcel5.xlsx - @Erik Tilt [CodePlex #9731](https://phpexcel.codeplex.com/workitem/9731) -- HTML & PDF Writer not working with mergeCells (regression since 1.6.5) - @Erik Tilt [CodePlex #9758](https://phpexcel.codeplex.com/workitem/9758) -- Too wide columns with HTML and PDF writer - @Erik Tilt [CodePlex #9774](https://phpexcel.codeplex.com/workitem/9774) -- PDF and cyrillic fonts - @MarkBaker [CodePlex #9775](https://phpexcel.codeplex.com/workitem/9775) -- Percentages not working correctly with HTML and PDF writers (shows 0.25% instead of 25%) - @Erik Tilt [CodePlex #9793](https://phpexcel.codeplex.com/workitem/9793) -- PHPExcel_Writer_HTML creates extra borders around cell contents using setUseInlineCss(true) - @Erik Tilt [CodePlex #9791](https://phpexcel.codeplex.com/workitem/9791) -- Problem with text wrap + merged cells in HTML and PDF writer - @Erik Tilt [CodePlex #9784](https://phpexcel.codeplex.com/workitem/9784) -- Adjacent path separators in include_path causing IOFactory to violate open_basedir restriction - @Erik Tilt [CodePlex #9814](https://phpexcel.codeplex.com/workitem/9814) - -## [1.6.6] - 2009-03-02 - -### General - -- Improve support for built-in number formats in PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9102](https://phpexcel.codeplex.com/workitem/9102) -- Source files are in both UNIX and DOS formats - changed to UNIX - @Erik Tilt [CodePlex #9281](https://phpexcel.codeplex.com/workitem/9281) - -### Features - -- Update documentation: Which language to write formulas in? - @MarkBaker [CodePlex #9338](https://phpexcel.codeplex.com/workitem/9338) -- Ignore DEFCOLWIDTH records with value 8 in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8817](https://phpexcel.codeplex.com/workitem/8817) -- Support for width, height, offsetX, offsetY for images in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8847](https://phpexcel.codeplex.com/workitem/8847) -- Disk Caching in specific folder - @MarkBaker [CodePlex #8870](https://phpexcel.codeplex.com/workitem/8870) -- Added SUMX2MY2, SUMX2PY2, SUMXMY2, MDETERM and MINVERSE Mathematical and Trigonometric Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added CONVERT Engineering Function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added DB, DDB, DISC, DOLLARDE, DOLLARFR, INTRATE, IPMT, PPMT, PRICEDISC, PRICEMAT and RECEIVED Financial Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added ACCRINTM, CUMIPMT, CUMPRINC, TBILLEQ, TBILLPRICE, TBILLYIELD, YIELDDISC and YIELDMAT Financial Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added DOLLAR Text Function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added CORREL, COVAR, FORECAST, INTERCEPT, RSQ, SLOPE and STEYX Statistical Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added PEARSON Statistical Functions as a synonym for CORREL - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added LINEST, LOGEST (currently only valid for stats = false), TREND and GROWTH Statistical Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added RANK and PERCENTRANK Statistical Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added ROMAN Mathematical Function (Classic form only) - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Update documentation to show example of getCellByColumnAndRow($col, $row) - @MarkBaker [CodePlex #8931](https://phpexcel.codeplex.com/workitem/8931) -- Implement worksheet, row and cell iterators - @MarkBaker [CodePlex #8770](https://phpexcel.codeplex.com/workitem/8770) -- Support for arbitrary defined names (named range) - @MarkBaker [CodePlex #9001](https://phpexcel.codeplex.com/workitem/9001) -- Update formulas when sheet title / named range title changes - @MB, ET [CodePlex #9016](https://phpexcel.codeplex.com/workitem/9016) -- Ability to read cached calculated value - @MarkBaker [CodePlex #9103](https://phpexcel.codeplex.com/workitem/9103) -- Support for Excel 1904 calendar date mode (Mac) - @MBaker, ET [CodePlex #8483](https://phpexcel.codeplex.com/workitem/8483) -- PHPExcel_Writer_Excel5 improvements writing shared strings table - @Erik Tilt [CodePlex #9194](https://phpexcel.codeplex.com/workitem/9194) -- PHPExcel_Writer_Excel5 iconv fallback when mbstring extension is not enabled - @Erik Tilt [CodePlex #9248](https://phpexcel.codeplex.com/workitem/9248) -- UTF-8 support in font names in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9253](https://phpexcel.codeplex.com/workitem/9253) -- Implement value binding architecture - @MarkBaker [CodePlex #9215](https://phpexcel.codeplex.com/workitem/9215) -- PDF writer not working with UTF-8 - @MarkBaker [CodePlex #6742](https://phpexcel.codeplex.com/workitem/6742) - -### Bugfixes - -- Eliminate duplicate style entries in multisheet workbook written by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9355](https://phpexcel.codeplex.com/workitem/9355) -- Redirect to client browser fails due to trailing white space in class definitions - @Erik Tilt [CodePlex #8810](https://phpexcel.codeplex.com/workitem/8810) -- Spurious column dimension element introduced in blank worksheet after using PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #8816](https://phpexcel.codeplex.com/workitem/8816) -- Image gets slightly narrower than expected when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8830](https://phpexcel.codeplex.com/workitem/8830) -- Image laid over non-visible row gets squeezed in height when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8831](https://phpexcel.codeplex.com/workitem/8831) -- PHPExcel_Reader_Excel5 fails when there are 10 or more images in the workbook - @Erik Tilt [CodePlex #8860](https://phpexcel.codeplex.com/workitem/8860) -- Different header/footer images in different sheets not working with PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #8909](https://phpexcel.codeplex.com/workitem/8909) -- Fractional seconds disappear when using PHPExcel_Reader_Excel2007 and PHPExcel_Reader_Excel5 - @MB, ET [CodePlex #8924](https://phpexcel.codeplex.com/workitem/8924) -- Images not showing in OpenOffice when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7994](https://phpexcel.codeplex.com/workitem/7994) -- Images not showing on print using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9047](https://phpexcel.codeplex.com/workitem/9047) -- PHPExcel_Writer_Excel5 maximum allowed record size 4 bytes too short - @Erik Tilt [CodePlex #9085](https://phpexcel.codeplex.com/workitem/9085) -- Not numeric strings are formatted as dates and numbers using worksheet's toArray method - @MarkBaker [CodePlex #9119](https://phpexcel.codeplex.com/workitem/9119) -- Excel5 simple formula parsing error - @Erik Tilt [CodePlex #9132](https://phpexcel.codeplex.com/workitem/9132) -- Problems writing dates with CSV - @Erik Tilt [CodePlex #9206](https://phpexcel.codeplex.com/workitem/9206) -- PHPExcel_Reader_Excel5 reader fails with fatal error when reading group shapes - @Erik Tilt [CodePlex #9203](https://phpexcel.codeplex.com/workitem/9203) -- PHPExcel_Writer_Excel5 fails completely when workbook contains more than 57 colors - @Erik Tilt [CodePlex #9231](https://phpexcel.codeplex.com/workitem/9231) -- PHPExcel_Writer_PDF not compatible with autoload - @Erik Tilt [CodePlex #9244](https://phpexcel.codeplex.com/workitem/9244) -- Fatal error: Call to a member function getNestingLevel() on a non-object in PHPExcel/Reader/Excel5.php on line 690 - @Erik Tilt [CodePlex #9250](https://phpexcel.codeplex.com/workitem/9250) -- Notices when running test 04printing.php on PHP 5.2.8 - @MarkBaker [CodePlex #9246](https://phpexcel.codeplex.com/workitem/9246) -- insertColumn() spawns creation of spurious RowDimension - @MarkBaker [CodePlex #9294](https://phpexcel.codeplex.com/workitem/9294) -- Fix declarations for methods in extended Trend classes - @MarkBaker [CodePlex #9296](https://phpexcel.codeplex.com/workitem/9296) -- Fix to parameters for the FORECAST Statistical Function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- PDF writer problems with cell height and text wrapping - @MarkBaker [CodePlex #7083](https://phpexcel.codeplex.com/workitem/7083) -- Fix test for calculated value in case the returned result is an array - @MarkBaker -- Column greater than 256 results in corrupt Excel file using PHPExcel_Writer_Excel5 - @Erik Tilt -- Excel Numberformat 0.00 results in non internal decimal places values in toArray() Method - @MarkBaker [CodePlex #9351](https://phpexcel.codeplex.com/workitem/9351) -- setAutoSize not taking into account text rotation - @MB,ET [CodePlex #9356](https://phpexcel.codeplex.com/workitem/9356) -- Call to undefined method PHPExcel_Worksheet_MemoryDrawing::getPath() in PHPExcel/Writer/HTML.php - @Erik Tilt [CodePlex #9372](https://phpexcel.codeplex.com/workitem/9372) - -## [1.6.5] - 2009-01-05 - -### General - -- Applied patch 2063 - @MarkBaker -- Optimise Shared Strings - @MarkBaker -- Optimise Cell Sorting - @MarkBaker -- Optimise Style Hashing - @MarkBaker -- UTF-8 enhancements - @Erik Tilt -- PHPExcel_Writer_HTML validation errors against strict HTML 4.01 / CSS 2.1 - @Erik Tilt -- Documented work items 6203 and 8110 in manual - @MarkBaker -- Restructure package hierachy so classes can be found more easily in auto-generated API (from work item 8468) - @Erik Tilt - -### Features - -- Redirect output to a client's browser: Update recommendation in documentation - @MarkBaker [CodePlex #8806](https://phpexcel.codeplex.com/workitem/8806) -- PHPExcel_Reader_Excel5 support for print gridlines - @Erik Tilt [CodePlex #7897](https://phpexcel.codeplex.com/workitem/7897) -- Screen gridlines support in Excel5 reader/writer - @Erik Tilt [CodePlex #7899](https://phpexcel.codeplex.com/workitem/7899) -- Option for adding image to spreadsheet from image resource in memory - @MB, ET [CodePlex #7552](https://phpexcel.codeplex.com/workitem/7552) -- PHPExcel_Reader_Excel5 style support for BIFF5 files (Excel 5.0 - Excel 95) - @Erik Tilt [CodePlex #7862](https://phpexcel.codeplex.com/workitem/7862) -- PHPExcel_Reader_Excel5 support for user-defined colors and special built-in colors - @Erik Tilt [CodePlex #7918](https://phpexcel.codeplex.com/workitem/7918) -- Support for freeze panes in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7992](https://phpexcel.codeplex.com/workitem/7992) -- Support for header and footer margins in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7996](https://phpexcel.codeplex.com/workitem/7996) -- Support for active sheet index in Excel5 reader/writer - @Erik Tilt [CodePlex #7997](https://phpexcel.codeplex.com/workitem/7997) -- Freeze panes not read by PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #7991](https://phpexcel.codeplex.com/workitem/7991) -- Support for screen zoom level (feature request) - @MB, ET [CodePlex #7993](https://phpexcel.codeplex.com/workitem/7993) -- Support for default style in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8012](https://phpexcel.codeplex.com/workitem/8012) -- Apple iWork / Numbers.app incompatibility - @MarkBaker [CodePlex #8094](https://phpexcel.codeplex.com/workitem/8094) -- Support "between rule" in conditional formatting - @MarkBaker [CodePlex #7931](https://phpexcel.codeplex.com/workitem/7931) -- Comment size, width and height control (feature request) - @MarkBaker [CodePlex #8308](https://phpexcel.codeplex.com/workitem/8308) -- Improve method for storing MERGEDCELLS records in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8418](https://phpexcel.codeplex.com/workitem/8418) -- Support for protectCells() in Excel5 reader/writer - @Erik Tilt [CodePlex #8435](https://phpexcel.codeplex.com/workitem/8435) -- Support for fitToWidth and fitToHeight pagesetup properties in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8472](https://phpexcel.codeplex.com/workitem/8472) -- Support for setShowSummaryBelow() and setShowSummaryRight() in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8489](https://phpexcel.codeplex.com/workitem/8489) -- Support for Excel 1904 calendar date mode (Mac) - @MarkBaker [CodePlex #8483](https://phpexcel.codeplex.com/workitem/8483) -- Excel5 reader: Support for reading images (bitmaps) - @Erik Tilt [CodePlex #7538](https://phpexcel.codeplex.com/workitem/7538) -- Support for default style in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8787](https://phpexcel.codeplex.com/workitem/8787) -- Modified calculate() method to return either an array or the first value from the array for those functions that return arrays rather than single values (e.g the MMULT and TRANSPOSE function). This performance can be modified based on the $returnArrayAsType which can be set/retrieved by calling the setArrayReturnType() and getArrayReturnType() methods of the PHPExcel_Calculation class. - @MarkBaker - -### Bugfixes - -- Added ERROR.TYPE Information Function, MMULT Mathematical and Trigonometry Function, and TRANSPOSE Lookup and Reference Function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- setPrintGridlines(true) not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7896](https://phpexcel.codeplex.com/workitem/7896) -- Incorrect mapping of fill patterns in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7907](https://phpexcel.codeplex.com/workitem/7907) -- setShowGridlines(false) not working with PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #7898](https://phpexcel.codeplex.com/workitem/7898) -- getShowGridlines() gives inverted value when reading sheet with PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #7905](https://phpexcel.codeplex.com/workitem/7905) -- User-defined column width becomes slightly larger after read/write with Excel5 - @Erik Tilt [CodePlex #7944](https://phpexcel.codeplex.com/workitem/7944) -- Incomplete border style support in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7949](https://phpexcel.codeplex.com/workitem/7949) -- Conditional formatting "containsText" read/write results in MS Office Excel 2007 crash - @MarkBaker [CodePlex #7928](https://phpexcel.codeplex.com/workitem/7928) -- All sheets are always selected in output when using PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #7995](https://phpexcel.codeplex.com/workitem/7995) -- COLUMN function warning message during plain read/write - @MarkBaker [CodePlex #8013](https://phpexcel.codeplex.com/workitem/8013) -- setValue(0) results in string data type '0' - @MarkBaker [CodePlex #8155](https://phpexcel.codeplex.com/workitem/8155) -- Styles not removed when removing rows from sheet - @MarkBaker [CodePlex #8226](https://phpexcel.codeplex.com/workitem/8226) -- =IF formula causes fatal error during $objWriter->save() in Excel2007 format - @MarkBaker [CodePlex #8301](https://phpexcel.codeplex.com/workitem/8301) -- Exception thrown reading valid xls file: "Excel file is corrupt. Didn't find CONTINUE record while reading shared strings" - @Erik Tilt [CodePlex #8333](https://phpexcel.codeplex.com/workitem/8333) -- MS Outlook corrupts files generated by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8320](https://phpexcel.codeplex.com/workitem/8320) -- Undefined method PHPExcel_Worksheet::setFreezePane() in ReferenceHelper.php on line 271 - @MarkBaker [CodePlex #8351](https://phpexcel.codeplex.com/workitem/8351) -- Ampersands (&), left and right angles (<, >) in Rich-Text strings leads to corrupt output using PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #8401](https://phpexcel.codeplex.com/workitem/8401) -- Print header and footer not supporting UTF-8 in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8408](https://phpexcel.codeplex.com/workitem/8408) -- Vertical page breaks not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8463](https://phpexcel.codeplex.com/workitem/8463) -- Missing support for accounting underline types in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8476](https://phpexcel.codeplex.com/workitem/8476) -- Infinite loops when reading corrupt xls file using PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8482](https://phpexcel.codeplex.com/workitem/8482) -- Sheet protection password not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8566](https://phpexcel.codeplex.com/workitem/8566) -- PHPExcel_Style_NumberFormat::FORMAT_NUMBER ignored by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8596](https://phpexcel.codeplex.com/workitem/8596) -- PHPExcel_Reader_Excel5 fails a whole when workbook contains a chart - @Erik Tilt [CodePlex #8781](https://phpexcel.codeplex.com/workitem/8781) -- Occasional loss of column widths using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8788](https://phpexcel.codeplex.com/workitem/8788) -- Notices while reading formulas with deleted sheet references using PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8795](https://phpexcel.codeplex.com/workitem/8795) -- Default style not read by PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #8807](https://phpexcel.codeplex.com/workitem/8807) -- Blank rows occupy too much space in file generated by PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #9341](https://phpexcel.codeplex.com/workitem/9341) - -## [1.6.4] - 2008-10-27 - -### Features - -- RK record number error in MS developer documentation: 0x007E should be 0x027E - @Erik Tilt [CodePlex #7882](https://phpexcel.codeplex.com/workitem/7882) -- getHighestColumn() returning "@" for blank worksheet causes corrupt output - @MarkBaker [CodePlex #7878](https://phpexcel.codeplex.com/workitem/7878) -- Implement ROW and COLUMN Lookup/Reference Functions (when specified with a parameter) - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement initial work on OFFSET Lookup/Reference Function (returning address rather than value at address) - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Excel5 reader: Page margins - @Erik Tilt [CodePlex #7416](https://phpexcel.codeplex.com/workitem/7416) -- Excel5 reader: Header & Footer - @Erik Tilt [CodePlex #7417](https://phpexcel.codeplex.com/workitem/7417) -- Excel5 reader support for page setup (paper size etc.) - @Erik Tilt [CodePlex #7449](https://phpexcel.codeplex.com/workitem/7449) -- Improve speed and memory consumption of PHPExcel_Writer_CSV - @MarkBaker [CodePlex #7445](https://phpexcel.codeplex.com/workitem/7445) -- Better recognition of number format in HTML, CSV, and PDF writer - @MarkBaker [CodePlex #7432](https://phpexcel.codeplex.com/workitem/7432) -- Font support: Superscript and Subscript - @MarkBaker [CodePlex #7485](https://phpexcel.codeplex.com/workitem/7485) -- Excel5 reader font support: Super- and subscript - @Erik Tilt [CodePlex #7509](https://phpexcel.codeplex.com/workitem/7509) -- Excel5 reader style support: Text rotation and stacked text - @Erik Tilt [CodePlex #7521](https://phpexcel.codeplex.com/workitem/7521) -- Excel5 reader: Support for hyperlinks - @Erik Tilt [CodePlex #7530](https://phpexcel.codeplex.com/workitem/7530) -- Import sheet by request - @MB, ET [CodePlex #7557](https://phpexcel.codeplex.com/workitem/7557) -- PHPExcel_Reader_Excel5 support for page breaks - @Erik Tilt [CodePlex #7607](https://phpexcel.codeplex.com/workitem/7607) -- PHPExcel_Reader_Excel5 support for shrink-to-fit - @Erik Tilt [CodePlex #7622](https://phpexcel.codeplex.com/workitem/7622) -- Support for error types - @MB, ET [CodePlex #7675](https://phpexcel.codeplex.com/workitem/7675) -- Excel5 reader true formula support - @Erik Tilt [CodePlex #7388](https://phpexcel.codeplex.com/workitem/7388) -- Support for named ranges (defined names) in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7701](https://phpexcel.codeplex.com/workitem/7701) -- Support for repeating rows and repeating columns (print titles) in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7781](https://phpexcel.codeplex.com/workitem/7781) -- Support for print area in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7783](https://phpexcel.codeplex.com/workitem/7783) -- Excel5 reader and writer support for horizontal and vertical centering of page - @Erik Tilt [CodePlex #7795](https://phpexcel.codeplex.com/workitem/7795) -- Applied patch 1962 - @MarkBaker -- Excel5 reader and writer support for hidden cells (formulas) - @Erik Tilt [CodePlex #7866](https://phpexcel.codeplex.com/workitem/7866) -- Support for indentation in cells (feature request) - @MB, ET [CodePlex #7612](https://phpexcel.codeplex.com/workitem/7612) - -### Bugfixes - -- Option for reading only specified interval of rows in a sheet - @MB, ET [CodePlex #7828](https://phpexcel.codeplex.com/workitem/7828) -- PHPExcel_Calculation_Functions::DATETIMENOW() and PHPExcel_Calculation_Functions::DATENOW() to force UTC - @MarkBaker [CodePlex #7367](https://phpexcel.codeplex.com/workitem/7367) -- Modified PHPExcel_Shared_Date::FormattedPHPToExcel() and PHPExcel_Shared_Date::ExcelToPHP to force datatype for return values - @MarkBaker [CodePlex #7395](https://phpexcel.codeplex.com/workitem/7395) -- Excel5 reader not producing UTF-8 strings with BIFF5 files - @Erik Tilt [CodePlex #7450](https://phpexcel.codeplex.com/workitem/7450) -- Array constant in formula gives run-time notice with Excel2007 writer - @MarkBaker [CodePlex #7470](https://phpexcel.codeplex.com/workitem/7470) -- PHPExcel_Reader_Excel2007 setReadDataOnly(true) returns Rich-Text - @MarkBaker [CodePlex #7494](https://phpexcel.codeplex.com/workitem/7494) -- PHPExcel_Reader_Excel5 setReadDataOnly(true) returns Rich-Text - @Erik Tilt [CodePlex #7496](https://phpexcel.codeplex.com/workitem/7496) -- Characters before superscript or subscript losing style - @MarkBaker [CodePlex #7497](https://phpexcel.codeplex.com/workitem/7497) -- Subscript not working with HTML writer - @MarkBaker [CodePlex #7507](https://phpexcel.codeplex.com/workitem/7507) -- DefaultColumnDimension not working on first column (A) - @MarkBaker [CodePlex #7508](https://phpexcel.codeplex.com/workitem/7508) -- Negative numbers are stored as text in PHPExcel_Writer_2007 - @MarkBaker [CodePlex #7527](https://phpexcel.codeplex.com/workitem/7527) -- Text rotation and stacked text not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7531](https://phpexcel.codeplex.com/workitem/7531) -- PHPExcel_Shared_Date::isDateTimeFormatCode erroneously says true - @MarkBaker [CodePlex #7536](https://phpexcel.codeplex.com/workitem/7536) -- Different images with same filename in separate directories become duplicates - @MarkBaker [CodePlex #7559](https://phpexcel.codeplex.com/workitem/7559) -- PHPExcel_Reader_Excel5 not returning sheet names as UTF-8 using for Excel 95 files - @Erik Tilt [CodePlex #7568](https://phpexcel.codeplex.com/workitem/7568) -- setAutoSize(true) on empty column gives column width of 10 using PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #7575](https://phpexcel.codeplex.com/workitem/7575) -- setAutoSize(true) on empty column gives column width of 255 using PHPExcel_Writer_Excel5 - @MB, ET [CodePlex #7573](https://phpexcel.codeplex.com/workitem/7573) -- Worksheet_Drawing bug - @MarkBaker [CodePlex #7514](https://phpexcel.codeplex.com/workitem/7514) -- getCalculatedValue() with REPT function causes script to stop - @MarkBaker [CodePlex #7593](https://phpexcel.codeplex.com/workitem/7593) -- getCalculatedValue() with LEN function causes script to stop - @MarkBaker [CodePlex #7594](https://phpexcel.codeplex.com/workitem/7594) -- Explicit fit-to-width (page setup) results in fit-to-height becoming 1 - @MarkBaker [CodePlex #7600](https://phpexcel.codeplex.com/workitem/7600) -- Fit-to-width value of 1 is lost after read/write of Excel2007 spreadsheet - @MarkBaker [CodePlex #7610](https://phpexcel.codeplex.com/workitem/7610) -- Conditional styles not read properly using PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #7516](https://phpexcel.codeplex.com/workitem/7516) -- PHPExcel_Writer_2007: Default worksheet style works only for first sheet - @MarkBaker [CodePlex #7611](https://phpexcel.codeplex.com/workitem/7611) -- Cannot Lock Cells using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #6940](https://phpexcel.codeplex.com/workitem/6940) -- Incorrect cell protection values found when using Excel5 reader - @Erik Tilt [CodePlex #7621](https://phpexcel.codeplex.com/workitem/7621) -- Default row height not working above highest row using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7623](https://phpexcel.codeplex.com/workitem/7623) -- Default column width does not get applied when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7637](https://phpexcel.codeplex.com/workitem/7637) -- Broken support for UTF-8 string formula results in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7642](https://phpexcel.codeplex.com/workitem/7642) -- UTF-8 sheet names not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7643](https://phpexcel.codeplex.com/workitem/7643) -- getCalculatedValue() with ISNONTEXT function causes script to stop - @MarkBaker [CodePlex #7631](https://phpexcel.codeplex.com/workitem/7631) -- Missing BIFF3 functions in PHPExcel_Writer_Excel5: USDOLLAR (YEN), FINDB, SEARCHB, REPLACEB, LEFTB, RIGHTB, MIDB, LENB, ASC, DBCS (JIS) - @Erik Tilt [CodePlex #7652](https://phpexcel.codeplex.com/workitem/7652) -- Excel5 reader doesn't read numbers correctly in 64-bit systems - @Erik Tilt [CodePlex #7663](https://phpexcel.codeplex.com/workitem/7663) -- Missing BIFF5 functions in PHPExcel_Writer_Excel5: ISPMT, DATEDIF, DATESTRING, NUMBERSTRING - @Erik Tilt [CodePlex #7667](https://phpexcel.codeplex.com/workitem/7667) -- Missing BIFF8 functions in PHPExcel_Writer_Excel5: GETPIVOTDATA, HYPERLINK, PHONETIC, AVERAGEA, MAXA, MINA, STDEVPA, VARPA, STDEVA, VARA - @Erik Tilt [CodePlex #7668](https://phpexcel.codeplex.com/workitem/7668) -- Wrong host value in PHPExcel_Shared_ZipStreamWrapper::stream_open() - @MarkBaker [CodePlex #7657](https://phpexcel.codeplex.com/workitem/7657) -- PHPExcel_Reader_Excel5 not reading explicitly entered error types in cells - @Erik Tilt [CodePlex #7676](https://phpexcel.codeplex.com/workitem/7676) -- Boolean and error data types not preserved for formula results in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7678](https://phpexcel.codeplex.com/workitem/7678) -- PHPExcel_Reader_Excel2007 ignores cell data type - @MarkBaker [CodePlex #7695](https://phpexcel.codeplex.com/workitem/7695) -- PHPExcel_Reader_Excel5 ignores cell data type - @Erik Tilt [CodePlex #7712](https://phpexcel.codeplex.com/workitem/7712) -- PHPExcel_Writer_Excel5 not aware of data type - @Erik Tilt [CodePlex #7587](https://phpexcel.codeplex.com/workitem/7587) -- Long strings sometimes truncated when using PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7713](https://phpexcel.codeplex.com/workitem/7713) -- Direct entry of boolean or error type in cell not supported by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7727](https://phpexcel.codeplex.com/workitem/7727) -- PHPExcel_Reader_Excel2007: Error reading cell with data type string, date number format, and numeric-like cell value - @MarkBaker [CodePlex #7714](https://phpexcel.codeplex.com/workitem/7714) -- Row and column outlines (group indent level) not showing after using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7735](https://phpexcel.codeplex.com/workitem/7735) -- Missing UTF-8 support in number format codes for PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7737](https://phpexcel.codeplex.com/workitem/7737) -- Missing UTF-8 support with PHPExcel_Writer_Excel5 for explicit string in formula - @Erik Tilt [CodePlex #7750](https://phpexcel.codeplex.com/workitem/7750) -- Problem with class constants in PHPExcel_Style_NumberFormat - @MarkBaker [CodePlex #7726](https://phpexcel.codeplex.com/workitem/7726) -- Sometimes errors with PHPExcel_Reader_Excel5 reading hyperlinks - @Erik Tilt [CodePlex #7758](https://phpexcel.codeplex.com/workitem/7758) -- Hyperlink in cell always results in string data type when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7759](https://phpexcel.codeplex.com/workitem/7759) -- Excel file with blank sheet seen as broken in MS Office Excel 2007 when created by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7771](https://phpexcel.codeplex.com/workitem/7771) -- PHPExcel_Reader_Excel5: Incorrect reading of formula with explicit string containing (escaped) double-quote - @Erik Tilt [CodePlex #7785](https://phpexcel.codeplex.com/workitem/7785) -- getCalculatedValue() fails on formula with sheet name containing (escaped) single-quote - @MarkBaker [CodePlex #7787](https://phpexcel.codeplex.com/workitem/7787) -- getCalculatedValue() fails on formula with explicit string containing (escaped) double-quote - @MarkBaker [CodePlex #7786](https://phpexcel.codeplex.com/workitem/7786) -- Problems with simultaneous repeatRowsAtTop and repeatColumnsAtLeft using Excel2007 reader and writer - @MarkBaker [CodePlex #7780](https://phpexcel.codeplex.com/workitem/7780) -- PHPExcel_Reader_Excel5: Error reading formulas with sheet reference containing special characters - @Erik Tilt [CodePlex #7802](https://phpexcel.codeplex.com/workitem/7802) -- Off-sheet references sheet!A1 not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7831](https://phpexcel.codeplex.com/workitem/7831) -- Repeating rows/columns (print titles), print area not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7834](https://phpexcel.codeplex.com/workitem/7834) -- Formula having datetime number format shows as text when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7849](https://phpexcel.codeplex.com/workitem/7849) -- Cannot set formula to hidden using applyFromArray() - @MarkBaker [CodePlex #7863](https://phpexcel.codeplex.com/workitem/7863) -- HTML/PDF Writers limited to 26 columns by calculateWorksheetDimension (erroneous comparison in getHighestColumn() method) - @MarkBaker [CodePlex #7805](https://phpexcel.codeplex.com/workitem/7805) -- Formula returning error type is lost when read by PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #7873](https://phpexcel.codeplex.com/workitem/7873) -- PHPExcel_Reader_Excel5: Cell style lost for last column in group of blank cells - @Erik Tilt [CodePlex #7883](https://phpexcel.codeplex.com/workitem/7883) -- Column width sometimes collapses to auto size using Excel2007 reader/writer - @MarkBaker [CodePlex #7886](https://phpexcel.codeplex.com/workitem/7886) -- Data Validation Formula = 0 crashes Excel - @MarkBaker [CodePlex #9343](https://phpexcel.codeplex.com/workitem/9343) - -## [1.6.3] - 2008-08-25 - -### General - -- Modified PHPExcel_Shared_Date::PHPToExcel() to force UTC - @MarkBaker [CodePlex #7367](https://phpexcel.codeplex.com/workitem/7367) -- Applied patch 1629 - @MarkBaker -- Applied patch 1644 - @MarkBaker -- Implement repeatRow and repeatColumn in Excel5 writer - @MarkBaker [CodePlex #6485](https://phpexcel.codeplex.com/workitem/6485) - -### Features - -- Remove scene3d filter in Excel2007 drawing - @MarkBaker [CodePlex #6838](https://phpexcel.codeplex.com/workitem/6838) -- Implement CHOOSE and INDEX Lookup/Reference Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement CLEAN Text Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement YEARFRAC Date/Time Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement 2 options for print/show gridlines - @MarkBaker [CodePlex #6508](https://phpexcel.codeplex.com/workitem/6508) -- Add VLOOKUP function (contribution) - @MarkBaker [CodePlex #7270](https://phpexcel.codeplex.com/workitem/7270) -- Implemented: ShrinkToFit - @MarkBaker [CodePlex #7182](https://phpexcel.codeplex.com/workitem/7182) -- Row heights not updated correctly when inserting new rows - @MarkBaker [CodePlex #7218](https://phpexcel.codeplex.com/workitem/7218) -- Copy worksheets within the same workbook - @MarkBaker [CodePlex #7157](https://phpexcel.codeplex.com/workitem/7157) -- Excel5 reader style support: horizontal and vertical alignment plus text wrap - @Erik Tilt [CodePlex #7290](https://phpexcel.codeplex.com/workitem/7290) -- Excel5 reader support for merged cells - @Erik Tilt [CodePlex #7294](https://phpexcel.codeplex.com/workitem/7294) -- Excel5 reader: Sheet Protection - @Erik Tilt [CodePlex #7296](https://phpexcel.codeplex.com/workitem/7296) -- Excel5 reader: Password for sheet protection - @Erik Tilt [CodePlex #7297](https://phpexcel.codeplex.com/workitem/7297) -- Excel5 reader: Column width - @Erik Tilt [CodePlex #7299](https://phpexcel.codeplex.com/workitem/7299) -- Excel5 reader: Row height - @Erik Tilt [CodePlex #7301](https://phpexcel.codeplex.com/workitem/7301) -- Excel5 reader: Font support - @Erik Tilt [CodePlex #7304](https://phpexcel.codeplex.com/workitem/7304) -- Excel5 reader: support for locked cells - @Erik Tilt [CodePlex #7324](https://phpexcel.codeplex.com/workitem/7324) -- Excel5 reader style support: Fill (background colors and patterns) - @Erik Tilt [CodePlex #7330](https://phpexcel.codeplex.com/workitem/7330) -- Excel5 reader style support: Borders (style and color) - @Erik Tilt [CodePlex #7332](https://phpexcel.codeplex.com/workitem/7332) -- Excel5 reader: Rich-Text support - @Erik Tilt [CodePlex #7346](https://phpexcel.codeplex.com/workitem/7346) -- Read Excel built-in number formats with Excel 2007 reader - @MarkBaker [CodePlex #7313](https://phpexcel.codeplex.com/workitem/7313) -- Excel5 reader: Number format support - @Erik Tilt [CodePlex #7317](https://phpexcel.codeplex.com/workitem/7317) -- Creating a copy of PHPExcel object - @MarkBaker [CodePlex #7362](https://phpexcel.codeplex.com/workitem/7362) -- Excel5 reader: support for row / column outline (group) - @Erik Tilt [CodePlex #7373](https://phpexcel.codeplex.com/workitem/7373) -- Implement default row/column sizes - @MarkBaker [CodePlex #7380](https://phpexcel.codeplex.com/workitem/7380) -- Writer HTML - option to return styles and table separately - @MarkBaker [CodePlex #7364](https://phpexcel.codeplex.com/workitem/7364) - -### Bugfixes - -- Excel5 reader: Support for remaining built-in number formats - @Erik Tilt [CodePlex #7393](https://phpexcel.codeplex.com/workitem/7393) -- Fixed rounding in HOUR MINUTE and SECOND Time functions, and improved performance for these - @MarkBaker -- Fix to TRIM function - @MarkBaker -- Fixed range validation in TIME Functions.php - @MarkBaker -- EDATE and EOMONTH functions now return date values based on the returnDateType flag - @MarkBaker -- Write date values that are the result of a calculation function correctly as Excel serialized dates rather than PHP serialized date values - @MarkBaker -- Excel2007 reader not always reading boolean correctly - @MarkBaker [CodePlex #6690](https://phpexcel.codeplex.com/workitem/6690) -- Columns above IZ - @MarkBaker [CodePlex #6275](https://phpexcel.codeplex.com/workitem/6275) -- Other locale than English causes Excel2007 writer to produce broken xlsx - @MarkBaker [CodePlex #6853](https://phpexcel.codeplex.com/workitem/6853) -- Typo: Number_fromat in NumberFormat.php - @MarkBaker [CodePlex #7061](https://phpexcel.codeplex.com/workitem/7061) -- Bug in Worksheet_BaseDrawing setWidth() - @MarkBaker [CodePlex #6865](https://phpexcel.codeplex.com/workitem/6865) -- PDF writer collapses column width for merged cells - @MarkBaker [CodePlex #6891](https://phpexcel.codeplex.com/workitem/6891) -- Issues with drawings filenames - @MarkBaker [CodePlex #6867](https://phpexcel.codeplex.com/workitem/6867) -- fromArray() local variable isn't defined - @MarkBaker [CodePlex #7073](https://phpexcel.codeplex.com/workitem/7073) -- PHPExcel_Writer_Excel5->setTempDir() not passed to all classes involved in writing to a file - @MarkBaker [CodePlex #7276](https://phpexcel.codeplex.com/workitem/7276) -- Excel5 reader not handling UTF-8 properly - @MarkBaker [CodePlex #7277](https://phpexcel.codeplex.com/workitem/7277) -- If you write a 0 value in cell, cell shows as empty - @MarkBaker [CodePlex #7327](https://phpexcel.codeplex.com/workitem/7327) -- Excel2007 writer: Row height ignored for empty rows - @MarkBaker [CodePlex #7302](https://phpexcel.codeplex.com/workitem/7302) -- Excel2007 (comments related error) - @MarkBaker [CodePlex #7281](https://phpexcel.codeplex.com/workitem/7281) -- Column width in other locale - @MarkBaker [CodePlex #7345](https://phpexcel.codeplex.com/workitem/7345) -- Excel2007 reader not reading underlined Rich-Text - @MarkBaker [CodePlex #7347](https://phpexcel.codeplex.com/workitem/7347) -- Excel5 reader converting booleans to strings - @Erik Tilt [CodePlex #7357](https://phpexcel.codeplex.com/workitem/7357) -- Recursive Object Memory Leak - @MarkBaker [CodePlex #7365](https://phpexcel.codeplex.com/workitem/7365) -- Excel2007 writer ignoring row dimensions without cells - @MarkBaker [CodePlex #7372](https://phpexcel.codeplex.com/workitem/7372) -- Excel5 reader is converting formatted numbers / dates to strings - @Erik Tilt [CodePlex #7382](https://phpexcel.codeplex.com/workitem/7382) - -## [1.6.2] - 2008-06-23 - -### General - -- Document style array values - @MarkBaker [CodePlex #6088](https://phpexcel.codeplex.com/workitem/6088) -- Applied patch 1195 - @MarkBaker -- Redirecting output to a client’s web browser - http headers - @MarkBaker [CodePlex #6178](https://phpexcel.codeplex.com/workitem/6178) -- Improve worksheet garbage collection - @MarkBaker [CodePlex #6187](https://phpexcel.codeplex.com/workitem/6187) -- Functions that return date values can now be configured to return as Excel serialized date/time, PHP serialized date/time, or a PHP date/time object. - @MarkBaker -- Functions that explicitly accept dates as parameters now permit values as Excel serialized date/time, PHP serialized date/time, a valid date string, or a PHP date/time object. - @MarkBaker -- Implement ACOSH, ASINH and ATANH functions for those operating platforms/PHP versions that don't include these functions - @MarkBaker -- Implement ATAN2 logic reversing the arguments as per Excel - @MarkBaker -- Additional validation of parameters for COMBIN - @MarkBaker - -### Features - -- Fixed validation for CEILING and FLOOR when the value and significance parameters have different signs; and allowed default value of 1 or -1 for significance when in GNUMERIC compatibility mode - @MarkBaker -- Implement ADDRESS, ISLOGICAL, ISTEXT and ISNONTEXT functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement COMPLEX, IMAGINARY, IMREAL, IMARGUMENT, IMCONJUGATE, IMABS, IMSUB, IMDIV, IMSUM, IMPRODUCT, IMSQRT, IMEXP, IMLN, IMLOG10, IMLOG2, IMPOWER IMCOS and IMSIN Engineering functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement NETWORKDAYS and WORKDAY Date/Time functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Make cell column AAA available - @MarkBaker [CodePlex #6100](https://phpexcel.codeplex.com/workitem/6100) -- Mark particular cell as selected when opening Excel - @MarkBaker [CodePlex #6095](https://phpexcel.codeplex.com/workitem/6095) -- Multiple sheets in PDF and HTML - @MarkBaker [CodePlex #6120](https://phpexcel.codeplex.com/workitem/6120) -- Implement PHPExcel_ReaderFactory and PHPExcel_WriterFactory - @MarkBaker [CodePlex #6227](https://phpexcel.codeplex.com/workitem/6227) -- Set image root of PHPExcel_Writer_HTML - @MarkBaker [CodePlex #6249](https://phpexcel.codeplex.com/workitem/6249) -- Enable/disable calculation cache - @MarkBaker [CodePlex #6264](https://phpexcel.codeplex.com/workitem/6264) -- PDF writer and multi-line text - @MarkBaker [CodePlex #6259](https://phpexcel.codeplex.com/workitem/6259) -- Feature request - setCacheExpirationTime() - @MarkBaker [CodePlex #6350](https://phpexcel.codeplex.com/workitem/6350) -- Implement late-binding mechanisms to reduce memory footprint - @JB [CodePlex #6370](https://phpexcel.codeplex.com/workitem/6370) -- Implement shared styles - @JB [CodePlex #6430](https://phpexcel.codeplex.com/workitem/6430) -- Copy sheet from external Workbook to active Workbook - @MarkBaker [CodePlex #6391](https://phpexcel.codeplex.com/workitem/6391) - -### Bugfixes - -- Functions in Conditional Formatting - @MarkBaker [CodePlex #6428](https://phpexcel.codeplex.com/workitem/6428) -- Default Style in Excel5 - @MarkBaker [CodePlex #6096](https://phpexcel.codeplex.com/workitem/6096) -- Numbers starting with '+' cause Excel 2007 errors - @MarkBaker [CodePlex #6150](https://phpexcel.codeplex.com/workitem/6150) -- ExcelWriter5 is not PHP5 compatible, using it with E_STRICT results in a bunch of errors (applied patches) - @MarkBaker [CodePlex #6092](https://phpexcel.codeplex.com/workitem/6092) -- Error Reader Excel2007 line 653 foreach ($relsDrawing->Relationship as $ele) - @MarkBaker [CodePlex #6179](https://phpexcel.codeplex.com/workitem/6179) -- Worksheet toArray() screws up DATE - @MarkBaker [CodePlex #6229](https://phpexcel.codeplex.com/workitem/6229) -- References to a Richtext cell in a formula - @MarkBaker [CodePlex #6253](https://phpexcel.codeplex.com/workitem/6253) -- insertNewColumnBefore Bug - @MarkBaker [CodePlex #6285](https://phpexcel.codeplex.com/workitem/6285) -- Error reading Excel2007 file with shapes - @MarkBaker [CodePlex #6319](https://phpexcel.codeplex.com/workitem/6319) -- Determine whether date values need conversion from PHP dates to Excel dates before writing to file, based on the data type (float or integer) - @MarkBaker [CodePlex #6302](https://phpexcel.codeplex.com/workitem/6302) -- Fixes to DATE function when it is given negative input parameters - @MarkBaker -- PHPExcel handles empty cells other than Excel - @MarkBaker [CodePlex #6347](https://phpexcel.codeplex.com/workitem/6347) -- PHPExcel handles 0 and "" as being the same - @MarkBaker [CodePlex #6348](https://phpexcel.codeplex.com/workitem/6348) -- Problem Using Excel2007 Reader for Spreadsheets containing images - @MarkBaker [CodePlex #6357](https://phpexcel.codeplex.com/workitem/6357) -- ShowGridLines ignored when reading/writing Excel 2007 - @MarkBaker [CodePlex #6359](https://phpexcel.codeplex.com/workitem/6359) -- Bug With Word Wrap in Excel 2007 Reader - @MarkBaker [CodePlex #6426](https://phpexcel.codeplex.com/workitem/6426) - -## [1.6.1] - 2008-04-28 - -### General - -- Fix documentation printing - @MarkBaker [CodePlex #5532](https://phpexcel.codeplex.com/workitem/5532) -- Memory usage improvements - @MarkBaker [CodePlex #5586](https://phpexcel.codeplex.com/workitem/5586) -- Applied patch 990 - @MarkBaker - -### Features - -- Applied patch 991 - @MarkBaker -- Implement PHPExcel_Reader_Excel5 - @BM [CodePlex #2841](https://phpexcel.codeplex.com/workitem/2841) -- Implement "toArray" and "fromArray" method - @MarkBaker [CodePlex #5564](https://phpexcel.codeplex.com/workitem/5564) -- Read shared formula - @MarkBaker [CodePlex #5665](https://phpexcel.codeplex.com/workitem/5665) -- Read image twoCellAnchor - @MarkBaker [CodePlex #5681](https://phpexcel.codeplex.com/workitem/5681) -- &G Image as bg for headerfooter - @MarkBaker [CodePlex #4446](https://phpexcel.codeplex.com/workitem/4446) -- Implement page layout functionality for Excel5 format - @MarkBaker [CodePlex #5834](https://phpexcel.codeplex.com/workitem/5834) - -### Bugfixes - -- Feature request: PHPExcel_Writer_PDF - @MarkBaker [CodePlex #6039](https://phpexcel.codeplex.com/workitem/6039) -- DefinedNames null check - @MarkBaker [CodePlex #5517](https://phpexcel.codeplex.com/workitem/5517) -- Hyperlinks should not always have trailing slash - @MarkBaker [CodePlex #5463](https://phpexcel.codeplex.com/workitem/5463) -- Saving Error - Uncaught exception (#REF! named range) - @MarkBaker [CodePlex #5592](https://phpexcel.codeplex.com/workitem/5592) -- Error when creating Zip file on Linux System (Not Windows) - @MarkBaker [CodePlex #5634](https://phpexcel.codeplex.com/workitem/5634) -- Time incorrecly formated - @MarkBaker [CodePlex #5876](https://phpexcel.codeplex.com/workitem/5876) -- Conditional formatting - second rule not applied - @MarkBaker [CodePlex #5914](https://phpexcel.codeplex.com/workitem/5914) -- PHPExcel_Reader_Excel2007 cannot load PHPExcel_Shared_File - @MarkBaker [CodePlex #5978](https://phpexcel.codeplex.com/workitem/5978) -- Output redirection to web browser - @MarkBaker [CodePlex #6020](https://phpexcel.codeplex.com/workitem/6020) - -## [1.6.0] - 2008-02-14 - -### Features - -- Use PHPExcel datatypes in formula calculation - @MarkBaker [CodePlex #3156](https://phpexcel.codeplex.com/workitem/3156) -- Center on page when printing - @MarkBaker [CodePlex #5019](https://phpexcel.codeplex.com/workitem/5019) -- Hyperlink to other spreadsheet - @MarkBaker [CodePlex #5099](https://phpexcel.codeplex.com/workitem/5099) -- Set the print area of a worksheet - @MarkBaker [CodePlex #5104](https://phpexcel.codeplex.com/workitem/5104) -- Read "definedNames" property of worksheet - @MarkBaker [CodePlex #5118](https://phpexcel.codeplex.com/workitem/5118) -- Set default style for all cells - @MarkBaker [CodePlex #5338](https://phpexcel.codeplex.com/workitem/5338) -- Named Ranges - @MarkBaker [CodePlex #4216](https://phpexcel.codeplex.com/workitem/4216) - -### Bugfixes - -- Implement worksheet references (Sheet1!A1) - @MarkBaker [CodePlex #5398](https://phpexcel.codeplex.com/workitem/5398) -- Redirect output to a client's web browser - @MarkBaker [CodePlex #4967](https://phpexcel.codeplex.com/workitem/4967) -- "File Error: data may have been lost." seen in Excel 2007 and Excel 2003 SP3 when opening XLS file - @MarkBaker [CodePlex #5008](https://phpexcel.codeplex.com/workitem/5008) -- Bug in style's getHashCode() - @MarkBaker [CodePlex #5165](https://phpexcel.codeplex.com/workitem/5165) -- PHPExcel_Reader not correctly reading numeric values - @MarkBaker [CodePlex #5165](https://phpexcel.codeplex.com/workitem/5165) -- Text rotation is read incorrectly - @MarkBaker [CodePlex #5324](https://phpexcel.codeplex.com/workitem/5324) -- Enclosure " and data " result a bad data : \" instead of "" - @MarkBaker [CodePlex #5326](https://phpexcel.codeplex.com/workitem/5326) -- Formula parser - IF statement returning array instead of scalar - @MarkBaker [CodePlex #5332](https://phpexcel.codeplex.com/workitem/5332) -- setFitToWidth(nbpage) & setFitToWidth(nbpage) work partially - @MarkBaker [CodePlex #5351](https://phpexcel.codeplex.com/workitem/5351) -- Worksheet::setTitle() causes unwanted renaming - @MarkBaker [CodePlex #5361](https://phpexcel.codeplex.com/workitem/5361) -- Hyperlinks not working. Results in broken xlsx file. - @MarkBaker [CodePlex #5407](https://phpexcel.codeplex.com/workitem/5407) - -## [1.5.5] - 2007-12-24 - -### General - -- Grouping Rows - @MarkBaker [CodePlex #4135](https://phpexcel.codeplex.com/workitem/4135) - -### Features - -- Semi-nightly builds - @MarkBaker [CodePlex #4427](https://phpexcel.codeplex.com/workitem/4427) -- Implement "date" datatype - @MarkBaker [CodePlex #3155](https://phpexcel.codeplex.com/workitem/3155) -- Date format not honored in CSV writer - @MarkBaker [CodePlex #4150](https://phpexcel.codeplex.com/workitem/4150) -- RichText and sharedStrings - @MarkBaker [CodePlex #4199](https://phpexcel.codeplex.com/workitem/4199) -- Implement more Excel calculation functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) - - Addition of DATE, DATEDIF, DATEVALUE, DAY, DAYS360- Implement more Excel calculation functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) - - Addition of AVEDEV, HARMEAN and GEOMEAN - - Addition of the BINOMDIST (Non-cumulative only), COUNTBLANK, EXPONDIST, FISHER, FISHERINV, NORMDIST, NORMSDIST, PERMUT, POISSON (Non-cumulative only) and STANDARDIZE Statistical Functions - - Addition of the CEILING, COMBIN, EVEN, FACT, FACTDOUBLE, FLOOR, MULTINOMIAL, ODD, ROUNDDOWN, ROUNDUP, SIGN, SQRTPI and SUMSQ Mathematical Functions - - Addition of the NORMINV, NORMSINV, CONFIDENCE and SKEW Statistical Functions - - Addition of the CRITBINOM, HYPGEOMDIST, KURT, LOGINV, LOGNORMDIST, NEGBINOMDIST and WEIBULL Statistical Functions - - Addition of the LARGE, PERCENTILE, QUARTILE, SMALL and TRIMMEAN Statistical Functions - - Addition of the BIN2HEX, BIN2OCT, DELTA, ERF, ERFC, GESTEP, HEX2BIN, HEX2DEC, HEX2OCT, OCT2BIN and OCT2HEX Engineering Functions - - Addition of the CHIDIST, GAMMADIST and GAMMALN Statistical Functions - - Addition of the GCD, LCM, MROUND and SUBTOTAL Mathematical Functions - - Addition of the LOWER, PROPER and UPPER Text Functions - - Addition of the BETADIST and BETAINV Statistical Functions - - Addition of the CHIINV and GAMMAINV Statistical Functions - - Addition of the SERIESSUM Mathematical Function - - Addition of the CHAR, CODE, FIND, LEN, REPT, SEARCH, T, TRIM Text Functions - - Addition of the FALSE and TRUE Boolean Functions - - Addition of the TDIST and TINV Statistical Functions - - Addition of the EDATE, EOMONTH, YEAR, MONTH, TIME, TIMEVALUE, HOUR, MINUTE, SECOND, WEEKDAY, WEEKNUM, NOW, TODAY and Date/Time Function - - Addition of the BESSELI, BESSELJ, BESSELK and BESSELY Engineering Functions - - Addition of the SLN and SYD Financial Functions - - reworked MODE calculation to handle floating point numbers - - Improved error trapping for invalid input values - - Fix to SMALL, LARGE, PERCENTILE and TRIMMEAN to eliminate non-numeric values - - Added CDF to BINOMDIST and POISSON - - Fix to a potential endless loop in CRITBINOM, together with other bugfixes to the algorithm - - Fix to SQRTPI so that it will work with a real value parameter rather than just integers - - Trap for passing negative values to FACT - - Improved accuracy of the NORMDIST cumulative function, and of the ERF and ERFC functions - - Replicated Excel data-type and error handling for BIN, DEC, OCT and HEX conversion functions - - Replicated Excel data-type and error handling for AND and OR Boolean functions - - Bugfix to MROUND - - Rework of the DATE, DATEVALUE, DAY, DAYS360 and DATEDIF date/Time functions to use Excel dates rather than straight PHP dates - - Rework of the AND, OR Boolean functions to ignore string values - - Rework of the BIN2DEC, BIN2HEX, BIN2OCT, DEC2BIN, DEC2HEX, DEC2OCT Engineering functions to handle two's complement - - Excel, Gnumeric and OpenOffice Calc compatibility flag for functions - - Note, not all functions have yet been written to work with the Gnumeric and OpenOffice Calc compatibility flags - - 1900 or 1904 Calendar flag for date functions - - Reworked ExcelToPHP date method to handle the Excel 1900 leap year - - Note that this will not correctly return values prior to 13-Dec-1901 20:45:52 as this is the minimum value that PHP date serial values can handle. If you need to work with dates prior to this, then an ExcelToPHPObject method has been added which will work correctly with values between Excel's 1900 calendar base date of 1-Jan-1900, and 13-Dec-1901 - - Addition of ExcelToPHPObject date method to return a PHP DateTime object from an Excel date serial value - - PHPToExcel method modified to accept either PHP date serial numbers or PHP DateTime objects - - Addition of FormattedPHPToExcel which will accept a date and time broken to into year, month, day, hour, minute, second and return an Excel date serial value- Control characters in Excel 2007 - @MarkBaker [CodePlex #4485](https://phpexcel.codeplex.com/workitem/4485) -- BaseDrawing::setWidthAndHeight method request - @MarkBaker [CodePlex #4796](https://phpexcel.codeplex.com/workitem/4796) -- Page Setup -> Print Titles -> Sheet -> 'Rows to repeat at top' - @MarkBaker [CodePlex #4798](https://phpexcel.codeplex.com/workitem/4798) - -### Bugfixes - -- Comment functionality - @MarkBaker [CodePlex #4433](https://phpexcel.codeplex.com/workitem/4433) -- Undefined variable in PHPExcel_Writer_Serialized - @MarkBaker [CodePlex #4124](https://phpexcel.codeplex.com/workitem/4124) -- Notice: Object of class PHPExcel_RichText could not be converted to int - @MarkBaker [CodePlex #4125](https://phpexcel.codeplex.com/workitem/4125) -- Excel5Writer: utf8 string not converted to utf16 - @MarkBaker [CodePlex #4126](https://phpexcel.codeplex.com/workitem/4126) -- PHPExcel_RichText and autosize - @MarkBaker [CodePlex #4180](https://phpexcel.codeplex.com/workitem/4180) -- Excel5Writer produces broken xls files after change mentioned in work item 4126 - @MarkBaker [CodePlex #4574](https://phpexcel.codeplex.com/workitem/4574) -- Small bug in PHPExcel_Reader_Excel2007 function _readStyle - @MarkBaker [CodePlex #4797](https://phpexcel.codeplex.com/workitem/4797) - -## [1.5.0] - 2007-10-23 - -### Features - -- Refactor PHPExcel Drawing - @MarkBaker [CodePlex #3265](https://phpexcel.codeplex.com/workitem/3265) -- Update Shared/OLE.php to latest version from PEAR - @CS [CodePlex #3079](https://phpexcel.codeplex.com/workitem/3079) -- Excel2007 vs Excel2003 compatibility pack - @MarkBaker [CodePlex #3217](https://phpexcel.codeplex.com/workitem/3217) -- Cell protection (lock/unlock) - @MarkBaker [CodePlex #3234](https://phpexcel.codeplex.com/workitem/3234) -- Create clickable links (hyperlinks) - @MarkBaker [CodePlex #3543](https://phpexcel.codeplex.com/workitem/3543) -- Additional page setup parameters - @MarkBaker [CodePlex #3241](https://phpexcel.codeplex.com/workitem/3241) -- Make temporary file path configurable (Excel5) - @MarkBaker [CodePlex #3300](https://phpexcel.codeplex.com/workitem/3300) -- Small addition to applyFromArray for font - @MarkBaker [CodePlex #3306](https://phpexcel.codeplex.com/workitem/3306) - -### Bugfixes - -- Better feedback when save of file is not possible - @MarkBaker [CodePlex #3373](https://phpexcel.codeplex.com/workitem/3373) -- Text Rotation - @MarkBaker [CodePlex #3181](https://phpexcel.codeplex.com/workitem/3181) -- Small bug in Page Orientation - @MarkBaker [CodePlex #3237](https://phpexcel.codeplex.com/workitem/3237) -- insertNewColumnBeforeByColumn undefined - @MarkBaker [CodePlex #3812](https://phpexcel.codeplex.com/workitem/3812) -- Sheet references not working in formula (Excel5 Writer) - @MarkBaker [CodePlex #3893](https://phpexcel.codeplex.com/workitem/3893) - -## [1.4.5] - 2007-08-23 - -### General - -- Class file endings - @MarkBaker [CodePlex #3003](https://phpexcel.codeplex.com/workitem/3003) -- Different calculation engine improvements - @MarkBaker [CodePlex #3081](https://phpexcel.codeplex.com/workitem/3081) -- Different improvements in PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #3082](https://phpexcel.codeplex.com/workitem/3082) - -### Features - -- Set XML indentation in PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #3146](https://phpexcel.codeplex.com/workitem/3146) -- Optionally store temporary Excel2007 writer data in file instead of memory - @MarkBaker [CodePlex #3159](https://phpexcel.codeplex.com/workitem/3159) -- Implement show/hide gridlines - @MarkBaker [CodePlex #3063](https://phpexcel.codeplex.com/workitem/3063) -- Implement option to read only data - @MarkBaker [CodePlex #3064](https://phpexcel.codeplex.com/workitem/3064) -- Optionally disable formula precalculation - @MarkBaker [CodePlex #3080](https://phpexcel.codeplex.com/workitem/3080) -- Explicitly set cell datatype - @MarkBaker [CodePlex #3154](https://phpexcel.codeplex.com/workitem/3154) - -### Bugfixes - -- Implement more Excel calculation functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) - - Addition of MINA, MAXA, COUNTA, AVERAGEA, MEDIAN, MODE, DEVSQ, STDEV, STDEVA, STDEVP, STDEVPA, VAR, VARA, VARP and VARPA Excel Functions - - Fix to SUM, PRODUCT, QUOTIENT, MIN, MAX, COUNT and AVERAGE functions when cell contains a numeric value in a string datatype, bringing it in line with MS Excel behaviour- File_exists on ZIP fails on some installations - @MarkBaker [CodePlex #2881](https://phpexcel.codeplex.com/workitem/2881) -- Argument in textRotation should be -90..90 - @MarkBaker [CodePlex #2879](https://phpexcel.codeplex.com/workitem/2879) -- Excel2007 reader/writer not implementing OpenXML/SpreadsheetML styles 100% correct - @MarkBaker [CodePlex #2883](https://phpexcel.codeplex.com/workitem/2883) -- Active sheet index not read/saved - @MarkBaker [CodePlex #2513](https://phpexcel.codeplex.com/workitem/2513) -- Print and print preview of generated XLSX causes Excel2007 to crash - @MarkBaker [CodePlex #2935](https://phpexcel.codeplex.com/workitem/2935) -- Error in Calculations - COUNT() function - @MarkBaker [CodePlex #2952](https://phpexcel.codeplex.com/workitem/2952) -- HTML and CSV writer not writing last row - @MarkBaker [CodePlex #3002](https://phpexcel.codeplex.com/workitem/3002) -- Memory leak in Excel5 writer - @MarkBaker [CodePlex #3017](https://phpexcel.codeplex.com/workitem/3017) -- Printing (PHPExcel_Writer_Excel5) - @MarkBaker [CodePlex #3044](https://phpexcel.codeplex.com/workitem/3044) -- Problems reading zip:// - @MarkBaker [CodePlex #3046](https://phpexcel.codeplex.com/workitem/3046) -- Error reading conditional formatting - @MarkBaker [CodePlex #3047](https://phpexcel.codeplex.com/workitem/3047) -- Bug in Excel5 writer (storePanes) - @MarkBaker [CodePlex #3067](https://phpexcel.codeplex.com/workitem/3067) -- Memory leak in PHPExcel_Style_Color - @MarkBaker [CodePlex #3077](https://phpexcel.codeplex.com/workitem/3077) - -## [1.4.0] - 2007-07-23 - -### General - -- Coding convention / code cleanup - @MarkBaker [CodePlex #2687](https://phpexcel.codeplex.com/workitem/2687) -- Use set_include_path in tests - @MarkBaker [CodePlex #2717](https://phpexcel.codeplex.com/workitem/2717) - -### Features - -- Move PHPExcel_Writer_Excel5 OLE to PHPExcel_Shared_OLE - @MarkBaker [CodePlex #2812](https://phpexcel.codeplex.com/workitem/2812) -- Hide/Unhide Column or Row - @MarkBaker [CodePlex #2679](https://phpexcel.codeplex.com/workitem/2679) -- Implement multi-cell styling - @MarkBaker [CodePlex #2271](https://phpexcel.codeplex.com/workitem/2271) -- Implement CSV file format (reader/writer) - @MarkBaker [CodePlex #2720](https://phpexcel.codeplex.com/workitem/2720) - -### Bugfixes - -- Implement HTML file format - @MarkBaker [CodePlex #2845](https://phpexcel.codeplex.com/workitem/2845) -- Active sheet index not read/saved - @MarkBaker [CodePlex #2513](https://phpexcel.codeplex.com/workitem/2513) -- Freeze Panes with PHPExcel_Writer_Excel5 - @MarkBaker [CodePlex #2678](https://phpexcel.codeplex.com/workitem/2678) -- OLE.php - @MarkBaker [CodePlex #2680](https://phpexcel.codeplex.com/workitem/2680) -- Copy and pasting multiple drop-down list cells breaks reader - @MarkBaker [CodePlex #2736](https://phpexcel.codeplex.com/workitem/2736) -- Function setAutoFilterByColumnAndRow takes wrong arguments - @MarkBaker [CodePlex #2775](https://phpexcel.codeplex.com/workitem/2775) -- Simplexml_load_file fails on ZipArchive - @MarkBaker [CodePlex #2858](https://phpexcel.codeplex.com/workitem/2858) - -## [1.3.5] - 2007-06-27 - -### Features - -- Documentation - @MarkBaker [CodePlex #15](https://phpexcel.codeplex.com/workitem/15) -- PHPExcel_Writer_Excel5 - @JV -- PHPExcel_Reader_Excel2007: Image shadows - @JV -- Data validation - @MarkBaker [CodePlex #2385](https://phpexcel.codeplex.com/workitem/2385) - -### Bugfixes - -- Implement richtext strings - @MarkBaker -- Empty relations when adding image to any sheet but the first one - @MarkBaker [CodePlex #2443](https://phpexcel.codeplex.com/workitem/2443) -- Excel2007 crashes on print preview - @MarkBaker [CodePlex #2536](https://phpexcel.codeplex.com/workitem/2536) - -## [1.3.0] - 2007-06-05 - -### General - -- Create PEAR package - @MarkBaker [CodePlex #1942](https://phpexcel.codeplex.com/workitem/1942) - -### Features - -- Replace *->duplicate() by __clone() - @MarkBaker [CodePlex #2331](https://phpexcel.codeplex.com/workitem/2331) -- PHPExcel_Reader_Excel2007: Column auto-size, Protection, Merged cells, Wrap text, Page breaks, Auto filter, Images - @JV -- Implement "freezing" panes - @MarkBaker [CodePlex #245](https://phpexcel.codeplex.com/workitem/245) -- Cell addressing alternative - @MarkBaker [CodePlex #2273](https://phpexcel.codeplex.com/workitem/2273) -- Implement cell word-wrap attribute - @MarkBaker [CodePlex #2270](https://phpexcel.codeplex.com/workitem/2270) -- Auto-size column - @MarkBaker [CodePlex #2282](https://phpexcel.codeplex.com/workitem/2282) -- Implement formula calculation - @MarkBaker [CodePlex #241](https://phpexcel.codeplex.com/workitem/241) - -### Bugfixes - -- Insert/remove row/column - @MarkBaker [CodePlex #2375](https://phpexcel.codeplex.com/workitem/2375) -- PHPExcel_Worksheet::getCell() should not accept absolute coordinates - @MarkBaker [CodePlex #1931](https://phpexcel.codeplex.com/workitem/1931) -- Cell reference without row number - @MarkBaker [CodePlex #2272](https://phpexcel.codeplex.com/workitem/2272) -- Styles with same coordinate but different worksheet - @MarkBaker [CodePlex #2276](https://phpexcel.codeplex.com/workitem/2276) -- PHPExcel_Worksheet->getCellCollection() usort error - @MarkBaker [CodePlex #2290](https://phpexcel.codeplex.com/workitem/2290) -- Bug in PHPExcel_Cell::stringFromColumnIndex - @SS [CodePlex #2353](https://phpexcel.codeplex.com/workitem/2353) -- Reader: numFmts can be missing, use cellStyleXfs instead of cellXfs in styles - @JV [CodePlex #2353](https://phpexcel.codeplex.com/workitem/2353) - -## [1.2.0] - 2007-04-26 - -### General - -- Stringtable attribute "count" not necessary, provides wrong info to Excel sometimes... - @MarkBaker -- Updated tests to address more document properties - @MarkBaker -- Some refactoring in PHPExcel_Writer_Excel2007_Workbook - @MarkBaker -- New package: PHPExcel_Shared - @MarkBaker -- Password hashing algorithm implemented in PHPExcel_Shared_PasswordHasher - @MarkBaker -- Moved pixel conversion functions to PHPExcel_Shared_Drawing - @MarkBaker -- Switch over to LGPL license - @MarkBaker [CodePlex #244](https://phpexcel.codeplex.com/workitem/244) - -### Features - -- Include PHPExcel version in file headers - @MarkBaker [CodePlex #5](https://phpexcel.codeplex.com/workitem/5) -- Autofilter - @MarkBaker [CodePlex #6](https://phpexcel.codeplex.com/workitem/6) -- Extra document property: keywords - @MarkBaker [CodePlex #7](https://phpexcel.codeplex.com/workitem/7) -- Extra document property: category - @MarkBaker [CodePlex #8](https://phpexcel.codeplex.com/workitem/8) -- Document security - @MarkBaker [CodePlex #9](https://phpexcel.codeplex.com/workitem/9) -- PHPExcel_Writer_Serialized and PHPExcel_Reader_Serialized - @MarkBaker [CodePlex #10](https://phpexcel.codeplex.com/workitem/10) -- Alternative syntax: Addressing a cell - @MarkBaker [CodePlex #11](https://phpexcel.codeplex.com/workitem/11) -- Merge cells - @MarkBaker [CodePlex #12](https://phpexcel.codeplex.com/workitem/12) - -### Bugfixes - -- Protect ranges of cells with a password - @MarkBaker [CodePlex #13](https://phpexcel.codeplex.com/workitem/13) -- (style/fill/patternFill/fgColor or bgColor can be empty) - @JV [CodePlex #14](https://phpexcel.codeplex.com/workitem/14) - -## [1.1.1] - 2007-03-26 - -### General - -- Syntax error in "Classes/PHPExcel/Writer/Excel2007.php" on line 243 - @MarkBaker [CodePlex #1250](https://phpexcel.codeplex.com/workitem/1250) -- Reader should check if file exists and throws an exception when it doesn't - @MarkBaker [CodePlex #1282](https://phpexcel.codeplex.com/workitem/1282) - -## [1.1.0] - 2007-03-22 - -### Bugfixes - -- Style information lost after passing trough Excel2007_Reader - @MarkBaker [CodePlex #836](https://phpexcel.codeplex.com/workitem/836) - -### General - -- Number of columns > AZ fails fixed in PHPExcel_Cell::columnIndexFromString - @MarkBaker [CodePlex #913](https://phpexcel.codeplex.com/workitem/913) - -### Features - -- Added a brief file with installation instructions - @MarkBaker -- Page breaks (horizontal and vertical) - @MarkBaker -- Image shadows - @MarkBaker - -## [1.0.0] - 2007-02-22 - -### Bugfixes - -- PHPExcel->removeSheetByIndex now re-orders sheets after deletion, so no array indexes are lost - @JV -- PHPExcel_Writer_Excel2007_Worksheet::_writeCols() used direct assignment to $pSheet->getColumnDimension('A')->Width instead of $pSheet->getColumnDimension('A')->setWidth() - @JV -- DocumentProperties used $this->LastModifiedBy instead of $this->_lastModifiedBy. - @JV - -### General - -- Only first = should be removed when writing formula in PHPExcel_Writer_Excel2007_Worksheet. - @JV -- Consistency of method names to camelCase - @JV -- Updated tests to match consistency changes - @JV -- Detection of mime-types now with image_type_to_mime_type() - @JV -- Constants now hold string value used in Excel 2007 - @JV - -### Features - -- Fixed folder name case (WorkSheet -> Worksheet) - @MarkBaker -- PHPExcel classes (not the Writer classes) can be duplicated, using a duplicate() method. - @MarkBaker -- Cell styles can now be duplicated to a range of cells using PHPExcel_Worksheet->duplicateStyle() - @MarkBaker -- Conditional formatting - @MarkBaker -- Reader for Excel 2007 (not supporting full specification yet!) - @JV - -## [1.0.0 RC] - 2007-01-31 - -- Project name has been changed to PHPExcel -- Project homepage is now http://www.codeplex.com/PHPExcel -- Started versioning at number: PHPExcel 1.0.0 RC - -## 2007-01-22 - -- Fixed some performance issues on large-scale worksheets (mainly loops vs. indexed arrays) -- Performance on creating StringTable has been increased -- Performance on writing Excel2007 worksheet has been increased - -## 2007-01-18 - -- Images can now be rotated -- Fixed bug: When drawings have full path specified, no mime type can be deducted -- Fixed bug: Only one drawing can be added to a worksheet - -## 2007-01-12 - -- Refactoring of some classes to use ArrayObject instead of array() -- Cell style now has support for number format (i.e. #,##0) -- Implemented embedding images - -## 2007-01-02 - -- Cell style now has support for fills, including gradient fills -- Cell style now has support for fonts -- Cell style now has support for border colors -- Cell style now has support for font colors -- Cell style now has support for alignment - -## 2006-12-21 - -- Support for cell style borders -- Support for cell styles -- Refactoring of Excel2007 Writer into multiple classes in package SpreadSheet_Writer_Excel2007 -- Refactoring of all classes, changed public members to public properties using getter/setter -- Worksheet names are now unique. On duplicate worksheet names, a number is appended. -- Worksheet now has parent SpreadSheet object -- Worksheet now has support for page header and footer -- Worksheet now has support for page margins -- Worksheet now has support for page setup (only Paper size and Orientation) -- Worksheet properties now accessible by using getProperties() -- Worksheet now has support for row and column dimensions (height / width) -- Exceptions thrown have a more clear description - -## Initial version - -- Create a Spreadsheet object -- Add one or more Worksheet objects -- Add cells to Worksheet objects -- Export Spreadsheet object to Excel 2007 OpenXML format -- Each cell supports the following data formats: string, number, formula, boolean. diff --git a/vendor/phpoffice/phpspreadsheet/CHANGELOG.md b/vendor/phpoffice/phpspreadsheet/CHANGELOG.md deleted file mode 100644 index 897a8e51..00000000 --- a/vendor/phpoffice/phpspreadsheet/CHANGELOG.md +++ /dev/null @@ -1,471 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com) -and this project adheres to [Semantic Versioning](https://semver.org). - -## [1.12.0] - 2020-04-27 - -### Added - -- Improved the ARABIC function to also handle short-hand roman numerals -- Added support for the FLOOR.MATH and FLOOR.PRECISE functions [#1351](https://github.com/PHPOffice/PhpSpreadsheet/pull/1351) - -### Fixed - -- Fix ROUNDUP and ROUNDDOWN for floating-point rounding error [#1404](https://github.com/PHPOffice/PhpSpreadsheet/pull/1404) -- Fix ROUNDUP and ROUNDDOWN for negative number [#1417](https://github.com/PHPOffice/PhpSpreadsheet/pull/1417) -- Fix loading styles from vmlDrawings when containing whitespace [#1347](https://github.com/PHPOffice/PhpSpreadsheet/issues/1347) -- Fix incorrect behavior when removing last row [#1365](https://github.com/PHPOffice/PhpSpreadsheet/pull/1365) -- MATCH with a static array should return the position of the found value based on the values submitted [#1332](https://github.com/PHPOffice/PhpSpreadsheet/pull/1332) -- Fix Xlsx Reader's handling of undefined fill color [#1353](https://github.com/PHPOffice/PhpSpreadsheet/pull/1353) - -## [1.11.0] - 2020-03-02 - -### Added - -- Added support for the BASE function -- Added support for the ARABIC function -- Conditionals - Extend Support for (NOT)CONTAINSBLANKS [#1278](https://github.com/PHPOffice/PhpSpreadsheet/pull/1278) - -### Fixed - -- Handle Error in Formula Processing Better for Xls [#1267](https://github.com/PHPOffice/PhpSpreadsheet/pull/1267) -- Handle ConditionalStyle NumberFormat When Reading Xlsx File [#1296](https://github.com/PHPOffice/PhpSpreadsheet/pull/1296) -- Fix Xlsx Writer's handling of decimal commas [#1282](https://github.com/PHPOffice/PhpSpreadsheet/pull/1282) -- Fix for issue by removing test code mistakenly left in [#1328](https://github.com/PHPOffice/PhpSpreadsheet/pull/1328) -- Fix for Xls writer wrong selected cells and active sheet [#1256](https://github.com/PHPOffice/PhpSpreadsheet/pull/1256) -- Fix active cell when freeze pane is used [#1323](https://github.com/PHPOffice/PhpSpreadsheet/pull/1323) -- Fix XLSX file loading with autofilter containing '$' [#1326](https://github.com/PHPOffice/PhpSpreadsheet/pull/1326) -- PHPDoc - Use `@return $this` for fluent methods [#1362](https://github.com/PHPOffice/PhpSpreadsheet/pull/1362) - -## [1.10.1] - 2019-12-02 - -### Changed - -- PHP 7.4 compatibility - -### Fixed - -- FLOOR() function accept negative number and negative significance [#1245](https://github.com/PHPOffice/PhpSpreadsheet/pull/1245) -- Correct column style even when using rowspan [#1249](https://github.com/PHPOffice/PhpSpreadsheet/pull/1249) -- Do not confuse defined names and cell refs [#1263](https://github.com/PHPOffice/PhpSpreadsheet/pull/1263) -- XLSX reader/writer keep decimal for floats with a zero decimal part [#1262](https://github.com/PHPOffice/PhpSpreadsheet/pull/1262) -- ODS writer prevent invalid numeric value if locale decimal separator is comma [#1268](https://github.com/PHPOffice/PhpSpreadsheet/pull/1268) -- Xlsx writer actually writes plotVisOnly and dispBlanksAs from chart properties [#1266](https://github.com/PHPOffice/PhpSpreadsheet/pull/1266) - -## [1.10.0] - 2019-11-18 - -### Changed - -- Change license from LGPL 2.1 to MIT [#140](https://github.com/PHPOffice/PhpSpreadsheet/issues/140) - -### Added - -- Implementation of IFNA() logical function -- Support "showZeros" worksheet option to change how Excel shows and handles "null" values returned from a calculation -- Allow HTML Reader to accept HTML as a string into an existing spreadsheet [#1212](https://github.com/PHPOffice/PhpSpreadsheet/pull/1212) - -### Fixed - -- IF implementation properly handles the value `#N/A` [#1165](https://github.com/PHPOffice/PhpSpreadsheet/pull/1165) -- Formula Parser: Wrong line count for stuff like "MyOtherSheet!A:D" [#1215](https://github.com/PHPOffice/PhpSpreadsheet/issues/1215) -- Call garbage collector after removing a column to prevent stale cached values -- Trying to remove a column that doesn't exist deletes the latest column -- Keep big integer as integer instead of lossely casting to float [#874](https://github.com/PHPOffice/PhpSpreadsheet/pull/874) -- Fix branch pruning handling of non boolean conditions [#1167](https://github.com/PHPOffice/PhpSpreadsheet/pull/1167) -- Fix ODS Reader when no DC namespace are defined [#1182](https://github.com/PHPOffice/PhpSpreadsheet/pull/1182) -- Fixed Functions->ifCondition for allowing <> and empty condition [#1206](https://github.com/PHPOffice/PhpSpreadsheet/pull/1206) -- Validate XIRR inputs and return correct error values [#1120](https://github.com/PHPOffice/PhpSpreadsheet/issues/1120) -- Allow to read xlsx files with exotic workbook names like "workbook2.xml" [#1183](https://github.com/PHPOffice/PhpSpreadsheet/pull/1183) - -## [1.9.0] - 2019-08-17 - -### Changed - -- Drop support for PHP 5.6 and 7.0, according to https://phpspreadsheet.readthedocs.io/en/latest/#php-version-support - -### Added - -- When <br> appears in a table cell, set the cell to wrap [#1071](https://github.com/PHPOffice/PhpSpreadsheet/issues/1071) and [#1070](https://github.com/PHPOffice/PhpSpreadsheet/pull/1070) -- Add MAXIFS, MINIFS, COUNTIFS and Remove MINIF, MAXIF [#1056](https://github.com/PHPOffice/PhpSpreadsheet/issues/1056) -- HLookup needs an ordered list even if range_lookup is set to false [#1055](https://github.com/PHPOffice/PhpSpreadsheet/issues/1055) and [#1076](https://github.com/PHPOffice/PhpSpreadsheet/pull/1076) -- Improve performance of IF function calls via ranch pruning to avoid resolution of every branches [#844](https://github.com/PHPOffice/PhpSpreadsheet/pull/844) -- MATCH function supports `*?~` Excel functionality, when match_type=0 [#1116](https://github.com/PHPOffice/PhpSpreadsheet/issues/1116) -- Allow HTML Reader to accept HTML as a string [#1136](https://github.com/PHPOffice/PhpSpreadsheet/pull/1136) - -### Fixed - -- Fix to AVERAGEIF() function when called with a third argument -- Eliminate duplicate fill none style entries [#1066](https://github.com/PHPOffice/PhpSpreadsheet/issues/1066) -- Fix number format masks containing literal (non-decimal point) dots [#1079](https://github.com/PHPOffice/PhpSpreadsheet/issues/1079) -- Fix number format masks containing named colours that were being misinterpreted as date formats; and add support for masks that fully replace the value with a full text string [#1009](https://github.com/PHPOffice/PhpSpreadsheet/issues/1009) -- Stricter-typed comparison testing in COUNTIF() and COUNTIFS() evaluation [#1046](https://github.com/PHPOffice/PhpSpreadsheet/issues/1046) -- COUPNUM should not return zero when settlement is in the last period [#1020](https://github.com/PHPOffice/PhpSpreadsheet/issues/1020) and [#1021](https://github.com/PHPOffice/PhpSpreadsheet/pull/1021) -- Fix handling of named ranges referencing sheets with spaces or "!" in their title -- Cover `getSheetByName()` with tests for name with quote and spaces [#739](https://github.com/PHPOffice/PhpSpreadsheet/issues/739) -- Best effort to support invalid colspan values in HTML reader - [#878](https://github.com/PHPOffice/PhpSpreadsheet/pull/878) -- Fixes incorrect rows deletion [#868](https://github.com/PHPOffice/PhpSpreadsheet/issues/868) -- MATCH function fix (value search by type, stop search when match_type=-1 and unordered element encountered) [#1116](https://github.com/PHPOffice/PhpSpreadsheet/issues/1116) -- Fix `getCalculatedValue()` error with more than two INDIRECT [#1115](https://github.com/PHPOffice/PhpSpreadsheet/pull/1115) -- Writer\Html did not hide columns [#985](https://github.com/PHPOffice/PhpSpreadsheet/pull/985) - -## [1.8.2] - 2019-07-08 - -### Fixed - -- Uncaught error when opening ods file and properties aren't defined [#1047](https://github.com/PHPOffice/PhpSpreadsheet/issues/1047) -- Xlsx Reader Cell datavalidations bug [#1052](https://github.com/PHPOffice/PhpSpreadsheet/pull/1052) - -## [1.8.1] - 2019-07-02 - -### Fixed - -- Allow nullable theme for Xlsx Style Reader class [#1043](https://github.com/PHPOffice/PhpSpreadsheet/issues/1043) - -## [1.8.0] - 2019-07-01 - -### Security Fix (CVE-2019-12331) - -- Detect double-encoded xml in the Security scanner, and reject as suspicious. -- This change also broadens the scope of the `libxml_disable_entity_loader` setting when reading XML-based formats, so that it is enabled while the xml is being parsed and not simply while it is loaded. - On some versions of PHP, this can cause problems because it is not thread-safe, and can affect other PHP scripts running on the same server. This flag is set to true when instantiating a loader, and back to its original setting when the Reader is no longer in scope, or manually unset. -- Provide a check to identify whether libxml_disable_entity_loader is thread-safe or not. - - `XmlScanner::threadSafeLibxmlDisableEntityLoaderAvailability()` -- Provide an option to disable the libxml_disable_entity_loader call through settings. This is not recommended as it reduces the security of the XML-based readers, and should only be used if you understand the consequences and have no other choice. - -### Added - -- Added support for the SWITCH function [#963](https://github.com/PHPOffice/PhpSpreadsheet/issues/963) and [#983](https://github.com/PHPOffice/PhpSpreadsheet/pull/983) -- Add accounting number format style [#974](https://github.com/PHPOffice/PhpSpreadsheet/pull/974) - -### Fixed - -- Whitelist `tsv` extension when opening CSV files [#429](https://github.com/PHPOffice/PhpSpreadsheet/issues/429) -- Fix a SUMIF warning with some versions of PHP when having different length of arrays provided as input [#873](https://github.com/PHPOffice/PhpSpreadsheet/pull/873) -- Fix incorrectly handled backslash-escaped space characters in number format - -## [1.7.0] - 2019-05-26 - -- Added support for inline styles in Html reader (borders, alignment, width, height) -- QuotedText cells no longer treated as formulae if the content begins with a `=` -- Clean handling for DDE in formulae - -### Fixed - -- Fix handling for escaped enclosures and new lines in CSV Separator Inference -- Fix MATCH an error was appearing when comparing strings against 0 (always true) -- Fix wrong calculation of highest column with specified row [#700](https://github.com/PHPOffice/PhpSpreadsheet/issues/700) -- Fix VLOOKUP -- Fix return type hint - -## [1.6.0] - 2019-01-02 - -### Added - -- Refactored Matrix Functions to use external Matrix library -- Possibility to specify custom colors of values for pie and donut charts [#768](https://github.com/PHPOffice/PhpSpreadsheet/pull/768) - -### Fixed - -- Improve XLSX parsing speed if no readFilter is applied [#772](https://github.com/PHPOffice/PhpSpreadsheet/issues/772) -- Fix column names if read filter calls in XLSX reader skip columns [#777](https://github.com/PHPOffice/PhpSpreadsheet/pull/777) -- XLSX reader can now ignore blank cells, using the setReadEmptyCells(false) method. [#810](https://github.com/PHPOffice/PhpSpreadsheet/issues/810) -- Fix LOOKUP function which was breaking on edge cases [#796](https://github.com/PHPOffice/PhpSpreadsheet/issues/796) -- Fix VLOOKUP with exact matches [#809](https://github.com/PHPOffice/PhpSpreadsheet/pull/809) -- Support COUNTIFS multiple arguments [#830](https://github.com/PHPOffice/PhpSpreadsheet/pull/830) -- Change `libxml_disable_entity_loader()` as shortly as possible [#819](https://github.com/PHPOffice/PhpSpreadsheet/pull/819) -- Improved memory usage and performance when loading large spreadsheets [#822](https://github.com/PHPOffice/PhpSpreadsheet/pull/822) -- Improved performance when loading large spreadsheets [#825](https://github.com/PHPOffice/PhpSpreadsheet/pull/825) -- Improved performance when loading large spreadsheets [#824](https://github.com/PHPOffice/PhpSpreadsheet/pull/824) -- Fix color from CSS when reading from HTML [#831](https://github.com/PHPOffice/PhpSpreadsheet/pull/831) -- Fix infinite loop when reading invalid ODS files [#832](https://github.com/PHPOffice/PhpSpreadsheet/pull/832) -- Fix time format for duration is incorrect [#666](https://github.com/PHPOffice/PhpSpreadsheet/pull/666) -- Fix iconv unsupported `//IGNORE//TRANSLIT` on IBM i [#791](https://github.com/PHPOffice/PhpSpreadsheet/issues/791) - -### Changed - -- `master` is the new default branch, `develop` does not exist anymore - -## [1.5.2] - 2018-11-25 - -### Security - -- Improvements to the design of the XML Security Scanner [#771](https://github.com/PHPOffice/PhpSpreadsheet/issues/771) - -## [1.5.1] - 2018-11-20 - -### Security - -- Fix and improve XXE security scanning for XML-based and HTML Readers [#771](https://github.com/PHPOffice/PhpSpreadsheet/issues/771) - -### Added - -- Support page margin in mPDF [#750](https://github.com/PHPOffice/PhpSpreadsheet/issues/750) - -### Fixed - -- Support numeric condition in SUMIF, SUMIFS, AVERAGEIF, COUNTIF, MAXIF and MINIF [#683](https://github.com/PHPOffice/PhpSpreadsheet/issues/683) -- SUMIFS containing multiple conditions [#704](https://github.com/PHPOffice/PhpSpreadsheet/issues/704) -- Csv reader avoid notice when the file is empty [#743](https://github.com/PHPOffice/PhpSpreadsheet/pull/743) -- Fix print area parser for XLSX reader [#734](https://github.com/PHPOffice/PhpSpreadsheet/pull/734) -- Support overriding `DefaultValueBinder::dataTypeForValue()` without overriding `DefaultValueBinder::bindValue()` [#735](https://github.com/PHPOffice/PhpSpreadsheet/pull/735) -- Mpdf export can exceed pcre.backtrack_limit [#637](https://github.com/PHPOffice/PhpSpreadsheet/issues/637) -- Fix index overflow on data values array [#748](https://github.com/PHPOffice/PhpSpreadsheet/pull/748) - -## [1.5.0] - 2018-10-21 - -### Added - -- PHP 7.3 support -- Add the DAYS() function [#594](https://github.com/PHPOffice/PhpSpreadsheet/pull/594) - -### Fixed - -- Sheet title can contain exclamation mark [#325](https://github.com/PHPOffice/PhpSpreadsheet/issues/325) -- Xls file cause the exception during open by Xls reader [#402](https://github.com/PHPOffice/PhpSpreadsheet/issues/402) -- Skip non numeric value in SUMIF [#618](https://github.com/PHPOffice/PhpSpreadsheet/pull/618) -- OFFSET should allow omitted height and width [#561](https://github.com/PHPOffice/PhpSpreadsheet/issues/561) -- Correctly determine delimiter when CSV contains line breaks inside enclosures [#716](https://github.com/PHPOffice/PhpSpreadsheet/issues/716) - -## [1.4.1] - 2018-09-30 - -### Fixed - -- Remove locale from formatting string [#644](https://github.com/PHPOffice/PhpSpreadsheet/pull/644) -- Allow iterators to go out of bounds with prev [#587](https://github.com/PHPOffice/PhpSpreadsheet/issues/587) -- Fix warning when reading xlsx without styles [#631](https://github.com/PHPOffice/PhpSpreadsheet/pull/631) -- Fix broken sample links on windows due to $baseDir having backslash [#653](https://github.com/PHPOffice/PhpSpreadsheet/pull/653) - -## [1.4.0] - 2018-08-06 - -### Added - -- Add excel function EXACT(value1, value2) support [#595](https://github.com/PHPOffice/PhpSpreadsheet/pull/595) -- Support workbook view attributes for Xlsx format [#523](https://github.com/PHPOffice/PhpSpreadsheet/issues/523) -- Read and write hyperlink for drawing image [#490](https://github.com/PHPOffice/PhpSpreadsheet/pull/490) -- Added calculation engine support for the new bitwise functions that were added in MS Excel 2013 - - BITAND() Returns a Bitwise 'And' of two numbers - - BITOR() Returns a Bitwise 'Or' of two number - - BITXOR() Returns a Bitwise 'Exclusive Or' of two numbers - - BITLSHIFT() Returns a number shifted left by a specified number of bits - - BITRSHIFT() Returns a number shifted right by a specified number of bits -- Added calculation engine support for other new functions that were added in MS Excel 2013 and MS Excel 2016 - - Text Functions - - CONCAT() Synonym for CONCATENATE() - - NUMBERVALUE() Converts text to a number, in a locale-independent way - - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - - Logical Functions - - XOR() Returns a logical Exclusive Or of all arguments - - Date/Time Functions - - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - - Lookup and Reference Functions - - FORMULATEXT() Returns a formula as a string - - Financial Functions - - PDURATION() Calculates the number of periods required for an investment to reach a specified value - - RRI() Calculates the interest rate required for an investment to grow to a specified future value - - Engineering Functions - - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - - ERFC.PRECISE() Synonym for ERFC - - Math and Trig Functions - - SEC() Returns the secant of an angle - - SECH() Returns the hyperbolic secant of an angle - - CSC() Returns the cosecant of an angle - - CSCH() Returns the hyperbolic cosecant of an angle - - COT() Returns the cotangent of an angle - - COTH() Returns the hyperbolic cotangent of an angle - - ACOT() Returns the cotangent of an angle - - ACOTH() Returns the hyperbolic cotangent of an angle -- Refactored Complex Engineering Functions to use external complex number library -- Added calculation engine support for the new complex number functions that were added in MS Excel 2013 - - IMCOSH() Returns the hyperbolic cosine of a complex number - - IMCOT() Returns the cotangent of a complex number - - IMCSC() Returns the cosecant of a complex number - - IMCSCH() Returns the hyperbolic cosecant of a complex number - - IMSEC() Returns the secant of a complex number - - IMSECH() Returns the hyperbolic secant of a complex number - - IMSINH() Returns the hyperbolic sine of a complex number - - IMTAN() Returns the tangent of a complex number - -### Fixed - -- Fix ISFORMULA() function to work with a cell reference to another worksheet -- Xlsx reader crashed when reading a file with workbook protection [#553](https://github.com/PHPOffice/PhpSpreadsheet/pull/553) -- Cell formats with escaped spaces were causing incorrect date formatting [#557](https://github.com/PHPOffice/PhpSpreadsheet/issues/557) -- Could not open CSV file containing HTML fragment [#564](https://github.com/PHPOffice/PhpSpreadsheet/issues/564) -- Exclude the vendor folder in migration [#481](https://github.com/PHPOffice/PhpSpreadsheet/issues/481) -- Chained operations on cell ranges involving borders operated on last cell only [#428](https://github.com/PHPOffice/PhpSpreadsheet/issues/428) -- Avoid memory exhaustion when cloning worksheet with a drawing [#437](https://github.com/PHPOffice/PhpSpreadsheet/issues/437) -- Migration tool keep variables containing $PHPExcel untouched [#598](https://github.com/PHPOffice/PhpSpreadsheet/issues/598) -- Rowspans/colspans were incorrect when adding worksheet using loadIntoExisting [#619](https://github.com/PHPOffice/PhpSpreadsheet/issues/619) - -## [1.3.1] - 2018-06-12 - -### Fixed - -- Ranges across Z and AA columns incorrectly threw an exception [#545](https://github.com/PHPOffice/PhpSpreadsheet/issues/545) - -## [1.3.0] - 2018-06-10 - -### Added - -- Support to read Xlsm templates with form elements, macros, printer settings, protected elements and back compatibility drawing, and save result without losing important elements of document [#435](https://github.com/PHPOffice/PhpSpreadsheet/issues/435) -- Expose sheet title maximum length as `Worksheet::SHEET_TITLE_MAXIMUM_LENGTH` [#482](https://github.com/PHPOffice/PhpSpreadsheet/issues/482) -- Allow escape character to be set in CSV reader [#492](https://github.com/PHPOffice/PhpSpreadsheet/issues/492) - -### Fixed - -- Subtotal 9 in a group that has other subtotals 9 exclude the totals of the other subtotals in the range [#332](https://github.com/PHPOffice/PhpSpreadsheet/issues/332) -- `Helper\Html` support UTF-8 HTML input [#444](https://github.com/PHPOffice/PhpSpreadsheet/issues/444) -- Xlsx loaded an extra empty comment for each real comment [#375](https://github.com/PHPOffice/PhpSpreadsheet/issues/375) -- Xlsx reader do not read rows and columns filtered out in readFilter at all [#370](https://github.com/PHPOffice/PhpSpreadsheet/issues/370) -- Make newer Excel versions properly recalculate formulas on document open [#456](https://github.com/PHPOffice/PhpSpreadsheet/issues/456) -- `Coordinate::extractAllCellReferencesInRange()` throws an exception for an invalid range [#519](https://github.com/PHPOffice/PhpSpreadsheet/issues/519) -- Fixed parsing of conditionals in COUNTIF functions [#526](https://github.com/PHPOffice/PhpSpreadsheet/issues/526) -- Corruption errors for saved Xlsx docs with frozen panes [#532](https://github.com/PHPOffice/PhpSpreadsheet/issues/532) - -## [1.2.1] - 2018-04-10 - -### Fixed - -- Plain text and richtext mixed in same cell can be read [#442](https://github.com/PHPOffice/PhpSpreadsheet/issues/442) - -## [1.2.0] - 2018-03-04 - -### Added - -- HTML writer creates a generator meta tag [#312](https://github.com/PHPOffice/PhpSpreadsheet/issues/312) -- Support invalid zoom value in XLSX format [#350](https://github.com/PHPOffice/PhpSpreadsheet/pull/350) -- Support for `_xlfn.` prefixed functions and `ISFORMULA`, `MODE.SNGL`, `STDEV.S`, `STDEV.P` [#390](https://github.com/PHPOffice/PhpSpreadsheet/pull/390) - -### Fixed - -- Avoid potentially unsupported PSR-16 cache keys [#354](https://github.com/PHPOffice/PhpSpreadsheet/issues/354) -- Check for MIME type to know if CSV reader can read a file [#167](https://github.com/PHPOffice/PhpSpreadsheet/issues/167) -- Use proper € symbol for currency format [#379](https://github.com/PHPOffice/PhpSpreadsheet/pull/379) -- Read printing area correctly when skipping some sheets [#371](https://github.com/PHPOffice/PhpSpreadsheet/issues/371) -- Avoid incorrectly overwriting calculated value type [#394](https://github.com/PHPOffice/PhpSpreadsheet/issues/394) -- Select correct cell when calling freezePane [#389](https://github.com/PHPOffice/PhpSpreadsheet/issues/389) -- `setStrikethrough()` did not set the font [#403](https://github.com/PHPOffice/PhpSpreadsheet/issues/403) - -## [1.1.0] - 2018-01-28 - -### Added - -- Support for PHP 7.2 -- Support cell comments in HTML writer and reader [#308](https://github.com/PHPOffice/PhpSpreadsheet/issues/308) -- Option to stop at a conditional styling, if it matches (only XLSX format) [#292](https://github.com/PHPOffice/PhpSpreadsheet/pull/292) -- Support for line width for data series when rendering Xlsx [#329](https://github.com/PHPOffice/PhpSpreadsheet/pull/329) - -### Fixed - -- Better auto-detection of CSV separators [#305](https://github.com/PHPOffice/PhpSpreadsheet/issues/305) -- Support for shape style ending with `;` [#304](https://github.com/PHPOffice/PhpSpreadsheet/issues/304) -- Freeze Panes takes wrong coordinates for XLSX [#322](https://github.com/PHPOffice/PhpSpreadsheet/issues/322) -- `COLUMNS` and `ROWS` functions crashed in some cases [#336](https://github.com/PHPOffice/PhpSpreadsheet/issues/336) -- Support XML file without styles [#331](https://github.com/PHPOffice/PhpSpreadsheet/pull/331) -- Cell coordinates which are already a range cause an exception [#319](https://github.com/PHPOffice/PhpSpreadsheet/issues/319) - -## [1.0.0] - 2017-12-25 - -### Added - -- Support to write merged cells in ODS format [#287](https://github.com/PHPOffice/PhpSpreadsheet/issues/287) -- Able to set the `topLeftCell` in freeze panes [#261](https://github.com/PHPOffice/PhpSpreadsheet/pull/261) -- Support `DateTimeImmutable` as cell value -- Support migration of prefixed classes - -### Fixed - -- Can read very small HTML files [#194](https://github.com/PHPOffice/PhpSpreadsheet/issues/194) -- Written DataValidation was corrupted [#290](https://github.com/PHPOffice/PhpSpreadsheet/issues/290) -- Date format compatible with both LibreOffice and Excel [#298](https://github.com/PHPOffice/PhpSpreadsheet/issues/298) - -### BREAKING CHANGE - -- Constant `TYPE_DOUGHTNUTCHART` is now `TYPE_DOUGHNUTCHART`. - -## [1.0.0-beta2] - 2017-11-26 - -### Added - -- Support for chart fill color - @CrazyBite [#158](https://github.com/PHPOffice/PhpSpreadsheet/pull/158) -- Support for read Hyperlink for xml - @GreatHumorist [#223](https://github.com/PHPOffice/PhpSpreadsheet/pull/223) -- Support for cell value validation according to data validation rules - @SailorMax [#257](https://github.com/PHPOffice/PhpSpreadsheet/pull/257) -- Support for custom implementation, or configuration, of PDF libraries - @SailorMax [#266](https://github.com/PHPOffice/PhpSpreadsheet/pull/266) - -### Changed - -- Merge data-validations to reduce written worksheet size - @billblume [#131](https://github.com/PHPOffice/PhpSpreadSheet/issues/131) -- Throws exception if a XML file is invalid - @GreatHumorist [#222](https://github.com/PHPOffice/PhpSpreadsheet/pull/222) -- Upgrade to mPDF 7.0+ [#144](https://github.com/PHPOffice/PhpSpreadsheet/issues/144) - -### Fixed - -- Control characters in cell values are automatically escaped [#212](https://github.com/PHPOffice/PhpSpreadsheet/issues/212) -- Prevent color changing when copy/pasting xls files written by PhpSpreadsheet to another file - @al-lala [#218](https://github.com/PHPOffice/PhpSpreadsheet/issues/218) -- Add cell reference automatic when there is no cell reference('r' attribute) in Xlsx file. - @GreatHumorist [#225](https://github.com/PHPOffice/PhpSpreadsheet/pull/225) Refer to [#201](https://github.com/PHPOffice/PhpSpreadsheet/issues/201) -- `Reader\Xlsx::getFromZipArchive()` function return false if the zip entry could not be located. - @anton-harvey [#268](https://github.com/PHPOffice/PhpSpreadsheet/pull/268) - -### BREAKING CHANGE - -- Extracted coordinate method to dedicate class [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Column indexes are based on 1, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Standardization of array keys used for style, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Easier usage of PDF writers, and other custom readers and writers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Easier usage of chart renderers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Rename a few more classes to keep them in their related namespaces: - - `CalcEngine` => `Calculation\Engine` - - `PhpSpreadsheet\Calculation` => `PhpSpreadsheet\Calculation\Calculation` - - `PhpSpreadsheet\Cell` => `PhpSpreadsheet\Cell\Cell` - - `PhpSpreadsheet\Chart` => `PhpSpreadsheet\Chart\Chart` - - `PhpSpreadsheet\RichText` => `PhpSpreadsheet\RichText\RichText` - - `PhpSpreadsheet\Style` => `PhpSpreadsheet\Style\Style` - - `PhpSpreadsheet\Worksheet` => `PhpSpreadsheet\Worksheet\Worksheet` - -## [1.0.0-beta] - 2017-08-17 - -### Added - -- Initial implementation of SUMIFS() function -- Additional codepages -- MemoryDrawing not working in HTML writer [#808](https://github.com/PHPOffice/PHPExcel/issues/808) -- CSV Reader can auto-detect the separator used in file [#141](https://github.com/PHPOffice/PhpSpreadsheet/pull/141) -- HTML Reader supports some basic inline styles [#180](https://github.com/PHPOffice/PhpSpreadsheet/pull/180) - -### Changed - -- Start following [SemVer](https://semver.org) properly. - -### Fixed - -- Fix to getCell() method when cell reference includes a worksheet reference - @MarkBaker -- Ignore inlineStr type if formula element exists - @ncrypthic [#570](https://github.com/PHPOffice/PHPExcel/issues/570) -- Excel 2007 Reader freezes because of conditional formatting - @rentalhost [#575](https://github.com/PHPOffice/PHPExcel/issues/575) -- Readers will now parse files containing worksheet titles over 31 characters [#176](https://github.com/PHPOffice/PhpSpreadsheet/pull/176) - -### General - -- Whitespace after toRichTextObject() - @MarkBaker [#554](https://github.com/PHPOffice/PHPExcel/issues/554) -- Optimize vlookup() sort - @umpirsky [#548](https://github.com/PHPOffice/PHPExcel/issues/548) -- c:max and c:min elements shall NOT be inside c:orientation elements - @vitalyrepin [#869](https://github.com/PHPOffice/PHPExcel/pull/869) -- Implement actual timezone adjustment into PHPExcel_Shared_Date::PHPToExcel - @sim642 [#489](https://github.com/PHPOffice/PHPExcel/pull/489) - -### BREAKING CHANGE - -- Introduction of namespaces for all classes, eg: `PHPExcel_Calculation_Functions` becomes `PhpOffice\PhpSpreadsheet\Calculation\Functions` -- Some classes were renamed for clarity and/or consistency: - -For a comprehensive list of all class changes, and a semi-automated migration path, read the [migration guide](./docs/topics/migration-from-PHPExcel.md). - -- Dropped `PHPExcel_Calculation_Functions::VERSION()`. Composer or git should be used to know the version. -- Dropped `PHPExcel_Settings::setPdfRenderer()` and `PHPExcel_Settings::setPdfRenderer()`. Composer should be used to autoload PDF libs. -- Dropped support for HHVM - -## Previous versions of PHPExcel - -The changelog for the project when it was called PHPExcel is [still available](./CHANGELOG.PHPExcel.md). diff --git a/vendor/phpoffice/phpspreadsheet/CONTRIBUTING.md b/vendor/phpoffice/phpspreadsheet/CONTRIBUTING.md deleted file mode 100644 index aed13fe2..00000000 --- a/vendor/phpoffice/phpspreadsheet/CONTRIBUTING.md +++ /dev/null @@ -1,11 +0,0 @@ -# Want to contribute? - -If you would like to contribute, here are some notes and guidelines: - - - All new development happens on feature/fix branches, and are then merged to the `master` branch once stable; so the `master` branch is always the most up-to-date, working code - - Tagged releases are made from the `master` branch - - If you are going to be submitting a pull request, please fork from `master`, and submit your pull request back as a fix/feature branch referencing the GitHub issue number - - Code style might be automatically fixed by `composer fix` - - All code changes must be validated by `composer check` - - [Helpful article about forking](https://help.github.com/articles/fork-a-repo/ "Forking a GitHub repository") - - [Helpful article about pull requests](https://help.github.com/articles/using-pull-requests/ "Pull Requests") diff --git a/vendor/phpoffice/phpspreadsheet/LICENSE b/vendor/phpoffice/phpspreadsheet/LICENSE deleted file mode 100644 index 3ec5723d..00000000 --- a/vendor/phpoffice/phpspreadsheet/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 PhpSpreadsheet Authors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/phpoffice/phpspreadsheet/bin/generate-document b/vendor/phpoffice/phpspreadsheet/bin/generate-document deleted file mode 100644 index 10ac8118..00000000 --- a/vendor/phpoffice/phpspreadsheet/bin/generate-document +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env php -getProperty('phpSpreadsheetFunctions'); - $phpSpreadsheetFunctionsProperty->setAccessible(true); - $phpSpreadsheetFunctions = $phpSpreadsheetFunctionsProperty->getValue(); - ksort($phpSpreadsheetFunctions); - - file_put_contents(__DIR__ . '/../docs/references/function-list-by-category.md', - DocumentGenerator::generateFunctionListByCategory($phpSpreadsheetFunctions) - ); - file_put_contents(__DIR__ . '/../docs/references/function-list-by-name.md', - DocumentGenerator::generateFunctionListByName($phpSpreadsheetFunctions) - ); -} catch (ReflectionException $e) { - fwrite(STDERR, (string)$e); - exit(1); -} diff --git a/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel b/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel deleted file mode 100644 index 51c60d49..00000000 --- a/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env php -migrate(); diff --git a/vendor/phpoffice/phpspreadsheet/bin/pre-commit b/vendor/phpoffice/phpspreadsheet/bin/pre-commit deleted file mode 100644 index 8d93f8ab..00000000 --- a/vendor/phpoffice/phpspreadsheet/bin/pre-commit +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -pass=true - -files=$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(php|phtml)$') -if [ "$files" != "" ]; then - - # Run php syntax check before commit - while read -r file; do - php -l "$file" - if [ $? -ne 0 ]; then - pass=false - fi - done <<< "$files" - - # Run php-cs-fixer validation before commit - echo "$files" | xargs ./vendor/bin/php-cs-fixer fix --diff --config .php_cs.dist - if [ $? -ne 0 ]; then - pass=false - fi - - # Automatically add files that may have been fixed by php-cs-fixer - echo "$files" | xargs git add -fi - -if $pass; then - exit 0 -else - echo "" - echo "PRE-COMMIT HOOK FAILED:" - echo "Code style validation failed. Please fix errors and try committing again." - exit 1 -fi diff --git a/vendor/phpoffice/phpspreadsheet/composer.json b/vendor/phpoffice/phpspreadsheet/composer.json deleted file mode 100644 index cfff1cb1..00000000 --- a/vendor/phpoffice/phpspreadsheet/composer.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "phpoffice/phpspreadsheet", - "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", - "keywords": ["PHP", "OpenXML", "Excel", "xlsx", "xls", "ods", "gnumeric", "spreadsheet"], - "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "Maarten Balliauw", - "homepage": "https://blog.maartenballiauw.be" - }, - { - "name": "Mark Baker", - "homepage": "https://markbakeruk.net" - }, - { - "name": "Franck Lefevre", - "homepage": "https://rootslabs.net" - }, - { - "name": "Erik Tilt" - }, - { - "name": "Adrien Crivelli" - } - ], - "scripts": { - "check": [ - "php-cs-fixer fix --ansi --dry-run --diff", - "phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PSR2 -n", - "phpunit --color=always" - ], - "fix": [ - "php-cs-fixer fix --ansi" - ], - "versions": [ - "phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PHPCompatibility --runtime-set testVersion 7.1- -n" - ] - }, - "require": { - "php": "^7.1", - "ext-ctype": "*", - "ext-dom": "*", - "ext-gd": "*", - "ext-iconv": "*", - "ext-fileinfo": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-SimpleXML": "*", - "ext-xml": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "ext-zip": "*", - "ext-zlib": "*", - "markbaker/complex": "^1.4", - "markbaker/matrix": "^1.2", - "psr/simple-cache": "^1.0" - }, - "require-dev": { - "dompdf/dompdf": "^0.8.3", - "friendsofphp/php-cs-fixer": "^2.16", - "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^8.0", - "phpcompatibility/php-compatibility": "^9.3", - "phpunit/phpunit": "^7.5", - "squizlabs/php_codesniffer": "^3.5", - "tecnickcom/tcpdf": "^6.3" - }, - "suggest": { - "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "dompdf/dompdf": "Option for rendering PDF with PDF Writer", - "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer", - "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers" - }, - "autoload": { - "psr-4": { - "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" - } - }, - "autoload-dev": { - "psr-4": { - "PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests" - } - } -} diff --git a/vendor/phpoffice/phpspreadsheet/composer.lock b/vendor/phpoffice/phpspreadsheet/composer.lock deleted file mode 100644 index 9299919f..00000000 --- a/vendor/phpoffice/phpspreadsheet/composer.lock +++ /dev/null @@ -1,3503 +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": "0fd32acfbb0d21f168f495840ffc8d7e", - "packages": [ - { - "name": "markbaker/complex", - "version": "1.4.7", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPComplex.git", - "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/1ea674a8308baf547cbcbd30c5fcd6d301b7c000", - "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000", - "shasum": "" - }, - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", - "phpcompatibility/php-compatibility": "^8.0", - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "2.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.35|^5.4.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "^3.3.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Complex\\": "classes/src/" - }, - "files": [ - "classes/src/functions/abs.php", - "classes/src/functions/acos.php", - "classes/src/functions/acosh.php", - "classes/src/functions/acot.php", - "classes/src/functions/acoth.php", - "classes/src/functions/acsc.php", - "classes/src/functions/acsch.php", - "classes/src/functions/argument.php", - "classes/src/functions/asec.php", - "classes/src/functions/asech.php", - "classes/src/functions/asin.php", - "classes/src/functions/asinh.php", - "classes/src/functions/atan.php", - "classes/src/functions/atanh.php", - "classes/src/functions/conjugate.php", - "classes/src/functions/cos.php", - "classes/src/functions/cosh.php", - "classes/src/functions/cot.php", - "classes/src/functions/coth.php", - "classes/src/functions/csc.php", - "classes/src/functions/csch.php", - "classes/src/functions/exp.php", - "classes/src/functions/inverse.php", - "classes/src/functions/ln.php", - "classes/src/functions/log2.php", - "classes/src/functions/log10.php", - "classes/src/functions/negative.php", - "classes/src/functions/pow.php", - "classes/src/functions/rho.php", - "classes/src/functions/sec.php", - "classes/src/functions/sech.php", - "classes/src/functions/sin.php", - "classes/src/functions/sinh.php", - "classes/src/functions/sqrt.php", - "classes/src/functions/tan.php", - "classes/src/functions/tanh.php", - "classes/src/functions/theta.php", - "classes/src/operations/add.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "description": "PHP Class for working with complex numbers", - "homepage": "https://github.com/MarkBaker/PHPComplex", - "keywords": [ - "complex", - "mathematics" - ], - "time": "2018-10-13T23:28:42+00:00" - }, - { - "name": "markbaker/matrix", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPMatrix.git", - "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/5348c5a67e3b75cd209d70103f916a93b1f1ed21", - "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21", - "shasum": "" - }, - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "dev-master", - "phpcompatibility/php-compatibility": "dev-master", - "phploc/phploc": "^4", - "phpmd/phpmd": "dev-master", - "phpunit/phpunit": "^5.7", - "sebastian/phpcpd": "^3.0", - "squizlabs/php_codesniffer": "^3.0@dev" - }, - "type": "library", - "autoload": { - "psr-4": { - "Matrix\\": "classes/src/" - }, - "files": [ - "classes/src/functions/adjoint.php", - "classes/src/functions/antidiagonal.php", - "classes/src/functions/cofactors.php", - "classes/src/functions/determinant.php", - "classes/src/functions/diagonal.php", - "classes/src/functions/identity.php", - "classes/src/functions/inverse.php", - "classes/src/functions/minors.php", - "classes/src/functions/trace.php", - "classes/src/functions/transpose.php", - "classes/src/operations/add.php", - "classes/src/operations/directsum.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "description": "PHP Class for working with matrices", - "homepage": "https://github.com/MarkBaker/PHPMatrix", - "keywords": [ - "mathematics", - "matrix", - "vector" - ], - "time": "2019-10-06T11:29:25+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "time": "2017-10-23T01:57:42+00:00" - } - ], - "packages-dev": [ - { - "name": "composer/semver", - "version": "1.5.0", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "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": "2019-03-19T17:25:45+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "cbe23383749496fe0f373345208b79568e4bc248" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/cbe23383749496fe0f373345208b79568e4bc248", - "reference": "cbe23383749496fe0f373345208b79568e4bc248", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" - }, - "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": "2019-11-06T16:40:04+00:00" - }, - { - "name": "doctrine/annotations", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/904dca4eb10715b92569fbcd79e201d5c349b6bc", - "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": "^7.1" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^7.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "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": "2019-10-01T18:55:10+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" - }, - "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://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2019-03-17T17:37:11+00:00" - }, - { - "name": "doctrine/lexer", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/1febd6c3ef84253d7c815bed85fc622ad207a9f8", - "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "^4.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" - } - }, - "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": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "time": "2019-06-08T11:03:04+00:00" - }, - { - "name": "dompdf/dompdf", - "version": "v0.8.3", - "source": { - "type": "git", - "url": "https://github.com/dompdf/dompdf.git", - "reference": "75f13c700009be21a1965dc2c5b68a8708c22ba2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/75f13c700009be21a1965dc2c5b68a8708c22ba2", - "reference": "75f13c700009be21a1965dc2c5b68a8708c22ba2", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-mbstring": "*", - "phenx/php-font-lib": "0.5.*", - "phenx/php-svg-lib": "0.3.*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8|^5.5|^6.5", - "squizlabs/php_codesniffer": "2.*" - }, - "suggest": { - "ext-gd": "Needed to process images", - "ext-gmagick": "Improves image processing performance", - "ext-imagick": "Improves image processing performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.7-dev" - } - }, - "autoload": { - "psr-4": { - "Dompdf\\": "src/" - }, - "classmap": [ - "lib/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Fabien Ménager", - "email": "fabien.menager@gmail.com" - }, - { - "name": "Brian Sweeney", - "email": "eclecticgeek@gmail.com" - }, - { - "name": "Gabriel Bull", - "email": "me@gabrielbull.com" - } - ], - "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", - "homepage": "https://github.com/dompdf/dompdf", - "time": "2018-12-14T02:40:31+00:00" - }, - { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.16.1", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", - "shasum": "" - }, - "require": { - "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.2", - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "php": "^5.6 || ^7.0", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", - "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", - "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", - "symfony/finder": "^3.0 || ^4.0 || ^5.0", - "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0 || ^5.0", - "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.2", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", - "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", - "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3 || ^5.0", - "symfony/yaml": "^3.0 || ^4.0 || ^5.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": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - } - ], - "description": "A tool to automatically fix PHP code style", - "time": "2019-11-25T22:10:32+00:00" - }, - { - "name": "jpgraph/jpgraph", - "version": "4.0.2", - "source": { - "type": "git", - "url": "https://github.com/ztec/JpGraph.git", - "reference": "e82db7da6a546d3926c24c9a346226da7aa49094" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ztec/JpGraph/zipball/e82db7da6a546d3926c24c9a346226da7aa49094", - "reference": "e82db7da6a546d3926c24c9a346226da7aa49094", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "lib/JpGraph.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "QPL 1.0" - ], - "authors": [ - { - "name": "JpGraph team" - } - ], - "description": "jpGraph, library to make graphs and charts", - "homepage": "http://jpgraph.net/", - "keywords": [ - "chart", - "data", - "graph", - "jpgraph", - "pie" - ], - "time": "2017-02-23T09:44:15+00:00" - }, - { - "name": "mpdf/mpdf", - "version": "v8.0.4", - "source": { - "type": "git", - "url": "https://github.com/mpdf/mpdf.git", - "reference": "d3147a0d790b6d11936fd9c73fa31a7ed45e3f6f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mpdf/mpdf/zipball/d3147a0d790b6d11936fd9c73fa31a7ed45e3f6f", - "reference": "d3147a0d790b6d11936fd9c73fa31a7ed45e3f6f", - "shasum": "" - }, - "require": { - "ext-gd": "*", - "ext-mbstring": "*", - "myclabs/deep-copy": "^1.7", - "paragonie/random_compat": "^1.4|^2.0|9.99.99", - "php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0", - "psr/log": "^1.0", - "setasign/fpdi": "^2.1" - }, - "require-dev": { - "mockery/mockery": "^0.9.5", - "mpdf/qrcode": "^1.0.0", - "phpunit/phpunit": "^5.0", - "squizlabs/php_codesniffer": "^3.5.0", - "tracy/tracy": "^2.4" - }, - "suggest": { - "ext-bcmath": "Needed for generation of some types of barcodes", - "ext-xml": "Needed mainly for SVG manipulation", - "ext-zlib": "Needed for compression of embedded resources, such as fonts" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-development": "7.x-dev" - } - }, - "autoload": { - "psr-4": { - "Mpdf\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-only" - ], - "authors": [ - { - "name": "Matěj Humpál", - "role": "Developer, maintainer" - }, - { - "name": "Ian Back", - "role": "Developer (retired)" - } - ], - "description": "PHP library generating PDF files from UTF-8 encoded HTML", - "homepage": "https://mpdf.github.io", - "keywords": [ - "pdf", - "php", - "utf-8" - ], - "time": "2019-11-28T09:39:33+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.9.3", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", - "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": "2019-08-09T12:45:53+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": "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": "phenx/php-font-lib", - "version": "0.5.1", - "source": { - "type": "git", - "url": "https://github.com/PhenX/php-font-lib.git", - "reference": "760148820110a1ae0936e5cc35851e25a938bc97" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/760148820110a1ae0936e5cc35851e25a938bc97", - "reference": "760148820110a1ae0936e5cc35851e25a938bc97", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "FontLib\\": "src/FontLib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Fabien Ménager", - "email": "fabien.menager@gmail.com" - } - ], - "description": "A library to read, parse, export and make subsets of different types of font files.", - "homepage": "https://github.com/PhenX/php-font-lib", - "time": "2017-09-13T16:14:37+00:00" - }, - { - "name": "phenx/php-svg-lib", - "version": "v0.3.3", - "source": { - "type": "git", - "url": "https://github.com/PhenX/php-svg-lib.git", - "reference": "5fa61b65e612ce1ae15f69b3d223cb14ecc60e32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/5fa61b65e612ce1ae15f69b3d223cb14ecc60e32", - "reference": "5fa61b65e612ce1ae15f69b3d223cb14ecc60e32", - "shasum": "" - }, - "require": { - "sabberworm/php-css-parser": "^8.3" - }, - "require-dev": { - "phpunit/phpunit": "^5.5|^6.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Svg\\": "src/Svg" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Fabien Ménager", - "email": "fabien.menager@gmail.com" - } - ], - "description": "A library to read, parse and export to PDF SVG files.", - "homepage": "https://github.com/PhenX/php-svg-lib", - "time": "2019-09-11T20:02:13+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": "phpcompatibility/php-compatibility", - "version": "9.3.2", - "source": { - "type": "git", - "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "bfca2be3992f40e92206e5a7ebe5eaee37280b58" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/bfca2be3992f40e92206e5a7ebe5eaee37280b58", - "reference": "bfca2be3992f40e92206e5a7ebe5eaee37280b58", - "shasum": "" - }, - "require": { - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" - }, - "conflict": { - "squizlabs/php_codesniffer": "2.6.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" - }, - "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", - "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." - }, - "type": "phpcodesniffer-standard", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0-or-later" - ], - "authors": [ - { - "name": "Wim Godden", - "homepage": "https://github.com/wimg", - "role": "lead" - }, - { - "name": "Juliette Reinders Folmer", - "homepage": "https://github.com/jrfnl", - "role": "lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" - } - ], - "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", - "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", - "keywords": [ - "compatibility", - "phpcs", - "standards" - ], - "time": "2019-10-16T21:24:24+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.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": "2018-08-07T13:53:10+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", - "phpdocumentor/type-resolver": "~0.4 || ^1.0.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": "2019-09-12T14:27:41+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "shasum": "" - }, - "require": { - "php": "^7.1", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "^7.1", - "mockery/mockery": "~1", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.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": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-08-22T18:11:29+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.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-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "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": "2019-10-03T11:07:50+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "6.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "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 || ^4.0", - "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.1-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-10-31T16:06:48+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^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-09-13T20:33:42+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.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-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": "2019-06-07T04:22:29+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-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": "2019-09-17T06:23:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "7.5.17", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4c92a15296e58191a4cd74cff3b34fc8e374174a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4c92a15296e58191a4cd74cff3b34fc8e374174a", - "reference": "4c92a15296e58191a4cd74cff3b34fc8e374174a", - "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.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.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.5-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": "2019-10-28T10:37:36+00:00" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/log", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.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": "2019-11-01T11:05:21+00:00" - }, - { - "name": "sabberworm/php-css-parser", - "version": "8.3.0", - "source": { - "type": "git", - "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", - "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f", - "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "codacy/coverage": "^1.4", - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "autoload": { - "psr-0": { - "Sabberworm\\CSS": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Raphael Schweikert" - } - ], - "description": "Parser for CSS Files written in PHP", - "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser", - "keywords": [ - "css", - "parser", - "stylesheet" - ], - "time": "2019-02-22T07:42:52+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.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.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": "2019-02-04T06:01:07+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-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": "2019-05-05T09:05:15+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", - "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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2019-09-14T09:02:43+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": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "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": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+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": "setasign/fpdi", - "version": "v2.2.0", - "source": { - "type": "git", - "url": "https://github.com/Setasign/FPDI.git", - "reference": "3c266002f8044f61b17329f7cd702d44d73f0f7f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/3c266002f8044f61b17329f7cd702d44d73f0f7f", - "reference": "3c266002f8044f61b17329f7cd702d44d73f0f7f", - "shasum": "" - }, - "require": { - "ext-zlib": "*", - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "~5.7", - "setasign/fpdf": "~1.8", - "setasign/tfpdf": "1.25", - "tecnickcom/tcpdf": "~6.2" - }, - "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured.", - "setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.", - "setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF.", - "setasign/fpdi-tfpdf": "Use this package to automatically evaluate dependencies to tFPDF." - }, - "type": "library", - "autoload": { - "psr-4": { - "setasign\\Fpdi\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Slabon", - "email": "jan.slabon@setasign.com", - "homepage": "https://www.setasign.com" - }, - { - "name": "Maximilian Kresse", - "email": "maximilian.kresse@setasign.com", - "homepage": "https://www.setasign.com" - } - ], - "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.", - "homepage": "https://www.setasign.com/fpdi", - "keywords": [ - "fpdf", - "fpdi", - "pdf" - ], - "time": "2019-01-30T14:11:19+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.5.2", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", - "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2019-10-28T04:36:32+00:00" - }, - { - "name": "symfony/console", - "version": "v4.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "136c4bd62ea871d00843d1bc0316de4c4a84bb78" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/136c4bd62ea871d00843d1bc0316de4c4a84bb78", - "reference": "136c4bd62ea871d00843d1bc0316de4c4a84bb78", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3", - "symfony/process": "<3.3" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "^4.3", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "symfony/var-dumper": "^4.3" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-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": "2019-10-30T12:58:49+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v4.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "6229f58993e5a157f6096fc7145c0717d0be8807" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/6229f58993e5a157f6096fc7145c0717d0be8807", - "reference": "6229f58993e5a157f6096fc7145c0717d0be8807", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/event-dispatcher-contracts": "^1.1" - }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" - }, - "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/http-foundation": "^3.4|^4.0", - "symfony/service-contracts": "^1.1", - "symfony/stopwatch": "~3.4|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-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": "2019-10-01T16:40:32+00:00" - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "c43ab685673fb6c8d84220c77897b1d6cdbe1d18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/c43ab685673fb6c8d84220c77897b1d6cdbe1d18", - "reference": "c43ab685673fb6c8d84220c77897b1d6cdbe1d18", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "suggest": { - "psr/event-dispatcher": "", - "symfony/event-dispatcher-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\EventDispatcher\\": "" - } - }, - "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": "Generic abstractions related to dispatching event", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2019-09-17T09:54:03+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v4.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/9abbb7ef96a51f4d7e69627bc6f63307994e4263", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-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": "2019-08-20T14:07:54+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/72a068f77e317ae77c0a0495236ad292cfb5ce6f", - "reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-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": "2019-10-30T12:53:54+00:00" - }, - { - "name": "symfony/options-resolver", - "version": "v4.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "f46c7fc8e207bd8a2188f54f8738f232533765a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/f46c7fc8e207bd8a2188f54f8738f232533765a4", - "reference": "f46c7fc8e207bd8a2188f54f8738f232533765a4", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-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": "2019-10-28T20:59:01+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.12.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.12-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2019-08-06T08:03:45+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.12.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.12-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": "2019-08-06T08:03:45+00:00" - }, - { - "name": "symfony/polyfill-php70", - "version": "v1.12.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "54b4c428a0054e254223797d2713c31e08610831" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/54b4c428a0054e254223797d2713c31e08610831", - "reference": "54b4c428a0054e254223797d2713c31e08610831", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.12-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": "2019-08-06T08:03:45+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.12.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "04ce3335667451138df4307d6a9b61565560199e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", - "reference": "04ce3335667451138df4307d6a9b61565560199e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.12-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": "2019-08-06T08:03:45+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.12.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/2ceb49eaccb9352bff54d22570276bb75ba4a188", - "reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.12-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "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.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2019-08-06T08:03:45+00:00" - }, - { - "name": "symfony/process", - "version": "v4.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "3b2e0cb029afbb0395034509291f21191d1a4db0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3b2e0cb029afbb0395034509291f21191d1a4db0", - "reference": "3b2e0cb029afbb0395034509291f21191d1a4db0", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-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": "2019-10-28T17:07:32+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v1.1.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "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": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2019-10-14T12:27:06+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v4.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "1e4ff456bd625be5032fac9be4294e60442e9b71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/1e4ff456bd625be5032fac9be4294e60442e9b71", - "reference": "1e4ff456bd625be5032fac9be4294e60442e9b71", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/service-contracts": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-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": "2019-08-07T11:52:19+00:00" - }, - { - "name": "tecnickcom/tcpdf", - "version": "6.3.2", - "source": { - "type": "git", - "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "9fde7bb9b404b945e7ea88fb7eccd23d9a4e324b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/9fde7bb9b404b945e7ea88fb7eccd23d9a4e324b", - "reference": "9fde7bb9b404b945e7ea88fb7eccd23d9a4e324b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "config", - "include", - "tcpdf.php", - "tcpdf_parser.php", - "tcpdf_import.php", - "tcpdf_barcodes_1d.php", - "tcpdf_barcodes_2d.php", - "include/tcpdf_colors.php", - "include/tcpdf_filters.php", - "include/tcpdf_font_data.php", - "include/tcpdf_fonts.php", - "include/tcpdf_images.php", - "include/tcpdf_static.php", - "include/barcodes/datamatrix.php", - "include/barcodes/pdf417.php", - "include/barcodes/qrcode.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Nicola Asuni", - "email": "info@tecnick.com", - "role": "lead" - } - ], - "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", - "homepage": "http://www.tcpdf.org/", - "keywords": [ - "PDFD32000-2008", - "TCPDF", - "barcodes", - "datamatrix", - "pdf", - "pdf417", - "qrcode" - ], - "time": "2019-09-20T09:35:01+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "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": "2019-06-13T22:48:21+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.5.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" - }, - "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": "2019-08-24T08:43:50+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^7.1", - "ext-ctype": "*", - "ext-dom": "*", - "ext-gd": "*", - "ext-iconv": "*", - "ext-fileinfo": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-xml": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "ext-zip": "*", - "ext-zlib": "*" - }, - "platform-dev": [] -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/logo.svg b/vendor/phpoffice/phpspreadsheet/docs/assets/logo.svg deleted file mode 100644 index 229debc0..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/logo.svg +++ /dev/null @@ -1,947 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/docs/extra/extra.css b/vendor/phpoffice/phpspreadsheet/docs/extra/extra.css deleted file mode 100644 index 2addeb79..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/extra/extra.css +++ /dev/null @@ -1,8 +0,0 @@ -/* Make the huge table always visible */ -table.features-cross-reference { - overflow: visible !important; -} -.rst-content table.features-cross-reference.docutils th, -.rst-content table.features-cross-reference.docutils td { - background-color: white; -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/faq.md b/vendor/phpoffice/phpspreadsheet/docs/faq.md deleted file mode 100644 index 19f5f8fc..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/faq.md +++ /dev/null @@ -1,57 +0,0 @@ -# Frequently asked questions - -## There seems to be a problem with character encoding... - -It is necessary to use UTF-8 encoding for all texts in PhpSpreadsheet. -If the script uses different encoding then you can convert those texts -with PHP's `iconv()` or `mb_convert_encoding()` functions. - -## Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate yyy bytes) in zzz on line aaa - -PhpSpreadsheet holds an "in memory" representation of a spreadsheet, so -it is susceptible to PHP's memory limitations. The memory made available -to PHP can be increased by editing the value of the `memory_limit` -directive in your `php.ini` file, or by using -`ini_set('memory_limit', '128M')` within your code. - -Some Readers and Writers are faster than others, and they also use -differing amounts of memory. - -## Protection on my worksheet is not working? - -When you make use of any of the worksheet protection features (e.g. cell -range protection, prohibiting deleting rows, ...), make sure you enable -worksheet security. This can for example be done like this: - -``` php -$spreadsheet->getActiveSheet()->getProtection()->setSheet(true); -``` - -## Feature X is not working with Reader\_Y / Writer\_Z - -Not all features of PhpSpreadsheet are implemented in all of the Reader -/ Writer classes. This is mostly due to underlying libraries not -supporting a specific feature or not having implemented a specific -feature. - -For example autofilter is not implemented in PEAR -Spreadsheet\_Excel\_writer, which is the base of our Xls writer. - -We are slowly building up a list of features, together with the -different readers and writers that support them, in the [features cross -reference](./references/features-cross-reference.md). - -## Formulas don't seem to be calculated in Excel2003 using compatibility pack? - -This is normal behaviour of the compatibility pack, `Xlsx` displays this -correctly. Use `\PhpOffice\PhpSpreadsheet\Writer\Xls` if you really need -calculated values, or force recalculation in Excel2003. - -## Setting column width is not 100% accurate - -Trying to set column width, I experience one problem. When I open the -file in Excel, the actual width is 0.71 less than it should be. - -The short answer is that PhpSpreadsheet uses a measure where padding is -included. See [how to set a column's width](./topics/recipes.md#setting-a-columns-width) -for more details. diff --git a/vendor/phpoffice/phpspreadsheet/docs/index.md b/vendor/phpoffice/phpspreadsheet/docs/index.md deleted file mode 100644 index e7bb4660..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/index.md +++ /dev/null @@ -1,98 +0,0 @@ -# Welcome to PhpSpreadsheet's documentation - -![Logo](./assets/logo.svg) - -PhpSpreadsheet is a library written in pure PHP and providing a set of -classes that allow you to read from and to write to different -spreadsheet file formats, like Excel and LibreOffice Calc. - -## File formats supported - -|Format |Reading|Writing| -|--------------------------------------------|:-----:|:-----:| -|Open Document Format/OASIS (.ods) | ✓ | ✓ | -|Office Open XML (.xlsx) Excel 2007 and above| ✓ | ✓ | -|BIFF 8 (.xls) Excel 97 and above | ✓ | ✓ | -|BIFF 5 (.xls) Excel 95 | ✓ | | -|SpreadsheetML (.xml) Excel 2003 | ✓ | | -|Gnumeric | ✓ | | -|HTML | ✓ | ✓ | -|SYLK | ✓ | | -|CSV | ✓ | ✓ | -|PDF (using either the TCPDF, Dompdf or mPDF libraries, which need to be installed separately)| | ✓ | - -# Getting started - -## Software requirements - -PHP version 7.1 or newer to develop using PhpSpreadsheet. Other requirements, such as PHP extensions, are enforced by -composer. See the `require` section of [the composer.json file](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/composer.json) -for details. - -### PHP version support - -Support for PHP versions will only be maintained for a period of six months beyond the end-of-life of that PHP version - -## Installation - -Use [composer](https://getcomposer.org) to install PhpSpreadsheet into your project: - -```sh -composer require phpoffice/phpspreadsheet -``` - -## Hello World - -This would be the simplest way to write a spreadsheet: - -```php -getActiveSheet(); -$sheet->setCellValue('A1', 'Hello World !'); - -$writer = new Xlsx($spreadsheet); -$writer->save('hello world.xlsx'); -``` - -## Learn by example - -A good way to get started is to run some of the samples. Serve the samples via -PHP built-in webserver: - -```sh -php -S localhost:8000 -t vendor/phpoffice/phpspreadsheet/samples -``` - -Then point your browser to: - -> http://localhost:8000/ - -The samples may also be run directly from the command line, for example: - -```sh -php vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php -``` - -## Learn by documentation - -For more in-depth documentation, you may read about an [overview of the -architecture](./topics/architecture.md), -[creating a spreadsheet](./topics/creating-spreadsheet.md), -[worksheets](./topics/worksheets.md), -[accessing cells](./topics/accessing-cells.md) and -[reading and writing to files](./topics/reading-and-writing-to-file.md). - -Or browse the [API documentation](https://phpoffice.github.io/PhpSpreadsheet). - -# Credits - -Please refer to the [contributor -list](https://github.com/PHPOffice/PhpSpreadsheet/graphs/contributors) -for up-to-date credits. diff --git a/vendor/phpoffice/phpspreadsheet/docs/references/features-cross-reference.md b/vendor/phpoffice/phpspreadsheet/docs/references/features-cross-reference.md deleted file mode 100644 index 716a3787..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/references/features-cross-reference.md +++ /dev/null @@ -1,1591 +0,0 @@ -# Features cross reference - -- Supported -- Partially supported -- Not supported -- N/A Cannot be supported - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ReadersWritersMethods
XLSXLSXExcel2003XMLOdsGnumericCSVSYLKXLSXLSXOdsCSVHTMLPDFGettersSetters
Reader OptionsN/AN/AN/AN/AN/AN/AN/AN/A
Read Data Only (no formatting)N/AN/AN/AN/AN/AN/AN/AN/A$reader->getReadDataOnly()$reader->setReadDataOnly()
Read Only Specified WorksheetsN/AN/AN/AN/AN/AN/AN/AN/A$reader->getLoadSheetsOnly()$reader->setLoadSheetsOnly()
$reader->setLoadAllSheets()
Read Only Specified CellsN/AN/AN/AN/AN/AN/AN/AN/A$reader->getReadFilter()$reader->setReadFilter()
Document PropertiesN/AN/AN/AN/A
Standard PropertiesN/AN/AN/AN/A
CreatorN/AN/AN/A$spreadsheet->getProperties()->getCreator()$spreadsheet->getProperties()->setCreator()
Creation Date/TimeN/AN/AN/AN/A$spreadsheet->getProperties()->getCreated()$spreadsheet->getProperties()->setCreated()
ModifierN/AN/AN/AN/AN/AN/A$spreadsheet->getProperties()->getLastModifiedBy()$spreadsheet->getProperties()->setLastModifiedBy()
Modified Date/TimeN/AN/AN/AN/AN/A$spreadsheet->getProperties()->getModified()$spreadsheet->getProperties()->setModified()
TitleN/AN/AN/A$spreadsheet->getProperties()->getTitle()$spreadsheet->getProperties()->setTitle()
DescriptionN/AN/AN/AN/A$spreadsheet->getProperties()->getDescription()$spreadsheet->getProperties()->setDescription()
SubjectN/AN/AN/A$spreadsheet->getProperties()->getSubject()$spreadsheet->getProperties()->setSubject()
KeywordsN/AN/AN/A$spreadsheet->getProperties()->getKeywords()$spreadsheet->getProperties()->setKeywords()
Extended PropertiesN/AN/AN/AN/AN/A
CategoryN/AN/AN/AN/AN/A$spreadsheet->getProperties()->getCategory()$spreadsheet->getProperties()->setCategory()
CompanyN/AN/AN/AN/AN/A$spreadsheet->getProperties()->getCompany()$spreadsheet->getProperties()->setCompany()
ManagerN/AN/AN/AN/AN/A$spreadsheet->getProperties()->getManager()$spreadsheet->getProperties()->setManager()
User-Defined (Custom) PropertiesN/AN/AN/AN/AN/A$spreadsheet->getProperties()->getCustomProperties()
$spreadsheet->getProperties()->isCustomPropertySet()
$spreadsheet->getProperties()->getCustomPropertyValue()
$spreadsheet->getProperties()->getCustomPropertyType()
$spreadsheet->getProperties()->setCustomProperty()
Text PropertiesN/AN/AN/AN/AN/A
Number PropertiesN/AN/AN/AN/AN/A
Date PropertiesN/AN/AN/AN/AN/A
Yes/No (Boolean) PropertiesN/AN/AN/AN/AN/A
Cell Data Types
Empty/NULL
Boolean
Integer
Floating Point
String
Error
Formula
Array
Rich TextN/AN/A
Conditional FormattingN/AN/A
Rows and Column Properties
Row Height/Column Width
Hidden
Worksheet Properties
Frozen Panes
Coloured TabsN/A
Drawing hyperlink$drawing->getHyperlink()->getUrl()$drawing->setHyperlink()->setUrl($url)
Cell Formatting
Number Format Mask
Alignment
Horizontal
Vertical
Wrapping
Shring-to-Fit
Indent
Background Colour
Patterned
Font Attributes
Font Face
Font Size
Bold
Italic
Strikethrough
Underline
Superscript
Subscript
Borders
Line Style
Position
Diagonal
Hyperlinks$cell->getHyperlink()->getUrl($url)$cell->getHyperlink()->setUrl($url)
http
Merged Cells
Cell CommentsN/AN/AN/A1N/A
Rich Text2N/AN/AN/AN/AN/A
Alignment3N/AN/AN/AN/AN/A
Cell ValidationN/AN/AN/AN/AN/A$cell->getDataValidation()$cell->setDataValidation()
AutoFilters$sheet->getAutoFilter()$sheet->setAutoFilter()
AutoFilter Expressions
Filter
Custom Filter
DateGroup Filter
Dynamic Filter
Colour Filter
Icon Filter
Top 10 Filter
Macros$spreadsheet->getMacrosCode();$spreadsheet->setMacrosCode();
Form Controls
Security
Protection (prevent editing)$sheet->getProtection()$sheet->getProtection()->setSheet(true)
Encryption (prevent viewing)
XLSXLSXExcel2003XMLOdsGnumericCSVSYLKXLSXLSXOdsCSVHTMLPDFGettersSetters
ReadersWritersMethods
- -1. Only text contents -2. Only BIFF8 files support Rich Text. Prior to that, comments could only be plain text -3. Only BIFF8 files support alignment and rotation. Prior to that, comments could only be unformatted text diff --git a/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-category.md b/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-category.md deleted file mode 100644 index 9f768459..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-category.md +++ /dev/null @@ -1,458 +0,0 @@ -# Function list by category - -## CATEGORY_CUBE - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -CUBEKPIMEMBER | **Not yet Implemented** -CUBEMEMBER | **Not yet Implemented** -CUBEMEMBERPROPERTY | **Not yet Implemented** -CUBERANKEDMEMBER | **Not yet Implemented** -CUBESET | **Not yet Implemented** -CUBESETCOUNT | **Not yet Implemented** -CUBEVALUE | **Not yet Implemented** - -## CATEGORY_DATABASE - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -DAVERAGE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DAVERAGE -DCOUNT | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNT -DCOUNTA | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNTA -DGET | \PhpOffice\PhpSpreadsheet\Calculation\Database::DGET -DMAX | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMAX -DMIN | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMIN -DPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\Database::DPRODUCT -DSTDEV | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEV -DSTDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEVP -DSUM | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSUM -DVAR | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVAR -DVARP | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVARP - -## CATEGORY_DATE_AND_TIME - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -DATE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATE -DATEDIF | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEDIF -DATEVALUE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEVALUE -DAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYOFMONTH -DAYS | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS -DAYS360 | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS360 -EDATE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EDATE -EOMONTH | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EOMONTH -HOUR | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::HOUROFDAY -ISOWEEKNUM | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::ISOWEEKNUM -MINUTE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MINUTE -MONTH | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MONTHOFYEAR -NETWORKDAYS | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::NETWORKDAYS -NETWORKDAYS.INTL | **Not yet Implemented** -NOW | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATETIMENOW -SECOND | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::SECOND -TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIME -TIMEVALUE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIMEVALUE -TODAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATENOW -WEEKDAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKDAY -WEEKNUM | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKNUM -WORKDAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WORKDAY -WORKDAY.INTL | **Not yet Implemented** -YEAR | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEAR -YEARFRAC | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEARFRAC - -## CATEGORY_ENGINEERING - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -BESSELI | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELI -BESSELJ | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELJ -BESSELK | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELK -BESSELY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELY -BIN2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTODEC -BIN2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOHEX -BIN2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOOCT -BITAND | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITAND -BITLSHIFT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITLSHIFT -BITOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR -BITRSHIFT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITRSHIFT -BITXOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR -COMPLEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::COMPLEX -CONVERT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::CONVERTUOM -DEC2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOBIN -DEC2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOHEX -DEC2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOOCT -DELTA | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DELTA -ERF | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERF -ERF.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFPRECISE -ERFC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC -ERFC.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC -GESTEP | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::GESTEP -HEX2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOBIN -HEX2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTODEC -HEX2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOOCT -IMABS | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMABS -IMAGINARY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMAGINARY -IMARGUMENT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMARGUMENT -IMCONJUGATE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCONJUGATE -IMCOS | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOS -IMCOSH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOSH -IMCOT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOT -IMCSC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSC -IMCSCH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSCH -IMDIV | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMDIV -IMEXP | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMEXP -IMLN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLN -IMLOG10 | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG10 -IMLOG2 | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG2 -IMPOWER | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPOWER -IMPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPRODUCT -IMREAL | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMREAL -IMSEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSEC -IMSECH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSECH -IMSIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSIN -IMSINH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSINH -IMSQRT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSQRT -IMSUB | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUB -IMSUM | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUM -IMTAN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMTAN -OCT2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOBIN -OCT2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTODEC -OCT2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOHEX - -## CATEGORY_FINANCIAL - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -ACCRINT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINT -ACCRINTM | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINTM -AMORDEGRC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORDEGRC -AMORLINC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORLINC -COUPDAYBS | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYBS -COUPDAYS | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYS -COUPDAYSNC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYSNC -COUPNCD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNCD -COUPNUM | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNUM -COUPPCD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPPCD -CUMIPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMIPMT -CUMPRINC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMPRINC -DB | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DB -DDB | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DDB -DISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DISC -DOLLARDE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARDE -DOLLARFR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARFR -DURATION | **Not yet Implemented** -EFFECT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::EFFECT -FV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FV -FVSCHEDULE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FVSCHEDULE -INTRATE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::INTRATE -IPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IPMT -IRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IRR -ISPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ISPMT -MDURATION | **Not yet Implemented** -MIRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::MIRR -NOMINAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NOMINAL -NPER | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPER -NPV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPV -ODDFPRICE | **Not yet Implemented** -ODDFYIELD | **Not yet Implemented** -ODDLPRICE | **Not yet Implemented** -ODDLYIELD | **Not yet Implemented** -PDURATION | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PDURATION -PMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PMT -PPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PPMT -PRICE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICE -PRICEDISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEDISC -PRICEMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEMAT -PV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PV -RATE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RATE -RECEIVED | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RECEIVED -RRI | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RRI -SLN | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SLN -SYD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SYD -TBILLEQ | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLEQ -TBILLPRICE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLPRICE -TBILLYIELD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLYIELD -USDOLLAR | **Not yet Implemented** -VDB | **Not yet Implemented** -XIRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XIRR -XNPV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XNPV -YIELD | **Not yet Implemented** -YIELDDISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDDISC -YIELDMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDMAT - -## CATEGORY_INFORMATION - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -CELL | **Not yet Implemented** -ERROR.TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::errorType -INFO | **Not yet Implemented** -ISBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isBlank -ISERR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isErr -ISERROR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isError -ISEVEN | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isEven -ISFORMULA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isFormula -ISLOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isLogical -ISNA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNa -ISNONTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNonText -ISNUMBER | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNumber -ISODD | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isOdd -ISREF | **Not yet Implemented** -ISTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isText -N | \PhpOffice\PhpSpreadsheet\Calculation\Functions::n -NA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::NA -TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::TYPE - -## CATEGORY_LOGICAL - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd -FALSE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::FALSE -IF | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementIf -IFERROR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR -IFNA | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFNA -IFS | **Not yet Implemented** -NOT | \PhpOffice\PhpSpreadsheet\Calculation\Logical::NOT -OR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalOr -SWITCH | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementSwitch -TRUE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::TRUE -XOR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor - -## CATEGORY_LOOKUP_AND_REFERENCE - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -ADDRESS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::cellAddress -AREAS | **Not yet Implemented** -CHOOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CHOOSE -COLUMN | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMN -COLUMNS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMNS -FORMULATEXT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::FORMULATEXT -GETPIVOTDATA | **Not yet Implemented** -HLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HLOOKUP -HYPERLINK | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HYPERLINK -INDEX | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDEX -INDIRECT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDIRECT -LOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::LOOKUP -MATCH | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::MATCH -OFFSET | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::OFFSET -ROW | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROW -ROWS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROWS -RTD | **Not yet Implemented** -TRANSPOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::TRANSPOSE -VLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::VLOOKUP - -## CATEGORY_MATH_AND_TRIG - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -ABS | abs -ACOS | acos -ACOSH | acosh -ACOT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT -ACOTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH -ARABIC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ARABIC -ASIN | asin -ASINH | asinh -ATAN | atan -ATAN2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ATAN2 -ATANH | atanh -BASE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::BASE -CEILING | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CEILING -COMBIN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COMBIN -COS | cos -COSH | cosh -COT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COT -COTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COTH -CSC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSC -CSCH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSCH -DEGREES | rad2deg -EVEN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::EVEN -EXP | exp -FACT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACT -FACTDOUBLE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACTDOUBLE -FLOOR | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FLOOR -GCD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::GCD -INT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::INT -LCM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LCM -LN | log -LOG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::logBase -LOG10 | log10 -MDETERM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MDETERM -MINVERSE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MINVERSE -MMULT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MMULT -MOD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MOD -MROUND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MROUND -MULTINOMIAL | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MULTINOMIAL -ODD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ODD -PI | pi -POWER | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::POWER -PRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::PRODUCT -QUOTIENT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::QUOTIENT -RADIANS | deg2rad -RAND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND -RANDBETWEEN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND -ROMAN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROMAN -ROUND | round -ROUNDDOWN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDDOWN -ROUNDUP | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDUP -SEC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SEC -SECH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SECH -SERIESSUM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SERIESSUM -SIGN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SIGN -SIN | sin -SINH | sinh -SQRT | sqrt -SQRTPI | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SQRTPI -SUBTOTAL | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUBTOTAL -SUM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUM -SUMIF | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIF -SUMIFS | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIFS -SUMPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMPRODUCT -SUMSQ | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMSQ -SUMX2MY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2MY2 -SUMX2PY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2PY2 -SUMXMY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMXMY2 -TAN | tan -TANH | tanh -TRUNC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::TRUNC - -## CATEGORY_STATISTICAL - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -AVEDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVEDEV -AVERAGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGE -AVERAGEA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEA -AVERAGEIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEIF -AVERAGEIFS | **Not yet Implemented** -BETADIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETADIST -BETAINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETAINV -BINOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BINOMDIST -CHIDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIDIST -CHIINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIINV -CHITEST | **Not yet Implemented** -CONFIDENCE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CONFIDENCE -CORREL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL -COUNT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNT -COUNTA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTA -COUNTBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTBLANK -COUNTIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTIF -COUNTIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTIFS -COVAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COVAR -CRITBINOM | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CRITBINOM -DEVSQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::DEVSQ -EXPONDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::EXPONDIST -FDIST | **Not yet Implemented** -FINV | **Not yet Implemented** -FISHER | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHER -FISHERINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHERINV -FORECAST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FORECAST -FREQUENCY | **Not yet Implemented** -FTEST | **Not yet Implemented** -GAMMADIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMADIST -GAMMAINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMAINV -GAMMALN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMALN -GEOMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GEOMEAN -GROWTH | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GROWTH -HARMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HARMEAN -HYPGEOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HYPGEOMDIST -INTERCEPT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::INTERCEPT -KURT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::KURT -LARGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LARGE -LINEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LINEST -LOGEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGEST -LOGINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGINV -LOGNORMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGNORMDIST -MAX | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAX -MAXA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXA -MAXIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXIFS -MEDIAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MEDIAN -MEDIANIF | **Not yet Implemented** -MIN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MIN -MINA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINA -MINIFS | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINIFS -MODE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE -MODE.SNGL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE -NEGBINOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NEGBINOMDIST -NORMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMDIST -NORMINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMINV -NORMSDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSDIST -NORMSINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSINV -PEARSON | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL -PERCENTILE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTILE -PERCENTRANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTRANK -PERMUT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERMUT -POISSON | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::POISSON -PROB | **Not yet Implemented** -QUARTILE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::QUARTILE -RANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RANK -RSQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RSQ -SKEW | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SKEW -SLOPE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SLOPE -SMALL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SMALL -STANDARDIZE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STANDARDIZE -STDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV -STDEV.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP -STDEV.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV -STDEVA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVA -STDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP -STDEVPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVPA -STEYX | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STEYX -TDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TDIST -TINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TINV -TREND | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TREND -TRIMMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TRIMMEAN -TTEST | **Not yet Implemented** -VAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc -VAR.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP -VAR.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc -VARA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARA -VARP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP -VARPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARPA -WEIBULL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::WEIBULL -ZTEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::ZTEST - -## CATEGORY_TEXT_AND_DATA - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -ASC | **Not yet Implemented** -BAHTTEXT | **Not yet Implemented** -CHAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER -CLEAN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMNONPRINTABLE -CODE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE -CONCAT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE -CONCATENATE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE -DOLLAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::DOLLAR -EXACT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::EXACT -FIND | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE -FINDB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE -FIXED | \PhpOffice\PhpSpreadsheet\Calculation\TextData::FIXEDFORMAT -JIS | **Not yet Implemented** -LEFT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT -LEFTB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT -LEN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH -LENB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH -LOWER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LOWERCASE -MID | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID -MIDB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID -NUMBERVALUE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::NUMBERVALUE -PHONETIC | **Not yet Implemented** -PROPER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::PROPERCASE -REPLACE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE -REPLACEB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE -REPT | str_repeat -RIGHT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT -RIGHTB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT -SEARCH | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE -SEARCHB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE -SUBSTITUTE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SUBSTITUTE -T | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RETURNSTRING -TEXT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTFORMAT -TEXTJOIN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTJOIN -TRIM | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMSPACES -UNICHAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER -UNICODE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE -UPPER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::UPPERCASE -VALUE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::VALUE diff --git a/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-name.md b/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-name.md deleted file mode 100644 index 709b4b1d..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-name.md +++ /dev/null @@ -1,533 +0,0 @@ -# Function list by name - -## A - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -ABS | CATEGORY_MATH_AND_TRIG | abs -ACCRINT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINT -ACCRINTM | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINTM -ACOS | CATEGORY_MATH_AND_TRIG | acos -ACOSH | CATEGORY_MATH_AND_TRIG | acosh -ACOT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT -ACOTH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH -ADDRESS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::cellAddress -AMORDEGRC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORDEGRC -AMORLINC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORLINC -AND | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd -ARABIC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ARABIC -AREAS | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented** -ASC | CATEGORY_TEXT_AND_DATA | **Not yet Implemented** -ASIN | CATEGORY_MATH_AND_TRIG | asin -ASINH | CATEGORY_MATH_AND_TRIG | asinh -ATAN | CATEGORY_MATH_AND_TRIG | atan -ATAN2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ATAN2 -ATANH | CATEGORY_MATH_AND_TRIG | atanh -AVEDEV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVEDEV -AVERAGE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGE -AVERAGEA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEA -AVERAGEIF | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEIF -AVERAGEIFS | CATEGORY_STATISTICAL | **Not yet Implemented** - -## B - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -BAHTTEXT | CATEGORY_TEXT_AND_DATA | **Not yet Implemented** -BASE | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::BASE -BESSELI | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELI -BESSELJ | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELJ -BESSELK | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELK -BESSELY | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELY -BETADIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETADIST -BETAINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETAINV -BIN2DEC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTODEC -BIN2HEX | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOHEX -BIN2OCT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOOCT -BINOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BINOMDIST -BITAND | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITAND -BITLSHIFT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITLSHIFT -BITOR | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR -BITRSHIFT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITRSHIFT -BITXOR | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR - -## C - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -CEILING | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CEILING -CELL | CATEGORY_INFORMATION | **Not yet Implemented** -CHAR | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER -CHIDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIDIST -CHIINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIINV -CHITEST | CATEGORY_STATISTICAL | **Not yet Implemented** -CHOOSE | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CHOOSE -CLEAN | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMNONPRINTABLE -CODE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE -COLUMN | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMN -COLUMNS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMNS -COMBIN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COMBIN -COMPLEX | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::COMPLEX -CONCAT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE -CONCATENATE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE -CONFIDENCE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CONFIDENCE -CONVERT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::CONVERTUOM -CORREL | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL -COS | CATEGORY_MATH_AND_TRIG | cos -COSH | CATEGORY_MATH_AND_TRIG | cosh -COT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COT -COTH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COTH -COUNT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNT -COUNTA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTA -COUNTBLANK | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTBLANK -COUNTIF | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTIF -COUNTIFS | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTIFS -COUPDAYBS | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYBS -COUPDAYS | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYS -COUPDAYSNC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYSNC -COUPNCD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNCD -COUPNUM | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNUM -COUPPCD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPPCD -COVAR | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COVAR -CRITBINOM | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CRITBINOM -CSC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSC -CSCH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSCH -CUBEKPIMEMBER | CATEGORY_CUBE | **Not yet Implemented** -CUBEMEMBER | CATEGORY_CUBE | **Not yet Implemented** -CUBEMEMBERPROPERTY | CATEGORY_CUBE | **Not yet Implemented** -CUBERANKEDMEMBER | CATEGORY_CUBE | **Not yet Implemented** -CUBESET | CATEGORY_CUBE | **Not yet Implemented** -CUBESETCOUNT | CATEGORY_CUBE | **Not yet Implemented** -CUBEVALUE | CATEGORY_CUBE | **Not yet Implemented** -CUMIPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMIPMT -CUMPRINC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMPRINC - -## D - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -DATE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATE -DATEDIF | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEDIF -DATEVALUE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEVALUE -DAVERAGE | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DAVERAGE -DAY | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYOFMONTH -DAYS | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS -DAYS360 | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS360 -DB | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DB -DCOUNT | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNT -DCOUNTA | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNTA -DDB | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DDB -DEC2BIN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOBIN -DEC2HEX | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOHEX -DEC2OCT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOOCT -DEGREES | CATEGORY_MATH_AND_TRIG | rad2deg -DELTA | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DELTA -DEVSQ | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::DEVSQ -DGET | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DGET -DISC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DISC -DMAX | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMAX -DMIN | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMIN -DOLLAR | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::DOLLAR -DOLLARDE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARDE -DOLLARFR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARFR -DPRODUCT | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DPRODUCT -DSTDEV | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEV -DSTDEVP | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEVP -DSUM | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSUM -DURATION | CATEGORY_FINANCIAL | **Not yet Implemented** -DVAR | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVAR -DVARP | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVARP - -## E - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -EDATE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EDATE -EFFECT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::EFFECT -EOMONTH | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EOMONTH -ERF | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERF -ERF.PRECISE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFPRECISE -ERFC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC -ERFC.PRECISE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC -ERROR.TYPE | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::errorType -EVEN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::EVEN -EXACT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::EXACT -EXP | CATEGORY_MATH_AND_TRIG | exp -EXPONDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::EXPONDIST - -## F - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -FACT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACT -FACTDOUBLE | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACTDOUBLE -FALSE | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::FALSE -FDIST | CATEGORY_STATISTICAL | **Not yet Implemented** -FIND | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE -FINDB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE -FINV | CATEGORY_STATISTICAL | **Not yet Implemented** -FISHER | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHER -FISHERINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHERINV -FIXED | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::FIXEDFORMAT -FLOOR | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FLOOR -FORECAST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FORECAST -FORMULATEXT | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::FORMULATEXT -FREQUENCY | CATEGORY_STATISTICAL | **Not yet Implemented** -FTEST | CATEGORY_STATISTICAL | **Not yet Implemented** -FV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FV -FVSCHEDULE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FVSCHEDULE - -## G - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -GAMMADIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMADIST -GAMMAINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMAINV -GAMMALN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMALN -GCD | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::GCD -GEOMEAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GEOMEAN -GESTEP | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::GESTEP -GETPIVOTDATA | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented** -GROWTH | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GROWTH - -## H - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -HARMEAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HARMEAN -HEX2BIN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOBIN -HEX2DEC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTODEC -HEX2OCT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOOCT -HLOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HLOOKUP -HOUR | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::HOUROFDAY -HYPERLINK | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HYPERLINK -HYPGEOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HYPGEOMDIST - -## I - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -IF | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementIf -IFERROR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR -IFNA | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFNA -IFS | CATEGORY_LOGICAL | **Not yet Implemented** -IMABS | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMABS -IMAGINARY | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMAGINARY -IMARGUMENT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMARGUMENT -IMCONJUGATE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCONJUGATE -IMCOS | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOS -IMCOSH | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOSH -IMCOT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOT -IMCSC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSC -IMCSCH | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSCH -IMDIV | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMDIV -IMEXP | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMEXP -IMLN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLN -IMLOG10 | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG10 -IMLOG2 | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG2 -IMPOWER | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPOWER -IMPRODUCT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPRODUCT -IMREAL | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMREAL -IMSEC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSEC -IMSECH | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSECH -IMSIN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSIN -IMSINH | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSINH -IMSQRT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSQRT -IMSUB | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUB -IMSUM | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUM -IMTAN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMTAN -INDEX | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDEX -INDIRECT | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDIRECT -INFO | CATEGORY_INFORMATION | **Not yet Implemented** -INT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::INT -INTERCEPT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::INTERCEPT -INTRATE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::INTRATE -IPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IPMT -IRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IRR -ISBLANK | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isBlank -ISERR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isErr -ISERROR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isError -ISEVEN | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isEven -ISFORMULA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isFormula -ISLOGICAL | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isLogical -ISNA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNa -ISNONTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNonText -ISNUMBER | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNumber -ISODD | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isOdd -ISOWEEKNUM | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::ISOWEEKNUM -ISPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ISPMT -ISREF | CATEGORY_INFORMATION | **Not yet Implemented** -ISTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isText - -## J - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -JIS | CATEGORY_TEXT_AND_DATA | **Not yet Implemented** - -## K - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -KURT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::KURT - -## L - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -LARGE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LARGE -LCM | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LCM -LEFT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT -LEFTB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT -LEN | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH -LENB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH -LINEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LINEST -LN | CATEGORY_MATH_AND_TRIG | log -LOG | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::logBase -LOG10 | CATEGORY_MATH_AND_TRIG | log10 -LOGEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGEST -LOGINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGINV -LOGNORMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGNORMDIST -LOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::LOOKUP -LOWER | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LOWERCASE - -## M - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -MATCH | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::MATCH -MAX | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAX -MAXA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXA -MAXIFS | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXIFS -MDETERM | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MDETERM -MDURATION | CATEGORY_FINANCIAL | **Not yet Implemented** -MEDIAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MEDIAN -MEDIANIF | CATEGORY_STATISTICAL | **Not yet Implemented** -MID | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID -MIDB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID -MIN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MIN -MINA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINA -MINIFS | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINIFS -MINUTE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MINUTE -MINVERSE | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MINVERSE -MIRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::MIRR -MMULT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MMULT -MOD | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MOD -MODE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE -MODE.SNGL | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE -MONTH | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MONTHOFYEAR -MROUND | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MROUND -MULTINOMIAL | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MULTINOMIAL - -## N - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -N | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::n -NA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::NA -NEGBINOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NEGBINOMDIST -NETWORKDAYS | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::NETWORKDAYS -NETWORKDAYS.INTL | CATEGORY_DATE_AND_TIME | **Not yet Implemented** -NOMINAL | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NOMINAL -NORMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMDIST -NORMINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMINV -NORMSDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSDIST -NORMSINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSINV -NOT | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::NOT -NOW | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATETIMENOW -NPER | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPER -NPV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPV -NUMBERVALUE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::NUMBERVALUE - -## O - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -OCT2BIN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOBIN -OCT2DEC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTODEC -OCT2HEX | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOHEX -ODD | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ODD -ODDFPRICE | CATEGORY_FINANCIAL | **Not yet Implemented** -ODDFYIELD | CATEGORY_FINANCIAL | **Not yet Implemented** -ODDLPRICE | CATEGORY_FINANCIAL | **Not yet Implemented** -ODDLYIELD | CATEGORY_FINANCIAL | **Not yet Implemented** -OFFSET | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::OFFSET -OR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalOr - -## P - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -PDURATION | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PDURATION -PEARSON | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL -PERCENTILE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTILE -PERCENTRANK | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTRANK -PERMUT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERMUT -PHONETIC | CATEGORY_TEXT_AND_DATA | **Not yet Implemented** -PI | CATEGORY_MATH_AND_TRIG | pi -PMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PMT -POISSON | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::POISSON -POWER | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::POWER -PPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PPMT -PRICE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICE -PRICEDISC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEDISC -PRICEMAT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEMAT -PROB | CATEGORY_STATISTICAL | **Not yet Implemented** -PRODUCT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::PRODUCT -PROPER | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::PROPERCASE -PV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PV - -## Q - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -QUARTILE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::QUARTILE -QUOTIENT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::QUOTIENT - -## R - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -RADIANS | CATEGORY_MATH_AND_TRIG | deg2rad -RAND | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND -RANDBETWEEN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND -RANK | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RANK -RATE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RATE -RECEIVED | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RECEIVED -REPLACE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE -REPLACEB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE -REPT | CATEGORY_TEXT_AND_DATA | str_repeat -RIGHT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT -RIGHTB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT -ROMAN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROMAN -ROUND | CATEGORY_MATH_AND_TRIG | round -ROUNDDOWN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDDOWN -ROUNDUP | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDUP -ROW | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROW -ROWS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROWS -RRI | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RRI -RSQ | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RSQ -RTD | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented** - -## S - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -SEARCH | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE -SEARCHB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE -SEC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SEC -SECH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SECH -SECOND | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::SECOND -SERIESSUM | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SERIESSUM -SIGN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SIGN -SIN | CATEGORY_MATH_AND_TRIG | sin -SINH | CATEGORY_MATH_AND_TRIG | sinh -SKEW | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SKEW -SLN | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SLN -SLOPE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SLOPE -SMALL | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SMALL -SQRT | CATEGORY_MATH_AND_TRIG | sqrt -SQRTPI | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SQRTPI -STANDARDIZE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STANDARDIZE -STDEV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV -STDEV.P | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP -STDEV.S | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV -STDEVA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVA -STDEVP | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP -STDEVPA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVPA -STEYX | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STEYX -SUBSTITUTE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SUBSTITUTE -SUBTOTAL | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUBTOTAL -SUM | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUM -SUMIF | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIF -SUMIFS | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIFS -SUMPRODUCT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMPRODUCT -SUMSQ | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMSQ -SUMX2MY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2MY2 -SUMX2PY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2PY2 -SUMXMY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMXMY2 -SWITCH | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementSwitch -SYD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SYD - -## T - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -T | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RETURNSTRING -TAN | CATEGORY_MATH_AND_TRIG | tan -TANH | CATEGORY_MATH_AND_TRIG | tanh -TBILLEQ | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLEQ -TBILLPRICE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLPRICE -TBILLYIELD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLYIELD -TDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TDIST -TEXT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTFORMAT -TEXTJOIN | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTJOIN -TIME | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIME -TIMEVALUE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIMEVALUE -TINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TINV -TODAY | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATENOW -TRANSPOSE | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::TRANSPOSE -TREND | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TREND -TRIM | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMSPACES -TRIMMEAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TRIMMEAN -TRUE | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::TRUE -TRUNC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::TRUNC -TTEST | CATEGORY_STATISTICAL | **Not yet Implemented** -TYPE | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::TYPE - -## U - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -UNICHAR | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER -UNICODE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE -UPPER | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::UPPERCASE -USDOLLAR | CATEGORY_FINANCIAL | **Not yet Implemented** - -## V - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -VALUE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::VALUE -VAR | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc -VAR.P | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP -VAR.S | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc -VARA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARA -VARP | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP -VARPA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARPA -VDB | CATEGORY_FINANCIAL | **Not yet Implemented** -VLOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::VLOOKUP - -## W - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -WEEKDAY | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKDAY -WEEKNUM | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKNUM -WEIBULL | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::WEIBULL -WORKDAY | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WORKDAY -WORKDAY.INTL | CATEGORY_DATE_AND_TIME | **Not yet Implemented** - -## X - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -XIRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XIRR -XNPV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XNPV -XOR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor - -## Y - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -YEAR | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEAR -YEARFRAC | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEARFRAC -YIELD | CATEGORY_FINANCIAL | **Not yet Implemented** -YIELDDISC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDDISC -YIELDMAT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDMAT - -## Z - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -ZTEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::ZTEST diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/accessing-cells.md b/vendor/phpoffice/phpspreadsheet/docs/topics/accessing-cells.md deleted file mode 100644 index 4770d721..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/accessing-cells.md +++ /dev/null @@ -1,556 +0,0 @@ -# Accessing cells - -Accessing cells in a Spreadsheet should be pretty straightforward. This -topic lists some of the options to access a cell. - -## Setting a cell value by coordinate - -Setting a cell value by coordinate can be done using the worksheet's -`setCellValue()` method. - -``` php -// Set cell A1 with a string value -$spreadsheet->getActiveSheet()->setCellValue('A1', 'PhpSpreadsheet'); - -// Set cell A2 with a numeric value -$spreadsheet->getActiveSheet()->setCellValue('A2', 12345.6789); - -// Set cell A3 with a boolean value -$spreadsheet->getActiveSheet()->setCellValue('A3', TRUE); - -// Set cell A4 with a formula -$spreadsheet->getActiveSheet()->setCellValue( - 'A4', - '=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))' -); -``` - -Alternatively, you can retrieve the cell object, and then call the -cell’s `setValue()` method: - -``` php -$spreadsheet->getActiveSheet() - ->getCell('B8') - ->setValue('Some value'); -``` - -### Creating a new Cell - -If you make a call to `getCell()`, and the cell doesn't already exist, then -PhpSpreadsheet will (by default) create the cell for you. If you don't want -to create a new cell, then you can pass a second argument of false, and then -`getCell()` will return a null if the cell doesn't exist. - -### BEWARE: Cells assigned to variables as a Detached Reference - -As an "in-memory" model, PHPSpreadsheet can be very demanding of memory, -particularly when working with large spreadsheets. One technique used to -reduce this memory overhead is cell caching, so cells are actually -maintained in a collection that may or may not be held in memory while you -are working with the spreadsheet. Because of this, a call to `getCell()` -(or any similar method) returns the cell data, and a pointer to the collection. -While this is not normally an issue, it can become significant -if you assign the result of a call to `getCell()` to a variable. Any -subsequent calls to retrieve other cells will unset that pointer, although -the cell object will still retain its data values. - -What does this mean? Consider the following code: - -``` -$spreadSheet = new Spreadsheet(); -$workSheet = $spreadSheet->getActiveSheet(); - -// Set details for the formula that we want to evaluate, together with any data on which it depends -$workSheet->fromArray( - [1, 2, 3], - null, - 'A1' -); - -$cellC1 = $workSheet->getCell('C1'); -echo 'Value: ', $cellC1->getValue(), '; Address: ', $cellC1->getCoordinate(), PHP_EOL; - -$cellA1 = $workSheet->getCell('A1'); -echo 'Value: ', $cellA1->getValue(), '; Address: ', $cellA1->getCoordinate(), PHP_EOL; - -echo 'Value: ', $cellC1->getValue(), '; Address: ', $cellC1->getCoordinate(), PHP_EOL; -``` - -The call to `getCell('C1')` returns the cell at `C1` containing its value (`3`), -together with its link to the collection (used to identify its -address/coordinate `C1`). The subsequent call to access cell `A1` -modifies the value of `$cellC1`, detaching its link to the collection. - -So when we try to display the value and address a second time, we can display -its value, but trying to display its address/coordinate will throw an -exception because that link has been set to null. - -__Note:__ There are some internal methods that will fetch other cells from the -collection, and this too will detach the link to the collection from any cell -that you might have assigned to a variable. - -## Excel DataTypes - -MS Excel supports 7 basic datatypes: - -- string -- number -- boolean -- null -- formula -- error -- Inline (or rich text) string - -By default, when you call the worksheet's `setCellValue()` method or the -cell's `setValue()` method, PhpSpreadsheet will use the appropriate -datatype for PHP nulls, booleans, floats or integers; or cast any string -data value that you pass to the method into the most appropriate -datatype, so numeric strings will be cast to numbers, while string -values beginning with `=` will be converted to a formula. Strings that -aren't numeric, or that don't begin with a leading `=` will be treated -as genuine string values. - -This "conversion" is handled by a cell "value binder", and you can write -custom "value binders" to change the behaviour of these "conversions". -The standard PhpSpreadsheet package also provides an "advanced value -binder" that handles a number of more complex conversions, such as -converting strings with a fractional format like "3/4" to a number value -(0.75 in this case) and setting an appropriate "fraction" number format -mask. Similarly, strings like "5%" will be converted to a value of 0.05, -and a percentage number format mask applied, and strings containing -values that look like dates will be converted to Excel serialized -datetimestamp values, and a corresponding mask applied. This is -particularly useful when loading data from csv files, or setting cell -values from a database. - -Formats handled by the advanced value binder include: - -- TRUE or FALSE (dependent on locale settings) are converted to booleans. -- Numeric strings identified as scientific (exponential) format are - converted to numbers. -- Fractions and vulgar fractions are converted to numbers, and - an appropriate number format mask applied. -- Percentages are converted - to numbers, divided by 100, and an appropriate number format mask - applied. -- Dates and times are converted to Excel timestamp values - (numbers), and an appropriate number format mask applied. -- When strings contain a newline character (`\n`), then the cell styling is - set to wrap. - -You can read more about value binders later in this section of the -documentation. - -### Setting a formula in a Cell - -As stated above, if you store a string value with the first character an `=` -in a cell. PHPSpreadsheet will treat that value as a formula, and then you -can evaluate that formula by calling `getCalculatedValue()` against the cell. - -There may be times though, when you wish to store a value beginning with `=` -as a string, and that you don't want PHPSpreadsheet to evaluate as though it -was a formula. - -To do this, you need to "escape" the value by setting it as "quoted text". - -``` -// Set cell A4 with a formula -$spreadsheet->getActiveSheet()->setCellValue( - 'A4', - '=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))' -); -$spreadsheet->getActiveSheet()->getCell('A4') - ->getStyle()->setQuotePrefix(true); -``` - -Then, even if you ask PHPSpreadsheet to return the calculated value for cell -`A4`, it will return `=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))` -as a string, and not try to evaluate the formula. - - -### Setting a date and/or time value in a cell - -Date or time values are held as timestamp in Excel (a simple floating -point value), and a number format mask is used to show how that value -should be formatted; so if we want to store a date in a cell, we need to -calculate the correct Excel timestamp, and set a number format mask. - -``` php -// Get the current date/time and convert to an Excel date/time -$dateTimeNow = time(); -$excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow ); -// Set cell A6 with the Excel date/time value -$spreadsheet->getActiveSheet()->setCellValue( - 'A6', - $excelDateValue -); -// Set the number format mask so that the excel timestamp will be displayed as a human-readable date/time -$spreadsheet->getActiveSheet()->getStyle('A6') - ->getNumberFormat() - ->setFormatCode( - \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME - ); -``` - -### Setting a number with leading zeroes - -By default, PhpSpreadsheet will automatically detect the value type and -set it to the appropriate Excel numeric datatype. This type conversion -is handled by a value binder, as described in the section of this -document entitled "Using value binders to facilitate data entry". - -Numbers don't have leading zeroes, so if you try to set a numeric value -that does have leading zeroes (such as a telephone number) then these -will be normally be lost as the value is cast to a number, so -"01513789642" will be displayed as 1513789642. - -There are two ways you can force PhpSpreadsheet to override this -behaviour. - -Firstly, you can set the datatype explicitly as a string so that it is -not converted to a number. - -``` php -// Set cell A8 with a numeric value, but tell PhpSpreadsheet it should be treated as a string -$spreadsheet->getActiveSheet()->setCellValueExplicit( - 'A8', - "01513789642", - \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING -); -``` - -Alternatively, you can use a number format mask to display the value -with leading zeroes. - -``` php -// Set cell A9 with a numeric value -$spreadsheet->getActiveSheet()->setCellValue('A9', 1513789642); -// Set a number format mask to display the value as 11 digits with leading zeroes -$spreadsheet->getActiveSheet()->getStyle('A9') - ->getNumberFormat() - ->setFormatCode( - '00000000000' - ); -``` - -With number format masking, you can even break up the digits into groups -to make the value more easily readable. - -``` php -// Set cell A10 with a numeric value -$spreadsheet->getActiveSheet()->setCellValue('A10', 1513789642); -// Set a number format mask to display the value as 11 digits with leading zeroes -$spreadsheet->getActiveSheet()->getStyle('A10') - ->getNumberFormat() - ->setFormatCode( - '0000-000-0000' - ); -``` - -![07-simple-example-1.png](./images/07-simple-example-1.png) - -**Note:** that not all complex format masks such as this one will work -when retrieving a formatted value to display "on screen", or for certain -writers such as HTML or PDF, but it will work with the true spreadsheet -writers (Xlsx and Xls). - -## Setting a range of cells from an array - -It is also possible to set a range of cell values in a single call by -passing an array of values to the `fromArray()` method. - -``` php -$arrayData = [ - [NULL, 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], -]; -$spreadsheet->getActiveSheet() - ->fromArray( - $arrayData, // The data to set - NULL, // Array values with this value will not be set - 'C3' // Top left coordinate of the worksheet range where - // we want to set these values (default is A1) - ); -``` - -![07-simple-example-2.png](./images/07-simple-example-2.png) - -If you pass a 2-d array, then this will be treated as a series of rows -and columns. A 1-d array will be treated as a single row, which is -particularly useful if you're fetching an array of data from a database. - -``` php -$rowArray = ['Value1', 'Value2', 'Value3', 'Value4']; -$spreadsheet->getActiveSheet() - ->fromArray( - $rowArray, // The data to set - NULL, // Array values with this value will not be set - 'C3' // Top left coordinate of the worksheet range where - // we want to set these values (default is A1) - ); -``` - -![07-simple-example-3.png](./images/07-simple-example-3.png) - -If you have a simple 1-d array, and want to write it as a column, then -the following will convert it into an appropriately structured 2-d array -that can be fed to the `fromArray()` method: - -``` php -$rowArray = ['Value1', 'Value2', 'Value3', 'Value4']; -$columnArray = array_chunk($rowArray, 1); -$spreadsheet->getActiveSheet() - ->fromArray( - $columnArray, // The data to set - NULL, // Array values with this value will not be set - 'C3' // Top left coordinate of the worksheet range where - // we want to set these values (default is A1) - ); -``` - -![07-simple-example-4.png](./images/07-simple-example-4.png) - -## Retrieving a cell value by coordinate - -To retrieve the value of a cell, the cell should first be retrieved from -the worksheet using the `getCell()` method. A cell's value can be read -using the `getValue()` method. - -``` php -// Get the value from cell A1 -$cellValue = $spreadsheet->getActiveSheet()->getCell('A1')->getValue(); -``` - -This will retrieve the raw, unformatted value contained in the cell. - -If a cell contains a formula, and you need to retrieve the calculated -value rather than the formula itself, then use the cell's -`getCalculatedValue()` method. This is further explained in -[the calculation engine](./calculation-engine.md). - -``` php -// Get the value from cell A4 -$cellValue = $spreadsheet->getActiveSheet()->getCell('A4')->getCalculatedValue(); -``` - -Alternatively, if you want to see the value with any cell formatting -applied (e.g. for a human-readable date or time value), then you can use -the cell's `getFormattedValue()` method. - -``` php -// Get the value from cell A6 -$cellValue = $spreadsheet->getActiveSheet()->getCell('A6')->getFormattedValue(); -``` - -## Setting a cell value by column and row - -Setting a cell value by coordinate can be done using the worksheet's -`setCellValueByColumnAndRow()` method. - -``` php -// Set cell A5 with a string value -$spreadsheet->getActiveSheet()->setCellValueByColumnAndRow(1, 5, 'PhpSpreadsheet'); -``` - -**Note:** that column references start with `1` for column `A`. - -## Retrieving a cell value by column and row - -To retrieve the value of a cell, the cell should first be retrieved from -the worksheet using the `getCellByColumnAndRow()` method. A cell’s value can -be read again using the following line of code: - -``` php -// Get the value from cell B5 -$cellValue = $spreadsheet->getActiveSheet()->getCellByColumnAndRow(2, 5)->getValue(); -``` - -If you need the calculated value of a cell, use the following code. This -is further explained in [the calculation engine](./calculation-engine.md). - -``` php -// Get the value from cell A4 -$cellValue = $spreadsheet->getActiveSheet()->getCellByColumnAndRow(1, 4)->getCalculatedValue(); -``` - -## Retrieving a range of cell values to an array - -It is also possible to retrieve a range of cell values to an array in a -single call using the `toArray()`, `rangeToArray()` or -`namedRangeToArray()` methods. - -``` php -$dataArray = $spreadsheet->getActiveSheet() - ->rangeToArray( - 'C3:E5', // The worksheet range that we want to retrieve - NULL, // Value that should be returned for empty cells - TRUE, // Should formulas be calculated (the equivalent of getCalculatedValue() for each cell) - TRUE, // Should values be formatted (the equivalent of getFormattedValue() for each cell) - TRUE // Should the array be indexed by cell row and cell column - ); -``` - -These methods will all return a 2-d array of rows and columns. The -`toArray()` method will return the whole worksheet; `rangeToArray()` -will return a specified range or cells; while `namedRangeToArray()` will -return the cells within a defined `named range`. - -## Looping through cells - -### Looping through cells using iterators - -The easiest way to loop cells is by using iterators. Using iterators, -one can use foreach to loop worksheets, rows within a worksheet, and -cells within a row. - -Below is an example where we read all the values in a worksheet and -display them in a table. - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); -$reader->setReadDataOnly(TRUE); -$spreadsheet = $reader->load("test.xlsx"); - -$worksheet = $spreadsheet->getActiveSheet(); - -echo '' . PHP_EOL; -foreach ($worksheet->getRowIterator() as $row) { - echo '' . PHP_EOL; - $cellIterator = $row->getCellIterator(); - $cellIterator->setIterateOnlyExistingCells(FALSE); // This loops through all cells, - // even if a cell value is not set. - // By default, only cells that have a value - // set will be iterated. - foreach ($cellIterator as $cell) { - echo '' . PHP_EOL; - } - echo '' . PHP_EOL; -} -echo '
' . - $cell->getValue() . - '
' . PHP_EOL; -``` - -Note that we have set the cell iterator's -`setIterateOnlyExistingCells()` to FALSE. This makes the iterator loop -all cells within the worksheet range, even if they have not been set. - -The cell iterator will return a `null` as the cell value if it is not -set in the worksheet. Setting the cell iterator's -`setIterateOnlyExistingCells()` to `false` will loop all cells in the -worksheet that can be available at that moment. This will create new -cells if required and increase memory usage! Only use it if it is -intended to loop all cells that are possibly available. - -### Looping through cells using indexes - -One can use the possibility to access cell values by column and row -index like `[1, 1]` instead of `'A1'` for reading and writing cell values in -loops. - -**Note:** In PhpSpreadsheet column index and row index are 1-based. That means `'A1'` ~ `[1, 1]` - -Below is an example where we read all the values in a worksheet and -display them in a table. - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); -$reader->setReadDataOnly(TRUE); -$spreadsheet = $reader->load("test.xlsx"); - -$worksheet = $spreadsheet->getActiveSheet(); -// Get the highest row and column numbers referenced in the worksheet -$highestRow = $worksheet->getHighestRow(); // e.g. 10 -$highestColumn = $worksheet->getHighestColumn(); // e.g 'F' -$highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highestColumn); // e.g. 5 - -echo '' . "\n"; -for ($row = 1; $row <= $highestRow; ++$row) { - echo '' . PHP_EOL; - for ($col = 1; $col <= $highestColumnIndex; ++$col) { - $value = $worksheet->getCellByColumnAndRow($col, $row)->getValue(); - echo '' . PHP_EOL; - } - echo '' . PHP_EOL; -} -echo '
' . $value . '
' . PHP_EOL; -``` - -Alternatively, you can take advantage of PHP's "Perl-style" character -incrementors to loop through the cells by coordinate: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); -$reader->setReadDataOnly(TRUE); -$spreadsheet = $reader->load("test.xlsx"); - -$worksheet = $spreadsheet->getActiveSheet(); -// Get the highest row number and column letter referenced in the worksheet -$highestRow = $worksheet->getHighestRow(); // e.g. 10 -$highestColumn = $worksheet->getHighestColumn(); // e.g 'F' -// Increment the highest column letter -$highestColumn++; - -echo '' . "\n"; -for ($row = 1; $row <= $highestRow; ++$row) { - echo '' . PHP_EOL; - for ($col = 'A'; $col != $highestColumn; ++$col) { - echo '' . PHP_EOL; - } - echo '' . PHP_EOL; -} -echo '
' . - $worksheet->getCell($col . $row) - ->getValue() . - '
' . PHP_EOL; -``` - -Note that we can't use a `<=` comparison here, because `'AA'` would match -as `<= 'B'`, so we increment the highest column letter and then loop -while `$col !=` the incremented highest column. - -## Using value binders to facilitate data entry - -Internally, PhpSpreadsheet uses a default -`\PhpOffice\PhpSpreadsheet\Cell\IValueBinder` implementation -(\PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder) to determine data -types of entered data using a cell's `setValue()` method (the -`setValueExplicit()` method bypasses this check). - -Optionally, the default behaviour of PhpSpreadsheet can be modified, -allowing easier data entry. For example, a -`\PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder` class is available. -It automatically converts percentages, number in scientific format, and -dates entered as strings to the correct format, also setting the cell's -style information. The following example demonstrates how to set the -value binder in PhpSpreadsheet: - -``` php -/** PhpSpreadsheet */ -require_once 'src/Boostrap.php'; - -// Set value binder -\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); - -// Create new Spreadsheet object -$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); - -// ... -// Add some data, resembling some different data types -$spreadsheet->getActiveSheet()->setCellValue('A4', 'Percentage value:'); -// Converts the string value to 0.1 and sets percentage cell style -$spreadsheet->getActiveSheet()->setCellValue('B4', '10%'); - -$spreadsheet->getActiveSheet()->setCellValue('A5', 'Date/time value:'); -// Converts the string value to an Excel datestamp and sets the date format cell style -$spreadsheet->getActiveSheet()->setCellValue('B5', '21 December 1983'); -``` - -**Creating your own value binder is easy.** When advanced value binding -is required, you can implement the -`\PhpOffice\PhpSpreadsheet\Cell\IValueBinder` interface or extend the -`\PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder` or -`\PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder` classes. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/architecture.md b/vendor/phpoffice/phpspreadsheet/docs/topics/architecture.md deleted file mode 100644 index 0295d672..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/architecture.md +++ /dev/null @@ -1,75 +0,0 @@ -# Architecture - -## Schematical - -![01-schematic.png](./images/01-schematic.png "Basic Architecture Schematic") - -## AutoLoader - -PhpSpreadsheet relies on Composer autoloader. So before working with -PhpSpreadsheet in standalone, be sure to run `composer install`. Or add it to a -pre-existing project with `composer require phpoffice/phpspreadsheet`. - -## Spreadsheet in memory - -PhpSpreadsheet's architecture is built in a way that it can serve as an -in-memory spreadsheet. This means that, if one would want to create a -web based view of a spreadsheet which communicates with PhpSpreadsheet's -object model, he would only have to write the front-end code. - -Just like desktop spreadsheet software, PhpSpreadsheet represents a -spreadsheet containing one or more worksheets, which contain cells with -data, formulas, images, ... - -## Readers and writers - -On its own, the `Spreadsheet` class does not provide the functionality -to read from or write to a persisted spreadsheet (on disk or in a -database). To provide that functionality, readers and writers can be -used. - -By default, the PhpSpreadsheet package provides some readers and -writers, including one for the Open XML spreadsheet format (a.k.a. Excel -2007 file format). You are not limited to the default readers and -writers, as you are free to implement the -`\PhpOffice\PhpSpreadsheet\Reader\IReader` and -`\PhpOffice\PhpSpreadsheet\Writer\IWriter` interface in a custom class. - -![02-readers-writers.png](./images/02-readers-writers.png "Readers/Writers") - -## Fluent interfaces - -PhpSpreadsheet supports fluent interfaces in most locations. This means -that you can easily "chain" calls to specific methods without requiring -a new PHP statement. For example, take the following code: - -``` php -$spreadsheet->getProperties()->setCreator("Maarten Balliauw"); -$spreadsheet->getProperties()->setLastModifiedBy("Maarten Balliauw"); -$spreadsheet->getProperties()->setTitle("Office 2007 XLSX Test Document"); -$spreadsheet->getProperties()->setSubject("Office 2007 XLSX Test Document"); -$spreadsheet->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes."); -$spreadsheet->getProperties()->setKeywords("office 2007 openxml php"); -$spreadsheet->getProperties()->setCategory("Test result file"); -``` - -This can be rewritten as: - -``` php -$spreadsheet->getProperties() - ->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); -``` - -> **Using fluent interfaces is not required** Fluent interfaces have -> been implemented to provide a convenient programming API. Use of them -> is not required, but can make your code easier to read and maintain. -> It can also improve performance, as you are reducing the overall -> number of calls to PhpSpreadsheet methods: in the above example, the -> `getProperties()` method is being called only once rather than 7 times -> in the non-fluent version. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/autofilters.md b/vendor/phpoffice/phpspreadsheet/docs/topics/autofilters.md deleted file mode 100644 index 66321ee9..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/autofilters.md +++ /dev/null @@ -1,530 +0,0 @@ -# AutoFilter Reference - -## Introduction - -Each worksheet in an Excel Workbook can contain a single autoFilter -range. Filtered data displays only the rows that meet criteria that you -specify and hides rows that you do not want displayed. You can filter by -more than one column: filters are additive, which means that each -additional filter is based on the current filter and further reduces the -subset of data. - -![01-01-autofilter.png](./images/01-01-autofilter.png) - -When an AutoFilter is applied to a range of cells, the first row in an -autofilter range will be the heading row, which displays the autoFilter -dropdown icons. It is not part of the actual autoFiltered data. All -subsequent rows are the autoFiltered data. So an AutoFilter range should -always contain the heading row and one or more data rows (one data row -is pretty meaningless), but PhpSpreadsheet won't actually stop you -specifying a meaningless range: it's up to you as a developer to avoid -such errors. - -To determine if a filter is applied, note the icon in the column -heading. A drop-down arrow -(![01-03-filter-icon-1.png](./images/01-03-filter-icon-1.png)) means -that filtering is enabled but not applied. In MS Excel, when you hover -over the heading of a column with filtering enabled but not applied, a -screen tip displays the cell text for the first row in that column, and -the message "(Showing All)". - -![01-02-autofilter.png](./images/01-02-autofilter.png) - -A Filter button -(![01-03-filter-icon-2.png](./images/01-03-filter-icon-2.png)) means -that a filter is applied. When you hover over the heading of a filtered -column, a screen tip displays the filter that has been applied to that -column, such as "Equals a red cell color" or "Larger than 150". - -![01-04-autofilter.png](./images/01-04-autofilter.png) - -## Setting an AutoFilter area on a worksheet - -To set an autoFilter on a range of cells. - -``` php -$spreadsheet->getActiveSheet()->setAutoFilter('A1:E20'); -``` - -The first row in an autofilter range will be the heading row, which -displays the autoFilter dropdown icons. It is not part of the actual -autoFiltered data. All subsequent rows are the autoFiltered data. So an -AutoFilter range should always contain the heading row and one or more -data rows (one data row is pretty meaningless, but PhpSpreadsheet won't -actually stop you specifying a meaningless range: it's up to you as a -developer to avoid such errors. - -If you want to set the whole worksheet as an autofilter region - -``` php -$spreadsheet->getActiveSheet()->setAutoFilter( - $spreadsheet->getActiveSheet() - ->calculateWorksheetDimension() -); -``` - -This enables filtering, but does not actually apply any filters. - -## Autofilter Expressions - -PHPEXcel 1.7.8 introduced the ability to actually create, read and write -filter expressions; initially only for Xlsx files, but later releases -will extend this to other formats. - -To apply a filter expression to an autoFilter range, you first need to -identify which column you're going to be applying this filter to. - -``` php -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$columnFilter = $autoFilter->getColumn('C'); -``` - -This returns an autoFilter column object, and you can then apply filter -expressions to that column. - -There are a number of different types of autofilter expressions. The -most commonly used are: - -- Simple Filters -- DateGroup Filters -- Custom filters -- Dynamic Filters -- Top Ten Filters - -These different types are mutually exclusive within any single column. -You should not mix the different types of filter in the same column. -PhpSpreadsheet will not actively prevent you from doing this, but the -results are unpredictable. - -Other filter expression types (such as cell colour filters) are not yet -supported. - -### Simple filters - -In MS Excel, Simple Filters are a dropdown list of all values used in -that column, and the user can select which ones they want to display and -which ones they want to hide by ticking and unticking the checkboxes -alongside each option. When the filter is applied, rows containing the -checked entries will be displayed, rows that don't contain those values -will be hidden. - -![04-01-simple-autofilter.png](./images/04-01-simple-autofilter.png) - -To create a filter expression, we need to start by identifying the -filter type. In this case, we're just going to specify that this filter -is a standard filter. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER -); -``` - -Now we've identified the filter type, we can create a filter rule and -set the filter values: - -When creating a simple filter in PhpSpreadsheet, you only need to -specify the values for "checked" columns: you do this by creating a -filter rule for each value. - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'France' - ); - -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'Germany' - ); -``` - -This creates two filter rules: the column will be filtered by values -that match "France" OR "Germany". For Simple Filters, you can create as -many rules as you want - -Simple filters are always a comparison match of EQUALS, and multiple -standard filters are always treated as being joined by an OR condition. - -#### Matching Blanks - -If you want to create a filter to select blank cells, you would use: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); -``` - -### DateGroup Filters - -In MS Excel, DateGroup filters provide a series of dropdown filter -selectors for date values, so you can specify entire years, or months -within a year, or individual days within each month. - -![04-02-dategroup-autofilter.png](./images/04-02-dategroup-autofilter.png) - -DateGroup filters are still applied as a Standard Filter type. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER -); -``` - -Creating a dateGroup filter in PhpSpreadsheet, you specify the values -for "checked" columns as an associative array of year. month, day, hour -minute and second. To select a year and month, you need to create a -DateGroup rule identifying the selected year and month: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - [ - 'year' => 2012, - 'month' => 1 - ] - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP - ); -``` - -The key values for the associative array are: - -- year -- month -- day -- hour -- minute -- second - -Like Standard filters, DateGroup filters are always a match of EQUALS, -and multiple standard filters are always treated as being joined by an -OR condition. - -Note that we alse specify a ruleType: to differentiate this from a -standard filter, we explicitly set the Rule's Type to -AUTOFILTER\_RULETYPE\_DATEGROUP. As with standard filters, we can create -any number of DateGroup Filters. - -### Custom filters - -In MS Excel, Custom filters allow us to select more complex conditions -using an operator as well as a value. Typical examples might be values -that fall within a range (e.g. between -20 and +20), or text values with -wildcards (e.g. beginning with the letter U). To handle this, they - -![04-03-custom-autofilter-1.png](./images/04-03-custom-autofilter-1.png) - -![04-03-custom-autofilter-2.png](./images/04-03-custom-autofilter-2.png) - -Custom filters are limited to 2 rules, and these can be joined using -either an AND or an OR. - -We start by specifying a Filter type, this time a CUSTOMFILTER. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER -); -``` - -And then define our rules. - -The following shows a simple wildcard filter to show all column entries -beginning with the letter `U`. - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'U*' - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER - ); -``` - -MS Excel uses \* as a wildcard to match any number of characters, and ? -as a wildcard to match a single character. 'U\*' equates to "begins with -a 'U'"; '\*U' equates to "ends with a 'U'"; and '\*U\*' equates to -"contains a 'U'" - -If you want to match explicitly against a \* or a ? character, you can -escape it with a tilde (\~), so ?\~\*\* would explicitly match for a \* -character as the second character in the cell value, followed by any -number of other characters. The only other character that needs escaping -is the \~ itself. - -To create a "between" condition, we need to define two rules: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, - -20 - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER - ); -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, - 20 - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER - ); -``` - -We also set the rule type to CUSTOMFILTER. - -This defined two rules, filtering numbers that are `>= -20` OR `<= -20`, so we also need to modify the join condition to reflect AND rather -than OR. - -``` php -$columnFilter->setAndOr( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_ANDOR_AND -); -``` - -The valid set of operators for Custom Filters are defined in the -`\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and -comprise: - -Operator Constant | Value -------------------------------------------|---------------------- -AUTOFILTER_COLUMN_RULE_EQUAL | 'equal' -AUTOFILTER_COLUMN_RULE_NOTEQUAL | 'notEqual' -AUTOFILTER_COLUMN_RULE_GREATERTHAN | 'greaterThan' -AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL | 'greaterThanOrEqual' -AUTOFILTER_COLUMN_RULE_LESSTHAN | 'lessThan' -AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL | 'lessThanOrEqual' - -### Dynamic Filters - -Dynamic Filters are based on a dynamic comparison condition, where the -value we're comparing against the cell values is variable, such as -'today'; or when we're testing against an aggregate of the cell data -(e.g. 'aboveAverage'). Only a single dynamic filter can be applied to a -column at a time. - -![04-04-dynamic-autofilter.png](./images/04-04-dynamic-autofilter.png) - -Again, we start by specifying a Filter type, this time a DYNAMICFILTER. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER -); -``` - -When defining the rule for a dynamic filter, we don't define a value (we -can simply set that to NULL) but we do specify the dynamic filter -category. - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - NULL, - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER - ); -``` - -We also set the rule type to DYNAMICFILTER. - -The valid set of dynamic filter categories is defined in the -`\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and -comprises: - -Operator Constant | Value ------------------------------------------|---------------- -AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY | 'yesterday' -AUTOFILTER_RULETYPE_DYNAMIC_TODAY | 'today' -AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW | 'tomorrow' -AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE | 'yearToDate' -AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR | 'thisYear' -AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER | 'thisQuarter' -AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH | 'thisMonth' -AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK | 'thisWeek' -AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR | 'lastYear' -AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER | 'lastQuarter' -AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH | 'lastMonth' -AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK | 'lastWeek' -AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR | 'nextYear' -AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER | 'nextQuarter' -AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH | 'nextMonth' -AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK | 'nextWeek' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 | 'M1' -AUTOFILTER_RULETYPE_DYNAMIC_JANUARY | 'M1' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 | 'M2' -AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY | 'M2' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 | 'M3' -AUTOFILTER_RULETYPE_DYNAMIC_MARCH | 'M3' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 | 'M4' -AUTOFILTER_RULETYPE_DYNAMIC_APRIL | 'M4' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 | 'M5' -AUTOFILTER_RULETYPE_DYNAMIC_MAY | 'M5' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 | 'M6' -AUTOFILTER_RULETYPE_DYNAMIC_JUNE | 'M6' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 | 'M7' -AUTOFILTER_RULETYPE_DYNAMIC_JULY | 'M7' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 | 'M8' -AUTOFILTER_RULETYPE_DYNAMIC_AUGUST | 'M8' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 | 'M9' -AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER | 'M9' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 | 'M10' -AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER | 'M10' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 | 'M11' -AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER | 'M11' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 | 'M12' -AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER | 'M12' -AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 | 'Q1' -AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 | 'Q2' -AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 | 'Q3' -AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 | 'Q4' -AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE | 'aboveAverage' -AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE | 'belowAverage' - -We can only apply a single Dynamic Filter rule to a column at a time. - -### Top Ten Filters - -Top Ten Filters are similar to Dynamic Filters in that they are based on -a summarisation of the actual data values in the cells. However, unlike -Dynamic Filters where you can only select a single option, Top Ten -Filters allow you to select based on a number of criteria: - -![04-05-custom-topten-1.png](./images/04-05-topten-autofilter-1.png) - -![04-05-custom-topten-2.png](./images/04-05-topten-autofilter-2.png) - -You can identify whether you want the top (highest) or bottom (lowest) -values.You can identify how many values you wish to select in the -filterYou can identify whether this should be a percentage or a number -of items. - -Like Dynamic Filters, only a single Top Ten filter can be applied to a -column at a time. - -We start by specifying a Filter type, this time a DYNAMICFILTER. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER -); -``` - -Then we create the rule: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT, - 5, - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_TOPTENFILTER - ); -``` - -This will filter the Top 5 percent of values in the column. - -To specify the lowest (bottom 2 values), we would specify a rule of: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE, - 5, - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_TOPTENFILTER - ); -``` - -The option values for TopTen Filters top/bottom value/percent are all -defined in the -`\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and -comprise: - -Operator Constant | Value ----------------------------------------|------------- -AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE | 'byValue' -AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT | 'byPercent' - -and - -Operator Constant | Value --------------------------------------|---------- -AUTOFILTER_COLUMN_RULE_TOPTEN_TOP | 'top' -AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM | 'bottom' - -## Executing an AutoFilter - -When an autofilter is applied in MS Excel, it sets the row -hidden/visible flags for each row of the autofilter area based on the -selected criteria, so that only those rows that match the filter -criteria are displayed. - -PhpSpreadsheet will not execute the equivalent function automatically -when you set or change a filter expression, but only when the file is -saved. - -### Applying the Filter - -If you wish to execute your filter from within a script, you need to do -this manually. You can do this using the autofilters `showHideRows()` -method. - -``` php -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$autoFilter->showHideRows(); -``` - -This will set all rows that match the filter criteria to visible, while -hiding all other rows within the autofilter area. - -### Displaying Filtered Rows - -Simply looping through the rows in an autofilter area will still access -ever row, whether it matches the filter criteria or not. To selectively -access only the filtered rows, you need to test each row’s visibility -settings. - -``` php -foreach ($spreadsheet->getActiveSheet()->getRowIterator() as $row) { - if ($spreadsheet->getActiveSheet() - ->getRowDimension($row->getRowIndex())->getVisible()) { - echo ' Row number - ' , $row->getRowIndex() , ' '; - echo $spreadsheet->getActiveSheet() - ->getCell( - 'C'.$row->getRowIndex() - ) - ->getValue(), ' '; - echo $spreadsheet->getActiveSheet() - ->getCell( - 'D'.$row->getRowIndex() - )->getFormattedValue(), ' '; - echo PHP_EOL; - } -} -``` - -## AutoFilter Sorting - -In MS Excel, Autofiltering also allows the rows to be sorted. This -feature is ***not*** supported by PhpSpreadsheet. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/calculation-engine.md b/vendor/phpoffice/phpspreadsheet/docs/topics/calculation-engine.md deleted file mode 100644 index 779d73e1..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/calculation-engine.md +++ /dev/null @@ -1,2098 +0,0 @@ -# Calculation Engine - -## Using the PhpSpreadsheet calculation engine - -### Performing formula calculations - -As PhpSpreadsheet represents an in-memory spreadsheet, it also offers -formula calculation capabilities. A cell can be of a value type -(containing a number or text), or a formula type (containing a formula -which can be evaluated). For example, the formula `=SUM(A1:A10)` -evaluates to the sum of values in A1, A2, ..., A10. - -To calculate a formula, you can call the cell containing the formula’s -method `getCalculatedValue()`, for example: - -``` php -$spreadsheet->getActiveSheet()->getCell('E11')->getCalculatedValue(); -``` - -If you write the following line of code in the invoice demo included -with PhpSpreadsheet, it evaluates to the value "64": - -![09-command-line-calculation.png](./images/09-command-line-calculation.png) - -Another nice feature of PhpSpreadsheet's formula parser, is that it can -automatically adjust a formula when inserting/removing rows/columns. -Here's an example: - -![09-formula-in-cell-1.png](./images/09-formula-in-cell-1.png) - -You see that the formula contained in cell E11 is "SUM(E4:E9)". Now, -when I write the following line of code, two new product lines are -added: - -``` php -$spreadsheet->getActiveSheet()->insertNewRowBefore(7, 2); -``` - -![09-formula-in-cell-2.png](./images/09-formula-in-cell-2.png) - -Did you notice? The formula in the former cell E11 (now E13, as I -inserted 2 new rows), changed to "SUM(E4:E11)". Also, the inserted cells -duplicate style information of the previous cell, just like Excel's -behaviour. Note that you can both insert rows and columns. - -## Calculation Cache - -Once the Calculation engine has evaluated the formula in a cell, the result -will be cached, so if you call `getCalculatedValue()` a second time for the -same cell, the result will be returned from the cache rather than evaluating -the formula a second time. This helps boost performance, because evaluating -a formula is an expensive operation in terms of performance and speed. - -However, there may be times when you don't want this, perhaps you've changed -the underlying data and need to re-evaluate the same formula with that new -data. - -``` -Calculation::getInstance($spreadsheet)->disableCalculationCache(); -``` - -Will disable calculation caching, and flush the current calculation cache. - -If you want only to flush the cache, then you can call - -``` -Calculation::getInstance($spreadsheet)->clearCalculationCache(); -``` - -## Known limitations - -There are some known limitations to the PhpSpreadsheet calculation -engine. Most of them are due to the fact that an Excel formula is -converted into PHP code before being executed. This means that Excel -formula calculation is subject to PHP's language characteristics. - -### Function that are not Supported in Xls - -Not all functions are supported, for a comprehensive list, read the -[function list by name](../references/function-list-by-name.md). - -#### Operator precedence - -In Excel `+` wins over `&`, just like `*` wins over `+` in ordinary -algebra. The former rule is not what one finds using the calculation -engine shipped with PhpSpreadsheet. - -- [Reference for Excel](https://support.office.com/en-us/article/Calculation-operators-and-precedence-in-Excel-48be406d-4975-4d31-b2b8-7af9e0e2878a) -- [Reference for PHP](https://php.net/manual/en/language.operators.php) - -#### Formulas involving numbers and text - -Formulas involving numbers and text may produce unexpected results or -even unreadable file contents. For example, the formula `=3+"Hello "` is -expected to produce an error in Excel (\#VALUE!). Due to the fact that -PHP converts `"Hello "` to a numeric value (zero), the result of this -formula is evaluated as 3 instead of evaluating as an error. This also -causes the Excel document being generated as containing unreadable -content. - -- [Reference for this behaviour in PHP](https://php.net/manual/en/language.types.string.php#language.types.string.conversion) - -#### Formulas don’t seem to be calculated in Excel2003 using compatibility pack? - -This is normal behaviour of the compatibility pack, Xlsx displays this -correctly. Use `\PhpOffice\PhpSpreadsheet\Writer\Xls` if you really need -calculated values, or force recalculation in Excel2003. - -## Handling Date and Time Values - -### Excel functions that return a Date and Time value - -Any of the Date and Time functions that return a date value in Excel can -return either an Excel timestamp or a PHP timestamp or `DateTime` object. - -It is possible for scripts to change the data type used for returning -date values by calling the -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType()` -method: - -``` php -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($returnDateType); -``` - -where the following constants can be used for `$returnDateType`: - -- `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC` -- `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_OBJECT` -- `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL` - -The method will return a Boolean True on success, False on failure (e.g. -if an invalid value is passed in for the return date type). - -The `\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()` -method can be used to determine the current value of this setting: - -``` php -$returnDateType = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(); -``` - -The default is `RETURNDATE_PHP_NUMERIC`. - -#### PHP Timestamps - -If `RETURNDATE_PHP_NUMERIC` is set for the Return Date Type, then any -date value returned to the calling script by any access to the Date and -Time functions in Excel will be an integer value that represents the -number of seconds from the PHP/Unix base date. The PHP/Unix base date -(0) is 00:00 UST on 1st January 1970. This value can be positive or -negative: so a value of -3600 would be 23:00 hrs on 31st December 1969; -while a value of +3600 would be 01:00 hrs on 1st January 1970. This -gives PHP a date range of between 14th December 1901 and 19th January -2038. - -#### PHP `DateTime` Objects - -If the Return Date Type is set for `RETURNDATE_PHP_OBJECT`, then any -date value returned to the calling script by any access to the Date and -Time functions in Excel will be a PHP `DateTime` object. - -#### Excel Timestamps - -If `RETURNDATE_EXCEL` is set for the Return Date Type, then the returned -date value by any access to the Date and Time functions in Excel will be -a floating point value that represents a number of days from the Excel -base date. The Excel base date is determined by which calendar Excel -uses: the Windows 1900 or the Mac 1904 calendar. 1st January 1900 is the -base date for the Windows 1900 calendar while 1st January 1904 is the -base date for the Mac 1904 calendar. - -It is possible for scripts to change the calendar used for calculating -Excel date values by calling the -`\PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar()` method: - -``` php -\PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar($baseDate); -``` - -where the following constants can be used for `$baseDate`: - -- `\PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_WINDOWS_1900` -- `\PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_MAC_1904` - -The method will return a Boolean True on success, False on failure (e.g. -if an invalid value is passed in). - -The `\PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar()` method can -be used to determine the current value of this setting: - -``` php -$baseDate = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar(); -``` - -The default is `CALENDAR_WINDOWS_1900`. - -#### Functions that return a Date/Time Value - -- DATE -- DATEVALUE -- EDATE -- EOMONTH -- NOW -- TIME -- TIMEVALUE -- TODAY - -### Excel functions that accept Date and Time values as parameters - -Date values passed in as parameters to a function can be an Excel -timestamp or a PHP timestamp; or `DateTime` object; or a string containing a -date value (e.g. '1-Jan-2009'). PhpSpreadsheet will attempt to identify -their type based on the PHP datatype: - -An integer numeric value will be treated as a PHP/Unix timestamp. A real -(floating point) numeric value will be treated as an Excel -date/timestamp. Any PHP `DateTime` object will be treated as a `DateTime` -object. Any string value (even one containing straight numeric data) -will be converted to a `DateTime` object for validation as a date value -based on the server locale settings, so passing through an ambiguous -value of '07/08/2008' will be treated as 7th August 2008 if your server -settings are UK, but as 8th July 2008 if your server settings are US. -However, if you pass through a value such as '31/12/2008' that would be -considered an error by a US-based server, but which is not ambiguous, -then PhpSpreadsheet will attempt to correct this to 31st December 2008. -If the content of the string doesn’t match any of the formats recognised -by the php `DateTime` object implementation of `strtotime()` (which can -handle a wider range of formats than the normal `strtotime()` function), -then the function will return a `#VALUE` error. However, Excel -recommends that you should always use date/timestamps for your date -functions, and the recommendation for PhpSpreadsheet is the same: avoid -strings because the result is not predictable. - -The same principle applies when data is being written to Excel. Cells -containing date actual values (rather than Excel functions that return a -date value) are always written as Excel dates, converting where -necessary. If a cell formatted as a date contains an integer or -`DateTime` object value, then it is converted to an Excel value for -writing: if a cell formatted as a date contains a real value, then no -conversion is required. Note that string values are written as strings -rather than converted to Excel date timestamp values. - -#### Functions that expect a Date/Time Value - -- DATEDIF -- DAY -- DAYS360 -- EDATE -- EOMONTH -- HOUR -- MINUTE -- MONTH -- NETWORKDAYS -- SECOND -- WEEKDAY -- WEEKNUM -- WORKDAY -- YEAR -- YEARFRAC - -### Helper Methods - -In addition to the `setExcelCalendar()` and `getExcelCalendar()` methods, a -number of other methods are available in the -`\PhpOffice\PhpSpreadsheet\Shared\Date` class that can help when working -with dates: - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDate) - -Converts a date/time from an Excel date timestamp to return a PHP -serialized date/timestamp. - -Note that this method does not trap for Excel dates that fall outside of -the valid range for a PHP date timestamp. - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDate) - -Converts a date from an Excel date/timestamp to return a PHP `DateTime` -object. - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDate) - -Converts a PHP serialized date/timestamp or a PHP `DateTime` object to -return an Excel date timestamp. - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) - -Takes year, month and day values (and optional hour, minute and second -values) and returns an Excel date timestamp value. - -### Timezone support for Excel date timestamp conversions - -The default timezone for the date functions in PhpSpreadsheet is UST (Universal Standard Time). -If a different timezone needs to be used, these methods are available: - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::getDefaultTimezone() - -Returns the current timezone value PhpSpeadsheet is using to handle dates and times. - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::setDefaultTimezone($timeZone) - -Sets the timezone for Excel date timestamp conversions to $timeZone, -which must be a valid PHP DateTimeZone value. -The return value is a Boolean, where true is success, -and false is failure (e.g. an invalid DateTimeZone value was passed.) - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDate, $timeZone) -#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimeStamp($excelDate, $timeZone) - -These functions support a timezone as an optional second parameter. -This applies a specific timezone to that function call without affecting the default PhpSpreadsheet Timezone. - -## Function Reference - -### Database Functions - -#### DAVERAGE - -The DAVERAGE function returns the average value of the cells in a column -of a list or database that match conditions you specify. - -##### Syntax - - DAVERAGE (database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The average value of the matching cells. - -This is the statistical mean. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DAVERAGE(A4:E10,"Yield",A1:B2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 12 -``` - -##### Notes - -There are no additional notes on this function - -#### DCOUNT - -The DCOUNT function returns the count of cells that contain a number in -a column of a list or database matching conditions that you specify. - -##### Syntax - - DCOUNT(database, [field], criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The count of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DCOUNT(A4:E10,"Height",A1:B3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); - -// $retVal = 3 -``` - -##### Notes - -In MS Excel, The field argument is optional. If field is omitted, DCOUNT -counts all records in the database that match the criteria. This logic -has not yet been implemented in PhpSpreadsheet. - -#### DCOUNTA - -The DCOUNT function returns the count of cells that aren’t blank in a -column of a list or database and that match conditions that you specify. - -##### Syntax - - DCOUNTA(database, [field], criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The count of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DCOUNTA(A4:E10,"Yield",A1:A3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); - -// $retVal = 5 -``` - -##### Notes - -In MS Excel, The field argument is optional. If field is omitted, -DCOUNTA counts all records in the database that match the criteria. This -logic has not yet been implemented in PhpSpreadsheet. - -#### DGET - -The DGET function extracts a single value from a column of a list or -database that matches conditions that you specify. - -##### Syntax - - DGET(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**mixed** The value from the selected column of the matching row. - -#### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=GET(A4:E10,"Age",A1:F2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 14 -``` - -##### Notes - -There are no additional notes on this function - -#### DMAX - -The DMAX function returns the largest number in a column of a list or -database that matches conditions you specify. - -##### Syntax - - DMAX(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The maximum value of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DMAX(A4:E10,"Profit",A1:B2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 105 -``` - -##### Notes - -There are no additional notes on this function - -#### DMIN - -The DMIN function returns the smallest number in a column of a list or -database that matches conditions you specify. - -##### Syntax - - DMIN(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The minimum value of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Yield",A1:A3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 6 -``` - -##### Notes - -There are no additional notes on this function - -#### DPRODUCT - -The DPRODUCT function multiplies the values in a column of a list or -database that match conditions that you specify. - -##### Syntax - - DPRODUCT(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The product of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DPRODUCT(A4:E10,"Yield",A1:B2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 140 -``` - -##### Notes - -There are no additional notes on this function - -#### DSTDEV - -The DSTDEV function estimates the standard deviation of a population -based on a sample by using the numbers in a column of a list or database -that match conditions that you specify. - -##### Syntax - - DSTDEV(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The estimated standard deviation of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DSTDEV(A4:E10,"Yield",A1:A3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 2.97 -``` - -##### Notes - -There are no additional notes on this function - -#### DSTDEVP - -The DSTDEVP function calculates the standard deviation of a population -based on the entire population by using the numbers in a column of a -list or database that match conditions that you specify. - -##### Syntax - - DSTDEVP(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The estimated standard deviation of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DSTDEVP(A4:E10,"Yield",A1:A3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 2.65 -``` - -##### Notes - -There are no additional notes on this function - -#### DSUM - -The DSUM function adds the numbers in a column of a list or database -that matches conditions you specify. - -##### Syntax - - DSUM(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The total value of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Profit",A1:A2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 225 -``` - -##### Notes - -There are no additional notes on this function - -#### DVAR - -Not yet documented. - -#### DVARP - -Not yet documented. - -### Date and Time Functions - -Excel provides a number of functions for the manipulation of dates and -times, and calculations based on date/time values. it is worth spending -some time reading the section titled "Date and Time Values" on passing -date parameters and returning date values to understand how -PhpSpreadsheet reconciles the differences between dates and times in -Excel and in PHP. - -#### DATE - -The DATE function returns an Excel timestamp or a PHP timestamp or `DateTime` -object representing the date that is referenced by the parameters. - -##### Syntax - - DATE(year, month, day) - -##### Parameters - -**year** The year number. - -If this value is between 0 (zero) and 1899 inclusive (for the Windows -1900 calendar), or between 4 and 1903 inclusive (for the Mac 1904), then -PhpSpreadsheet adds it to the Calendar base year, so a value of 108 will -interpret the year as 2008 when using the Windows 1900 calendar, or 2012 -when using the Mac 1904 calendar. - -**month** The month number. - -If this value is greater than 12, the DATE function adds that number of -months to the first month in the year specified. For example, -DATE(2008,14,2) returns a value representing February 2, 2009. - -If the value of **month** is less than 1, then that value will be -adjusted by -1, and that will then be subtracted from the first month of -the year specified. For example, DATE(2008,0,2) returns a value -representing December 2, 2007; while DATE(2008,-1,2) returns a value -representing November 2, 2007. - -**day** The day number. - -If this value is greater than the number of days in the month (and year) -specified, the DATE function adds that number of days to the first day -in the month. For example, DATE(2008,1,35) returns a value representing -February 4, 2008. - -If the value of **day** is less than 1, then that value will be adjusted -by -1, and that will then be subtracted from the first month of the year -specified. For example, DATE(2008,3,0) returns a value representing -February 29, 2008; while DATE(2008,3,-2) returns a value representing -February 27, 2008. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the given date. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Year') - ->setCellValue('A2', 'Month') - ->setCellValue('A3', 'Day'); - -$worksheet->setCellValue('B1', 2008) - ->setCellValue('B2', 12) - ->setCellValue('B3', 31); - -$worksheet->setCellValue('D1', '=DATE(B1,B2,B3)'); - -$retVal = $worksheet->getCell('D1')->getCalculatedValue(); -// $retVal = 1230681600 -``` - -``` php -// We're going to be calling the same cell calculation multiple times, -// and expecting different return values, so disable calculation cacheing -\PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->setCalculationCacheEnabled(FALSE); - -$saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'], - [2008, 12, 31] -); -// $retVal = 39813.0 - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'], - [2008, 12, 31] -); -// $retVal = 1230681600 - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($saveFormat); -``` - -##### Notes - -There are no additional notes on this function - -#### DATEDIF - -The DATEDIF function computes the difference between two dates in a -variety of different intervals, such number of years, months, or days. - -##### Syntax - - DATEDIF(date1, date2 [, unit]) - -##### Parameters - -**date1** First Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**date2** Second Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**unit** The interval type to use for the calculation - -This is a string, comprising one of the values listed below: - -Unit | Meaning | Description ------|---------------------------------|-------------------------------- -m | Months | Complete calendar months between the dates. -d | Days | Number of days between the dates. -y | Years | Complete calendar years between the dates. -ym | Months Excluding Years | Complete calendar months between the dates as if they were of the same year. -yd | Days Excluding Years | Complete calendar days between the dates as if they were of the same year. -md | Days Excluding Years And Months | Complete calendar days between the dates as if they were of the same month and same year. - -The unit value is not case sensitive, and defaults to `d`. - -##### Return Value - -**integer** An integer value that reflects the difference between the -two dates. - -This could be the number of full days, months or years between the two -dates, depending on the interval unit value passed into the function as -the third parameter. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Year') - ->setCellValue('A2', 'Month') - ->setCellValue('A3', 'Day'); - -$worksheet->setCellValue('B1', 2001) - ->setCellValue('C1', 2009) - ->setCellValue('B2', 7) - ->setCellValue('C2', 12) - ->setCellValue('B3', 1) - ->setCellValue('C3', 31); - -$worksheet->setCellValue('D1', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"d")') - ->setCellValue('D2', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"m")') - ->setCellValue('D3', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"y")') - ->setCellValue('D4', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"ym")') - ->setCellValue('D5', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"yd")') - ->setCellValue('D6', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"md")'); - -$retVal = $worksheet->getCell('D1')->getCalculatedValue(); -// $retVal = 3105 - -$retVal = $worksheet->getCell('D2')->getCalculatedValue(); -// $retVal = 101 - -$retVal = $worksheet->getCell('D3')->getCalculatedValue(); -// $retVal = 8 - -$retVal = $worksheet->getCell('D4')->getCalculatedValue(); -// $retVal = 5 - -$retVal = $worksheet->getCell('D5')->getCalculatedValue(); -// $retVal = 183 - -$retVal = $worksheet->getCell('D6')->getCalculatedValue(); -// $retVal = 30 -``` - -``` php -$date1 = 1193317015; // PHP timestamp for 25-Oct-2007 -$date2 = 1449579415; // PHP timestamp for 8-Dec-2015 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'd'] -); -// $retVal = 2966 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'm'] -); -// $retVal = 97 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'y'] -); -// $retVal = 8 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'ym'] -); -// $retVal = 1 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'yd'] -); -// $retVal = 44 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'md'] -); -// $retVal = 13 -``` - -##### Notes - -If Date1 is later than Date2, DATEDIF will return a \#NUM! error. - -#### DATEVALUE - -The DATEVALUE function returns the date represented by a date formatted -as a text string. Use DATEVALUE to convert a date represented by text to -a serial number. - -##### Syntax - - DATEVALUE(dateString) - -##### Parameters - -**date** Date String. - -A string, representing a date value. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the given date. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String'); - ->setCellValue('A2', '31-Dec-2008') - ->setCellValue('A3', '31/12/2008') - ->setCellValue('A4', '12-31-2008'); - -$worksheet->setCellValue('B2', '=DATEVALUE(A2)') - ->setCellValue('B3', '=DATEVALUE(A3)') - ->setCellValue('B4', '=DATEVALUE(A4)'); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 39813.0 for all cases -``` - -``` php -// We're going to be calling the same cell calculation multiple times, -// and expecting different return values, so disable calculation cacheing -\PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->setCalculationCacheEnabled(FALSE); - -$saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'], - ['31-Dec-2008'] -); -// $retVal = 39813.0 - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'], - ['31-Dec-2008'] -); -// $retVal = 1230681600 - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($saveFormat); -``` - -##### Notes - -DATEVALUE uses the php `DateTime` object implementation of `strtotime()` -(which can handle a wider range of formats than the normal `strtotime()` -function), and it is also called for any date parameter passed to other -date functions (such as DATEDIF) when the parameter value is a string. - -**WARNING:-** PhpSpreadsheet accepts a wider range of date formats than -MS Excel, so it is entirely possible that Excel will return a \#VALUE! -error when passed a date string that it can’t interpret, while -PhpSpreadsheet is able to translate that same string into a correct date -value. - -Care should be taken in workbooks that use string formatted dates in -calculations when writing to Xls or Xlsx. - -#### DAY - -The DAY function returns the day of a date. The day is given as an -integer ranging from 1 to 31. - -##### Syntax - - DAY(datetime) - -##### Parameters - -**datetime** Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -##### Return Value - -**integer** An integer value that reflects the day of the month. - -This is an integer ranging from 1 to 31. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '31-Dec-2008') - ->setCellValue('A3', '14-Feb-2008'); - -$worksheet->setCellValue('B2', '=DAY(A2)') - ->setCellValue('B3', '=DAY(A3)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 31 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 14 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYOFMONTH'], - ['25-Dec-2008'] -); -// $retVal = 25 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::DAYOFMONTH()` when the -method is called statically. - -#### DAYS360 - -The DAYS360 function computes the difference between two dates based on -a 360 day year (12 equal periods of 30 days each) used by some -accounting systems. - -##### Syntax - - DAYS360(date1, date2 [, method]) - -#### Parameters - -**date1** First Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**date2** Second Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**method** A boolean flag (TRUE or FALSE) - -This is a flag that determines which method to use in the calculation, -based on the values listed below: - -method | Description --------|------------ -FALSE | U.S. (NASD) method. If the starting date is the last day of a month, it becomes equal to the 30th of the same month. If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month. -TRUE | European method. Starting dates and ending dates that occur on the 31st of a month become equal to the 30th of the same month. - -The method value defaults to FALSE. - -##### Return Value - -**integer** An integer value that reflects the difference between the -two dates. - -This is the number of full days between the two dates, based on a 360 -day year. - -##### Examples - -``` php -$worksheet->setCellValue('B1', 'Start Date') - ->setCellValue('C1', 'End Date') - ->setCellValue('A2', 'Year') - ->setCellValue('A3', 'Month') - ->setCellValue('A4', 'Day'); - -$worksheet->setCellValue('B2', 2003) - ->setCellValue('B3', 2) - ->setCellValue('B4', 3); - -$worksheet->setCellValue('C2', 2007) - ->setCellValue('C3', 5) - ->setCellValue('C4', 31); - -$worksheet->setCellValue('E2', '=DAYS360(DATE(B2,B3,B4),DATE(C2,C3,C4))') - ->setCellValue('E4', '=DAYS360(DATE(B2,B3,B4),DATE(C2,C3,C4),FALSE)'); - -$retVal = $worksheet->getCell('E2')->getCalculatedValue(); -// $retVal = 1558 - -$retVal = $worksheet->getCell('E4')->getCalculatedValue(); -// $retVal = 1557 -``` - -``` php -$date1 = 37655.0; // Excel timestamp for 25-Oct-2007 -$date2 = 39233.0; // Excel timestamp for 8-Dec-2015 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'], - [$date1, $date2] -); -// $retVal = 1558 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'], - [$date1, $date2, TRUE] -); -// $retVal = 1557 -``` - -##### Notes - -**WARNING:-** This function does not currently work with the Xls Writer -when a PHP Boolean is used for the third (optional) parameter (as shown -in the example above), and the writer will generate and error. It will -work if a numeric 0 or 1 is used for the method parameter; or if the -Excel `TRUE()` and `FALSE()` functions are used instead. - -#### EDATE - -The EDATE function returns an Excel timestamp or a PHP timestamp or `DateTime` -object representing the date that is the indicated number of months -before or after a specified date (the start\_date). Use EDATE to -calculate maturity dates or due dates that fall on the same day of the -month as the date of issue. - -##### Syntax - - EDATE(baseDate, months) - -##### Parameters - -**baseDate** Start Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**months** Number of months to add. - -An integer value indicating the number of months before or after -baseDate. A positive value for months yields a future date; a negative -value yields a past date. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the basedate + months. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '1-Jan-2008') - ->setCellValue('A3', '29-Feb-2008'); - -$worksheet->setCellValue('B2', '=EDATE(A2,5)') - ->setCellValue('B3', '=EDATE(A3,-12)'); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 39600.0 (1-Jun-2008) - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 39141.0 (28-Feb-2007) -``` - -``` php -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EDATE'], - ['31-Oct-2008', 25] -); -// $retVal = 40512.0 (30-Nov-2010) -``` - -###### Notes - -**WARNING:-** This function is currently not supported by the Xls Writer -because it is not a standard function within Excel 5, but an add-in from -the Analysis ToolPak. - -#### EOMONTH - -The EOMONTH function returns an Excel timestamp or a PHP timestamp or -`DateTime` object representing the date of the last day of the month that is -the indicated number of months before or after a specified date (the -start\_date). Use EOMONTH to calculate maturity dates or due dates that -fall on the last day of the month. - -##### Syntax - - EOMONTH(baseDate, months) - -##### Parameters - -**baseDate** Start Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**months** Number of months to add. - -An integer value indicating the number of months before or after -baseDate. A positive value for months yields a future date; a negative -value yields a past date. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the last day of basedate -+ months. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '1-Jan-2000') - ->setCellValue('A3', '14-Feb-2009'); - -$worksheet->setCellValue('B2', '=EOMONTH(A2,5)') - ->setCellValue('B3', '=EOMONTH(A3,-12)'); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 39629.0 (30-Jun-2008) - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 39507.0 (29-Feb-2008) -``` - -``` php -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EOMONTH'], - ['31-Oct-2008', 13] -); -// $retVal = 40147.0 (30-Nov-2010) -``` - -##### Notes - -**WARNING:-** This function is currently not supported by the Xls Writer -because it is not a standard function within Excel 5, but an add-in from -the Analysis ToolPak. - -#### HOUR - -The HOUR function returns the hour of a time value. The hour is given as -an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). - -##### Syntax - - HOUR(datetime) - -##### Parameters - -**datetime** Time. - -An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a -date/time represented as a string. - -##### Return Value - -**integer** An integer value that reflects the hour of the day. - -This is an integer ranging from 0 to 23. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Time String') - ->setCellValue('A2', '31-Dec-2008 17:30') - ->setCellValue('A3', '14-Feb-2008 4:20 AM') - ->setCellValue('A4', '14-Feb-2008 4:20 PM'); - -$worksheet->setCellValue('B2', '=HOUR(A2)') - ->setCellValue('B3', '=HOUR(A3)') - ->setCellValue('B4', '=HOUR(A4)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 17 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 4 - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 16 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'HOUROFDAY'], - ['09:30'] -); -// $retVal = 9 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::HOUROFDAY()` when the -method is called statically. - -#### MINUTE - -The MINUTE function returns the minutes of a time value. The minute is -given as an integer, ranging from 0 to 59. - -##### Syntax - - MINUTE(datetime) - -##### Parameters - -**datetime** Time. - -An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a -date/time represented as a string. - -##### Return Value - -**integer** An integer value that reflects the minutes within the hour. - -This is an integer ranging from 0 to 59. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Time String') - ->setCellValue('A2', '31-Dec-2008 17:30') - ->setCellValue('A3', '14-Feb-2008 4:20 AM') - ->setCellValue('A4', '14-Feb-2008 4:45 PM'); - -$worksheet->setCellValue('B2', '=MINUTE(A2)') - ->setCellValue('B3', '=MINUTE(A3)') - ->setCellValue('B4', '=MINUTE(A4)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 30 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 20 - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 45 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MINUTE'], - ['09:30'] -); -// $retVal = 30 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::MINUTE()` when the -method is called statically. - -#### MONTH - -The MONTH function returns the month of a date. The month is given as an -integer ranging from 1 to 12. - -##### Syntax - - MONTH(datetime) - -##### Parameters - -**datetime** Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -##### Return Value - -**integer** An integer value that reflects the month of the year. - -This is an integer ranging from 1 to 12. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String'); -$worksheet->setCellValue('A2', '31-Dec-2008'); -$worksheet->setCellValue('A3', '14-Feb-2008'); - -$worksheet->setCellValue('B2', '=MONTH(A2)'); -$worksheet->setCellValue('B3', '=MONTH(A3)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 12 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 2 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MONTHOFYEAR'], - ['14-July-2008'] -); -// $retVal = 7 -``` - -#### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::MONTHOFYEAR()` when the -method is called statically. - -#### NETWORKDAYS - -The NETWORKDAYS function returns the number of whole working days -between a *start date* and an *end date*. Working days exclude weekends -and any dates identified in *holidays*. Use NETWORKDAYS to calculate -employee benefits that accrue based on the number of days worked during -a specific term. - -##### Syntax - - NETWORKDAYS(startDate, endDate [, holidays]) - -##### Parameters - -**startDate** Start Date of the period. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**endDate** End Date of the period. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**holidays** Optional array of Holiday dates. - -An optional range of one or more dates to exclude from the working -calendar, such as state and federal holidays and floating holidays. - -The list can be either a range of cells that contains the dates or an -array constant of Excel date values, PHP date timestamps, PHP date -objects, or dates represented as strings. - -##### Return Value - -**integer** Number of working days. - -The number of working days between startDate and endDate. - -##### Examples - -``` php -``` - -``` php -``` - -##### Notes - -There are no additional notes on this function - -#### NOW - -The NOW function returns the current date and time. - -##### Syntax - - NOW() - -##### Parameters - -There are no parameters for the `NOW()` function. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the current date and -time. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -``` - -``` php -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::DATETIMENOW()` when the -method is called statically. - -#### SECOND - -The SECOND function returns the seconds of a time value. The second is -given as an integer, ranging from 0 to 59. - -##### Syntax - - SECOND(datetime) - -##### Parameters - -**datetime** Time. - -An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a -date/time represented as a string. - -##### Return Value - -**integer** An integer value that reflects the seconds within the -minute. - -This is an integer ranging from 0 to 59. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Time String') - ->setCellValue('A2', '31-Dec-2008 17:30:20') - ->setCellValue('A3', '14-Feb-2008 4:20 AM') - ->setCellValue('A4', '14-Feb-2008 4:45:59 PM'); - -$worksheet->setCellValue('B2', '=SECOND(A2)') - ->setCellValue('B3', '=SECOND(A3)'); - ->setCellValue('B4', '=SECOND(A4)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 20 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 0 - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 59 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'SECOND'], - ['09:30:17'] -); -// $retVal = 17 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::SECOND()` when the -method is called statically. - -#### TIME - -Not yet documented. - -#### TIMEVALUE - -Not yet documented. - -#### TODAY - -Not yet documented. - -#### WEEKDAY - -The WEEKDAY function returns the day of the week for a given date. The -day is given as an integer ranging from 1 to 7, although this can be -modified to return a value between 0 and 6. - -##### Syntax - - WEEKDAY(datetime [, method]) - -##### Parameters - -**datetime** Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**method** An integer flag (values 0, 1 or 2) - -This is a flag that determines which method to use in the calculation, -based on the values listed below: - - method | Description - :-----:|------------------------------------------ - 0 | Returns 1 (Sunday) through 7 (Saturday). - 1 | Returns 1 (Monday) through 7 (Sunday). - 2 | Returns 0 (Monday) through 6 (Sunday). - -The method value defaults to 1. - -##### Return Value - -**integer** An integer value that reflects the day of the week. - -This is an integer ranging from 1 to 7, or 0 to 6, depending on the -value of method. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '31-Dec-2008') - ->setCellValue('A3', '14-Feb-2008'); - -$worksheet->setCellValue('B2', '=WEEKDAY(A2)') - ->setCellValue('B3', '=WEEKDAY(A3,0)') - ->setCellValue('B4', '=WEEKDAY(A3,2)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 12 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 2 - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 2 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'WEEKDAY'], - ['14-July-2008'] -); -// $retVal = 7 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::WEEKDAY()` when the -method is called statically. - -#### WEEKNUM - -Not yet documented. - -#### WORKDAY - -Not yet documented. - -#### YEAR - -The YEAR function returns the year of a date. - -##### Syntax - - YEAR(datetime) - -##### Parameters - -**datetime** Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -##### Return Value - -**integer** An integer value that reflects the month of the year. - -This is an integer year value. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '17-Jul-1982') - ->setCellValue('A3', '16-Apr-2009'); - -$worksheet->setCellValue('B2', '=YEAR(A2)') - ->setCellValue('B3', '=YEAR(A3)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 1982 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 2009 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'YEAR'], - ['14-July-2001'] -); -// $retVal = 2001 -``` - -##### Notes - -There are no additional notes on this function - -### YEARFRAC - -Not yet documented. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/creating-spreadsheet.md b/vendor/phpoffice/phpspreadsheet/docs/topics/creating-spreadsheet.md deleted file mode 100644 index dceafe4b..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/creating-spreadsheet.md +++ /dev/null @@ -1,59 +0,0 @@ -# Creating a spreadsheet - -## The `Spreadsheet` class - -The `Spreadsheet` class is the core of PhpSpreadsheet. It contains -references to the contained worksheets, document security settings and -document meta data. - -To simplify the PhpSpreadsheet concept: the `Spreadsheet` class -represents your workbook. - -Typically, you will create a workbook in one of two ways, either by -loading it from a spreadsheet file, or creating it manually. A third -option, though less commonly used, is cloning an existing workbook that -has been created using one of the previous two methods. - -### Loading a Workbook from a file - -Details of the different spreadsheet formats supported, and the options -available to read them into a Spreadsheet object are described fully in -the [Reading Files](./reading-files.md) document. - -``` php -$inputFileName = './sampleData/example1.xls'; - -/** Load $inputFileName to a Spreadsheet object **/ -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName); -``` - -### Creating a new workbook - -If you want to create a new workbook, rather than load one from file, -then you simply need to instantiate it as a new Spreadsheet object. - -``` php -/** Create a new Spreadsheet Object **/ -$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); -``` - -A new workbook will always be created with a single worksheet. - -## Clearing a Workbook from memory - -The PhpSpreadsheet object contains cyclic references (e.g. the workbook -is linked to the worksheets, and the worksheets are linked to their -parent workbook) which cause problems when PHP tries to clear the -objects from memory when they are `unset()`, or at the end of a function -when they are in local scope. The result of this is "memory leaks", -which can easily use a large amount of PHP's limited memory. - -This can only be resolved manually: if you need to unset a workbook, -then you also need to "break" these cyclic references before doing so. -PhpSpreadsheet provides the `disconnectWorksheets()` method for this -purpose. - -``` php -$spreadsheet->disconnectWorksheets(); -unset($spreadsheet); -``` diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/file-formats.md b/vendor/phpoffice/phpspreadsheet/docs/topics/file-formats.md deleted file mode 100644 index 7f4e6b7e..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/file-formats.md +++ /dev/null @@ -1,121 +0,0 @@ -# File Formats - -PhpSpreadsheet can read a number of different spreadsheet and file -formats, although not all features are supported by all of the readers. -Check the [features cross -reference](../references/features-cross-reference.md) for a list that -identifies which features are supported by which readers. - -Currently, PhpSpreadsheet supports the following File Types for Reading: - -### Xls - -The Microsoft Excel™ Binary file format (BIFF5 and BIFF8) is a binary -file format that was used by Microsoft Excel™ between versions 95 and 2003. -The format is supported (to various extents) by most spreadsheet -programs. BIFF files normally have an extension of .xls. Documentation -describing the format can be [read online](https://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx) -or [downloaded as PDF](https://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/%5BMS-XLS%5D.pdf). - -### Xml - -Microsoft Excel™ 2003 included options for a file format called -SpreadsheetML. This file is a zipped XML document. It is not very -common, but its core features are supported. Documentation for the -format can be [read online](https://msdn.microsoft.com/en-us/library/aa140066(office.10).aspx) -though it’s sadly rather sparse in its detail. - -### Xlsx - -Microsoft Excel™ 2007 shipped with a new file format, namely Microsoft -Office Open XML SpreadsheetML, and Excel 2010 extended this still -further with its new features such as sparklines. These files typically -have an extension of .xlsx. This format is based around a zipped -collection of eXtensible Markup Language (XML) files. Microsoft Office -Open XML SpreadsheetML is mostly standardized in [ECMA 376](https://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm) -and ISO 29500. - -### Ods - -aka Open Document Format (ODF) or OASIS, this is the OpenOffice.org XML -file format for spreadsheets. It comprises a zip archive including -several components all of which are text files, most of these with -markup in the eXtensible Markup Language (XML). It is the standard file -format for OpenOffice.org Calc and StarCalc, and files typically have an -extension of .ods. The published specification for the file format is -available from [the OASIS Open Office XML Format Technical Committee web -page](https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office). -Other information is available from [the OpenOffice.org XML File Format -web page](https://www.openoffice.org/xml/), part of the -OpenOffice.org project. - -### Slk - -This is the Microsoft Multiplan Symbolic Link Interchange (SYLK) file -format. Multiplan was a predecessor to Microsoft Excel™. Files normally -have an extension of .slk. While not common, there are still a few -applications that generate SYLK files as a cross-platform option, -because (despite being limited to a single worksheet) it is a simple -format to implement, and supports some basic data and cell formatting -options (unlike CSV files). - -### Gnumeric - -The [Gnumeric file format](https://help.gnome.org/users/gnumeric/stable/sect-file-formats.html.en#file-format-gnumeric) -is used by the Gnome Gnumeric spreadsheet -application, and typically files have an extension of `.gnumeric`. The -file contents are stored using eXtensible Markup Language (XML) markup, -and the file is then compressed using the GNU project's gzip compression -library. - -### Csv - -Comma Separated Value (CSV) file format is a common structuring strategy -for text format files. In CSV flies, each line in the file represents a -row of data and (within each line of the file) the different data fields -(or columns) are separated from one another using a comma (`,`). If a -data field contains a comma, then it should be enclosed (typically in -quotation marks (`"`). Sometimes tabs `\t`, or the pipe symbol (`|`), or a -semi-colon (`;`) are used as separators instead of a comma, although -other symbols can be used. Because CSV is a text-only format, it doesn't -support any data formatting options. - -"CSV" is not a single, well-defined format (although see RFC 4180 for -one definition that is commonly used). Rather, in practice the term -"CSV" refers to any file that: - -- is plain text using a character set such as ASCII, Unicode, EBCDIC, - or Shift JIS, -- consists of records (typically one record per line), -- with the records divided into fields separated by delimiters - (typically a single reserved character such as comma, semicolon, or - tab, -- where every record has the same sequence of fields. - -Within these general constraints, many variations are in use. Therefore -"CSV" files are not entirely portable. Nevertheless, the variations are -fairly small, and many implementations allow users to glance at the file -(which is feasible because it is plain text), and then specify the -delimiter character(s), quoting rules, etc. - -**Warning:** Microsoft Excel™ will open .csv files, but depending on the -system's regional settings, it may expect a semicolon as a separator -instead of a comma, since in some languages the comma is used as the -decimal separator. Also, many regional versions of Excel will not be -able to deal with Unicode characters in a CSV file. - -### Html - -HyperText Markup Language (HTML) is the main markup language for -creating web pages and other information that can be displayed in a web -browser. Files typically have an extension of .html or .htm. HTML markup -provides a means to create structured documents by denoting structural -semantics for text such as headings, paragraphs, lists, links, quotes -and other items. Since 1996, the HTML specifications have been -maintained, with input from commercial software vendors, by the World -Wide Web Consortium (W3C). However, in 2000, HTML also became an -international standard (ISO/IEC 15445:2000). HTML 4.01 was published in -late 1999, with further errata published through 2001. In 2004 -development began on HTML5 in the Web Hypertext Application Technology -Working Group (WHATWG), which became a joint deliverable with the W3C in -2008. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-01-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-01-autofilter.png deleted file mode 100644 index 8b5c4fad..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-01-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-02-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-02-autofilter.png deleted file mode 100644 index a2d6c9b9..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-02-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-1.png deleted file mode 100644 index e5a7e7dc..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-2.png deleted file mode 100644 index 1567245f..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-04-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-04-autofilter.png deleted file mode 100644 index b88f4c4f..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-04-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-schematic.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-schematic.png deleted file mode 100644 index 8b677920..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-schematic.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/02-readers-writers.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/02-readers-writers.png deleted file mode 100644 index 0600788a..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/02-readers-writers.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-01-simple-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-01-simple-autofilter.png deleted file mode 100644 index 5dcc6a47..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-01-simple-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-02-dategroup-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-02-dategroup-autofilter.png deleted file mode 100644 index da1f089b..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-02-dategroup-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-1.png deleted file mode 100644 index 0098d98a..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-2.png deleted file mode 100644 index 96ff2cf0..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-04-dynamic-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-04-dynamic-autofilter.png deleted file mode 100644 index 6cb905d9..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-04-dynamic-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-1.png deleted file mode 100644 index 207e6457..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-2.png deleted file mode 100644 index 4db51252..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-1.png deleted file mode 100644 index 30d19368..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-2.png deleted file mode 100644 index e2b68506..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-3.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-3.png deleted file mode 100644 index 459261f3..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-3.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-4.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-4.png deleted file mode 100644 index 70725452..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-4.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-cell-comment.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-cell-comment.png deleted file mode 100644 index bd8f8e66..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-cell-comment.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-column-width.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-column-width.png deleted file mode 100644 index 14199434..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-column-width.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-margins.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-margins.png deleted file mode 100644 index 36e07a9b..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-margins.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-scaling-options.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-scaling-options.png deleted file mode 100644 index 80fb5f00..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-scaling-options.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-styling-border-options.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-styling-border-options.png deleted file mode 100644 index 4ef59707..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-styling-border-options.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-command-line-calculation.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-command-line-calculation.png deleted file mode 100644 index ceb2b309..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-command-line-calculation.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-1.png deleted file mode 100644 index e50c6cc8..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-2.png deleted file mode 100644 index 46daf090..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/memory_saving.md b/vendor/phpoffice/phpspreadsheet/docs/topics/memory_saving.md deleted file mode 100644 index 4c9a848f..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/memory_saving.md +++ /dev/null @@ -1,107 +0,0 @@ -# Memory saving - -PhpSpreadsheet uses an average of about 1k per cell in your worksheets, so -large workbooks can quickly use up available memory. Cell caching -provides a mechanism that allows PhpSpreadsheet to maintain the cell -objects in a smaller size of memory, or off-memory (eg: on disk, in APCu, -memcache or redis). This allows you to reduce the memory usage for large -workbooks, although at a cost of speed to access cell data. - -By default, PhpSpreadsheet holds all cell objects in memory, but -you can specify alternatives by providing your own -[PSR-16](https://www.php-fig.org/psr/psr-16/) implementation. PhpSpreadsheet keys -are automatically namespaced, and cleaned up after use, so a single cache -instance may be shared across several usage of PhpSpreadsheet or even with other -cache usages. - -To enable cell caching, you must provide your own implementation of cache like so: - -``` php -$cache = new MyCustomPsr16Implementation(); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($cache); -``` - -A separate cache is maintained for each individual worksheet, and is -automatically created when the worksheet is instantiated based on the -settings that you have configured. You cannot change -the configuration settings once you have started to read a workbook, or -have created your first worksheet. - -## Beware of TTL - -As opposed to common cache concept, PhpSpreadsheet data cannot be re-generated -from scratch. If some data is stored and later is not retrievable, -PhpSpreadsheet will throw an exception. - -That means that the data stored in cache **must not be deleted** by a -third-party or via TTL mechanism. - -So be sure that TTL is either de-activated or long enough to cover the entire -usage of PhpSpreadsheet. - -## Common use cases - -PhpSpreadsheet does not ship with alternative cache implementation. It is up to -you to select the most appropriate implementation for your environment. You -can either implement [PSR-16](https://www.php-fig.org/psr/psr-16/) from scratch, -or use [pre-existing libraries](https://packagist.org/search/?q=psr-16). - -One such library is [PHP Cache](https://www.php-cache.com/) which -provides a wide range of alternatives. Refers to their documentation for -details, but here are a few suggestions that should get you started. - -### APCu - -Require the packages into your project: - -```sh -composer require cache/simple-cache-bridge cache/apcu-adapter -``` - -Configure PhpSpreadsheet with something like: - -```php -$pool = new \Cache\Adapter\Apcu\ApcuCachePool(); -$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache); -``` - -### Redis - -Require the packages into your project: - -```sh -composer require cache/simple-cache-bridge cache/redis-adapter -``` - -Configure PhpSpreadsheet with something like: - -```php -$client = new \Redis(); -$client->connect('127.0.0.1', 6379); -$pool = new \Cache\Adapter\Redis\RedisCachePool($client); -$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache); -``` - -### Memcache - -Require the packages into your project: - -```sh -composer require cache/simple-cache-bridge cache/memcache-adapter -``` - -Configure PhpSpreadsheet with something like: - -```php -$client = new \Memcache(); -$client->connect('localhost', 11211); -$pool = new \Cache\Adapter\Memcache\MemcacheCachePool($client); -$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache); -``` diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/migration-from-PHPExcel.md b/vendor/phpoffice/phpspreadsheet/docs/topics/migration-from-PHPExcel.md deleted file mode 100644 index 011b3770..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/migration-from-PHPExcel.md +++ /dev/null @@ -1,433 +0,0 @@ -# Migration from PHPExcel - -PhpSpreadsheet introduced many breaking changes by introducing -namespaces and renaming some classes. To help you migrate existing -project, a tool was written to replace all references to PHPExcel -classes to their new names. But there are also manual changes that -need to be done. - -## Automated tool - -The tool is included in PhpSpreadsheet. It scans recursively all files -and directories, starting from the current directory. Assuming it was -installed with composer, it can be run like so: - -``` sh -cd /project/to/migrate/src -php /project/to/migrate/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel -``` - -**Important** The tool will irreversibly modify your sources, be sure to -backup everything, and double check the result before committing. - -## Manual changes - -In addition to automated changes, a few things need to be migrated manually. - -### Renamed readers and writers - -When using `IOFactory::createReader()`, `IOFactory::createWriter()` and -`IOFactory::identify()`, the reader/writer short names are used. Those were -changed, along as their corresponding class, to remove ambiguity: - -Before | After ------------------|--------- -`'CSV'` | `'Csv'` -`'Excel2003XML'` | `'Xml'` -`'Excel2007'` | `'Xlsx'` -`'Excel5'` | `'Xls'` -`'Gnumeric'` | `'Gnumeric'` -`'HTML'` | `'Html'` -`'OOCalc'` | `'Ods'` -`'OpenDocument'` | `'Ods'` -`'PDF'` | `'Pdf'` -`'SYLK'` | `'Slk'` - -### Simplified IOFactory - -The following methods : - -- `PHPExcel_IOFactory::getSearchLocations()` -- `PHPExcel_IOFactory::setSearchLocations()` -- `PHPExcel_IOFactory::addSearchLocation()` - -were replaced by `IOFactory::registerReader()` and `IOFactory::registerWriter()`. That means -IOFactory now relies on classes autoloading. - -Before: - -```php -\PHPExcel_IOFactory::addSearchLocation($type, $location, $classname); -``` - -After: - -```php -\PhpOffice\PhpSpreadsheet\IOFactory::registerReader($type, $classname); -``` - -### Removed deprecated things - -#### Worksheet::duplicateStyleArray() - -``` php -// Before -$worksheet->duplicateStyleArray($styles, $range, $advanced); - -// After -$worksheet->getStyle($range)->applyFromArray($styles, $advanced); -``` - -#### DataType::dataTypeForValue() - -``` php -// Before -DataType::dataTypeForValue($value); - -// After -DefaultValueBinder::dataTypeForValue($value); -``` - -#### Conditional::getCondition() - -``` php -// Before -$conditional->getCondition(); - -// After -$conditional->getConditions()[0]; -``` - -#### Conditional::setCondition() - -``` php -// Before -$conditional->setCondition($value); - -// After -$conditional->setConditions($value); -``` - -#### Worksheet::getDefaultStyle() - -``` php -// Before -$worksheet->getDefaultStyle(); - -// After -$worksheet->getParent()->getDefaultStyle(); -``` - -#### Worksheet::setDefaultStyle() - -``` php -// Before -$worksheet->setDefaultStyle($value); - -// After -$worksheet->getParent()->getDefaultStyle()->applyFromArray([ - 'font' => [ - 'name' => $pValue->getFont()->getName(), - 'size' => $pValue->getFont()->getSize(), - ], -]); - -``` - -#### Worksheet::setSharedStyle() - -``` php -// Before -$worksheet->setSharedStyle($sharedStyle, $range); - -// After -$worksheet->duplicateStyle($sharedStyle, $range); -``` - -#### Worksheet::getSelectedCell() - -``` php -// Before -$worksheet->getSelectedCell(); - -// After -$worksheet->getSelectedCells(); -``` - -#### Writer\Xls::setTempDir() - -``` php -// Before -$writer->setTempDir(); - -// After, there is no way to set temporary storage directory anymore -``` - -### Autoloader - -The class `PHPExcel_Autoloader` was removed entirely and is replaced by composer -autoloading mechanism. - -### Writing PDF - -PDF libraries must be installed via composer. And the following methods were removed -and are replaced by `IOFactory::registerWriter()` instead: - -- `PHPExcel_Settings::getPdfRenderer()` -- `PHPExcel_Settings::setPdfRenderer()` -- `PHPExcel_Settings::getPdfRendererName()` -- `PHPExcel_Settings::setPdfRendererName()` - -Before: - -```php -\PHPExcel_Settings::setPdfRendererName(PHPExcel_Settings::PDF_RENDERER_MPDF); -\PHPExcel_Settings::setPdfRenderer($somePath); -$writer = \PHPExcel_IOFactory::createWriter($spreadsheet, 'PDF'); -``` - -After: - -```php -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Mpdf'); - -// Or alternatively -\PhpOffice\PhpSpreadsheet\IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf'); - -// Or alternatively -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet); -``` - -### Rendering charts - -When rendering charts for HTML or PDF outputs, the process was also simplified. And while -JpGraph support is still available, it is unfortunately not up to date for latest PHP versions -and it will generate various warnings. - -If you rely on this feature, please consider -contributing either patches to JpGraph or another `IRenderer` implementation (a good -candidate might be [CpChart](https://github.com/szymach/c-pchart)). - -Before: - -```php -$rendererName = \PHPExcel_Settings::CHART_RENDERER_JPGRAPH; -$rendererLibrary = 'jpgraph3.5.0b1/src/'; -$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary; - -\PHPExcel_Settings::setChartRenderer($rendererName, $rendererLibraryPath); -``` - -After: - -Require the dependency via composer: - -```sh -composer require jpgraph/jpgraph -``` - -And then: - -```php -Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class); -``` - -### PclZip and ZipArchive - -Support for PclZip were dropped in favor of the more complete and modern -[PHP extension ZipArchive](https://php.net/manual/en/book.zip.php). -So the following were removed: - -- `PclZip` -- `PHPExcel_Settings::setZipClass()` -- `PHPExcel_Settings::getZipClass()` -- `PHPExcel_Shared_ZipArchive` -- `PHPExcel_Shared_ZipStreamWrapper` - -### Cell caching - -Cell caching was heavily refactored to leverage -[PSR-16](https://www.php-fig.org/psr/psr-16/). That means most classes -related to that feature were removed: - -- `PHPExcel_CachedObjectStorage_APC` -- `PHPExcel_CachedObjectStorage_DiscISAM` -- `PHPExcel_CachedObjectStorage_ICache` -- `PHPExcel_CachedObjectStorage_Igbinary` -- `PHPExcel_CachedObjectStorage_Memcache` -- `PHPExcel_CachedObjectStorage_Memory` -- `PHPExcel_CachedObjectStorage_MemoryGZip` -- `PHPExcel_CachedObjectStorage_MemorySerialized` -- `PHPExcel_CachedObjectStorage_PHPTemp` -- `PHPExcel_CachedObjectStorage_SQLite` -- `PHPExcel_CachedObjectStorage_SQLite3` -- `PHPExcel_CachedObjectStorage_Wincache` - -In addition to that, `\PhpOffice\PhpSpreadsheet::getCellCollection()` was renamed -to `\PhpOffice\PhpSpreadsheet::getCoordinates()` and -`\PhpOffice\PhpSpreadsheet::getCellCacheController()` to -`\PhpOffice\PhpSpreadsheet::getCellCollection()` for clarity. - -Refer to [the new documentation](./memory_saving.md) to see how to migrate. - -### Dropped conditionally returned cell - -For all the following methods, it is no more possible to change the type of -returned value. It always return the Worksheet and never the Cell or Rule: - -- Worksheet::setCellValue() -- Worksheet::setCellValueByColumnAndRow() -- Worksheet::setCellValueExplicit() -- Worksheet::setCellValueExplicitByColumnAndRow() -- Worksheet::addRule() - -Migration would be similar to: - -``` php -// Before -$cell = $worksheet->setCellValue('A1', 'value', true); - -// After -$cell = $worksheet->getCell('A1')->setValue('value'); -``` - -### Standardized keys for styling - -Array keys used for styling have been standardized for a more coherent experience. -It now uses the same wording and casing as the getter and setter: - -```php -// Before -$style = [ - 'numberformat' => [ - 'code' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, - ], - 'font' => [ - 'strike' => true, - 'superScript' => true, - 'subScript' => true, - ], - 'alignment' => [ - 'rotation' => 90, - 'readorder' => Alignment::READORDER_RTL, - 'wrap' => true, - ], - 'borders' => [ - 'diagonaldirection' => Borders::DIAGONAL_BOTH, - 'allborders' => [ - 'style' => Border::BORDER_THIN, - ], - ], - 'fill' => [ - 'type' => Fill::FILL_GRADIENT_LINEAR, - 'startcolor' => [ - 'argb' => 'FFA0A0A0', - ], - 'endcolor' => [ - 'argb' => 'FFFFFFFF', - ], - ], -]; - -// After -$style = [ - 'numberFormat' => [ - 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, - ], - 'font' => [ - 'strikethrough' => true, - 'superscript' => true, - 'subscript' => true, - ], - 'alignment' => [ - 'textRotation' => 90, - 'readOrder' => Alignment::READORDER_RTL, - 'wrapText' => true, - ], - 'borders' => [ - 'diagonalDirection' => Borders::DIAGONAL_BOTH, - 'allBorders' => [ - 'borderStyle' => Border::BORDER_THIN, - ], - ], - 'fill' => [ - 'fillType' => Fill::FILL_GRADIENT_LINEAR, - 'startColor' => [ - 'argb' => 'FFA0A0A0', - ], - 'endColor' => [ - 'argb' => 'FFFFFFFF', - ], - ], -]; -``` - -### Dedicated class to manipulate coordinates - -Methods to manipulate coordinates that used to exists in `PHPExcel_Cell` were extracted -to a dedicated new class `\PhpOffice\PhpSpreadsheet\Cell\Coordinate`. The methods are: - -- `absoluteCoordinate()` -- `absoluteReference()` -- `buildRange()` -- `columnIndexFromString()` -- `coordinateFromString()` -- `extractAllCellReferencesInRange()` -- `getRangeBoundaries()` -- `mergeRangesInCollection()` -- `rangeBoundaries()` -- `rangeDimension()` -- `splitRange()` -- `stringFromColumnIndex()` - -### Column index based on 1 - -Column indexes are now based on 1. So column `A` is the index `1`. This is consistent -with rows starting at 1 and Excel function `COLUMN()` that returns `1` for column `A`. -So the code must be adapted with something like: - -```php -// Before -$cell = $worksheet->getCellByColumnAndRow($column, $row); - -for ($column = 0; $column < $max; $column++) { - $worksheet->setCellValueByColumnAndRow($column, $row, 'value ' . $column); -} - -// After -$cell = $worksheet->getCellByColumnAndRow($column + 1, $row); - -for ($column = 1; $column <= $max; $column++) { - $worksheet->setCellValueByColumnAndRow($column, $row, 'value ' . $column); -} -``` - -All the following methods are affected: - -- `PHPExcel_Worksheet::cellExistsByColumnAndRow()` -- `PHPExcel_Worksheet::freezePaneByColumnAndRow()` -- `PHPExcel_Worksheet::getCellByColumnAndRow()` -- `PHPExcel_Worksheet::getColumnDimensionByColumn()` -- `PHPExcel_Worksheet::getCommentByColumnAndRow()` -- `PHPExcel_Worksheet::getStyleByColumnAndRow()` -- `PHPExcel_Worksheet::insertNewColumnBeforeByIndex()` -- `PHPExcel_Worksheet::mergeCellsByColumnAndRow()` -- `PHPExcel_Worksheet::protectCellsByColumnAndRow()` -- `PHPExcel_Worksheet::removeColumnByIndex()` -- `PHPExcel_Worksheet::setAutoFilterByColumnAndRow()` -- `PHPExcel_Worksheet::setBreakByColumnAndRow()` -- `PHPExcel_Worksheet::setCellValueByColumnAndRow()` -- `PHPExcel_Worksheet::setCellValueExplicitByColumnAndRow()` -- `PHPExcel_Worksheet::setSelectedCellByColumnAndRow()` -- `PHPExcel_Worksheet::stringFromColumnIndex()` -- `PHPExcel_Worksheet::unmergeCellsByColumnAndRow()` -- `PHPExcel_Worksheet::unprotectCellsByColumnAndRow()` -- `PHPExcel_Worksheet_PageSetup::addPrintAreaByColumnAndRow()` -- `PHPExcel_Worksheet_PageSetup::setPrintAreaByColumnAndRow()` - -### Removed default values - -Default values for many methods were removed when it did not make sense. Typically, -setter methods should not have default values. For a complete list of methods and -their original default values, see [that commit](https://github.com/PHPOffice/PhpSpreadsheet/commit/033a4bdad56340795a5bf7ec3c8a2fde005cda24). diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-and-writing-to-file.md b/vendor/phpoffice/phpspreadsheet/docs/topics/reading-and-writing-to-file.md deleted file mode 100644 index 3b6a037c..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-and-writing-to-file.md +++ /dev/null @@ -1,928 +0,0 @@ -# Reading and writing to file - -As you already know from the [architecture](./architecture.md#readers-and-writers), -reading and writing to a -persisted storage is not possible using the base PhpSpreadsheet classes. -For this purpose, PhpSpreadsheet provides readers and writers, which are -implementations of `\PhpOffice\PhpSpreadsheet\Reader\IReader` and -`\PhpOffice\PhpSpreadsheet\Writer\IWriter`. - -## \PhpOffice\PhpSpreadsheet\IOFactory - -The PhpSpreadsheet API offers multiple methods to create a -`\PhpOffice\PhpSpreadsheet\Reader\IReader` or -`\PhpOffice\PhpSpreadsheet\Writer\IWriter` instance: - -Direct creation via `\PhpOffice\PhpSpreadsheet\IOFactory`. All examples -underneath demonstrate the direct creation method. Note that you can -also use the `\PhpOffice\PhpSpreadsheet\IOFactory` class to do this. - -### Creating `\PhpOffice\PhpSpreadsheet\Reader\IReader` using `\PhpOffice\PhpSpreadsheet\IOFactory` - -There are 2 methods for reading in a file into PhpSpreadsheet: using -automatic file type resolving or explicitly. - -Automatic file type resolving checks the different -`\PhpOffice\PhpSpreadsheet\Reader\IReader` distributed with -PhpSpreadsheet. If one of them can load the specified file name, the -file is loaded using that `\PhpOffice\PhpSpreadsheet\Reader\IReader`. -Explicit mode requires you to specify which -`\PhpOffice\PhpSpreadsheet\Reader\IReader` should be used. - -You can create a `\PhpOffice\PhpSpreadsheet\Reader\IReader` instance using -`\PhpOffice\PhpSpreadsheet\IOFactory` in automatic file type resolving -mode using the following code sample: - -``` php -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("05featuredemo.xlsx"); -``` - -A typical use of this feature is when you need to read files uploaded by -your users, and you don’t know whether they are uploading xls or xlsx -files. - -If you need to set some properties on the reader, (e.g. to only read -data, see more about this later), then you may instead want to use this -variant: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile("05featuredemo.xlsx"); -$reader->setReadDataOnly(true); -$reader->load("05featuredemo.xlsx"); -``` - -You can create a `\PhpOffice\PhpSpreadsheet\Reader\IReader` instance using -`\PhpOffice\PhpSpreadsheet\IOFactory` in explicit mode using the following -code sample: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx"); -$spreadsheet = $reader->load("05featuredemo.xlsx"); -``` - -Note that automatic type resolving mode is slightly slower than explicit -mode. - -### Creating `\PhpOffice\PhpSpreadsheet\Writer\IWriter` using `\PhpOffice\PhpSpreadsheet\IOFactory` - -You can create a `\PhpOffice\PhpSpreadsheet\Writer\IWriter` instance using -`\PhpOffice\PhpSpreadsheet\IOFactory`: - -``` php -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, "Xlsx"); -$writer->save("05featuredemo.xlsx"); -``` - -## Excel 2007 (SpreadsheetML) file format - -Xlsx file format is the main file format of PhpSpreadsheet. It allows -outputting the in-memory spreadsheet to a .xlsx file. - -### \PhpOffice\PhpSpreadsheet\Reader\Xlsx - -#### Reading a spreadsheet - -You can read an .xlsx file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -$spreadsheet = $reader->load("05featuredemo.xlsx"); -``` - -#### Read data only - -You can set the option setReadDataOnly on the reader, to instruct the -reader to ignore styling, data validation, … and just read cell data: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -$reader->setReadDataOnly(true); -$spreadsheet = $reader->load("05featuredemo.xlsx"); -``` - -#### Read specific sheets only - -You can set the option setLoadSheetsOnly on the reader, to instruct the -reader to only load the sheets with a given name: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -$reader->setLoadSheetsOnly(["Sheet 1", "My special sheet"]); -$spreadsheet = $reader->load("05featuredemo.xlsx"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 – 30 of any sheet in -the Excel file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } -} - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.xlsx"); -``` - -### \PhpOffice\PhpSpreadsheet\Writer\Xlsx - -#### Writing a spreadsheet - -You can write an .xlsx file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); -$writer->save("05featuredemo.xlsx"); -``` - -#### Formula pre-calculation - -By default, this writer pre-calculates all formulas in the spreadsheet. -This can be slow on large spreadsheets, and maybe even unwanted. You can -however disable formula pre-calculation: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); -$writer->setPreCalculateFormulas(false); -$writer->save("05featuredemo.xlsx"); -``` - -#### Office 2003 compatibility pack - -Because of a bug in the Office2003 compatibility pack, there can be some -small issues when opening Xlsx spreadsheets (mostly related to formula -calculation). You can enable Office2003 compatibility with the following -code: - - $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); - $writer->setOffice2003Compatibility(true); - $writer->save("05featuredemo.xlsx"); - -**Office2003 compatibility option should only be used when needed** because -it disables several Office2007 file format options, resulting in a -lower-featured Office2007 spreadsheet. - -## Excel 5 (BIFF) file format - -Xls file format is the old Excel file format, implemented in -PhpSpreadsheet to provide a uniform manner to create both .xlsx and .xls -files. It is basically a modified version of [PEAR -Spreadsheet\_Excel\_Writer](https://pear.php.net/package/Spreadsheet_Excel_Writer), -although it has been extended and has fewer limitations and more -features than the old PEAR library. This can read all BIFF versions that -use OLE2: BIFF5 (introduced with office 95) through BIFF8, but cannot -read earlier versions. - -Xls file format will not be developed any further, it just provides an -additional file format for PhpSpreadsheet. - -**Excel5 (BIFF) limitations** Please note that BIFF file format has some -limits regarding to styling cells and handling large spreadsheets via -PHP. - -### \PhpOffice\PhpSpreadsheet\Reader\Xls - -#### Reading a spreadsheet - -You can read an .xls file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -$spreadsheet = $reader->load("05featuredemo.xls"); -``` - -#### Read data only - -You can set the option setReadDataOnly on the reader, to instruct the -reader to ignore styling, data validation, … and just read cell data: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -$reader->setReadDataOnly(true); -$spreadsheet = $reader->load("05featuredemo.xls"); -``` - -#### Read specific sheets only - -You can set the option setLoadSheetsOnly on the reader, to instruct the -reader to only load the sheets with a given name: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -$reader->setLoadSheetsOnly(["Sheet 1", "My special sheet"]); -$spreadsheet = $reader->load("05featuredemo.xls"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 to 30 of any sheet -in the Excel file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } -} - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.xls"); -``` - -### \PhpOffice\PhpSpreadsheet\Writer\Xls - -#### Writing a spreadsheet - -You can write an .xls file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xls($spreadsheet); -$writer->save("05featuredemo.xls"); -``` - -## Excel 2003 XML file format - -Excel 2003 XML file format is a file format which can be used in older -versions of Microsoft Excel. - -**Excel 2003 XML limitations** Please note that Excel 2003 XML format -has some limits regarding to styling cells and handling large -spreadsheets via PHP. - -### \PhpOffice\PhpSpreadsheet\Reader\Xml - -#### Reading a spreadsheet - -You can read an Excel 2003 .xml file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); -$spreadsheet = $reader->load("05featuredemo.xml"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 to 30 of any sheet -in the Excel file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } - -} - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.xml"); -``` - -## Symbolic LinK (SYLK) - -Symbolic Link (SYLK) is a Microsoft file format typically used to -exchange data between applications, specifically spreadsheets. SYLK -files conventionally have a .slk suffix. Composed of only displayable -ANSI characters, it can be easily created and processed by other -applications, such as databases. - -**SYLK limitations** Please note that SYLK file format has some limits -regarding to styling cells and handling large spreadsheets via PHP. - -### \PhpOffice\PhpSpreadsheet\Reader\Slk - -#### Reading a spreadsheet - -You can read an .slk file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); -$spreadsheet = $reader->load("05featuredemo.slk"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 to 30 of any sheet -in the SYLK file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } - -} - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.slk"); -``` - -## Open/Libre Office (.ods) - -Open Office or Libre Office .ods files are the standard file format for -Open Office or Libre Office Calc files. - -### \PhpOffice\PhpSpreadsheet\Reader\Ods - -#### Reading a spreadsheet - -You can read an .ods file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods(); -$spreadsheet = $reader->load("05featuredemo.ods"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 to 30 of any sheet -in the Calc file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } - -} - -$reader = new PhpOffice\PhpSpreadsheet\Reader\Ods(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.ods"); -``` - -## CSV (Comma Separated Values) - -CSV (Comma Separated Values) are often used as an import/export file -format with other systems. PhpSpreadsheet allows reading and writing to -CSV files. - -**CSV limitations** Please note that CSV file format has some limits -regarding to styling cells, number formatting, ... - -### \PhpOffice\PhpSpreadsheet\Reader\Csv - -#### Reading a CSV file - -You can read a .csv file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); -$spreadsheet = $reader->load("sample.csv"); -``` - -#### Setting CSV options - -Often, CSV files are not really "comma separated", or use semicolon (`;`) -as a separator. You can instruct -`\PhpOffice\PhpSpreadsheet\Reader\Csv` some options before reading a CSV -file. - -The separator will be auto-detected, so in most cases it should not be necessary -to specify it. But in cases where auto-detection does not fit the use-case, then -it can be set manually. - -Note that `\PhpOffice\PhpSpreadsheet\Reader\Csv` by default assumes that -the loaded CSV file is UTF-8 encoded. If you are reading CSV files that -were created in Microsoft Office Excel the correct input encoding may -rather be Windows-1252 (CP1252). Always make sure that the input -encoding is set appropriately. - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); -$reader->setInputEncoding('CP1252'); -$reader->setDelimiter(';'); -$reader->setEnclosure(''); -$reader->setSheetIndex(0); - -$spreadsheet = $reader->load("sample.csv"); -``` - -#### Read a specific worksheet - -CSV files can only contain one worksheet. Therefore, you can specify -which sheet to read from CSV: - -``` php -$reader->setSheetIndex(0); -``` - -#### Read into existing spreadsheet - -When working with CSV files, it might occur that you want to import CSV -data into an existing `Spreadsheet` object. The following code loads a -CSV file into an existing `$spreadsheet` containing some sheets, and -imports onto the 6th sheet: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); -$reader->setDelimiter(';'); -$reader->setEnclosure(''); -$reader->setSheetIndex(5); - -$reader->loadIntoExisting("05featuredemo.csv", $spreadsheet); -``` - -### \PhpOffice\PhpSpreadsheet\Writer\Csv - -#### Writing a CSV file - -You can write a .csv file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); -$writer->save("05featuredemo.csv"); -``` - -#### Setting CSV options - -Often, CSV files are not really "comma separated", or use semicolon (`;`) -as a separator. You can instruct -`\PhpOffice\PhpSpreadsheet\Writer\Csv` some options before writing a CSV -file: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); -$writer->setDelimiter(';'); -$writer->setEnclosure(''); -$writer->setLineEnding("\r\n"); -$writer->setSheetIndex(0); - -$writer->save("05featuredemo.csv"); -``` - -#### Write a specific worksheet - -CSV files can only contain one worksheet. Therefore, you can specify -which sheet to write to CSV: - -``` php -$writer->setSheetIndex(0); -``` - -#### Formula pre-calculation - -By default, this writer pre-calculates all formulas in the spreadsheet. -This can be slow on large spreadsheets, and maybe even unwanted. You can -however disable formula pre-calculation: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); -$writer->setPreCalculateFormulas(false); -$writer->save("05featuredemo.csv"); -``` - -#### Writing UTF-8 CSV files - -A CSV file can be marked as UTF-8 by writing a BOM file header. This can -be enabled by using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); -$writer->setUseBOM(true); -$writer->save("05featuredemo.csv"); -``` - -#### Decimal and thousands separators - -If the worksheet you are exporting contains numbers with decimal or -thousands separators then you should think about what characters you -want to use for those before doing the export. - -By default PhpSpreadsheet looks up in the server's locale settings to -decide what characters to use. But to avoid problems it is recommended -to set the characters explicitly as shown below. - -English users will want to use this before doing the export: - -``` php -\PhpOffice\PhpSpreadsheet\Shared\StringHelper::setDecimalSeparator('.'); -\PhpOffice\PhpSpreadsheet\Shared\StringHelper::setThousandsSeparator(','); -``` - -German users will want to use the opposite values. - -``` php -\PhpOffice\PhpSpreadsheet\Shared\StringHelper::setDecimalSeparator(','); -\PhpOffice\PhpSpreadsheet\Shared\StringHelper::setThousandsSeparator('.'); -``` - -Note that the above code sets decimal and thousand separators as global -options. This also affects how HTML and PDF is exported. - -## HTML - -PhpSpreadsheet allows you to read or write a spreadsheet as HTML format, -for quick representation of the data in it to anyone who does not have a -spreadsheet application on their PC, or loading files saved by other -scripts that simply create HTML markup and give it a .xls file -extension. - -**HTML limitations** Please note that HTML file format has some limits -regarding to styling cells, number formatting, ... - -### \PhpOffice\PhpSpreadsheet\Reader\Html - -#### Reading a spreadsheet - -You can read an .html or .htm file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html(); - -$spreadsheet = $reader->load("05featuredemo.html"); -``` - -**HTML limitations** Please note that HTML reader is still experimental -and does not yet support merged cells or nested tables cleanly - -### \PhpOffice\PhpSpreadsheet\Writer\Html - -Please note that `\PhpOffice\PhpSpreadsheet\Writer\Html` only outputs the -first worksheet by default. - -#### Writing a spreadsheet - -You can write a .htm file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); - -$writer->save("05featuredemo.htm"); -``` - -#### Write all worksheets - -HTML files can contain one or more worksheets. If you want to write all -sheets into a single HTML file, use the following code: - -``` php -$writer->writeAllSheets(); -``` - -#### Write a specific worksheet - -HTML files can contain one or more worksheets. Therefore, you can -specify which sheet to write to HTML: - -``` php -$writer->setSheetIndex(0); -``` - -#### Setting the images root of the HTML file - -There might be situations where you want to explicitly set the included -images root. For example, instead of: - - ``` html - - ``` - -You might want to see: - -``` html - -``` - -You can use the following code to achieve this result: - -``` php -$writer->setImagesRoot('http://www.example.com'); -``` - -#### Formula pre-calculation - -By default, this writer pre-calculates all formulas in the spreadsheet. -This can be slow on large spreadsheets, and maybe even unwanted. You can -however disable formula pre-calculation: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); -$writer->setPreCalculateFormulas(false); - -$writer->save("05featuredemo.htm"); -``` - -#### Embedding generated HTML in a web page - -There might be a situation where you want to embed the generated HTML in -an existing website. \PhpOffice\PhpSpreadsheet\Writer\Html provides -support to generate only specific parts of the HTML code, which allows -you to use these parts in your website. - -Supported methods: - -- `generateHTMLHeader()` -- `generateStyles()` -- `generateSheetData()` -- `generateHTMLFooter()` - -Here's an example which retrieves all parts independently and merges -them into a resulting HTML page: - -``` php -generateHTMLHeader(); -?> - - -?> - ---> - - -generateSheetData(); -echo $writer->generateHTMLFooter(); -?> -``` - -#### Writing UTF-8 HTML files - -A HTML file can be marked as UTF-8 by writing a BOM file header. This -can be enabled by using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); -$writer->setUseBOM(true); - -$writer->save("05featuredemo.htm"); -``` - -#### Decimal and thousands separators - -See section `\PhpOffice\PhpSpreadsheet\Writer\Csv` how to control the -appearance of these. - -## PDF - -PhpSpreadsheet allows you to write a spreadsheet into PDF format, for -fast distribution of represented data. - -**PDF limitations** Please note that PDF file format has some limits -regarding to styling cells, number formatting, ... - -### \PhpOffice\PhpSpreadsheet\Writer\Pdf - -PhpSpreadsheet’s PDF Writer is a wrapper for a 3rd-Party PDF Rendering -library such as TCPDF, mPDF or Dompdf. You must now install a PDF -rendering library yourself; but PhpSpreadsheet will work with a number -of different libraries. - -Currently, the following libraries are supported: - -Library | Downloadable from | PhpSpreadsheet writer ---------|-------------------------------------|---------------------- -TCPDF | https://github.com/tecnickcom/tcpdf | Tcpdf -mPDF | https://github.com/mpdf/mpdf | Mpdf -Dompdf | https://github.com/dompdf/dompdf | Dompdf - -The different libraries have different strengths and weaknesses. Some -generate better formatted output than others, some are faster or use -less memory than others, while some generate smaller .pdf files. It is -the developers choice which one they wish to use, appropriate to their -own circumstances. - -You can instantiate a writer with its specific name, like so: - -``` php -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Mpdf'); -``` - -Or you can register which writer you are using with a more generic name, -so you don't need to remember which library you chose, only that you want -to write PDF files: - -``` php -$class = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class; -\PhpOffice\PhpSpreadsheet\IOFactory::registerWriter('Pdf', $class); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf'); -``` - -Or you can instantiate directly the writer of your choice like so: - -``` php -$writer = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet); -``` - -#### Custom implementation or configuration - -If you need a custom implementation, or custom configuration, of a supported -PDF library. You can extends the PDF library, and the PDF writer like so: - -``` php -class My_Custom_TCPDF extends TCPDF -{ - // ... -} - -class My_Custom_TCPDF_Writer extends \PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf -{ - protected function createExternalWriterInstance($orientation, $unit, $paperSize) - { - $instance = new My_Custom_TCPDF($orientation, $unit, $paperSize); - - // more configuration of $instance - - return $instance; - } -} - -\PhpOffice\PhpSpreadsheet\IOFactory::registerWriter('Pdf', MY_TCPDF_WRITER::class); -``` - -#### Writing a spreadsheet - -Once you have identified the Renderer that you wish to use for PDF -generation, you can write a .pdf file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet); -$writer->save("05featuredemo.pdf"); -``` - -Please note that `\PhpOffice\PhpSpreadsheet\Writer\Pdf` only outputs the -first worksheet by default. - -#### Write all worksheets - -PDF files can contain one or more worksheets. If you want to write all -sheets into a single PDF file, use the following code: - -``` php -$writer->writeAllSheets(); -``` - -#### Write a specific worksheet - -PDF files can contain one or more worksheets. Therefore, you can specify -which sheet to write to PDF: - -``` php -$writer->setSheetIndex(0); -``` - -#### Formula pre-calculation - -By default, this writer pre-calculates all formulas in the spreadsheet. -This can be slow on large spreadsheets, and maybe even unwanted. You can -however disable formula pre-calculation: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet); -$writer->setPreCalculateFormulas(false); - -$writer->save("05featuredemo.pdf"); -``` - -#### Decimal and thousands separators - -See section `\PhpOffice\PhpSpreadsheet\Writer\Csv` how to control the -appearance of these. - -## Generating Excel files from templates (read, modify, write) - -Readers and writers are the tools that allow you to generate Excel files -from templates. This requires less coding effort than generating the -Excel file from scratch, especially if your template has many styles, -page setup properties, headers etc. - -Here is an example how to open a template file, fill in a couple of -fields and save it again: - -``` php -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('template.xlsx'); - -$worksheet = $spreadsheet->getActiveSheet(); - -$worksheet->getCell('A1')->setValue('John'); -$worksheet->getCell('A2')->setValue('Smith'); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); -$writer->save('write.xls'); -``` - -Notice that it is ok to load an xlsx file and generate an xls file. - -## Generating Excel files from HTML content - -If you are generating an Excel file from pre-rendered HTML content you can do so -automatically using the HTML Reader. This is most useful when you are generating -Excel files from web application content that would be downloaded/sent to a user. - -For example: - -```php -$htmlString = ' - - - - - - - - - -
Hello World
Hello
World
Hello
World
'; - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html(); -$spreadsheet = $reader->loadFromString($htmlString); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); -$writer->save('write.xls'); -``` - -Suppose you have multiple worksheets you'd like created from html. This can be -accomplished as follows. - -```php -$firstHtmlString = ' - - - -
Hello World
'; -$secondHtmlString = ' - - - -
Hello World
'; - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html(); -$spreadsheet = $reader->loadFromString($firstHtmlString); -$reader->setSheetIndex(1); -$spreadhseet = $reader->loadFromString($secondHtmlString, $spreadsheet); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); -$writer->save('write.xls'); -``` diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md b/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md deleted file mode 100644 index 779082dc..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md +++ /dev/null @@ -1,689 +0,0 @@ -# Reading Files - -## Security - -XML-based formats such as OfficeOpen XML, Excel2003 XML, OASIS and -Gnumeric are susceptible to XML External Entity Processing (XXE) -injection attacks when reading spreadsheet files. This can lead to: - -- Disclosure whether a file is existent -- Server Side Request Forgery -- Command Execution (depending on the installed PHP wrappers) - -To prevent this, by default every XML-based Reader looks for XML -entities declared inside the DOCTYPE and if any is found an exception -is raised. - -Read more [about of XXE injection](https://websec.io/2012/08/27/Preventing-XXE-in-PHP.html). - -## Loading a Spreadsheet File - -The simplest way to load a workbook file is to let PhpSpreadsheet's IO -Factory identify the file type and load it, calling the static `load()` -method of the `\PhpOffice\PhpSpreadsheet\IOFactory` class. - -``` php -$inputFileName = './sampleData/example1.xls'; - -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName); -``` - -See `samples/Reader/01_Simple_file_reader_using_IOFactory.php` for a working -example of this code. - -The `load()` method will attempt to identify the file type, and -instantiate a loader for that file type; using it to load the file and -store the data and any formatting in a `Spreadsheet` object. - -The method makes an initial guess at the loader to instantiate based on -the file extension; but will test the file before actually executing the -load: so if (for example) the file is actually a CSV file or contains -HTML markup, but that has been given a .xls extension (quite a common -practise), it will reject the Xls loader that it would normally use for -a .xls file; and test the file using the other loaders until it finds -the appropriate loader, and then use that to read the file. - -While easy to implement in your code, and you don't need to worry about -the file type; this isn't the most efficient method to load a file; and -it lacks the flexibility to configure the loader in any way before -actually reading the file into a `Spreadsheet` object. - -## Creating a Reader and Loading a Spreadsheet File - -If you know the file type of the spreadsheet file that you need to load, -you can instantiate a new reader object for that file type, then use the -reader's `load()` method to read the file to a `Spreadsheet` object. It is -possible to instantiate the reader objects for each of the different -supported filetype by name. However, you may get unpredictable results -if the file isn't of the right type (e.g. it is a CSV with an extension -of .xls), although this type of exception should normally be trapped. - -``` php -$inputFileName = './sampleData/example1.xls'; - -/** Create a new Xls Reader **/ -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Gnumeric(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/02_Simple_file_reader_using_a_specified_reader.php` -for a working example of this code. - -Alternatively, you can use the IO Factory's `createReader()` method to -instantiate the reader object for you, simply telling it the file type -of the reader that you want instantiating. - -``` php -$inputFileType = 'Xls'; -// $inputFileType = 'Xlsx'; -// $inputFileType = 'Xml'; -// $inputFileType = 'Ods'; -// $inputFileType = 'Slk'; -// $inputFileType = 'Gnumeric'; -// $inputFileType = 'Csv'; -$inputFileName = './sampleData/example1.xls'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php` -for a working example of this code. - -If you're uncertain of the filetype, you can use the `IOFactory::identify()` -method to identify the reader that you need, before using the -`createReader()` method to instantiate the reader object. - -``` php -$inputFileName = './sampleData/example1.xls'; - -/** Identify the type of $inputFileName **/ -$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($inputFileName); -/** Create a new Reader of the type that has been identified **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php` -for a working example of this code. - -## Spreadsheet Reader Options - -Once you have created a reader object for the workbook that you want to -load, you have the opportunity to set additional options before -executing the `load()` method. - -### Reading Only Data from a Spreadsheet File - -If you're only interested in the cell values in a workbook, but don't -need any of the cell formatting information, then you can set the reader -to read only the data values and any formulae from each cell using the -`setReadDataOnly()` method. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Advise the Reader that we only want to load cell data **/ -$reader->setReadDataOnly(true); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php` -for a working example of this code. - -It is important to note that Workbooks (and PhpSpreadsheet) store dates -and times as simple numeric values: they can only be distinguished from -other numeric values by the format mask that is applied to that cell. -When setting read data only to true, PhpSpreadsheet doesn't read the -cell format masks, so it is not possible to differentiate between -dates/times and numbers. - -The Gnumeric loader has been written to read the format masks for date -values even when read data only has been set to true, so it can -differentiate between dates/times and numbers; but this change hasn't -yet been implemented for the other readers. - -Reading Only Data from a Spreadsheet File applies to Readers: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Xml | YES | -Ods | YES | SYLK | NO | Gnumeric | YES | -CSV | NO | HTML | NO - -### Reading Only Named WorkSheets from a File - -If your workbook contains a number of worksheets, but you are only -interested in reading some of those, then you can use the -`setLoadSheetsOnly()` method to identify those sheets you are interested -in reading. - -To read a single sheet, you can pass that sheet name as a parameter to -the `setLoadSheetsOnly()` method. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; -$sheetname = 'Data Sheet #2'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Advise the Reader of which WorkSheets we want to load **/ -$reader->setLoadSheetsOnly($sheetname); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php` -for a working example of this code. - -If you want to read more than just a single sheet, you can pass a list -of sheet names as an array parameter to the `setLoadSheetsOnly()` method. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; -$sheetnames = ['Data Sheet #1','Data Sheet #3']; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Advise the Reader of which WorkSheets we want to load **/ -$reader->setLoadSheetsOnly($sheetnames); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php` -for a working example of this code. - -To reset this option to the default, you can call the `setLoadAllSheets()` -method. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Advise the Reader to load all Worksheets **/ -$reader->setLoadAllSheets(); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/06_Simple_file_reader_loading_all_worksheets.php` for a -working example of this code. - -Reading Only Named WorkSheets from a File applies to Readers: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Xml | YES | -Ods | YES | SYLK | NO | Gnumeric | YES | -CSV | NO | HTML | NO - -### Reading Only Specific Columns and Rows from a File (Read Filters) - -If you are only interested in reading part of a worksheet, then you can -write a filter class that identifies whether or not individual cells -should be read by the loader. A read filter must implement the -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter` interface, and contain a -`readCell()` method that accepts arguments of `$column`, `$row` and -`$worksheetName`, and return a boolean true or false that indicates -whether a workbook cell identified by those arguments should be read or -not. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; -$sheetname = 'Data Sheet #3'; - -/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter -{ - public function readCell($column, $row, $worksheetName = '') { - // Read rows 1 to 7 and columns A to E only - if ($row >= 1 && $row <= 7) { - if (in_array($column,range('A','E'))) { - return true; - } - } - return false; - } -} - -/** Create an Instance of our Read Filter **/ -$filterSubset = new MyReadFilter(); - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Tell the Reader that we want to use the Read Filter **/ -$reader->setReadFilter($filterSubset); -/** Load only the rows and columns that match our filter to Spreadsheet **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/09_Simple_file_reader_using_a_read_filter.php` for a -working example of this code. - -This example is not particularly useful, because it can only be used in -a very specific circumstance (when you only want cells in the range -A1:E7 from your worksheet. A generic Read Filter would probably be more -useful: - -``` php -/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter -{ - private $startRow = 0; - private $endRow = 0; - private $columns = []; - - /** Get the list of rows and columns to read */ - public function __construct($startRow, $endRow, $columns) { - $this->startRow = $startRow; - $this->endRow = $endRow; - $this->columns = $columns; - } - - public function readCell($column, $row, $worksheetName = '') { - // Only read the rows and columns that were configured - if ($row >= $this->startRow && $row <= $this->endRow) { - if (in_array($column,$this->columns)) { - return true; - } - } - return false; - } -} - -/** Create an Instance of our Read Filter, passing in the cell range **/ -$filterSubset = new MyReadFilter(9,15,range('G','K')); -``` - -See `samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php` -for a working example of this code. - -This can be particularly useful for conserving memory, by allowing you -to read and process a large workbook in "chunks": an example of this -usage might be when transferring data from an Excel worksheet to a -database. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example2.xls'; - -/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ -class ChunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter -{ - private $startRow = 0; - private $endRow = 0; - - /** Set the list of rows that we want to read */ - public function setRows($startRow, $chunkSize) { - $this->startRow = $startRow; - $this->endRow = $startRow + $chunkSize; - } - - public function readCell($column, $row, $worksheetName = '') { - // Only read the heading row, and the configured rows - if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { - return true; - } - return false; - } -} - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -/** Define how many rows we want to read for each "chunk" **/ -$chunkSize = 2048; -/** Create a new Instance of our Read Filter **/ -$chunkFilter = new ChunkReadFilter(); - -/** Tell the Reader that we want to use the Read Filter **/ -$reader->setReadFilter($chunkFilter); - -/** Loop to read our worksheet in "chunk size" blocks **/ -for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) { - /** Tell the Read Filter which rows we want this iteration **/ - $chunkFilter->setRows($startRow,$chunkSize); - /** Load only the rows that match our filter **/ - $spreadsheet = $reader->load($inputFileName); - // Do some processing here -} -``` - -See `samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_` -for a working example of this code. - -Using Read Filters applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Xml | YES | -Ods | YES | SYLK | NO | Gnumeric | YES | -CSV | YES | HTML | NO | | | - -### Combining Multiple Files into a Single Spreadsheet Object - -While you can limit the number of worksheets that are read from a -workbook file using the `setLoadSheetsOnly()` method, certain readers also -allow you to combine several individual "sheets" from different files -into a single `Spreadsheet` object, where each individual file is a -single worksheet within that workbook. For each file that you read, you -need to indicate which worksheet index it should be loaded into using -the `setSheetIndex()` method of the `$reader`, then use the -`loadIntoExisting()` method rather than the `load()` method to actually read -the file into that worksheet. - -``` php -$inputFileType = 'Csv'; -$inputFileNames = [ - './sampleData/example1.csv', - './sampleData/example2.csv' - './sampleData/example3.csv' -]; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -/** Extract the first named file from the array list **/ -$inputFileName = array_shift($inputFileNames); -/** Load the initial file to the first worksheet in a `Spreadsheet` Object **/ -$spreadsheet = $reader->load($inputFileName); -/** Set the worksheet title (to the filename that we've loaded) **/ -$spreadsheet->getActiveSheet() - ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME)); - -/** Loop through all the remaining files in the list **/ -foreach($inputFileNames as $sheet => $inputFileName) { - /** Increment the worksheet index pointer for the Reader **/ - $reader->setSheetIndex($sheet+1); - /** Load the current file into a new worksheet in Spreadsheet **/ - $reader->loadIntoExisting($inputFileName,$spreadsheet); - /** Set the worksheet title (to the filename that we've loaded) **/ - $spreadsheet->getActiveSheet() - ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME)); -} -``` - -See `samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php` for a -working example of this code. - -Note that using the same sheet index for multiple sheets won't append -files into the same sheet, but overwrite the results of the previous -load. You cannot load multiple CSV files into the same worksheet. - -Combining Multiple Files into a Single Spreadsheet Object applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Xml | NO | -Ods | NO | SYLK | YES | Gnumeric | NO | -CSV | YES | HTML | NO - -### Combining Read Filters with the `setSheetIndex()` method to split a large CSV file across multiple Worksheets - -An Xls BIFF .xls file is limited to 65536 rows in a worksheet, while the -Xlsx Microsoft Office Open XML SpreadsheetML .xlsx file is limited to -1,048,576 rows in a worksheet; but a CSV file is not limited other than -by available disk space. This means that we wouldn’t ordinarily be able -to read all the rows from a very large CSV file that exceeded those -limits, and save it as an Xls or Xlsx file. However, by using Read -Filters to read the CSV file in "chunks" (using the ChunkReadFilter -Class that we defined in [the above section](#reading-only-specific-columns-and-rows-from-a-file-read-filters), -and the `setSheetIndex()` method of the `$reader`, we can split the CSV -file across several individual worksheets. - -``` php -$inputFileType = 'Csv'; -$inputFileName = './sampleData/example2.csv'; - -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
'; -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -/** Define how many rows we want to read for each "chunk" **/ -$chunkSize = 65530; -/** Create a new Instance of our Read Filter **/ -$chunkFilter = new ChunkReadFilter(); - -/** Tell the Reader that we want to use the Read Filter **/ -/** and that we want to store it in contiguous rows/columns **/ - -$reader->setReadFilter($chunkFilter) - ->setContiguous(true); - -/** Instantiate a new Spreadsheet object manually **/ -$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); - -/** Set a sheet index **/ -$sheet = 0; -/** Loop to read our worksheet in "chunk size" blocks **/ -/** $startRow is set to 2 initially because we always read the headings in row #1 **/ -for ($startRow = 2; $startRow <= 1000000; $startRow += $chunkSize) { - /** Tell the Read Filter which rows we want to read this loop **/ - $chunkFilter->setRows($startRow,$chunkSize); - - /** Increment the worksheet index pointer for the Reader **/ - $reader->setSheetIndex($sheet); - /** Load only the rows that match our filter into a new worksheet **/ - $reader->loadIntoExisting($inputFileName,$spreadsheet); - /** Set the worksheet title for the sheet that we've justloaded) **/ - /** and increment the sheet index as well **/ - $spreadsheet->getActiveSheet()->setTitle('Country Data #'.(++$sheet)); -} -``` - -See `samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php` -for a working example of this code. - -This code will read 65,530 rows at a time from the CSV file that we’re -loading, and store each "chunk" in a new worksheet. - -The `setContiguous()` method for the Reader is important here. It is -applicable only when working with a Read Filter, and identifies whether -or not the cells should be stored by their position within the CSV file, -or their position relative to the filter. - -For example, if the filter returned true for cells in the range B2:C3, -then with setContiguous set to false (the default) these would be loaded -as B2:C3 in the `Spreadsheet` object; but with setContiguous set to -true, they would be loaded as A1:B2. - -Splitting a single loaded file across multiple worksheets applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Xml | NO | -Ods | NO | SYLK | NO | Gnumeric | NO | -CSV | YES | HTML | NO - -### Pipe or Tab Separated Value Files - -The CSV loader will attempt to auto-detect the separator used in the file. If it -cannot auto-detect, it will default to the comma. If this does not fit your -use-case, you can manually specify a separator by using the `setDelimiter()` -method. - -``` php -$inputFileType = 'Csv'; -$inputFileName = './sampleData/example1.tsv'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Set the delimiter to a TAB character **/ -$reader->setDelimiter("\t"); -// $reader->setDelimiter('|'); - -/** Load the file to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php` -for a working example of this code. - -In addition to the delimiter, you can also use the following methods to -set other attributes for the data load: - -Method | Default --------------------|---------- -setEnclosure() | `"` -setInputEncoding() | `UTF-8` - -Setting CSV delimiter applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Xml | NO | -Ods | NO | SYLK | NO | Gnumeric | NO | -CSV | YES | HTML | NO - -### A Brief Word about the Advanced Value Binder - -When loading data from a file that contains no formatting information, -such as a CSV file, then data is read either as strings or numbers -(float or integer). This means that PhpSpreadsheet does not -automatically recognise dates/times (such as `16-Apr-2009` or `13:30`), -booleans (`true` or `false`), percentages (`75%`), hyperlinks -(`https://www.example.com`), etc as anything other than simple strings. -However, you can apply additional processing that is executed against -these values during the load process within a Value Binder. - -A Value Binder is a class that implement the -`\PhpOffice\PhpSpreadsheet\Cell\IValueBinder` interface. It must contain a -`bindValue()` method that accepts a `\PhpOffice\PhpSpreadsheet\Cell\Cell` and a -value as arguments, and return a boolean `true` or `false` that indicates -whether the workbook cell has been populated with the value or not. The -Advanced Value Binder implements such a class: amongst other tests, it -identifies a string comprising "TRUE" or "FALSE" (based on locale -settings) and sets it to a boolean; or a number in scientific format -(e.g. "1.234e-5") and converts it to a float; or dates and times, -converting them to their Excel timestamp value – before storing the -value in the cell object. It also sets formatting for strings that are -identified as dates, times or percentages. It could easily be extended -to provide additional handling (including text or cell formatting) when -it encountered a hyperlink, or HTML markup within a CSV file. - -So using a Value Binder allows a great deal more flexibility in the -loader logic when reading unformatted text files. - -``` php -/** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/ -\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); - -$inputFileType = 'Csv'; -$inputFileName = './sampleData/example1.tsv'; - -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -$reader->setDelimiter("\t"); -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php` -for a working example of this code. - -Loading using a Value Binder applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N -----------|:---:|--------|:---:|--------------|:---: -Xlsx | NO | Xls | NO | Xml | NO -Ods | NO | SYLK | NO | Gnumeric | NO -CSV | YES | HTML | YES - -## Error Handling - -Of course, you should always apply some error handling to your scripts -as well. PhpSpreadsheet throws exceptions, so you can wrap all your code -that accesses the library methods within Try/Catch blocks to trap for -any problems that are encountered, and deal with them in an appropriate -manner. - -The PhpSpreadsheet Readers throw a -`\PhpOffice\PhpSpreadsheet\Reader\Exception`. - -``` php -$inputFileName = './sampleData/example-1.xls'; - -try { - /** Load $inputFileName to a Spreadsheet Object **/ - $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName); -} catch(\PhpOffice\PhpSpreadsheet\Reader\Exception $e) { - die('Error loading file: '.$e->getMessage()); -} -``` - -See `samples/Reader/16_Handling_loader_exceptions_using_TryCatch.php` for a -working example of this code. - -## Helper Methods - -You can retrieve a list of worksheet names contained in a file without -loading the whole file by using the Reader’s `listWorksheetNames()` -method; similarly, a `listWorksheetInfo()` method will retrieve the -dimensions of worksheet in a file without needing to load and parse the -whole file. - -### listWorksheetNames - -The `listWorksheetNames()` method returns a simple array listing each -worksheet name within the workbook: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -$worksheetNames = $reader->listWorksheetNames($inputFileName); - -echo '

Worksheet Names

'; -echo '
    '; -foreach ($worksheetNames as $worksheetName) { - echo '
  1. ', $worksheetName, '
  2. '; -} -echo '
'; -``` - -See `samples/Reader/18_Reading_list_of_worksheets_without_loading_entire_file.php` -for a working example of this code. - -### listWorksheetInfo - -The `listWorksheetInfo()` method returns a nested array, with each entry -listing the name and dimensions for a worksheet: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -$worksheetData = $reader->listWorksheetInfo($inputFileName); - -echo '

Worksheet Information

'; -echo '
    '; -foreach ($worksheetData as $worksheet) { - echo '
  1. ', $worksheet['worksheetName'], '
    '; - echo 'Rows: ', $worksheet['totalRows'], - ' Columns: ', $worksheet['totalColumns'], '
    '; - echo 'Cell Range: A1:', - $worksheet['lastColumnLetter'], $worksheet['totalRows']; - echo '
  2. '; -} -echo '
'; -``` - -See `samples/Reader/19_Reading_worksheet_information_without_loading_entire_file.php` -for a working example of this code. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/recipes.md b/vendor/phpoffice/phpspreadsheet/docs/topics/recipes.md deleted file mode 100644 index b0956b6e..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/recipes.md +++ /dev/null @@ -1,1506 +0,0 @@ -# Recipes - -The following pages offer you some widely-used PhpSpreadsheet recipes. -Please note that these do NOT offer complete documentation on specific -PhpSpreadsheet API functions, but just a bump to get you started. If you -need specific API functions, please refer to the [API documentation](https://phpoffice.github.io/PhpSpreadsheet). - -For example, [setting a worksheet's page orientation and size -](#setting-a-worksheets-page-orientation-and-size) covers setting a page -orientation to A4. Other paper formats, like US Letter, are not covered -in this document, but in the PhpSpreadsheet [API documentation](https://phpoffice.github.io/PhpSpreadsheet). - -## Setting a spreadsheet's metadata - -PhpSpreadsheet allows an easy way to set a spreadsheet's metadata, using -document property accessors. Spreadsheet metadata can be useful for -finding a specific document in a file repository or a document -management system. For example Microsoft Sharepoint uses document -metadata to search for a specific document in its document lists. - -Setting spreadsheet metadata is done as follows: - -``` php -$spreadsheet->getProperties() - ->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription( - "Test document for Office 2007 XLSX, generated using PHP classes." - ) - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); -``` - -## Setting a spreadsheet's active sheet - -The following line of code sets the active sheet index to the first -sheet: - -``` php -$spreadsheet->setActiveSheetIndex(0); -``` - -You can also set the active sheet by its name/title - -``` php -$spreadsheet->setActiveSheetIndexByName('DataSheet') -``` - -will change the currently active sheet to the worksheet called -"DataSheet". - -## Write a date or time into a cell - -In Excel, dates and Times are stored as numeric values counting the -number of days elapsed since 1900-01-01. For example, the date -'2008-12-31' is represented as 39813. You can verify this in Microsoft -Office Excel by entering that date in a cell and afterwards changing the -number format to 'General' so the true numeric value is revealed. -Likewise, '3:15 AM' is represented as 0.135417. - -PhpSpreadsheet works with UST (Universal Standard Time) date and Time -values, but does no internal conversions; so it is up to the developer -to ensure that values passed to the date/time conversion functions are -UST. - -Writing a date value in a cell consists of 2 lines of code. Select the -method that suits you the best. Here are some examples: - -``` php - -// MySQL-like timestamp '2008-12-31' or date string -\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); - -$spreadsheet->getActiveSheet() - ->setCellValue('D1', '2008-12-31'); - -$spreadsheet->getActiveSheet()->getStyle('D1') - ->getNumberFormat() - ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH); - -// PHP-time (Unix time) -$time = gmmktime(0,0,0,12,31,2008); // int(1230681600) -$spreadsheet->getActiveSheet() - ->setCellValue('D1', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($time)); -$spreadsheet->getActiveSheet()->getStyle('D1') - ->getNumberFormat() - ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH); - -// Excel-date/time -$spreadsheet->getActiveSheet()->setCellValue('D1', 39813) -$spreadsheet->getActiveSheet()->getStyle('D1') - ->getNumberFormat() - ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH); -``` - -The above methods for entering a date all yield the same result. -`\PhpOffice\PhpSpreadsheet\Style\NumberFormat` provides a lot of -pre-defined date formats. - -The `\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel()` method will also -work with a PHP DateTime object. - -Similarly, times (or date and time values) can be entered in the same -fashion: just remember to use an appropriate format code. - -**Note:** - -See section "Using value binders to facilitate data entry" to learn more -about the AdvancedValueBinder used in the first example. Excel can also -operate in a 1904-based calendar (default for workbooks saved on Mac). -Normally, you do not have to worry about this when using PhpSpreadsheet. - -## Write a formula into a cell - -Inside the Excel file, formulas are always stored as they would appear -in an English version of Microsoft Office Excel, and PhpSpreadsheet -handles all formulae internally in this format. This means that the -following rules hold: - -- Decimal separator is `.` (period) -- Function argument separator is `,` (comma) -- Matrix row separator is `;` (semicolon) -- English function names must be used - -This is regardless of which language version of Microsoft Office Excel -may have been used to create the Excel file. - -When the final workbook is opened by the user, Microsoft Office Excel -will take care of displaying the formula according the applications -language. Translation is taken care of by the application! - -The following line of code writes the formula -`=IF(C4>500,"profit","loss")` into the cell B8. Note that the -formula must start with `=` to make PhpSpreadsheet recognise this as a -formula. - -``` php -$spreadsheet->getActiveSheet()->setCellValue('B8','=IF(C4>500,"profit","loss")'); -``` - -If you want to write a string beginning with an `=` character to a -cell, then you should use the `setCellValueExplicit()` method. - -``` php -$spreadsheet->getActiveSheet() - ->setCellValueExplicit( - 'B8', - '=IF(C4>500,"profit","loss")', - \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING - ); -``` - -A cell's formula can be read again using the following line of code: - -``` php -$formula = $spreadsheet->getActiveSheet()->getCell('B8')->getValue(); -``` - -If you need the calculated value of a cell, use the following code. This -is further explained in [the calculation engine](./calculation-engine.md). - -``` php -$value = $spreadsheet->getActiveSheet()->getCell('B8')->getCalculatedValue(); -``` - -## Locale Settings for Formulae - -Some localisation elements have been included in PhpSpreadsheet. You can -set a locale by changing the settings. To set the locale to Russian you -would use: - -``` php -$locale = 'ru'; -$validLocale = \PhpOffice\PhpSpreadsheet\Settings::setLocale($locale); -if (!$validLocale) { - echo 'Unable to set locale to '.$locale." - reverting to en_us
\n"; -} -``` - -If Russian language files aren't available, the `setLocale()` method -will return an error, and English settings will be used throughout. - -Once you have set a locale, you can translate a formula from its -internal English coding. - -``` php -$formula = $spreadsheet->getActiveSheet()->getCell('B8')->getValue(); -$translatedFormula = \PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->_translateFormulaToLocale($formula); -``` - -You can also create a formula using the function names and argument -separators appropriate to the defined locale; then translate it to -English before setting the cell value: - -``` php -$formula = '=ДНЕЙ360(ДАТА(2010;2;5);ДАТА(2010;12;31);ИСТИНА)'; -$internalFormula = \PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->translateFormulaToEnglish($formula); -$spreadsheet->getActiveSheet()->setCellValue('B8',$internalFormula); -``` - -Currently, formula translation only translates the function names, the -constants TRUE and FALSE, and the function argument separators. - -At present, the following locale settings are supported: - -Language | | Locale Code ----------------------|----------------------|------------- -Czech | Ceština | cs -Danish | Dansk | da -German | Deutsch | de -Spanish | Español | es -Finnish | Suomi | fi -French | Français | fr -Hungarian | Magyar | hu -Italian | Italiano | it -Dutch | Nederlands | nl -Norwegian | Norsk | no -Polish | Jezyk polski | pl -Portuguese | Português | pt -Brazilian Portuguese | Português Brasileiro | pt_br -Russian | русский язык | ru -Swedish | Svenska | sv -Turkish | Türkçe | tr - -## Write a newline character "\n" in a cell (ALT+"Enter") - -In Microsoft Office Excel you get a line break in a cell by hitting -ALT+"Enter". When you do that, it automatically turns on "wrap text" for -the cell. - -Here is how to achieve this in PhpSpreadsheet: - -``` php -$spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld"); -$spreadsheet->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true); -``` - -**Tip** - -Read more about formatting cells using `getStyle()` elsewhere. - -**Tip** - -AdvancedValuebinder.php automatically turns on "wrap text" for the cell -when it sees a newline character in a string that you are inserting in a -cell. Just like Microsoft Office Excel. Try this: - -``` php -\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); - -$spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld"); -``` - -Read more about AdvancedValueBinder.php elsewhere. - -## Explicitly set a cell's datatype - -You can set a cell's datatype explicitly by using the cell's -setValueExplicit method, or the setCellValueExplicit method of a -worksheet. Here's an example: - -``` php -$spreadsheet->getActiveSheet()->getCell('A1') - ->setValueExplicit( - '25', - \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC - ); -``` - -## Change a cell into a clickable URL - -You can make a cell a clickable URL by setting its hyperlink property: - -``` php -$spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net'); -$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('https://www.example.com'); -``` - -If you want to make a hyperlink to another worksheet/cell, use the -following code: - -``` php -$spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net'); -$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl("sheet://'Sheetname'!A1"); -``` - -## Setting Printer Options for Excel files - -### Setting a worksheet's page orientation and size - -Setting a worksheet's page orientation and size can be done using the -following lines of code: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup() - ->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); -$spreadsheet->getActiveSheet()->getPageSetup() - ->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4); -``` - -Note that there are additional page settings available. Please refer to -the [API documentation](https://phpoffice.github.io/PhpSpreadsheet) for all possible options. - -### Page Setup: Scaling options - -The page setup scaling options in PhpSpreadsheet relate directly to the -scaling options in the "Page Setup" dialog as shown in the illustration. - -Default values in PhpSpreadsheet correspond to default values in MS -Office Excel as shown in illustration - -![08-page-setup-scaling-options.png](./images/08-page-setup-scaling-options.png) - -method | initial value | calling method will trigger | Note ---------------------|:-------------:|-----------------------------|------ -setFitToPage(...) | FALSE | - | -setScale(...) | 100 | setFitToPage(FALSE) | -setFitToWidth(...) | 1 | setFitToPage(TRUE) | value 0 means do-not-fit-to-width -setFitToHeight(...) | 1 | setFitToPage(TRUE) | value 0 means do-not-fit-to-height - -#### Example - -Here is how to fit to 1 page wide by infinite pages tall: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setFitToWidth(1); -$spreadsheet->getActiveSheet()->getPageSetup()->setFitToHeight(0); -``` - -As you can see, it is not necessary to call setFitToPage(TRUE) since -setFitToWidth(...) and setFitToHeight(...) triggers this. - -If you use `setFitToWidth()` you should in general also specify -`setFitToHeight()` explicitly like in the example. Be careful relying on -the initial values. - -### Page margins - -To set page margins for a worksheet, use this code: - -``` php -$spreadsheet->getActiveSheet()->getPageMargins()->setTop(1); -$spreadsheet->getActiveSheet()->getPageMargins()->setRight(0.75); -$spreadsheet->getActiveSheet()->getPageMargins()->setLeft(0.75); -$spreadsheet->getActiveSheet()->getPageMargins()->setBottom(1); -``` - -Note that the margin values are specified in inches. - -![08-page-setup-margins.png](./images/08-page-setup-margins.png) - -### Center a page horizontally/vertically - -To center a page horizontally/vertically, you can use the following -code: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setHorizontalCentered(true); -$spreadsheet->getActiveSheet()->getPageSetup()->setVerticalCentered(false); -``` - -### Setting the print header and footer of a worksheet - -Setting a worksheet's print header and footer can be done using the -following lines of code: - -``` php -$spreadsheet->getActiveSheet()->getHeaderFooter() - ->setOddHeader('&C&HPlease treat this document as confidential!'); -$spreadsheet->getActiveSheet()->getHeaderFooter() - ->setOddFooter('&L&B' . $spreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); -``` - -Substitution and formatting codes (starting with &) can be used inside -headers and footers. There is no required order in which these codes -must appear. - -The first occurrence of the following codes turns the formatting ON, the -second occurrence turns it OFF again: - -- Strikethrough -- Superscript -- Subscript - -Superscript and subscript cannot both be ON at same time. Whichever -comes first wins and the other is ignored, while the first is ON. - -The following codes are supported by Xlsx: - -Code | Meaning --------------------------|----------- -`&L` | Code for "left section" (there are three header / footer locations, "left", "center", and "right"). When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the left section. -`&P` | Code for "current page #" -`&N` | Code for "total pages" -`&font size` | Code for "text font size", where font size is a font size in points. -`&K` | Code for "text font color" - RGB Color is specified as RRGGBB Theme Color is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade value, NN is the tint/shade value. -`&S` | Code for "text strikethrough" on / off -`&X` | Code for "text super script" on / off -`&Y` | Code for "text subscript" on / off -`&C` | Code for "center section". When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the center section. -`&D` | Code for "date" -`&T` | Code for "time" -`&G` | Code for "picture as background" - Please make sure to add the image to the header/footer (see Tip for picture) -`&U` | Code for "text single underline" -`&E` | Code for "double underline" -`&R` | Code for "right section". When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the right section. -`&Z` | Code for "this workbook's file path" -`&F` | Code for "this workbook's file name" -`&A` | Code for "sheet tab name" -`&+` | Code for add to page # -`&-` | Code for subtract from page # -`&"font name,font type"` | Code for "text font name" and "text font type", where font name and font type are strings specifying the name and type of the font, separated by a comma. When a hyphen appears in font name, it means "none specified". Both of font name and font type can be localized values. -`&"-,Bold"` | Code for "bold font style" -`&B` | Code for "bold font style" -`&"-,Regular"` | Code for "regular font style" -`&"-,Italic"` | Code for "italic font style" -`&I` | Code for "italic font style" -`&"-,Bold Italic"` | Code for "bold italic font style" -`&O` | Code for "outline style" -`&H` | Code for "shadow style" - -**Tip** - -The above table of codes may seem overwhelming first time you are trying to -figure out how to write some header or footer. Luckily, there is an easier way. -Let Microsoft Office Excel do the work for you.For example, create in Microsoft - Office Excel an xlsx file where you insert the header and footer as desired -using the programs own interface. Save file as test.xlsx. Now, take that file -and read off the values using PhpSpreadsheet as follows: - -```php -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('test.xlsx'); -$worksheet = $spreadsheet->getActiveSheet(); - -var_dump($worksheet->getHeaderFooter()->getOddFooter()); -var_dump($worksheet->getHeaderFooter()->getEvenFooter()); -var_dump($worksheet->getHeaderFooter()->getOddHeader()); -var_dump($worksheet->getHeaderFooter()->getEvenHeader()); -``` - -That reveals the codes for the even/odd header and footer. Experienced -users may find it easier to rename test.xlsx to test.zip, unzip it, and -inspect directly the contents of the relevant xl/worksheets/sheetX.xml -to find the codes for header/footer. - -**Tip for picture** - -```php -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing(); -$drawing->setName('PhpSpreadsheet logo'); -$drawing->setPath('./images/PhpSpreadsheet_logo.png'); -$drawing->setHeight(36); -$spreadsheet->getActiveSheet()->getHeaderFooter()->addImage($drawing, \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT); -``` - -### Setting printing breaks on a row or column - -To set a print break, use the following code, which sets a row break on -row 10. - -``` php -$spreadsheet->getActiveSheet()->setBreak('A10', \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_ROW); -``` - -The following line of code sets a print break on column D: - -``` php -$spreadsheet->getActiveSheet()->setBreak('D10', \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_COLUMN); -``` - -### Show/hide gridlines when printing - -To show/hide gridlines when printing, use the following code: - -```php -$spreadsheet->getActiveSheet()->setShowGridlines(true); -``` - -### Setting rows/columns to repeat at top/left - -PhpSpreadsheet can repeat specific rows/cells at top/left of a page. The -following code is an example of how to repeat row 1 to 5 on each printed -page of a specific worksheet: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 5); -``` - -### Specify printing area - -To specify a worksheet's printing area, use the following code: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setPrintArea('A1:E5'); -``` - -There can also be multiple printing areas in a single worksheet: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setPrintArea('A1:E5,G4:M20'); -``` - -## Styles - -### Formatting cells - -A cell can be formatted with font, border, fill, ... style information. -For example, one can set the foreground colour of a cell to red, aligned -to the right, and the border to black and thick border style. Let's do -that on cell B2: - -``` php -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getBorders()->getTop()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getBorders()->getBottom()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getBorders()->getLeft()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getBorders()->getRight()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getFill()->getStartColor()->setARGB('FFFF0000'); -``` - -`getStyle()` also accepts a cell range as a parameter. For example, you -can set a red background color on a range of cells: - -``` php -$spreadsheet->getActiveSheet()->getStyle('B3:B7')->getFill() - ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) - ->getStartColor()->setARGB('FFFF0000'); -``` - -**Tip** It is recommended to style many cells at once, using e.g. -getStyle('A1:M500'), rather than styling the cells individually in a -loop. This is much faster compared to looping through cells and styling -them individually. - -There is also an alternative manner to set styles. The following code -sets a cell's style to font bold, alignment right, top border thin and a -gradient fill: - -``` php -$styleArray = [ - 'font' => [ - 'bold' => true, - ], - 'alignment' => [ - 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT, - ], - 'borders' => [ - 'top' => [ - 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, - ], - ], - 'fill' => [ - 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR, - 'rotation' => 90, - 'startColor' => [ - 'argb' => 'FFA0A0A0', - ], - 'endColor' => [ - 'argb' => 'FFFFFFFF', - ], - ], -]; - -$spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray($styleArray); -``` - -Or with a range of cells: - -``` php -$spreadsheet->getActiveSheet()->getStyle('B3:B7')->applyFromArray($styleArray); -``` - -This alternative method using arrays should be faster in terms of -execution whenever you are setting more than one style property. But the -difference may barely be measurable unless you have many different -styles in your workbook. - -### Number formats - -You often want to format numbers in Excel. For example you may want a -thousands separator plus a fixed number of decimals after the decimal -separator. Or perhaps you want some numbers to be zero-padded. - -In Microsoft Office Excel you may be familiar with selecting a number -format from the "Format Cells" dialog. Here there are some predefined -number formats available including some for dates. The dialog is -designed in a way so you don't have to interact with the underlying raw -number format code unless you need a custom number format. - -In PhpSpreadsheet, you can also apply various predefined number formats. -Example: - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat() - ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1); -``` - -This will format a number e.g. 1587.2 so it shows up as 1,587.20 when -you open the workbook in MS Office Excel. (Depending on settings for -decimal and thousands separators in Microsoft Office Excel it may show -up as 1.587,20) - -You can achieve exactly the same as the above by using this: - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat() - ->setFormatCode('#,##0.00'); -``` - -In Microsoft Office Excel, as well as in PhpSpreadsheet, you will have -to interact with raw number format codes whenever you need some special -custom number format. Example: - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat() - ->setFormatCode('[Blue][>=3000]$#,##0;[Red][<0]$#,##0;$#,##0'); -``` - -Another example is when you want numbers zero-padded with leading zeros -to a fixed length: - -``` php -$spreadsheet->getActiveSheet()->getCell('A1')->setValue(19); -$spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat() - ->setFormatCode('0000'); // will show as 0019 in Excel -``` - -**Tip** The rules for composing a number format code in Excel can be -rather complicated. Sometimes you know how to create some number format -in Microsoft Office Excel, but don't know what the underlying number -format code looks like. How do you find it? - -The readers shipped with PhpSpreadsheet come to the rescue. Load your -template workbook using e.g. Xlsx reader to reveal the number format -code. Example how read a number format code for cell A1: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); -$spreadsheet = $reader->load('template.xlsx'); -var_dump($spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat()->getFormatCode()); -``` - -Advanced users may find it faster to inspect the number format code -directly by renaming template.xlsx to template.zip, unzipping, and -looking for the relevant piece of XML code holding the number format -code in *xl/styles.xml*. - -### Alignment and wrap text - -Let's set vertical alignment to the top for cells A1:D4 - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1:D4') - ->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_TOP); -``` - -Here is how to achieve wrap text: - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1:D4') - ->getAlignment()->setWrapText(true); -``` - -### Setting the default style of a workbook - -It is possible to set the default style of a workbook. Let's set the -default font to Arial size 8: - -``` php -$spreadsheet->getDefaultStyle()->getFont()->setName('Arial'); -$spreadsheet->getDefaultStyle()->getFont()->setSize(8); -``` - -### Styling cell borders - -In PhpSpreadsheet it is easy to apply various borders on a rectangular -selection. Here is how to apply a thick red border outline around cells -B2:G8. - -``` php -$styleArray = [ - 'borders' => [ - 'outline' => [ - 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK, - 'color' => ['argb' => 'FFFF0000'], - ], - ], -]; - -$worksheet->getStyle('B2:G8')->applyFromArray($styleArray); -``` - -In Microsoft Office Excel, the above operation would correspond to -selecting the cells B2:G8, launching the style dialog, choosing a thick -red border, and clicking on the "Outline" border component. - -Note that the border outline is applied to the rectangular selection -B2:G8 as a whole, not on each cell individually. - -You can achieve any border effect by using just the 5 basic borders and -operating on a single cell at a time: - -- left -- right -- top -- bottom -- diagonal - -Additional shortcut borders come in handy like in the example above. -These are the shortcut borders available: - -- allBorders -- outline -- inside -- vertical -- horizontal - -An overview of all border shortcuts can be seen in the following image: - -![08-styling-border-options.png](./images/08-styling-border-options.png) - -If you simultaneously set e.g. allBorders and vertical, then we have -"overlapping" borders, and one of the components has to win over the -other where there is border overlap. In PhpSpreadsheet, from weakest to -strongest borders, the list is as follows: allBorders, outline/inside, -vertical/horizontal, left/right/top/bottom/diagonal. - -This border hierarchy can be utilized to achieve various effects in an -easy manner. - -### Valid array keys for style `applyFromArray()` - -The following table lists the valid array keys for -`\PhpOffice\PhpSpreadsheet\Style\Style::applyFromArray()` classes. If the "Maps -to property" column maps a key to a setter, the value provided for that -key will be applied directly. If the "Maps to property" column maps a -key to a getter, the value provided for that key will be applied as -another style array. - -**\PhpOffice\PhpSpreadsheet\Style\Style** - -Array key | Maps to property --------------|------------------- -fill | getFill() -font | getFont() -borders | getBorders() -alignment | getAlignment() -numberFormat | getNumberFormat() -protection | getProtection() - -**\PhpOffice\PhpSpreadsheet\Style\Fill** - -Array key | Maps to property ------------|------------------- -fillType | setFillType() -rotation | setRotation() -startColor | getStartColor() -endColor | getEndColor() -color | getStartColor() - -**\PhpOffice\PhpSpreadsheet\Style\Font** - -Array key | Maps to property -------------|------------------- -name | setName() -bold | setBold() -italic | setItalic() -underline | setUnderline() -strikethrough | setStrikethrough() -color | getColor() -size | setSize() -superscript | setSuperscript() -subscript | setSubscript() - -**\PhpOffice\PhpSpreadsheet\Style\Borders** - -Array key | Maps to property -------------------|------------------- -allBorders | getLeft(); getRight(); getTop(); getBottom() -left | getLeft() -right | getRight() -top | getTop() -bottom | getBottom() -diagonal | getDiagonal() -vertical | getVertical() -horizontal | getHorizontal() -diagonalDirection | setDiagonalDirection() -outline | setOutline() - -**\PhpOffice\PhpSpreadsheet\Style\Border** - -Array key | Maps to property -------------|------------------- -borderStyle | setBorderStyle() -color | getColor() - -**\PhpOffice\PhpSpreadsheet\Style\Alignment** - -Array key | Maps to property -------------|------------------- -horizontal | setHorizontal() -vertical | setVertical() -textRotation| setTextRotation() -wrapText | setWrapText() -shrinkToFit | setShrinkToFit() -indent | setIndent() - -**\PhpOffice\PhpSpreadsheet\Style\NumberFormat** - -Array key | Maps to property -----------|------------------- -formatCode | setFormatCode() - -**\PhpOffice\PhpSpreadsheet\Style\Protection** - -Array key | Maps to property -----------|------------------- -locked | setLocked() -hidden | setHidden() - -## Conditional formatting a cell - -A cell can be formatted conditionally, based on a specific rule. For -example, one can set the foreground colour of a cell to red if its value -is below zero, and to green if its value is zero or more. - -One can set a conditional style ruleset to a cell using the following -code: - -``` php -$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); -$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); -$conditional1->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN); -$conditional1->addCondition('0'); -$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED); -$conditional1->getStyle()->getFont()->setBold(true); - -$conditional2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); -$conditional2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); -$conditional2->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL); -$conditional2->addCondition('0'); -$conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN); -$conditional2->getStyle()->getFont()->setBold(true); - -$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles(); -$conditionalStyles[] = $conditional1; -$conditionalStyles[] = $conditional2; - -$spreadsheet->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles); -``` - -If you want to copy the ruleset to other cells, you can duplicate the -style object: - -``` php -$spreadsheet->getActiveSheet() - ->duplicateStyle( - $spreadsheet->getActiveSheet()->getStyle('B2'), - 'B3:B7' - ); -``` - -## Add a comment to a cell - -To add a comment to a cell, use the following code. The example below -adds a comment to cell E11: - -``` php -$spreadsheet->getActiveSheet() - ->getComment('E11') - ->setAuthor('Mark Baker'); -$commentRichText = $spreadsheet->getActiveSheet() - ->getComment('E11') - ->getText()->createTextRun('PhpSpreadsheet:'); -$commentRichText->getFont()->setBold(true); -$spreadsheet->getActiveSheet() - ->getComment('E11') - ->getText()->createTextRun("\r\n"); -$spreadsheet->getActiveSheet() - ->getComment('E11') - ->getText()->createTextRun('Total amount on the current invoice, excluding VAT.'); -``` - -![08-cell-comment.png](./images/08-cell-comment.png) - -## Apply autofilter to a range of cells - -To apply an autofilter to a range of cells, use the following code: - -``` php -$spreadsheet->getActiveSheet()->setAutoFilter('A1:C9'); -``` - -**Make sure that you always include the complete filter range!** Excel -does support setting only the captionrow, but that's **not** a best -practice... - -## Setting security on a spreadsheet - -Excel offers 3 levels of "protection": - -- Document: allows you to set a password on a complete -spreadsheet, allowing changes to be made only when that password is -entered. -- Worksheet: offers other security options: you can -disallow inserting rows on a specific sheet, disallow sorting, ... -- Cell: offers the option to lock/unlock a cell as well as show/hide -the internal formula. - -An example on setting document security: - -``` php -$spreadsheet->getSecurity()->setLockWindows(true); -$spreadsheet->getSecurity()->setLockStructure(true); -$spreadsheet->getSecurity()->setWorkbookPassword("PhpSpreadsheet"); -``` - -An example on setting worksheet security: - -``` php -$spreadsheet->getActiveSheet() - ->getProtection()->setPassword('PhpSpreadsheet'); -$spreadsheet->getActiveSheet() - ->getProtection()->setSheet(true); -$spreadsheet->getActiveSheet() - ->getProtection()->setSort(true); -$spreadsheet->getActiveSheet() - ->getProtection()->setInsertRows(true); -$spreadsheet->getActiveSheet() - ->getProtection()->setFormatCells(true); -``` - -An example on setting cell security: - -``` php -$spreadsheet->getActiveSheet()->getStyle('B1') - ->getProtection() - ->setLocked(\PhpOffice\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED); -``` - -**Make sure you enable worksheet protection if you need any of the -worksheet protection features!** This can be done using the following -code: - -``` php -$spreadsheet->getActiveSheet()->getProtection()->setSheet(true); -``` - -## Setting data validation on a cell - -Data validation is a powerful feature of Xlsx. It allows to specify an -input filter on the data that can be inserted in a specific cell. This -filter can be a range (i.e. value must be between 0 and 10), a list -(i.e. value must be picked from a list), ... - -The following piece of code only allows numbers between 10 and 20 to be -entered in cell B3: - -``` php -$validation = $spreadsheet->getActiveSheet()->getCell('B3') - ->getDataValidation(); -$validation->setType( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE ); -$validation->setErrorStyle( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP ); -$validation->setAllowBlank(true); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Number is not allowed!'); -$validation->setPromptTitle('Allowed input'); -$validation->setPrompt('Only numbers between 10 and 20 are allowed.'); -$validation->setFormula1(10); -$validation->setFormula2(20); -``` - -The following piece of code only allows an item picked from a list of -data to be entered in cell B5: - -``` php -$validation = $spreadsheet->getActiveSheet()->getCell('B5') - ->getDataValidation(); -$validation->setType( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST ); -$validation->setErrorStyle( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION ); -$validation->setAllowBlank(false); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setShowDropDown(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Value is not in list.'); -$validation->setPromptTitle('Pick from list'); -$validation->setPrompt('Please pick a value from the drop-down list.'); -$validation->setFormula1('"Item A,Item B,Item C"'); -``` - -When using a data validation list like above, make sure you put the list -between `"` and `"` and that you split the items with a comma (`,`). - -It is important to remember that any string participating in an Excel -formula is allowed to be maximum 255 characters (not bytes). This sets a -limit on how many items you can have in the string "Item A,Item B,Item -C". Therefore it is normally a better idea to type the item values -directly in some cell range, say A1:A3, and instead use, say, -`$validation->setFormula1('Sheet!$A$1:$A$3')`. Another benefit is that -the item values themselves can contain the comma `,` character itself. - -If you need data validation on multiple cells, one can clone the -ruleset: - -``` php -$spreadsheet->getActiveSheet()->getCell('B8')->setDataValidation(clone $validation); -``` - -## Setting a column's width - -A column's width can be set using the following code: - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(12); -``` - -If you want PhpSpreadsheet to perform an automatic width calculation, -use the following code. PhpSpreadsheet will approximate the column with -to the width of the widest column value. - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('B')->setAutoSize(true); -``` - -![08-column-width.png](./images/08-column-width.png) - -The measure for column width in PhpSpreadsheet does **not** correspond -exactly to the measure you may be used to in Microsoft Office Excel. -Column widths are difficult to deal with in Excel, and there are several -measures for the column width. - -1. Inner width in character units -(e.g. 8.43 this is probably what you are familiar with in Excel) -2. Full width in pixels (e.g. 64 pixels) -3. Full width in character units (e.g. 9.140625, value -1 indicates unset width) - -**PhpSpreadsheet always -operates with "3. Full width in character units"** which is in fact the -only value that is stored in any Excel file, hence the most reliable -measure. Unfortunately, **Microsoft Office Excel does not present you -with this measure**. Instead measures 1 and 2 are computed by the -application when the file is opened and these values are presented in -various dialogues and tool tips. - -The character width unit is the width of -a `0` (zero) glyph in the workbooks default font. Therefore column -widths measured in character units in two different workbooks can only -be compared if they have the same default workbook font.If you have some -Excel file and need to know the column widths in measure 3, you can -read the Excel file with PhpSpreadsheet and echo the retrieved values. - -## Show/hide a column - -To set a worksheet's column visibility, you can use the following code. -The first line explicitly shows the column C, the second line hides -column D. - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('C')->setVisible(true); -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setVisible(false); -``` - -## Group/outline a column - -To group/outline a column, you can use the following code: - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1); -``` - -You can also collapse the column. Note that you should also set the -column invisible, otherwise the collapse will not be visible in Excel -2007. - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('E')->setCollapsed(true); -$spreadsheet->getActiveSheet()->getColumnDimension('E')->setVisible(false); -``` - -Please refer to the section "group/outline a row" for a complete example -on collapsing. - -You can instruct PhpSpreadsheet to add a summary to the right (default), -or to the left. The following code adds the summary to the left: - -``` php -$spreadsheet->getActiveSheet()->setShowSummaryRight(false); -``` - -## Setting a row's height - -A row's height can be set using the following code: - -``` php -$spreadsheet->getActiveSheet()->getRowDimension('10')->setRowHeight(100); -``` - -Excel measures row height in points, where 1 pt is 1/72 of an inch (or -about 0.35mm). The default value is 12.75 pts; and the permitted range -of values is between 0 and 409 pts, where 0 pts is a hidden row. - -## Show/hide a row - -To set a worksheet''s row visibility, you can use the following code. -The following example hides row number 10. - -``` php -$spreadsheet->getActiveSheet()->getRowDimension('10')->setVisible(false); -``` - -Note that if you apply active filters using an AutoFilter, then this -will override any rows that you hide or unhide manually within that -AutoFilter range if you save the file. - -## Group/outline a row - -To group/outline a row, you can use the following code: - -``` php -$spreadsheet->getActiveSheet()->getRowDimension('5')->setOutlineLevel(1); -``` - -You can also collapse the row. Note that you should also set the row -invisible, otherwise the collapse will not be visible in Excel 2007. - -``` php -$spreadsheet->getActiveSheet()->getRowDimension('5')->setCollapsed(true); -$spreadsheet->getActiveSheet()->getRowDimension('5')->setVisible(false); -``` - -Here's an example which collapses rows 50 to 80: - -``` php -for ($i = 51; $i <= 80; $i++) { - $spreadsheet->getActiveSheet()->setCellValue('A' . $i, "FName $i"); - $spreadsheet->getActiveSheet()->setCellValue('B' . $i, "LName $i"); - $spreadsheet->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i"); - $spreadsheet->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i"); - $spreadsheet->getActiveSheet()->setCellValue('E' . $i, true); - $spreadsheet->getActiveSheet()->getRowDimension($i)->setOutlineLevel(1); - $spreadsheet->getActiveSheet()->getRowDimension($i)->setVisible(false); -} - -$spreadsheet->getActiveSheet()->getRowDimension(81)->setCollapsed(true); -``` - -You can instruct PhpSpreadsheet to add a summary below the collapsible -rows (default), or above. The following code adds the summary above: - -``` php -$spreadsheet->getActiveSheet()->setShowSummaryBelow(false); -``` - -## Merge/unmerge cells - -If you have a big piece of data you want to display in a worksheet, you -can merge two or more cells together, to become one cell. This can be -done using the following code: - -``` php -$spreadsheet->getActiveSheet()->mergeCells('A18:E22'); -``` - -Removing a merge can be done using the unmergeCells method: - -``` php -$spreadsheet->getActiveSheet()->unmergeCells('A18:E22'); -``` - -## Inserting rows/columns - -You can insert/remove rows/columns at a specific position. The following -code inserts 2 new rows, right before row 7: - -``` php -$spreadsheet->getActiveSheet()->insertNewRowBefore(7, 2); -``` - -## Add a drawing to a worksheet - -A drawing is always represented as a separate object, which can be added -to a worksheet. Therefore, you must first instantiate a new -`\PhpOffice\PhpSpreadsheet\Worksheet\Drawing`, and assign its properties a -meaningful value: - -``` php -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); -$drawing->setName('Logo'); -$drawing->setDescription('Logo'); -$drawing->setPath('./images/officelogo.jpg'); -$drawing->setHeight(36); -``` - -To add the above drawing to the worksheet, use the following snippet of -code. PhpSpreadsheet creates the link between the drawing and the -worksheet: - -``` php -$drawing->setWorksheet($spreadsheet->getActiveSheet()); -``` - -You can set numerous properties on a drawing, here are some examples: - -``` php -$drawing->setName('Paid'); -$drawing->setDescription('Paid'); -$drawing->setPath('./images/paid.png'); -$drawing->setCoordinates('B15'); -$drawing->setOffsetX(110); -$drawing->setRotation(25); -$drawing->getShadow()->setVisible(true); -$drawing->getShadow()->setDirection(45); -``` - -You can also add images created using GD functions without needing to -save them to disk first as In-Memory drawings. - -``` php -// Use GD to create an in-memory image -$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - -// Add the In-Memory image to a worksheet -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing(); -$drawing->setName('In-Memory image 1'); -$drawing->setDescription('In-Memory image 1'); -$drawing->setCoordinates('A1'); -$drawing->setImageResource($gdImage); -$drawing->setRenderingFunction( - \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG -); -$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT); -$drawing->setHeight(36); -$drawing->setWorksheet($spreadsheet->getActiveSheet()); -``` - -## Reading Images from a worksheet - -A commonly asked question is how to retrieve the images from a workbook -that has been loaded, and save them as individual image files to disk. - -The following code extracts images from the current active worksheet, -and writes each as a separate file. - -``` php -$i = 0; -foreach ($spreadsheet->getActiveSheet()->getDrawingCollection() as $drawing) { - if ($drawing instanceof \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing) { - ob_start(); - call_user_func( - $drawing->getRenderingFunction(), - $drawing->getImageResource() - ); - $imageContents = ob_get_contents(); - ob_end_clean(); - switch ($drawing->getMimeType()) { - case \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_PNG : - $extension = 'png'; - break; - case \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_GIF: - $extension = 'gif'; - break; - case \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_JPEG : - $extension = 'jpg'; - break; - } - } else { - $zipReader = fopen($drawing->getPath(),'r'); - $imageContents = ''; - while (!feof($zipReader)) { - $imageContents .= fread($zipReader,1024); - } - fclose($zipReader); - $extension = $drawing->getExtension(); - } - $myFileName = '00_Image_'.++$i.'.'.$extension; - file_put_contents($myFileName,$imageContents); -} -``` - -## Add rich text to a cell - -Adding rich text to a cell can be done using -`\PhpOffice\PhpSpreadsheet\RichText\RichText` instances. Here''s an example, which -creates the following rich text string: - -> This invoice is ***payable within thirty days after the end of the -> month*** unless specified otherwise on the invoice. - -``` php -$richText = new \PhpOffice\PhpSpreadsheet\RichText\RichText(); -$richText->createText('This invoice is '); -$payable = $richText->createTextRun('payable within thirty days after the end of the month'); -$payable->getFont()->setBold(true); -$payable->getFont()->setItalic(true); -$payable->getFont()->setColor( new \PhpOffice\PhpSpreadsheet\Style\Color( \PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN ) ); -$richText->createText(', unless specified otherwise on the invoice.'); -$spreadsheet->getActiveSheet()->getCell('A18')->setValue($richText); -``` - -## Define a named range - -PhpSpreadsheet supports the definition of named ranges. These can be -defined using the following code: - -``` php -// Add some data -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:'); -$spreadsheet->getActiveSheet()->setCellValue('A2', 'Lastname:'); -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Maarten'); -$spreadsheet->getActiveSheet()->setCellValue('B2', 'Balliauw'); - -// Define named ranges -$spreadsheet->addNamedRange( new \PhpOffice\PhpSpreadsheet\NamedRange('PersonFN', $spreadsheet->getActiveSheet(), 'B1') ); -$spreadsheet->addNamedRange( new \PhpOffice\PhpSpreadsheet\NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2') ); -``` - -Optionally, a fourth parameter can be passed defining the named range -local (i.e. only usable on the current worksheet). Named ranges are -global by default. - -## Redirect output to a client's web browser - -Sometimes, one really wants to output a file to a client''s browser, -especially when creating spreadsheets on-the-fly. There are some easy -steps that can be followed to do this: - -1. Create your PhpSpreadsheet spreadsheet -2. Output HTTP headers for the type of document you wish to output -3. Use the `\PhpOffice\PhpSpreadsheet\Writer\*` of your choice, and save - to `'php://output'` - -`\PhpOffice\PhpSpreadsheet\Writer\Xlsx` uses temporary storage when -writing to `php://output`. By default, temporary files are stored in the -script's working directory. When there is no access, it falls back to -the operating system's temporary files location. - -**This may not be safe for unauthorized viewing!** Depending on the -configuration of your operating system, temporary storage can be read by -anyone using the same temporary storage folder. When confidentiality of -your document is needed, it is recommended not to use `php://output`. - -### HTTP headers - -Example of a script redirecting an Excel 2007 file to the client's -browser: - -``` php -/* Here there will be some code where you create $spreadsheet */ - -// redirect output to client browser -header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); -header('Content-Disposition: attachment;filename="myfile.xlsx"'); -header('Cache-Control: max-age=0'); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->save('php://output'); -``` - -Example of a script redirecting an Xls file to the client's browser: - -``` php -/* Here there will be some code where you create $spreadsheet */ - -// redirect output to client browser -header('Content-Type: application/vnd.ms-excel'); -header('Content-Disposition: attachment;filename="myfile.xls"'); -header('Cache-Control: max-age=0'); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); -$writer->save('php://output'); -``` - -**Caution:** - -Make sure not to include any echo statements or output any other -contents than the Excel file. There should be no whitespace before the -opening `` -tag (which can also be omitted to avoid problems). Make sure that your -script is saved without a BOM (Byte-order mark) because this counts as -echoing output. The same things apply to all included files. Failing to -follow the above guidelines may result in corrupt Excel files arriving -at the client browser, and/or that headers cannot be set by PHP -(resulting in warning messages). - -## Setting the default column width - -Default column width can be set using the following code: - -``` php -$spreadsheet->getActiveSheet()->getDefaultColumnDimension()->setWidth(12); -``` - -## Setting the default row height - -Default row height can be set using the following code: - -``` php -$spreadsheet->getActiveSheet()->getDefaultRowDimension()->setRowHeight(15); -``` - -## Add a GD drawing to a worksheet - -There might be a situation where you want to generate an in-memory image -using GD and add it to a `Spreadsheet` without first having to save this -file to a temporary location. - -Here''s an example which generates an image in memory and adds it to the -active worksheet: - -``` php -// Generate an image -$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - -// Add a drawing to the worksheet -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing(); -$drawing->setName('Sample image'); -$drawing->setDescription('Sample image'); -$drawing->setImageResource($gdImage); -$drawing->setRenderingFunction(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG); -$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT); -$drawing->setHeight(36); -$drawing->setWorksheet($spreadsheet->getActiveSheet()); -``` - -## Setting worksheet zoom level - -To set a worksheet's zoom level, the following code can be used: - -``` php -$spreadsheet->getActiveSheet()->getSheetView()->setZoomScale(75); -``` - -Note that zoom level should be in range 10 - 400. - -## Sheet tab color - -Sometimes you want to set a color for sheet tab. For example you can -have a red sheet tab: - -``` php -$worksheet->getTabColor()->setRGB('FF0000'); -``` - -## Creating worksheets in a workbook - -If you need to create more worksheets in the workbook, here is how: - -``` php -$worksheet1 = $spreadsheet->createSheet(); -$worksheet1->setTitle('Another sheet'); -``` - -Think of `createSheet()` as the "Insert sheet" button in Excel. When you -hit that button a new sheet is appended to the existing collection of -worksheets in the workbook. - -## Hidden worksheets (Sheet states) - -Set a worksheet to be **hidden** using this code: - -``` php -$spreadsheet->getActiveSheet() - ->setSheetState(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN); -``` - -Sometimes you may even want the worksheet to be **"very hidden"**. The -available sheet states are : - -- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VISIBLE` -- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN` -- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN` - -In Excel the sheet state "very hidden" can only be set programmatically, -e.g. with Visual Basic Macro. It is not possible to make such a sheet -visible via the user interface. - -## Right-to-left worksheet - -Worksheets can be set individually whether column `A` should start at -left or right side. Default is left. Here is how to set columns from -right-to-left. - -``` php -// right-to-left worksheet -$spreadsheet->getActiveSheet()->setRightToLeft(true); -``` diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/settings.md b/vendor/phpoffice/phpspreadsheet/docs/topics/settings.md deleted file mode 100644 index a9aae9f9..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/settings.md +++ /dev/null @@ -1,45 +0,0 @@ -# Configuration Settings - -Once you have included the PhpSpreadsheet files in your script, but -before instantiating a `Spreadsheet` object or loading a workbook file, -there are a number of configuration options that can be set which will -affect the subsequent behaviour of the script. - -## Cell collection caching - -By default, PhpSpreadsheet holds all cell objects in memory, but -you can specify alternatives to reduce memory consumption at the cost of speed. -Read more about [memory saving](./memory_saving.md). - -To enable cell caching, you must provide your own implementation of cache like so: - -``` php -$cache = new MyCustomPsr16Implementation(); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($cache); -``` - -## Language/Locale - -Some localisation elements have been included in PhpSpreadsheet. You can -set a locale by changing the settings. To set the locale to Brazilian -Portuguese you would use: - -``` php -$locale = 'pt_br'; -$validLocale = \PhpOffice\PhpSpreadsheet\Settings::setLocale($locale); -if (!$validLocale) { - echo 'Unable to set locale to ' . $locale . " - reverting to en_us" . PHP_EOL; -} -``` - -- If Brazilian Portuguese language files aren't available, then Portuguese -will be enabled instead -- If Portuguese language files aren't available, -then the `setLocale()` method will return an error, and American English -(en\_us) settings will be used throughout. - -More details of the features available once a locale has been set, -including a list of the languages and locales currently supported, can -be found in [Locale Settings for -Formulae](./recipes.md#locale-settings-for-formulae). diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/worksheets.md b/vendor/phpoffice/phpspreadsheet/docs/topics/worksheets.md deleted file mode 100644 index f97a0066..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/worksheets.md +++ /dev/null @@ -1,128 +0,0 @@ -# Worksheets - -A worksheet is a collection of cells, formulae, images, graphs, etc. It -holds all data necessary to represent a spreadsheet worksheet. - -When you load a workbook from a spreadsheet file, it will be loaded with -all its existing worksheets (unless you specified that only certain -sheets should be loaded). When you load from non-spreadsheet files (such -as a CSV or HTML file) or from spreadsheet formats that don't identify -worksheets by name (such as SYLK), then a single worksheet called -"WorkSheet1" will be created containing the data from that file. - -When you instantiate a new workbook, PhpSpreadsheet will create it with -a single worksheet called "WorkSheet1". - -The `getSheetCount()` method will tell you the number of worksheets in -the workbook; while the `getSheetNames()` method will return a list of -all worksheets in the workbook, indexed by the order in which their -"tabs" would appear when opened in MS Excel (or other appropriate -Spreadsheet program). - -Individual worksheets can be accessed by name, or by their index -position in the workbook. The index position represents the order that -each worksheet "tab" is shown when the workbook is opened in MS Excel -(or other appropriate Spreadsheet program). To access a sheet by its -index, use the `getSheet()` method. - -``` php -// Get the second sheet in the workbook -// Note that sheets are indexed from 0 -$spreadsheet->getSheet(1); -``` - - -Methods also exist allowing you to reorder the worksheets in the -workbook. - -To access a sheet by name, use the `getSheetByName()` method, specifying -the name of the worksheet that you want to access. - -``` php -// Retrieve the worksheet called 'Worksheet 1' -$spreadsheet->getSheetByName('Worksheet 1'); -``` - -Alternatively, one worksheet is always the currently active worksheet, -and you can access that directly. The currently active worksheet is the -one that will be active when the workbook is opened in MS Excel (or -other appropriate Spreadsheet program). - -``` php -// Retrieve the current active worksheet -$spreadsheet->getActiveSheet(); -``` - -You can change the currently active sheet by index or by name using the -`setActiveSheetIndex()` and `setActiveSheetIndexByName()` methods. - -## Adding a new Worksheet - -You can add a new worksheet to the workbook using the `createSheet()` -method of the `Spreadsheet` object. By default, this will be created as -a new "last" sheet; but you can also specify an index position as an -argument, and the worksheet will be inserted at that position, shuffling -all subsequent worksheets in the collection down a place. - -``` php -$spreadsheet->createSheet(); -``` - -A new worksheet created using this method will be called -`Worksheet` where `` is the lowest number possible to -guarantee that the title is unique. - -Alternatively, you can instantiate a new worksheet (setting the title to -whatever you choose) and then insert it into your workbook using the -`addSheet()` method. - -``` php -// Create a new worksheet called "My Data" -$myWorkSheet = new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet($spreadsheet, 'My Data'); - -// Attach the "My Data" worksheet as the first worksheet in the Spreadsheet object -$spreadsheet->addSheet($myWorkSheet, 0); -``` - -If you don't specify an index position as the second argument, then the -new worksheet will be added after the last existing worksheet. - -## Copying Worksheets - -Sheets within the same workbook can be copied by creating a clone of the -worksheet you wish to copy, and then using the `addSheet()` method to -insert the clone into the workbook. - -``` php -$clonedWorksheet = clone $spreadsheet->getSheetByName('Worksheet 1'); -$clonedWorksheet->setTitle('Copy of Worksheet 1'); -$spreadsheet->addSheet($clonedWorksheet); -``` - -You can also copy worksheets from one workbook to another, though this -is more complex as PhpSpreadsheet also has to replicate the styling -between the two workbooks. The `addExternalSheet()` method is provided for -this purpose. - - $clonedWorksheet = clone $spreadsheet1->getSheetByName('Worksheet 1'); - $spreadsheet->addExternalSheet($clonedWorksheet); - -In both cases, it is the developer's responsibility to ensure that -worksheet names are not duplicated. PhpSpreadsheet will throw an -exception if you attempt to copy worksheets that will result in a -duplicate name. - -## Removing a Worksheet - -You can delete a worksheet from a workbook, identified by its index -position, using the `removeSheetByIndex()` method - -``` php -$sheetIndex = $spreadsheet->getIndex( - $spreadsheet->getSheetByName('Worksheet 1') -); -$spreadsheet->removeSheetByIndex($sheetIndex); -``` - -If the currently active worksheet is deleted, then the sheet at the -previous index position will become the currently active sheet. diff --git a/vendor/phpoffice/phpspreadsheet/mkdocs.yml b/vendor/phpoffice/phpspreadsheet/mkdocs.yml deleted file mode 100644 index cf87a142..00000000 --- a/vendor/phpoffice/phpspreadsheet/mkdocs.yml +++ /dev/null @@ -1,7 +0,0 @@ -site_name: PhpSpreadsheet Documentation -repo_url: https://github.com/PHPOffice/phpspreadsheet -edit_uri: edit/master/docs/ - -theme: readthedocs -extra_css: - - extra/extra.css diff --git a/vendor/phpoffice/phpspreadsheet/phpunit.xml.dist b/vendor/phpoffice/phpspreadsheet/phpunit.xml.dist deleted file mode 100644 index be3643d8..00000000 --- a/vendor/phpoffice/phpspreadsheet/phpunit.xml.dist +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - ./tests/PhpSpreadsheetTests - - - - ./src - - ./src/PhpSpreadsheet/Shared/JAMA - ./src/PhpSpreadsheet/Writer/PDF - - - - diff --git a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter.php b/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter.php deleted file mode 100644 index db9de54a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter.php +++ /dev/null @@ -1,101 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Create the worksheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Year') - ->setCellValue('B1', 'Quarter') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Sales'); - -$dataArray = [ - ['2010', 'Q1', 'United States', 790], - ['2010', 'Q2', 'United States', 730], - ['2010', 'Q3', 'United States', 860], - ['2010', 'Q4', 'United States', 850], - ['2011', 'Q1', 'United States', 800], - ['2011', 'Q2', 'United States', 700], - ['2011', 'Q3', 'United States', 900], - ['2011', 'Q4', 'United States', 950], - ['2010', 'Q1', 'Belgium', 380], - ['2010', 'Q2', 'Belgium', 390], - ['2010', 'Q3', 'Belgium', 420], - ['2010', 'Q4', 'Belgium', 460], - ['2011', 'Q1', 'Belgium', 400], - ['2011', 'Q2', 'Belgium', 350], - ['2011', 'Q3', 'Belgium', 450], - ['2011', 'Q4', 'Belgium', 500], - ['2010', 'Q1', 'UK', 690], - ['2010', 'Q2', 'UK', 610], - ['2010', 'Q3', 'UK', 620], - ['2010', 'Q4', 'UK', 600], - ['2011', 'Q1', 'UK', 720], - ['2011', 'Q2', 'UK', 650], - ['2011', 'Q3', 'UK', 580], - ['2011', 'Q4', 'UK', 510], - ['2010', 'Q1', 'France', 510], - ['2010', 'Q2', 'France', 490], - ['2010', 'Q3', 'France', 460], - ['2010', 'Q4', 'France', 590], - ['2011', 'Q1', 'France', 620], - ['2011', 'Q2', 'France', 650], - ['2011', 'Q3', 'France', 415], - ['2011', 'Q4', 'France', 570], - ['2010', 'Q1', 'Germany', 720], - ['2010', 'Q2', 'Germany', 680], - ['2010', 'Q3', 'Germany', 640], - ['2010', 'Q4', 'Germany', 660], - ['2011', 'Q1', 'Germany', 680], - ['2011', 'Q2', 'Germany', 620], - ['2011', 'Q3', 'Germany', 710], - ['2011', 'Q4', 'Germany', 690], - ['2010', 'Q1', 'Spain', 510], - ['2010', 'Q2', 'Spain', 490], - ['2010', 'Q3', 'Spain', 470], - ['2010', 'Q4', 'Spain', 420], - ['2011', 'Q1', 'Spain', 460], - ['2011', 'Q2', 'Spain', 390], - ['2011', 'Q3', 'Spain', 430], - ['2011', 'Q4', 'Spain', 415], - ['2010', 'Q1', 'Italy', 440], - ['2010', 'Q2', 'Italy', 410], - ['2010', 'Q3', 'Italy', 420], - ['2010', 'Q4', 'Italy', 450], - ['2011', 'Q1', 'Italy', 430], - ['2011', 'Q2', 'Italy', 370], - ['2011', 'Q3', 'Italy', 350], - ['2011', 'Q4', 'Italy', 335], -]; -$spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A2'); - -// Set title row bold -$helper->log('Set title row bold'); -$spreadsheet->getActiveSheet()->getStyle('A1:D1')->getFont()->setBold(true); - -// Set autofilter -$helper->log('Set autofilter'); -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$spreadsheet->getActiveSheet()->setAutoFilter($spreadsheet->getActiveSheet()->calculateWorksheetDimension()); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_1.php b/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_1.php deleted file mode 100644 index 464b8c18..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_1.php +++ /dev/null @@ -1,156 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Create the worksheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); -$startYear = $endYear = $currentYear = date('Y'); ---$startYear; -++$endYear; - -$years = range($startYear, $endYear); -$periods = range(1, 12); -$countries = [ - 'United States', - 'UK', - 'France', - 'Germany', - 'Italy', - 'Spain', - 'Portugal', - 'Japan', -]; - -$row = 2; -foreach ($years as $year) { - foreach ($periods as $period) { - foreach ($countries as $country) { - $endDays = date('t', mktime(0, 0, 0, $period, 1, (int) $year)); - for ($i = 1; $i <= $endDays; ++$i) { - $eDate = Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = null; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - } else { - $expenditure = null; - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - } - $dataArray = [$year, - $period, - $country, - $eDate, - $income, - $expenditure, - ]; - $spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A' . $row++); - } - } - } -} ---$row; - -// Set styling -$helper->log('Set styling'); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true); -$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); -$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$spreadsheet->getActiveSheet()->freezePane('A2'); - -// Set autofilter range -$helper->log('Set autofilter range'); -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$spreadsheet->getActiveSheet()->setAutoFilter($spreadsheet->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$helper->log('Set active filters'); -// Filter the Country column on a filter value of countries beginning with the letter U (or Japan) -// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter -$autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'u*' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('C') - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'japan' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -// Filter the Date column on a filter value of the first day of every period of the current year -// We us a dateGroup ruletype for this, although it is still a standard filter -foreach ($periods as $period) { - $endDate = date('t', mktime(0, 0, 0, $period, 1, (int) $currentYear)); - - $autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - [ - 'year' => $currentYear, - 'month' => $period, - 'day' => $endDate, - ] - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); -} -// Display only sales values that are blank -// Standard filter, operator equals, and value of NULL -$autoFilter->getColumn('E') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_2.php b/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_2.php deleted file mode 100644 index 1c55a0cf..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_2.php +++ /dev/null @@ -1,148 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Create the worksheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); -$startYear = $endYear = $currentYear = date('Y'); ---$startYear; -++$endYear; - -$years = range($startYear, $endYear); -$periods = range(1, 12); -$countries = [ - 'United States', - 'UK', - 'France', - 'Germany', - 'Italy', - 'Spain', - 'Portugal', - 'Japan', -]; - -$row = 2; -foreach ($years as $year) { - foreach ($periods as $period) { - foreach ($countries as $country) { - $endDays = date('t', mktime(0, 0, 0, $period, 1, (int) $year)); - for ($i = 1; $i <= $endDays; ++$i) { - $eDate = Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = null; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - } else { - $expenditure = null; - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - } - $dataArray = [$year, - $period, - $country, - $eDate, - $income, - $expenditure, - ]; - $spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A' . $row++); - } - } - } -} ---$row; - -// Set styling -$helper->log('Set styling'); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true); -$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); -$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$spreadsheet->getActiveSheet()->freezePane('A2'); - -// Set autofilter range -$helper->log('Set autofilter range'); -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$spreadsheet->getActiveSheet()->setAutoFilter($spreadsheet->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$helper->log('Set active filters'); -// Filter the Country column on a filter value of Germany -// As it's just a simple value filter, we can use FILTERTYPE_FILTER -$autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'Germany' - ); -// Filter the Date column on a filter value of the year to date -$autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - null, - Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER); -// Display only sales values that are between 400 and 600 -$autoFilter->getColumn('E') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, - 400 - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('E') - ->setJoin(Column::AUTOFILTER_COLUMN_JOIN_AND) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, - 600 - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_display.php b/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_display.php deleted file mode 100644 index 55211552..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_display.php +++ /dev/null @@ -1,170 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Create the worksheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); -$startYear = $endYear = $currentYear = date('Y'); ---$startYear; -++$endYear; - -$years = range($startYear, $endYear); -$periods = range(1, 12); -$countries = [ - 'United States', - 'UK', - 'France', - 'Germany', - 'Italy', - 'Spain', - 'Portugal', - 'Japan', -]; - -$row = 2; -foreach ($years as $year) { - foreach ($periods as $period) { - foreach ($countries as $country) { - $endDays = date('t', mktime(0, 0, 0, $period, 1, (int) $year)); - for ($i = 1; $i <= $endDays; ++$i) { - $eDate = Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = null; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + (rand(-1, 1) / 4)); - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - } else { - $expenditure = null; - $income = rand(500, 1000) * (1 + (rand(-1, 1) / 4)); - } - $dataArray = [$year, - $period, - $country, - $eDate, - $income, - $expenditure, - ]; - $spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A' . $row++); - } - } - } -} ---$row; - -// Set styling -$helper->log('Set styling'); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true); -$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); -$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$spreadsheet->getActiveSheet()->freezePane('A2'); - -// Set autofilter range -$helper->log('Set autofilter range'); -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$spreadsheet->getActiveSheet()->setAutoFilter($spreadsheet->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$helper->log('Set active filters'); -// Filter the Country column on a filter value of countries beginning with the letter U (or Japan) -// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter -$autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'u*' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('C') - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'japan' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -// Filter the Date column on a filter value of the first day of every period of the current year -// We us a dateGroup ruletype for this, although it is still a standard filter -foreach ($periods as $period) { - $endDate = date('t', mktime(0, 0, 0, $period, 1, (int) $currentYear)); - - $autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - [ - 'year' => $currentYear, - 'month' => $period, - 'day' => $endDate, - ] - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); -} -// Display only sales values that are blank -// Standard filter, operator equals, and value of NULL -$autoFilter->getColumn('E') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); - -// Execute filtering -$helper->log('Execute filtering'); -$autoFilter->showHideRows(); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Display Results of filtering -$helper->log('Display filtered rows'); -foreach ($spreadsheet->getActiveSheet()->getRowIterator() as $row) { - if ($spreadsheet->getActiveSheet()->getRowDimension($row->getRowIndex())->getVisible()) { - $helper->log(' Row number - ' . $row->getRowIndex()); - $helper->log($spreadsheet->getActiveSheet()->getCell('C' . $row->getRowIndex())->getValue()); - $helper->log($spreadsheet->getActiveSheet()->getCell('D' . $row->getRowIndex())->getFormattedValue()); - } -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php deleted file mode 100644 index 89aca6d0..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php +++ /dev/null @@ -1,65 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties() - ->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A8', "Hello\nWorld"); -$spreadsheet->getActiveSheet() - ->getRowDimension(8) - ->setRowHeight(-1); -$spreadsheet->getActiveSheet() - ->getStyle('A8') - ->getAlignment() - ->setWrapText(true); - -$value = "-ValueA\n-Value B\n-Value C"; -$spreadsheet->getActiveSheet() - ->setCellValue('A10', $value); -$spreadsheet->getActiveSheet() - ->getRowDimension(10) - ->setRowHeight(-1); -$spreadsheet->getActiveSheet() - ->getStyle('A10') - ->getAlignment() - ->setWrapText(true); -$spreadsheet->getActiveSheet() - ->getStyle('A10') - ->setQuotePrefix(true); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet() - ->setTitle('Simple'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_ods.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_ods.php deleted file mode 100644 index 0c38a004..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_ods.php +++ /dev/null @@ -1,61 +0,0 @@ -isCli()) { - $helper->log('This example should only be run from a Web Browser' . PHP_EOL); - - return; -} - -// Create new Spreadsheet object -$spreadsheet = new Spreadsheet(); - -// Set document properties -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Redirect output to a client’s web browser (Ods) -header('Content-Type: application/vnd.oasis.opendocument.spreadsheet'); -header('Content-Disposition: attachment;filename="01simple.ods"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified -header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header('Pragma: public'); // HTTP/1.0 - -$writer = IOFactory::createWriter($spreadsheet, 'Ods'); -$writer->save('php://output'); -exit; diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_pdf.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_pdf.php deleted file mode 100644 index 5f3e71d7..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_pdf.php +++ /dev/null @@ -1,56 +0,0 @@ -isCli()) { - $helper->log('This example should only be run from a Web Browser' . PHP_EOL); - - return; -} - -// Create new Spreadsheet object -$spreadsheet = new Spreadsheet(); - -// Set document properties -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PDF Test Document') - ->setSubject('PDF Test Document') - ->setDescription('Test document for PDF, generated using PHP classes.') - ->setKeywords('pdf php') - ->setCategory('Test result file'); - -// Add some data -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$spreadsheet->getActiveSheet()->setTitle('Simple'); -$spreadsheet->getActiveSheet()->setShowGridLines(false); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class); - -// Redirect output to a client’s web browser (PDF) -header('Content-Type: application/pdf'); -header('Content-Disposition: attachment;filename="01simple.pdf"'); -header('Cache-Control: max-age=0'); - -$writer = IOFactory::createWriter($spreadsheet, 'Pdf'); -$writer->save('php://output'); -exit; diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xls.php deleted file mode 100644 index 46d12022..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xls.php +++ /dev/null @@ -1,61 +0,0 @@ -isCli()) { - $helper->log('This example should only be run from a Web Browser' . PHP_EOL); - - return; -} - -// Create new Spreadsheet object -$spreadsheet = new Spreadsheet(); - -// Set document properties -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Redirect output to a client’s web browser (Xls) -header('Content-Type: application/vnd.ms-excel'); -header('Content-Disposition: attachment;filename="01simple.xls"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified -header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header('Pragma: public'); // HTTP/1.0 - -$writer = IOFactory::createWriter($spreadsheet, 'Xls'); -$writer->save('php://output'); -exit; diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xlsx.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xlsx.php deleted file mode 100644 index 93efe73d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xlsx.php +++ /dev/null @@ -1,60 +0,0 @@ -isCli()) { - $helper->log('This example should only be run from a Web Browser' . PHP_EOL); - - return; -} -// Create new Spreadsheet object -$spreadsheet = new Spreadsheet(); - -// Set document properties -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Redirect output to a client’s web browser (Xlsx) -header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); -header('Content-Disposition: attachment;filename="01simple.xlsx"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified -header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header('Pragma: public'); // HTTP/1.0 - -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->save('php://output'); -exit; diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/02_Types.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/02_Types.php deleted file mode 100644 index 79f109f5..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/02_Types.php +++ /dev/null @@ -1,162 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties() - ->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Set default font -$helper->log('Set default font'); -$spreadsheet->getDefaultStyle() - ->getFont() - ->setName('Arial') - ->setSize(10); - -// Add some data, resembling some different data types -$helper->log('Add some data'); -$spreadsheet->getActiveSheet() - ->setCellValue('A1', 'String') - ->setCellValue('B1', 'Simple') - ->setCellValue('C1', 'PhpSpreadsheet'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A2', 'String') - ->setCellValue('B2', 'Symbols') - ->setCellValue('C2', '!+&=()~§±æþ'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A3', 'String') - ->setCellValue('B3', 'UTF-8') - ->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A4', 'Number') - ->setCellValue('B4', 'Integer') - ->setCellValue('C4', 12); - -$spreadsheet->getActiveSheet() - ->setCellValue('A5', 'Number') - ->setCellValue('B5', 'Float') - ->setCellValue('C5', 34.56); - -$spreadsheet->getActiveSheet() - ->setCellValue('A6', 'Number') - ->setCellValue('B6', 'Negative') - ->setCellValue('C6', -7.89); - -$spreadsheet->getActiveSheet() - ->setCellValue('A7', 'Boolean') - ->setCellValue('B7', 'True') - ->setCellValue('C7', true); - -$spreadsheet->getActiveSheet() - ->setCellValue('A8', 'Boolean') - ->setCellValue('B8', 'False') - ->setCellValue('C8', false); - -$dateTimeNow = time(); -$spreadsheet->getActiveSheet() - ->setCellValue('A9', 'Date/Time') - ->setCellValue('B9', 'Date') - ->setCellValue('C9', Date::PHPToExcel($dateTimeNow)); -$spreadsheet->getActiveSheet() - ->getStyle('C9') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); - -$spreadsheet->getActiveSheet() - ->setCellValue('A10', 'Date/Time') - ->setCellValue('B10', 'Time') - ->setCellValue('C10', Date::PHPToExcel($dateTimeNow)); -$spreadsheet->getActiveSheet() - ->getStyle('C10') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_TIME4); - -$spreadsheet->getActiveSheet() - ->setCellValue('A11', 'Date/Time') - ->setCellValue('B11', 'Date and Time') - ->setCellValue('C11', Date::PHPToExcel($dateTimeNow)); -$spreadsheet->getActiveSheet() - ->getStyle('C11') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_DATETIME); - -$spreadsheet->getActiveSheet() - ->setCellValue('A12', 'NULL') - ->setCellValue('C12', null); - -$richText = new RichText(); -$richText->createText('你好 '); - -$payable = $richText->createTextRun('你 好 吗?'); -$payable->getFont()->setBold(true); -$payable->getFont()->setItalic(true); -$payable->getFont()->setColor(new Color(Color::COLOR_DARKGREEN)); - -$richText->createText(', unless specified otherwise on the invoice.'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A13', 'Rich Text') - ->setCellValue('C13', $richText); - -$richText2 = new RichText(); -$richText2->createText("black text\n"); - -$red = $richText2->createTextRun('red text'); -$red->getFont()->setColor(new Color(Color::COLOR_RED)); - -$spreadsheet->getActiveSheet() - ->getCell('C14') - ->setValue($richText2); -$spreadsheet->getActiveSheet() - ->getStyle('C14') - ->getAlignment()->setWrapText(true); - -$spreadsheet->getActiveSheet()->setCellValue('A17', 'Hyperlink'); - -$spreadsheet->getActiveSheet() - ->setCellValue('C17', 'PhpSpreadsheet Web Site'); -$spreadsheet->getActiveSheet() - ->getCell('C17') - ->getHyperlink() - ->setUrl('https://github.com/PHPOffice/PhpSpreadsheet') - ->setTooltip('Navigate to PhpSpreadsheet website'); - -$spreadsheet->getActiveSheet() - ->setCellValue('C18', '=HYPERLINK("mailto:abc@def.com","abc@def.com")'); - -$spreadsheet->getActiveSheet() - ->getColumnDimension('B') - ->setAutoSize(true); -$spreadsheet->getActiveSheet() - ->getColumnDimension('C') - ->setAutoSize(true); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Datatypes'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/03_Formulas.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/03_Formulas.php deleted file mode 100644 index e4538231..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/03_Formulas.php +++ /dev/null @@ -1,81 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data, we will use some formulas here -$helper->log('Add some data'); -$spreadsheet->getActiveSheet() - ->setCellValue('A5', 'Sum:'); - -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Range #1') - ->setCellValue('B2', 3) - ->setCellValue('B3', 7) - ->setCellValue('B4', 13) - ->setCellValue('B5', '=SUM(B2:B4)'); -$helper->log('Sum of Range #1 is ' . $spreadsheet->getActiveSheet()->getCell('B5')->getCalculatedValue()); - -$spreadsheet->getActiveSheet()->setCellValue('C1', 'Range #2') - ->setCellValue('C2', 5) - ->setCellValue('C3', 11) - ->setCellValue('C4', 17) - ->setCellValue('C5', '=SUM(C2:C4)'); -$helper->log('Sum of Range #2 is ' . $spreadsheet->getActiveSheet()->getCell('C5')->getCalculatedValue()); - -$spreadsheet->getActiveSheet() - ->setCellValue('A7', 'Total of both ranges:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B7', '=SUM(B5:C5)'); -$helper->log('Sum of both Ranges is ' . $spreadsheet->getActiveSheet()->getCell('B7')->getCalculatedValue()); - -$spreadsheet->getActiveSheet() - ->setCellValue('A8', 'Minimum of both ranges:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B8', '=MIN(B2:C4)'); -$helper->log('Minimum value in either Range is ' . $spreadsheet->getActiveSheet()->getCell('B8')->getCalculatedValue()); - -$spreadsheet->getActiveSheet() - ->setCellValue('A9', 'Maximum of both ranges:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B9', '=MAX(B2:C4)'); -$helper->log('Maximum value in either Range is ' . $spreadsheet->getActiveSheet()->getCell('B9')->getCalculatedValue()); - -$spreadsheet->getActiveSheet() - ->setCellValue('A10', 'Average of both ranges:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B10', '=AVERAGE(B2:C4)'); -$helper->log('Average value of both Ranges is ' . $spreadsheet->getActiveSheet()->getCell('B10')->getCalculatedValue()); -$spreadsheet->getActiveSheet() - ->getColumnDimension('A') - ->setAutoSize(true); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet() - ->setTitle('Formulas'); - -// -// If we set Pre Calculated Formulas to true then PhpSpreadsheet will calculate all formulae in the -// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae -// using functions or features (such as array formulae) that aren't yet supported by the calculation engine -// If the value is false (the default) for the Xlsx Writer, then MS Excel (or the application used to -// open the file) will need to recalculate values itself to guarantee that the correct results are available. -// -//$writer->setPreCalculateFormulas(true); -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/04_Printing.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/04_Printing.php deleted file mode 100644 index 5e90fc91..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/04_Printing.php +++ /dev/null @@ -1,64 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data, we will use printing features -$helper->log('Add some data'); -for ($i = 1; $i < 200; ++$i) { - $spreadsheet->getActiveSheet()->setCellValue('A' . $i, $i); - $spreadsheet->getActiveSheet()->setCellValue('B' . $i, 'Test value'); -} - -// Set header and footer. When no different headers for odd/even are used, odd header is assumed. -$helper->log('Set header/footer'); -$spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->setOddHeader('&L&G&C&HPlease treat this document as confidential!'); -$spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->setOddFooter('&L&B' . $spreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); - -// Add a drawing to the header -$helper->log('Add a drawing to the header'); -$drawing = new HeaderFooterDrawing(); -$drawing->setName('PhpSpreadsheet logo'); -$drawing->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.png'); -$drawing->setHeight(36); -$spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT); - -// Set page orientation and size -$helper->log('Set page orientation and size'); -$spreadsheet->getActiveSheet() - ->getPageSetup() - ->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); -$spreadsheet->getActiveSheet() - ->getPageSetup() - ->setPaperSize(PageSetup::PAPERSIZE_A4); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Printing'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/05_Feature_demo.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/05_Feature_demo.php deleted file mode 100644 index a85ebbc2..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/05_Feature_demo.php +++ /dev/null @@ -1,7 +0,0 @@ -write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/06_Largescale.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/06_Largescale.php deleted file mode 100644 index 2e8a3e67..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/06_Largescale.php +++ /dev/null @@ -1,8 +0,0 @@ -write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/07_Reader.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/07_Reader.php deleted file mode 100644 index 4d9bd79e..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/07_Reader.php +++ /dev/null @@ -1,19 +0,0 @@ -getTemporaryFilename(); -$writer = new Xlsx($sampleSpreadsheet); -$writer->save($filename); - -$callStartTime = microtime(true); -$spreadsheet = IOFactory::load($filename); -$helper->logRead('Xlsx', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting.php deleted file mode 100644 index 2f548632..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting.php +++ /dev/null @@ -1,115 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Create a first sheet, representing sales data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Description') - ->setCellValue('B1', 'Amount'); - -$spreadsheet->getActiveSheet()->setCellValue('A2', 'Paycheck received') - ->setCellValue('B2', 100); - -$spreadsheet->getActiveSheet()->setCellValue('A3', 'Cup of coffee bought') - ->setCellValue('B3', -1.5); - -$spreadsheet->getActiveSheet()->setCellValue('A4', 'Cup of coffee bought') - ->setCellValue('B4', -1.5); - -$spreadsheet->getActiveSheet()->setCellValue('A5', 'Cup of tea bought') - ->setCellValue('B5', -1.2); - -$spreadsheet->getActiveSheet()->setCellValue('A6', 'Found some money') - ->setCellValue('B6', 8); - -$spreadsheet->getActiveSheet()->setCellValue('A7', 'Total:') - ->setCellValue('B7', '=SUM(B2:B6)'); - -// Set column widths -$helper->log('Set column widths'); -$spreadsheet->getActiveSheet()->getColumnDimension('A')->setWidth(30); -$spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(12); - -// Add conditional formatting -$helper->log('Add conditional formatting'); -$conditional1 = new Conditional(); -$conditional1->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_BETWEEN) - ->addCondition('200') - ->addCondition('400'); -$conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_YELLOW); -$conditional1->getStyle()->getFont()->setBold(true); -$conditional1->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$conditional2 = new Conditional(); -$conditional2->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_LESSTHAN) - ->addCondition('0'); -$conditional2->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED); -$conditional2->getStyle()->getFont()->setItalic(true); -$conditional2->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$conditional3 = new Conditional(); -$conditional3->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL) - ->addCondition('0'); -$conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN); -$conditional3->getStyle()->getFont()->setItalic(true); -$conditional3->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles(); -$conditionalStyles[] = $conditional1; -$conditionalStyles[] = $conditional2; -$conditionalStyles[] = $conditional3; -$spreadsheet->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles); - -// duplicate the conditional styles across a range of cells -$helper->log('Duplicate the conditional formatting across a range of cells'); -$spreadsheet->getActiveSheet()->duplicateConditionalStyle( - $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles(), - 'B3:B7' -); - -// Set fonts -$helper->log('Set fonts'); -$spreadsheet->getActiveSheet()->getStyle('A1:B1')->getFont()->setBold(true); -//$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); -$spreadsheet->getActiveSheet()->getStyle('A7:B7')->getFont()->setBold(true); -//$spreadsheet->getActiveSheet()->getStyle('B7')->getFont()->setBold(true); -// Set header and footer. When no different headers for odd/even are used, odd header is assumed. -$helper->log('Set header/footer'); -$spreadsheet->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BPersonal cash register&RPrinted on &D'); -$spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $spreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); - -// Set page orientation and size -$helper->log('Set page orientation and size'); -$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_PORTRAIT); -$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(PageSetup::PAPERSIZE_A4); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Invoice'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting_2.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting_2.php deleted file mode 100644 index 818cdd9f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting_2.php +++ /dev/null @@ -1,70 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Create a first sheet, representing sales data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet() - ->setCellValue('A1', '-0.5') - ->setCellValue('A2', '-0.25') - ->setCellValue('A3', '0.0') - ->setCellValue('A4', '0.25') - ->setCellValue('A5', '0.5') - ->setCellValue('A6', '0.75') - ->setCellValue('A7', '1.0') - ->setCellValue('A8', '1.25'); - -$spreadsheet->getActiveSheet()->getStyle('A1:A8') - ->getNumberFormat() - ->setFormatCode( - NumberFormat::FORMAT_PERCENTAGE_00 - ); - -// Add conditional formatting -$helper->log('Add conditional formatting'); -$conditional1 = new Conditional(); -$conditional1->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_LESSTHAN) - ->addCondition('0'); -$conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED); - -$conditional3 = new Conditional(); -$conditional3->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL) - ->addCondition('1'); -$conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN); - -$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles(); -$conditionalStyles[] = $conditional1; -$conditionalStyles[] = $conditional3; -$spreadsheet->getActiveSheet()->getStyle('A1')->setConditionalStyles($conditionalStyles); - -// duplicate the conditional styles across a range of cells -$helper->log('Duplicate the conditional formatting across a range of cells'); -$spreadsheet->getActiveSheet()->duplicateConditionalStyle( - $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles(), - 'A2:A8' -); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/09_Pagebreaks.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/09_Pagebreaks.php deleted file mode 100644 index ab99a079..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/09_Pagebreaks.php +++ /dev/null @@ -1,63 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Create a first sheet -$helper->log('Add data and page breaks'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname') - ->setCellValue('B1', 'Lastname') - ->setCellValue('C1', 'Phone') - ->setCellValue('D1', 'Fax') - ->setCellValue('E1', 'Is Client ?'); - -// Add data -for ($i = 2; $i <= 50; ++$i) { - $spreadsheet->getActiveSheet()->setCellValue('A' . $i, "FName $i"); - $spreadsheet->getActiveSheet()->setCellValue('B' . $i, "LName $i"); - $spreadsheet->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i"); - $spreadsheet->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i"); - $spreadsheet->getActiveSheet()->setCellValue('E' . $i, true); - - // Add page breaks every 10 rows - if ($i % 10 == 0) { - // Add a page break - $spreadsheet->getActiveSheet()->setBreak('A' . $i, Worksheet::BREAK_ROW); - } -} - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setTitle('Printing Options'); - -// Set print headers -$spreadsheet->getActiveSheet() - ->getHeaderFooter()->setOddHeader('&C&24&K0000FF&B&U&A'); -$spreadsheet->getActiveSheet() - ->getHeaderFooter()->setEvenHeader('&C&24&K0000FF&B&U&A'); - -// Set print footers -$spreadsheet->getActiveSheet() - ->getHeaderFooter()->setOddFooter('&R&D &T&C&F&LPage &P / &N'); -$spreadsheet->getActiveSheet() - ->getHeaderFooter()->setEvenFooter('&L&D &T&C&F&RPage &P / &N'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/11_Documentsecurity.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/11_Documentsecurity.php deleted file mode 100644 index ec537ab3..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/11_Documentsecurity.php +++ /dev/null @@ -1,48 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Hello'); -$spreadsheet->getActiveSheet()->setCellValue('B2', 'world!'); -$spreadsheet->getActiveSheet()->setCellValue('C1', 'Hello'); -$spreadsheet->getActiveSheet()->setCellValue('D2', 'world!'); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set document security -$helper->log('Set document security'); -$spreadsheet->getSecurity()->setLockWindows(true); -$spreadsheet->getSecurity()->setLockStructure(true); -$spreadsheet->getSecurity()->setWorkbookPassword('PhpSpreadsheet'); - -// Set sheet security -$helper->log('Set sheet security'); -$spreadsheet->getActiveSheet()->getProtection()->setPassword('PhpSpreadsheet'); -$spreadsheet->getActiveSheet()->getProtection()->setSheet(true); // This should be enabled in order to enable any of the following! -$spreadsheet->getActiveSheet()->getProtection()->setSort(true); -$spreadsheet->getActiveSheet()->getProtection()->setInsertRows(true); -$spreadsheet->getActiveSheet()->getProtection()->setFormatCells(true); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/12_CellProtection.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/12_CellProtection.php deleted file mode 100644 index 8a1b2a0b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/12_CellProtection.php +++ /dev/null @@ -1,47 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Mark Baker') - ->setLastModifiedBy('Mark Baker') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Crouching'); -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Tiger'); -$spreadsheet->getActiveSheet()->setCellValue('A2', 'Hidden'); -$spreadsheet->getActiveSheet()->setCellValue('B2', 'Dragon'); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set document security -$helper->log('Set cell protection'); - -// Set sheet security -$helper->log('Set sheet security'); -$spreadsheet->getActiveSheet()->getProtection()->setSheet(true); -$spreadsheet->getActiveSheet() - ->getStyle('A2:B2') - ->getProtection()->setLocked( - Protection::PROTECTION_UNPROTECTED - ); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/13_Calculation.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/13_Calculation.php deleted file mode 100644 index 087b443f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/13_Calculation.php +++ /dev/null @@ -1,176 +0,0 @@ -log('List implemented functions'); -$calc = Calculation::getInstance(); -print_r($calc->getImplementedFunctionNames()); - -// Create new Spreadsheet object -$helper->log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Add some data, we will use some formulas here -$helper->log('Add some data and formulas'); -$spreadsheet->getActiveSheet()->setCellValue('A14', 'Count:') - ->setCellValue('A15', 'Sum:') - ->setCellValue('A16', 'Max:') - ->setCellValue('A17', 'Min:') - ->setCellValue('A18', 'Average:') - ->setCellValue('A19', 'Median:') - ->setCellValue('A20', 'Mode:'); - -$spreadsheet->getActiveSheet()->setCellValue('A22', 'CountA:') - ->setCellValue('A23', 'MaxA:') - ->setCellValue('A24', 'MinA:'); - -$spreadsheet->getActiveSheet()->setCellValue('A26', 'StDev:') - ->setCellValue('A27', 'StDevA:') - ->setCellValue('A28', 'StDevP:') - ->setCellValue('A29', 'StDevPA:'); - -$spreadsheet->getActiveSheet()->setCellValue('A31', 'DevSq:') - ->setCellValue('A32', 'Var:') - ->setCellValue('A33', 'VarA:') - ->setCellValue('A34', 'VarP:') - ->setCellValue('A35', 'VarPA:'); - -$spreadsheet->getActiveSheet()->setCellValue('A37', 'Date:'); - -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Range 1') - ->setCellValue('B2', 2) - ->setCellValue('B3', 8) - ->setCellValue('B4', 10) - ->setCellValue('B5', true) - ->setCellValue('B6', false) - ->setCellValue('B7', 'Text String') - ->setCellValue('B9', '22') - ->setCellValue('B10', 4) - ->setCellValue('B11', 6) - ->setCellValue('B12', 12); - -$spreadsheet->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)') - ->setCellValue('B15', '=SUM(B2:B12)') - ->setCellValue('B16', '=MAX(B2:B12)') - ->setCellValue('B17', '=MIN(B2:B12)') - ->setCellValue('B18', '=AVERAGE(B2:B12)') - ->setCellValue('B19', '=MEDIAN(B2:B12)') - ->setCellValue('B20', '=MODE(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('B22', '=COUNTA(B2:B12)') - ->setCellValue('B23', '=MAXA(B2:B12)') - ->setCellValue('B24', '=MINA(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('B26', '=STDEV(B2:B12)') - ->setCellValue('B27', '=STDEVA(B2:B12)') - ->setCellValue('B28', '=STDEVP(B2:B12)') - ->setCellValue('B29', '=STDEVPA(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('B31', '=DEVSQ(B2:B12)') - ->setCellValue('B32', '=VAR(B2:B12)') - ->setCellValue('B33', '=VARA(B2:B12)') - ->setCellValue('B34', '=VARP(B2:B12)') - ->setCellValue('B35', '=VARPA(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('B37', '=DATE(2007, 12, 21)') - ->setCellValue('B38', '=DATEDIF( DATE(2007, 12, 21), DATE(2007, 12, 22), "D" )') - ->setCellValue('B39', '=DATEVALUE("01-Feb-2006 10:06 AM")') - ->setCellValue('B40', '=DAY( DATE(2006, 1, 2) )') - ->setCellValue('B41', '=DAYS360( DATE(2002, 2, 3), DATE(2005, 5, 31) )'); - -$spreadsheet->getActiveSheet()->setCellValue('C1', 'Range 2') - ->setCellValue('C2', 1) - ->setCellValue('C3', 2) - ->setCellValue('C4', 2) - ->setCellValue('C5', 3) - ->setCellValue('C6', 3) - ->setCellValue('C7', 3) - ->setCellValue('C8', '0') - ->setCellValue('C9', 4) - ->setCellValue('C10', 4) - ->setCellValue('C11', 4) - ->setCellValue('C12', 4); - -$spreadsheet->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)') - ->setCellValue('C15', '=SUM(C2:C12)') - ->setCellValue('C16', '=MAX(C2:C12)') - ->setCellValue('C17', '=MIN(C2:C12)') - ->setCellValue('C18', '=AVERAGE(C2:C12)') - ->setCellValue('C19', '=MEDIAN(C2:C12)') - ->setCellValue('C20', '=MODE(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('C22', '=COUNTA(C2:C12)') - ->setCellValue('C23', '=MAXA(C2:C12)') - ->setCellValue('C24', '=MINA(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('C26', '=STDEV(C2:C12)') - ->setCellValue('C27', '=STDEVA(C2:C12)') - ->setCellValue('C28', '=STDEVP(C2:C12)') - ->setCellValue('C29', '=STDEVPA(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('C31', '=DEVSQ(C2:C12)') - ->setCellValue('C32', '=VAR(C2:C12)') - ->setCellValue('C33', '=VARA(C2:C12)') - ->setCellValue('C34', '=VARP(C2:C12)') - ->setCellValue('C35', '=VARPA(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('D1', 'Range 3') - ->setCellValue('D2', 2) - ->setCellValue('D3', 3) - ->setCellValue('D4', 4); - -$spreadsheet->getActiveSheet()->setCellValue('D14', '=((D2 * D3) + D4) & " should be 10"'); - -$spreadsheet->getActiveSheet()->setCellValue('E12', 'Other functions') - ->setCellValue('E14', '=PI()') - ->setCellValue('E15', '=RAND()') - ->setCellValue('E16', '=RANDBETWEEN(5, 10)'); - -$spreadsheet->getActiveSheet()->setCellValue('E17', 'Count of both ranges:') - ->setCellValue('F17', '=COUNT(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E18', 'Total of both ranges:') - ->setCellValue('F18', '=SUM(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E19', 'Maximum of both ranges:') - ->setCellValue('F19', '=MAX(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E20', 'Minimum of both ranges:') - ->setCellValue('F20', '=MIN(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E21', 'Average of both ranges:') - ->setCellValue('F21', '=AVERAGE(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E22', 'Median of both ranges:') - ->setCellValue('F22', '=MEDIAN(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E23', 'Mode of both ranges:') - ->setCellValue('F23', '=MODE(B2:C12)'); - -// Calculated data -$helper->log('Calculated data'); -for ($col = 'B'; $col != 'G'; ++$col) { - for ($row = 14; $row <= 41; ++$row) { - if ((($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue()) !== null) && - ($formula[0] == '=')) { - $helper->log('Value of ' . $col . $row . ' [' . $formula . ']: ' . $spreadsheet->getActiveSheet()->getCell($col . $row)->getCalculatedValue()); - } - } -} - -// -// If we set Pre Calculated Formulas to true then PhpSpreadsheet will calculate all formulae in the -// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae -// using functions or features (such as array formulae) that aren't yet supported by the calculation engine -// If the value is false (the default) for the Xlsx Writer, then MS Excel (or the application used to -// open the file) will need to recalculate values itself to guarantee that the correct results are available. -// -//$writer->setPreCalculateFormulas(true); -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/13_CalculationCyclicFormulae.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/13_CalculationCyclicFormulae.php deleted file mode 100644 index 26e9784d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/13_CalculationCyclicFormulae.php +++ /dev/null @@ -1,33 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Add some data, we will use some formulas here -$helper->log('Add some data and formulas'); -$spreadsheet->getActiveSheet()->setCellValue('A1', '=B1') - ->setCellValue('A2', '=B2+1') - ->setCellValue('B1', '=A1+1') - ->setCellValue('B2', '=A2'); - -Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100; - -// Calculated data -$helper->log('Calculated data'); -for ($row = 1; $row <= 2; ++$row) { - for ($col = 'A'; $col != 'C'; ++$col) { - if ((($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue()) !== null) && - ($formula[0] == '=')) { - $helper->log('Value of ' . $col . $row . ' [' . $formula . ']: ' . $spreadsheet->getActiveSheet()->getCell($col . $row)->getCalculatedValue()); - } - } -} - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/14_Xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/14_Xls.php deleted file mode 100644 index ce27eb8c..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/14_Xls.php +++ /dev/null @@ -1,13 +0,0 @@ -getFilename(__FILE__, 'xls'); -$writer = IOFactory::createWriter($spreadsheet, 'Xls'); - -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/15_Datavalidation.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/15_Datavalidation.php deleted file mode 100644 index fb76b4dc..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/15_Datavalidation.php +++ /dev/null @@ -1,80 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Create a first sheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Cell B3 and B5 contain data validation...') - ->setCellValue('A3', 'Number:') - ->setCellValue('B3', '10') - ->setCellValue('A5', 'List:') - ->setCellValue('B5', 'Item A') - ->setCellValue('A7', 'List #2:') - ->setCellValue('B7', 'Item #2') - ->setCellValue('D2', 'Item #1') - ->setCellValue('D3', 'Item #2') - ->setCellValue('D4', 'Item #3') - ->setCellValue('D5', 'Item #4') - ->setCellValue('D6', 'Item #5'); - -// Set data validation -$helper->log('Set data validation'); -$validation = $spreadsheet->getActiveSheet()->getCell('B3')->getDataValidation(); -$validation->setType(DataValidation::TYPE_WHOLE); -$validation->setErrorStyle(DataValidation::STYLE_STOP); -$validation->setAllowBlank(true); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Only numbers between 10 and 20 are allowed!'); -$validation->setPromptTitle('Allowed input'); -$validation->setPrompt('Only numbers between 10 and 20 are allowed.'); -$validation->setFormula1(10); -$validation->setFormula2(20); - -$validation = $spreadsheet->getActiveSheet()->getCell('B5')->getDataValidation(); -$validation->setType(DataValidation::TYPE_LIST); -$validation->setErrorStyle(DataValidation::STYLE_INFORMATION); -$validation->setAllowBlank(false); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setShowDropDown(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Value is not in list.'); -$validation->setPromptTitle('Pick from list'); -$validation->setPrompt('Please pick a value from the drop-down list.'); -$validation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!! - -$validation = $spreadsheet->getActiveSheet()->getCell('B7')->getDataValidation(); -$validation->setType(DataValidation::TYPE_LIST); -$validation->setErrorStyle(DataValidation::STYLE_INFORMATION); -$validation->setAllowBlank(false); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setShowDropDown(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Value is not in list.'); -$validation->setPromptTitle('Pick from list'); -$validation->setPrompt('Please pick a value from the drop-down list.'); -$validation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/16_Csv.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/16_Csv.php deleted file mode 100644 index de753d56..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/16_Csv.php +++ /dev/null @@ -1,41 +0,0 @@ -log('Write to CSV format'); -/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writer */ -$writer = IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',') - ->setEnclosure('"') - ->setSheetIndex(0); - -$callStartTime = microtime(true); -$filename = $helper->getTemporaryFilename('csv'); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -$helper->log('Read from CSV format'); - -/** @var \PhpOffice\PhpSpreadsheet\Reader\Csv $reader */ -$reader = IOFactory::createReader('Csv')->setDelimiter(',') - ->setEnclosure('"') - ->setSheetIndex(0); - -$callStartTime = microtime(true); -$spreadsheetFromCSV = $reader->load($filename); -$helper->logRead('Csv', $filename, $callStartTime); - -// Write Xlsx -$helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx']); - -// Write CSV -$filenameCSV = $helper->getFilename(__FILE__, 'csv'); -/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writerCSV */ -$writerCSV = IOFactory::createWriter($spreadsheetFromCSV, 'Csv'); -$writerCSV->setExcelCompatibility(true); - -$callStartTime = microtime(true); -$writerCSV->save($filenameCSV); -$helper->logWrite($writerCSV, $filenameCSV, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/17_Html.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/17_Html.php deleted file mode 100644 index b90b7212..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/17_Html.php +++ /dev/null @@ -1,13 +0,0 @@ -getFilename(__FILE__, 'html'); -$writer = IOFactory::createWriter($spreadsheet, 'Html'); - -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/18_Extendedcalculation.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/18_Extendedcalculation.php deleted file mode 100644 index c1ec2c0a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/18_Extendedcalculation.php +++ /dev/null @@ -1,69 +0,0 @@ -log('List implemented functions'); -$calc = Calculation::getInstance(); -print_r($calc->getImplementedFunctionNames()); - -// Create new Spreadsheet object -$helper->log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Add some data, we will use some formulas here -$helper->log('Add some data'); -$spreadsheet->getActiveSheet()->setCellValue('A14', 'Count:'); - -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Range 1'); -$spreadsheet->getActiveSheet()->setCellValue('B2', 2); -$spreadsheet->getActiveSheet()->setCellValue('B3', 8); -$spreadsheet->getActiveSheet()->setCellValue('B4', 10); -$spreadsheet->getActiveSheet()->setCellValue('B5', true); -$spreadsheet->getActiveSheet()->setCellValue('B6', false); -$spreadsheet->getActiveSheet()->setCellValue('B7', 'Text String'); -$spreadsheet->getActiveSheet()->setCellValue('B9', '22'); -$spreadsheet->getActiveSheet()->setCellValue('B10', 4); -$spreadsheet->getActiveSheet()->setCellValue('B11', 6); -$spreadsheet->getActiveSheet()->setCellValue('B12', 12); - -$spreadsheet->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('C1', 'Range 2'); -$spreadsheet->getActiveSheet()->setCellValue('C2', 1); -$spreadsheet->getActiveSheet()->setCellValue('C3', 2); -$spreadsheet->getActiveSheet()->setCellValue('C4', 2); -$spreadsheet->getActiveSheet()->setCellValue('C5', 3); -$spreadsheet->getActiveSheet()->setCellValue('C6', 3); -$spreadsheet->getActiveSheet()->setCellValue('C7', 3); -$spreadsheet->getActiveSheet()->setCellValue('C8', '0'); -$spreadsheet->getActiveSheet()->setCellValue('C9', 4); -$spreadsheet->getActiveSheet()->setCellValue('C10', 4); -$spreadsheet->getActiveSheet()->setCellValue('C11', 4); -$spreadsheet->getActiveSheet()->setCellValue('C12', 4); - -$spreadsheet->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('D1', 'Range 3'); -$spreadsheet->getActiveSheet()->setCellValue('D2', 2); -$spreadsheet->getActiveSheet()->setCellValue('D3', 3); -$spreadsheet->getActiveSheet()->setCellValue('D4', 4); - -$spreadsheet->getActiveSheet()->setCellValue('D5', '=((D2 * D3) + D4) & " should be 10"'); - -$spreadsheet->getActiveSheet()->setCellValue('E1', 'Other functions'); -$spreadsheet->getActiveSheet()->setCellValue('E2', '=PI()'); -$spreadsheet->getActiveSheet()->setCellValue('E3', '=RAND()'); -$spreadsheet->getActiveSheet()->setCellValue('E4', '=RANDBETWEEN(5, 10)'); - -$spreadsheet->getActiveSheet()->setCellValue('E14', 'Count of both ranges:'); -$spreadsheet->getActiveSheet()->setCellValue('F14', '=COUNT(B2:C12)'); - -// Calculated data -$helper->log('Calculated data'); -$helper->log('Value of B14 [=COUNT(B2:B12)]: ' . $spreadsheet->getActiveSheet()->getCell('B14')->getCalculatedValue()); - -$helper->logEndingNotes(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/19_Namedrange.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/19_Namedrange.php deleted file mode 100644 index d89e1b04..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/19_Namedrange.php +++ /dev/null @@ -1,70 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:') - ->setCellValue('A2', 'Lastname:') - ->setCellValue('A3', 'Fullname:') - ->setCellValue('B1', 'Maarten') - ->setCellValue('B2', 'Balliauw') - ->setCellValue('B3', '=B1 & " " & B2'); - -// Define named ranges -$helper->log('Define named ranges'); -$spreadsheet->addNamedRange(new NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1')); -$spreadsheet->addNamedRange(new NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2')); - -// Rename named ranges -$helper->log('Rename named ranges'); -$spreadsheet->getNamedRange('PersonName')->setName('PersonFN'); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Person'); - -// Create a new worksheet, after the default sheet -$helper->log('Create new Worksheet object'); -$spreadsheet->createSheet(); - -// Add some data to the second sheet, resembling some different data types -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(1); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:') - ->setCellValue('A2', 'Lastname:') - ->setCellValue('A3', 'Fullname:') - ->setCellValue('B1', '=PersonFN') - ->setCellValue('B2', '=PersonLN') - ->setCellValue('B3', '=PersonFN & " " & PersonLN'); - -// Resolve range -$helper->log('Resolve range'); -$helper->log('Cell B1 {=PersonFN}: ' . $spreadsheet->getActiveSheet()->getCell('B1')->getCalculatedValue()); -$helper->log('Cell B3 {=PersonFN & " " & PersonLN}: ' . $spreadsheet->getActiveSheet()->getCell('B3')->getCalculatedValue()); -$helper->log('Cell Person!B1: ' . $spreadsheet->getActiveSheet()->getCell('Person!B1')->getCalculatedValue()); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Person (cloned)'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Excel2003XML.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Excel2003XML.php deleted file mode 100644 index 44425e20..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Excel2003XML.php +++ /dev/null @@ -1,13 +0,0 @@ -logRead('Xml', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Gnumeric.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Gnumeric.php deleted file mode 100644 index 2d6ce221..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Gnumeric.php +++ /dev/null @@ -1,13 +0,0 @@ -logRead('Gnumeric', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Ods.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Ods.php deleted file mode 100644 index 64f54827..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Ods.php +++ /dev/null @@ -1,13 +0,0 @@ -logRead('Ods', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Sylk.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Sylk.php deleted file mode 100644 index 1a064593..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Sylk.php +++ /dev/null @@ -1,13 +0,0 @@ -logRead('Slk', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Xls.php deleted file mode 100644 index 9e5fa014..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Xls.php +++ /dev/null @@ -1,22 +0,0 @@ -getTemporaryFilename('xls'); -$writer = IOFactory::createWriter($spreadsheet, 'Xls'); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -// Read Xls file -$callStartTime = microtime(true); -$spreadsheet = IOFactory::load($filename); -$helper->logRead('Xls', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/22_Heavily_formatted.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/22_Heavily_formatted.php deleted file mode 100644 index d7ba861b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/22_Heavily_formatted.php +++ /dev/null @@ -1,48 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); - -$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray( - ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFCCFFCC'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] -); - -$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray( - ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFFFFF00'], - ], - ] -); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/23_Sharedstyles.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/23_Sharedstyles.php deleted file mode 100644 index b5398883..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/23_Sharedstyles.php +++ /dev/null @@ -1,59 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); - -$sharedStyle1 = new Style(); -$sharedStyle2 = new Style(); - -$sharedStyle1->applyFromArray( - ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFCCFFCC'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] -); - -$sharedStyle2->applyFromArray( - ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFFFFF00'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] -); - -$spreadsheet->getActiveSheet()->duplicateStyle($sharedStyle1, 'A1:T100'); -$spreadsheet->getActiveSheet()->duplicateStyle($sharedStyle2, 'C5:R95'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/24_Readfilter.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/24_Readfilter.php deleted file mode 100644 index 844996f2..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/24_Readfilter.php +++ /dev/null @@ -1,41 +0,0 @@ -getTemporaryFilename(); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -class MyReadFilter implements IReadFilter -{ - public function readCell($column, $row, $worksheetName = '') - { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - - return false; - } -} - -$helper->log('Load from Xlsx file'); -$reader = IOFactory::createReader('Xlsx'); -$reader->setReadFilter(new MyReadFilter()); -$callStartTime = microtime(true); -$spreadsheet = $reader->load($filename); -$helper->logRead('Xlsx', $filename, $callStartTime); -$helper->log('Remove unnecessary rows'); -$spreadsheet->getActiveSheet()->removeRow(2, 18); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/25_In_memory_image.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/25_In_memory_image.php deleted file mode 100644 index a897486d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/25_In_memory_image.php +++ /dev/null @@ -1,40 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Generate an image -$helper->log('Generate an image'); -$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - -// Add a drawing to the worksheet -$helper->log('Add a drawing to the worksheet'); -$drawing = new MemoryDrawing(); -$drawing->setName('Sample image'); -$drawing->setDescription('Sample image'); -$drawing->setImageResource($gdImage); -$drawing->setRenderingFunction(MemoryDrawing::RENDERING_JPEG); -$drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT); -$drawing->setHeight(36); -$drawing->setWorksheet($spreadsheet->getActiveSheet()); - -// Save -$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Html']); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/26_Utf8.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/26_Utf8.php deleted file mode 100644 index 52a64509..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/26_Utf8.php +++ /dev/null @@ -1,40 +0,0 @@ -log('Load Xlsx template file'); -$reader = IOFactory::createReader('Xlsx'); -$spreadsheet = $reader->load(__DIR__ . '/../templates/26template.xlsx'); - -// at this point, we could do some manipulations with the template, but we skip this step -$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']); - -// Export to PDF (.pdf) -$helper->log('Write to PDF format'); -IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class); -$helper->write($spreadsheet, __FILE__, ['Pdf']); - -// Remove first two rows with field headers before exporting to CSV -$helper->log('Removing first two heading rows for CSV export'); -$worksheet = $spreadsheet->getActiveSheet(); -$worksheet->removeRow(1, 2); - -// Export to CSV (.csv) -$helper->log('Write to CSV format'); -/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writer */ -$writer = IOFactory::createWriter($spreadsheet, 'Csv'); -$filename = $helper->getFilename(__FILE__, 'csv'); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -// Export to CSV with BOM (.csv) -$filename = str_replace('.csv', '-bom.csv', $filename); -$helper->log('Write to CSV format (with BOM)'); -$writer->setUseBOM(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/27_Images_Xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/27_Images_Xls.php deleted file mode 100644 index 4c20a9ac..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/27_Images_Xls.php +++ /dev/null @@ -1,13 +0,0 @@ -log('Load Xlsx template file'); -$reader = IOFactory::createReader('Xls'); -$spreadsheet = $reader->load(__DIR__ . '/../templates/27template.xls'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/28_Iterator.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/28_Iterator.php deleted file mode 100644 index 4aec7a92..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/28_Iterator.php +++ /dev/null @@ -1,34 +0,0 @@ -getTemporaryFilename(); -$writer = new Xlsx($sampleSpreadsheet); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -$callStartTime = microtime(true); -$reader = IOFactory::createReader('Xlsx'); -$spreadsheet = $reader->load($filename); -$helper->logRead('Xlsx', $filename, $callStartTime); -$helper->log('Iterate worksheets'); -foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $helper->log('Worksheet - ' . $worksheet->getTitle()); - - foreach ($worksheet->getRowIterator() as $row) { - $helper->log(' Row number - ' . $row->getRowIndex()); - - $cellIterator = $row->getCellIterator(); - $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set - foreach ($cellIterator as $cell) { - if ($cell !== null) { - $helper->log(' Cell - ' . $cell->getCoordinate() . ' - ' . $cell->getCalculatedValue()); - } - } - } -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/29_Advanced_value_binder.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/29_Advanced_value_binder.php deleted file mode 100644 index 74c16c21..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/29_Advanced_value_binder.php +++ /dev/null @@ -1,132 +0,0 @@ -log('Set timezone'); -date_default_timezone_set('UTC'); - -// Set value binder -$helper->log('Set value binder'); -Cell::setValueBinder(new AdvancedValueBinder()); - -// Create new Spreadsheet object -$helper->log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Set default font -$helper->log('Set default font'); -$spreadsheet->getDefaultStyle()->getFont()->setName('Arial'); -$spreadsheet->getDefaultStyle()->getFont()->setSize(10); - -// Set column widths -$helper->log('Set column widths'); -$spreadsheet->getActiveSheet()->getColumnDimension('A')->setAutoSize(true); -$spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(14); - -// Add some data, resembling some different data types -$helper->log('Add some data'); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'String value:') - ->setCellValue('B1', 'Mark Baker'); - -$spreadsheet->getActiveSheet()->setCellValue('A2', 'Numeric value #1:') - ->setCellValue('B2', 12345); - -$spreadsheet->getActiveSheet()->setCellValue('A3', 'Numeric value #2:') - ->setCellValue('B3', -12.345); - -$spreadsheet->getActiveSheet()->setCellValue('A4', 'Numeric value #3:') - ->setCellValue('B4', .12345); - -$spreadsheet->getActiveSheet()->setCellValue('A5', 'Numeric value #4:') - ->setCellValue('B5', '12345'); - -$spreadsheet->getActiveSheet()->setCellValue('A6', 'Numeric value #5:') - ->setCellValue('B6', '1.2345'); - -$spreadsheet->getActiveSheet()->setCellValue('A7', 'Numeric value #6:') - ->setCellValue('B7', '.12345'); - -$spreadsheet->getActiveSheet()->setCellValue('A8', 'Numeric value #7:') - ->setCellValue('B8', '1.234e-5'); - -$spreadsheet->getActiveSheet()->setCellValue('A9', 'Numeric value #8:') - ->setCellValue('B9', '-1.234e+5'); - -$spreadsheet->getActiveSheet()->setCellValue('A10', 'Boolean value:') - ->setCellValue('B10', 'TRUE'); - -$spreadsheet->getActiveSheet()->setCellValue('A11', 'Percentage value #1:') - ->setCellValue('B11', '10%'); - -$spreadsheet->getActiveSheet()->setCellValue('A12', 'Percentage value #2:') - ->setCellValue('B12', '12.5%'); - -$spreadsheet->getActiveSheet()->setCellValue('A13', 'Fraction value #1:') - ->setCellValue('B13', '-1/2'); - -$spreadsheet->getActiveSheet()->setCellValue('A14', 'Fraction value #2:') - ->setCellValue('B14', '3 1/2'); - -$spreadsheet->getActiveSheet()->setCellValue('A15', 'Fraction value #3:') - ->setCellValue('B15', '-12 3/4'); - -$spreadsheet->getActiveSheet()->setCellValue('A16', 'Fraction value #4:') - ->setCellValue('B16', '13/4'); - -$spreadsheet->getActiveSheet()->setCellValue('A17', 'Currency value #1:') - ->setCellValue('B17', '$12345'); - -$spreadsheet->getActiveSheet()->setCellValue('A18', 'Currency value #2:') - ->setCellValue('B18', '$12345.67'); - -$spreadsheet->getActiveSheet()->setCellValue('A19', 'Currency value #3:') - ->setCellValue('B19', '$12,345.67'); - -$spreadsheet->getActiveSheet()->setCellValue('A20', 'Date value #1:') - ->setCellValue('B20', '21 December 1983'); - -$spreadsheet->getActiveSheet()->setCellValue('A21', 'Date value #2:') - ->setCellValue('B21', '19-Dec-1960'); - -$spreadsheet->getActiveSheet()->setCellValue('A22', 'Date value #3:') - ->setCellValue('B22', '07/12/1982'); - -$spreadsheet->getActiveSheet()->setCellValue('A23', 'Date value #4:') - ->setCellValue('B23', '24-11-1950'); - -$spreadsheet->getActiveSheet()->setCellValue('A24', 'Date value #5:') - ->setCellValue('B24', '17-Mar'); - -$spreadsheet->getActiveSheet()->setCellValue('A25', 'Time value #1:') - ->setCellValue('B25', '01:30'); - -$spreadsheet->getActiveSheet()->setCellValue('A26', 'Time value #2:') - ->setCellValue('B26', '01:30:15'); - -$spreadsheet->getActiveSheet()->setCellValue('A27', 'Date/Time value:') - ->setCellValue('B27', '19-Dec-1960 01:30'); - -$spreadsheet->getActiveSheet()->setCellValue('A28', 'Formula:') - ->setCellValue('B28', '=SUM(B2:B9)'); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Advanced value binder'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/30_Template.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/30_Template.php deleted file mode 100644 index b70c18b6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/30_Template.php +++ /dev/null @@ -1,43 +0,0 @@ -log('Load from Xls template'); -$reader = IOFactory::createReader('Xls'); -$spreadsheet = $reader->load(__DIR__ . '/../templates/30template.xls'); - -$helper->log('Add new data to the template'); -$data = [['title' => 'Excel for dummies', - 'price' => 17.99, - 'quantity' => 2, - ], - ['title' => 'PHP for dummies', - 'price' => 15.99, - 'quantity' => 1, - ], - ['title' => 'Inside OOP', - 'price' => 12.95, - 'quantity' => 1, - ], -]; - -$spreadsheet->getActiveSheet()->setCellValue('D1', Date::PHPToExcel(time())); - -$baseRow = 5; -foreach ($data as $r => $dataRow) { - $row = $baseRow + $r; - $spreadsheet->getActiveSheet()->insertNewRowBefore($row, 1); - - $spreadsheet->getActiveSheet()->setCellValue('A' . $row, $r + 1) - ->setCellValue('B' . $row, $dataRow['title']) - ->setCellValue('C' . $row, $dataRow['price']) - ->setCellValue('D' . $row, $dataRow['quantity']) - ->setCellValue('E' . $row, '=C' . $row . '*D' . $row); -} -$spreadsheet->getActiveSheet()->removeRow($baseRow - 1, 1); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write.php deleted file mode 100644 index bdce86dd..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write.php +++ /dev/null @@ -1,68 +0,0 @@ -load($inputFileName); -$helper->logRead($inputFileType, $inputFileName, $callStartTime); - -$helper->log('Adjust properties'); -$spreadsheet->getProperties()->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test XLSX document, generated using PhpSpreadsheet') - ->setKeywords('office 2007 openxml php'); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -$helper->logEndingNotes(); - -// Reread File -$helper->log('Reread Xlsx file'); -$spreadsheetRead = IOFactory::load($filename); - -// Set properties -$helper->log('Get properties'); - -$helper->log('Core Properties:'); -$helper->log(' Created by - ' . $spreadsheet->getProperties()->getCreator()); -$helper->log(' Created on - ' . date('d-M-Y' . $spreadsheet->getProperties()->getCreated()) . ' at ' . date('H:i:s' . $spreadsheet->getProperties()->getCreated())); -$helper->log(' Last Modified by - ' . $spreadsheet->getProperties()->getLastModifiedBy()); -$helper->log(' Last Modified on - ' . date('d-M-Y' . $spreadsheet->getProperties()->getModified()) . ' at ' . date('H:i:s' . $spreadsheet->getProperties()->getModified())); -$helper->log(' Title - ' . $spreadsheet->getProperties()->getTitle()); -$helper->log(' Subject - ' . $spreadsheet->getProperties()->getSubject()); -$helper->log(' Description - ' . $spreadsheet->getProperties()->getDescription()); -$helper->log(' Keywords: - ' . $spreadsheet->getProperties()->getKeywords()); - -$helper->log('Extended (Application) Properties:'); -$helper->log(' Category - ' . $spreadsheet->getProperties()->getCategory()); -$helper->log(' Company - ' . $spreadsheet->getProperties()->getCompany()); -$helper->log(' Manager - ' . $spreadsheet->getProperties()->getManager()); - -$helper->log('Custom Properties:'); -$customProperties = $spreadsheet->getProperties()->getCustomProperties(); -foreach ($customProperties as $customProperty) { - $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); - $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); - if ($propertyType == Properties::PROPERTY_TYPE_DATE) { - $formattedValue = date('d-M-Y H:i:s', (int) $propertyValue); - } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) { - $formattedValue = $propertyValue ? 'TRUE' : 'FALSE'; - } else { - $formattedValue = $propertyValue; - } - $helper->log(' ' . $customProperty . ' - (' . $propertyType . ') - ' . $formattedValue); -} - -$helper->logEndingNotes(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write_xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write_xls.php deleted file mode 100644 index f3a48f95..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write_xls.php +++ /dev/null @@ -1,68 +0,0 @@ -load($inputFileName); -$helper->logRead($inputFileType, $inputFileName, $callStartTime); - -$helper->log('Adjust properties'); -$spreadsheet->getProperties()->setTitle('Office 95 XLS Test Document') - ->setSubject('Office 95 XLS Test Document') - ->setDescription('Test XLS document, generated using PhpSpreadsheet') - ->setKeywords('office 95 biff php'); - -// Save Excel 95 file -$filename = $helper->getFilename(__FILE__, 'xls'); -$writer = IOFactory::createWriter($spreadsheet, 'Xls'); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -$helper->logEndingNotes(); - -// Reread File -$helper->log('Reread Xls file'); -$spreadsheetRead = IOFactory::load($filename); - -// Set properties -$helper->log('Get properties'); - -$helper->log('Core Properties:'); -$helper->log(' Created by - ' . $spreadsheet->getProperties()->getCreator()); -$helper->log(' Created on - ' . date('d-M-Y' . $spreadsheet->getProperties()->getCreated()) . ' at ' . date('H:i:s' . $spreadsheet->getProperties()->getCreated())); -$helper->log(' Last Modified by - ' . $spreadsheet->getProperties()->getLastModifiedBy()); -$helper->log(' Last Modified on - ' . date('d-M-Y' . $spreadsheet->getProperties()->getModified()) . ' at ' . date('H:i:s' . $spreadsheet->getProperties()->getModified())); -$helper->log(' Title - ' . $spreadsheet->getProperties()->getTitle()); -$helper->log(' Subject - ' . $spreadsheet->getProperties()->getSubject()); -$helper->log(' Description - ' . $spreadsheet->getProperties()->getDescription()); -$helper->log(' Keywords: - ' . $spreadsheet->getProperties()->getKeywords()); - -$helper->log('Extended (Application) Properties:'); -$helper->log(' Category - ' . $spreadsheet->getProperties()->getCategory()); -$helper->log(' Company - ' . $spreadsheet->getProperties()->getCompany()); -$helper->log(' Manager - ' . $spreadsheet->getProperties()->getManager()); - -$helper->log('Custom Properties:'); -$customProperties = $spreadsheet->getProperties()->getCustomProperties(); -foreach ($customProperties as $customProperty) { - $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); - $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); - if ($propertyType == Properties::PROPERTY_TYPE_DATE) { - $formattedValue = date('d-M-Y H:i:s', (int) $propertyValue); - } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) { - $formattedValue = $propertyValue ? 'TRUE' : 'FALSE'; - } else { - $formattedValue = $propertyValue; - } - $helper->log(' ' . $customProperty . ' - (' . $propertyType . ') - ' . $formattedValue); -} - -$helper->logEndingNotes(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/37_Page_layout_view.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/37_Page_layout_view.php deleted file mode 100644 index d9bac80a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/37_Page_layout_view.php +++ /dev/null @@ -1,32 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPOffice') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('Office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!'); - -// Set the page layout view as page layout -$spreadsheet->getActiveSheet()->getSheetView()->setView(SheetView::SHEETVIEW_PAGE_LAYOUT); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/38_Clone_worksheet.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/38_Clone_worksheet.php deleted file mode 100644 index 83f2d9ce..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/38_Clone_worksheet.php +++ /dev/null @@ -1,57 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -$spreadsheet->getActiveSheet()->setCellValue('A8', "Hello\nWorld"); -$spreadsheet->getActiveSheet()->getRowDimension(8)->setRowHeight(-1); -$spreadsheet->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Clone worksheet -$helper->log('Clone worksheet'); -$clonedSheet = clone $spreadsheet->getActiveSheet(); -$clonedSheet - ->setCellValue('A1', 'Goodbye') - ->setCellValue('A2', 'cruel') - ->setCellValue('C1', 'Goodbye') - ->setCellValue('C2', 'cruel'); - -// Rename cloned worksheet -$helper->log('Rename cloned worksheet'); -$clonedSheet->setTitle('Simple Clone'); -$spreadsheet->addSheet($clonedSheet); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/39_Dropdown.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/39_Dropdown.php deleted file mode 100644 index e34d73e6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/39_Dropdown.php +++ /dev/null @@ -1,129 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties() - ->setCreator('PHPOffice') - ->setLastModifiedBy('PHPOffice') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('Office PhpSpreadsheet php') - ->setCategory('Test result file'); -function transpose($value) -{ - return [$value]; -} - -// Add some data -$continentColumn = 'D'; -$column = 'F'; - -// Set data for dropdowns -$continents = glob(__DIR__ . '/data/continents/*'); -foreach ($continents as $key => $filename) { - $continent = pathinfo($filename, PATHINFO_FILENAME); - $helper->log("Loading $continent"); - $continent = str_replace(' ', '_', $continent); - $countries = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - $countryCount = count($countries); - - // Transpose $countries from a row to a column array - $countries = array_map('transpose', $countries); - $spreadsheet->getActiveSheet() - ->fromArray($countries, null, $column . '1'); - $spreadsheet->addNamedRange( - new NamedRange( - $continent, - $spreadsheet->getActiveSheet(), - $column . '1:' . $column . $countryCount - ) - ); - $spreadsheet->getActiveSheet() - ->getColumnDimension($column) - ->setVisible(false); - - $spreadsheet->getActiveSheet() - ->setCellValue($continentColumn . ($key + 1), $continent); - - ++$column; -} - -// Hide the dropdown data -$spreadsheet->getActiveSheet() - ->getColumnDimension($continentColumn) - ->setVisible(false); - -$spreadsheet->addNamedRange( - new NamedRange( - 'Continents', - $spreadsheet->getActiveSheet(), - $continentColumn . '1:' . $continentColumn . count($continents) - ) -); - -// Set selection cells -$spreadsheet->getActiveSheet() - ->setCellValue('A1', 'Continent:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B1', 'Select continent'); -$spreadsheet->getActiveSheet() - ->setCellValue('B3', '=' . $column . 1); -$spreadsheet->getActiveSheet() - ->setCellValue('B3', 'Select country'); -$spreadsheet->getActiveSheet() - ->getStyle('A1:A3') - ->getFont()->setBold(true); - -// Set linked validators -$validation = $spreadsheet->getActiveSheet() - ->getCell('B1') - ->getDataValidation(); -$validation->setType(DataValidation::TYPE_LIST) - ->setErrorStyle(DataValidation::STYLE_INFORMATION) - ->setAllowBlank(false) - ->setShowInputMessage(true) - ->setShowErrorMessage(true) - ->setShowDropDown(true) - ->setErrorTitle('Input error') - ->setError('Continent is not in the list.') - ->setPromptTitle('Pick from the list') - ->setPrompt('Please pick a continent from the drop-down list.') - ->setFormula1('=Continents'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A3', 'Country:'); -$spreadsheet->getActiveSheet() - ->getStyle('A3') - ->getFont()->setBold(true); - -$validation = $spreadsheet->getActiveSheet() - ->getCell('B3') - ->getDataValidation(); -$validation->setType(DataValidation::TYPE_LIST) - ->setErrorStyle(DataValidation::STYLE_INFORMATION) - ->setAllowBlank(false) - ->setShowInputMessage(true) - ->setShowErrorMessage(true) - ->setShowDropDown(true) - ->setErrorTitle('Input error') - ->setError('Country is not in the list.') - ->setPromptTitle('Pick from the list') - ->setPrompt('Please pick a country from the drop-down list.') - ->setFormula1('=INDIRECT($B$1)'); - -$spreadsheet->getActiveSheet()->getColumnDimension('A')->setWidth(12); -$spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(30); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/40_Duplicate_style.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/40_Duplicate_style.php deleted file mode 100644 index 0366703d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/40_Duplicate_style.php +++ /dev/null @@ -1,36 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -$helper->log('Create styles array'); -$styles = []; -for ($i = 0; $i < 10; ++$i) { - $style = new Style(); - $style->getFont()->setSize($i + 4); - $styles[] = $style; -} - -$helper->log('Add data (begin)'); -$t = microtime(true); -for ($col = 1; $col <= 50; ++$col) { - for ($row = 0; $row < 100; ++$row) { - $str = ($row + $col); - $style = $styles[$row % 10]; - $coord = Coordinate::stringFromColumnIndex($col) . ($row + 1); - $worksheet->setCellValue($coord, $str); - $worksheet->duplicateStyle($style, $coord); - } -} -$d = microtime(true) - $t; -$helper->log('Add data (end) . time: ' . round((string) ($d . 2)) . ' s'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/41_Password.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/41_Password.php deleted file mode 100644 index 9aa8e6db..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/41_Password.php +++ /dev/null @@ -1,12 +0,0 @@ -getSecurity()->setLockWindows(true); -$spreadsheet->getSecurity()->setLockStructure(true); -$spreadsheet->getSecurity()->setWorkbookPassword('secret'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/42_RichText.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/42_RichText.php deleted file mode 100644 index 43b35a62..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/42_RichText.php +++ /dev/null @@ -1,98 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); - -$html1 = ' -

My very first example of rich text
generated from html markup

-

- -This block contains an italicized word; -while this block uses an underline. - -

-

-I want to eat healthy food pizza. - -'; - -$html2 = '

- - 100°C is a hot temperature - -
- - 10°F is cold - -

'; - -$html3 = '23 equals 8'; - -$html4 = 'H2SO4 is the chemical formula for Sulphuric acid'; - -$html5 = 'bold, italic, bold+italic'; - -$wizard = new HtmlHelper(); -$richText = $wizard->toRichTextObject($html1); - -$spreadsheet->getActiveSheet() - ->setCellValue('A1', $richText); - -$spreadsheet->getActiveSheet() - ->getColumnDimension('A') - ->setWidth(48); -$spreadsheet->getActiveSheet() - ->getRowDimension(1) - ->setRowHeight(-1); -$spreadsheet->getActiveSheet()->getStyle('A1') - ->getAlignment() - ->setWrapText(true); - -$richText = $wizard->toRichTextObject($html2); - -$spreadsheet->getActiveSheet() - ->setCellValue('A2', $richText); - -$spreadsheet->getActiveSheet() - ->getRowDimension(1) - ->setRowHeight(-1); -$spreadsheet->getActiveSheet() - ->getStyle('A2') - ->getAlignment() - ->setWrapText(true); - -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A3', $wizard->toRichTextObject($html3)); - -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', $wizard->toRichTextObject($html4)); - -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A5', $wizard->toRichTextObject($html5)); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet() - ->setTitle('Rich Text Examples'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/43_Merge_workbooks.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/43_Merge_workbooks.php deleted file mode 100644 index 86314b3b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/43_Merge_workbooks.php +++ /dev/null @@ -1,26 +0,0 @@ -log('Load MergeBook1 from Xlsx file'); -$filename1 = __DIR__ . '/../templates/43mergeBook1.xlsx'; -$callStartTime = microtime(true); -$spreadsheet1 = IOFactory::load($filename1); -$helper->logRead('Xlsx', $filename1, $callStartTime); - -$helper->log('Load MergeBook2 from Xlsx file'); -$filename2 = __DIR__ . '/../templates/43mergeBook2.xlsx'; -$callStartTime = microtime(true); -$spreadsheet2 = IOFactory::load($filename2); -$helper->logRead('Xlsx', $filename2, $callStartTime); - -foreach ($spreadsheet2->getSheetNames() as $sheetName) { - $sheet = $spreadsheet2->getSheetByName($sheetName); - $sheet->setTitle($sheet->getTitle() . ' copied'); - $spreadsheet1->addExternalSheet($sheet); -} - -// Save -$helper->write($spreadsheet1, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/44_Worksheet_info.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/44_Worksheet_info.php deleted file mode 100644 index 33c0cd05..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/44_Worksheet_info.php +++ /dev/null @@ -1,26 +0,0 @@ -getTemporaryFilename(); -$writer = new Xlsx($sampleSpreadsheet); -$writer->save($filename); - -$inputFileType = IOFactory::identify($filename); -$reader = IOFactory::createReader($inputFileType); -$sheetList = $reader->listWorksheetNames($filename); -$sheetInfo = $reader->listWorksheetInfo($filename); - -$helper->log('File Type:'); -var_dump($inputFileType); - -$helper->log('Worksheet Names:'); -var_dump($sheetList); - -$helper->log('Worksheet Names:'); -var_dump($sheetInfo); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/45_Quadratic_equation_solver.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/45_Quadratic_equation_solver.php deleted file mode 100644 index a59a0ceb..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/45_Quadratic_equation_solver.php +++ /dev/null @@ -1,43 +0,0 @@ - -
- Enter the coefficients for the Ax2 + Bx + C = 0 - - - - - - - - - - -
-
- If A=0, the equation is not quadratic. -
- -log('The equation is not quadratic'); - } else { - // Calculate and Display the results - $helper->log('
Roots:
'); - - $discriminantFormula = '=POWER(' . $_POST['B'] . ',2) - (4 * ' . $_POST['A'] . ' * ' . $_POST['C'] . ')'; - $discriminant = Calculation::getInstance()->calculateFormula($discriminantFormula); - - $r1Formula = '=IMDIV(IMSUM(-' . $_POST['B'] . ',IMSQRT(' . $discriminant . ')),2 * ' . $_POST['A'] . ')'; - $r2Formula = '=IF(' . $discriminant . '=0,"Only one root",IMDIV(IMSUB(-' . $_POST['B'] . ',IMSQRT(' . $discriminant . ')),2 * ' . $_POST['A'] . '))'; - - $helper->log(Calculation::getInstance()->calculateFormula($r1Formula)); - $helper->log(Calculation::getInstance()->calculateFormula($r2Formula)); - $callEndTime = microtime(true); - $helper->logEndingNotes(); - } -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/46_ReadHtml.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/46_ReadHtml.php deleted file mode 100644 index bd37af9b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/46_ReadHtml.php +++ /dev/null @@ -1,19 +0,0 @@ -load($html); - -$helper->logRead('Html', $html, $callStartTime); - -// Save -$helper->write($objPHPExcel, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Africa.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Africa.txt deleted file mode 100644 index 407fa769..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Africa.txt +++ /dev/null @@ -1,54 +0,0 @@ -Algeria -Angola -Benin -Botswana -Burkina -Burundi -Cameroon -Cape Verde -Central African Republic -Chad -Comoros -Congo -Congo, Democratic Republic of -Djibouti -Egypt -Equatorial Guinea -Eritrea -Ethiopia -Gabon -Gambia -Ghana -Guinea -Guinea-Bissau -Ivory Coast -Kenya -Lesotho -Liberia -Libya -Madagascar -Malawi -Mali -Mauritania -Mauritius -Morocco -Mozambique -Namibia -Niger -Nigeria -Rwanda -Sao Tome and Principe -Senegal -Seychelles -Sierra Leone -Somalia -South Africa -South Sudan -Sudan -Swaziland -Tanzania -Togo -Tunisia -Uganda -Zambia -Zimbabwe diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Asia.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Asia.txt deleted file mode 100644 index 9ce006c5..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Asia.txt +++ /dev/null @@ -1,44 +0,0 @@ -Afghanistan -Bahrain -Bangladesh -Bhutan -Brunei -Burma (Myanmar) -Cambodia -China -East Timor -India -Indonesia -Iran -Iraq -Israel -Japan -Jordan -Kazakhstan -Korea, North -Korea, South -Kuwait -Kyrgyzstan -Laos -Lebanon -Malaysia -Maldives -Mongolia -Nepal -Oman -Pakistan -Philippines -Qatar -Russian Federation -Saudi Arabia -Singapore -Sri Lanka -Syria -Tajikistan -Thailand -Turkey -Turkmenistan -United Arab Emirates -Uzbekistan -Vietnam -Yemen diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Europe.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Europe.txt deleted file mode 100644 index 70c11607..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Europe.txt +++ /dev/null @@ -1,47 +0,0 @@ -Albania -Andorra -Armenia -Austria -Azerbaijan -Belarus -Belgium -Bosnia and Herzegovina -Bulgaria -Croatia -Cyprus -Czech Republic -Denmark -Estonia -Finland -France -Georgia -Germany -Greece -Hungary -Iceland -Ireland -Italy -Latvia -Liechtenstein -Lithuania -Luxembourg -Macedonia -Malta -Moldova -Monaco -Montenegro -Netherlands -Norway -Poland -Portugal -Romania -San Marino -Serbia -Slovakia -Slovenia -Spain -Sweden -Switzerland -Ukraine -United Kingdom -Vatican City diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/North America.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/North America.txt deleted file mode 100644 index 5881ae13..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/North America.txt +++ /dev/null @@ -1,23 +0,0 @@ -Antigua and Barbuda -Bahamas -Barbados -Belize -Canada -Costa Rica -Cuba -Dominica -Dominican Republic -El Salvador -Grenada -Guatemala -Haiti -Honduras -Jamaica -Mexico -Nicaragua -Panama -Saint Kitts and Nevis -Saint Lucia -Saint Vincent and the Grenadines -Trinidad and Tobago -United States diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Oceania.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Oceania.txt deleted file mode 100644 index cbdc896c..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Oceania.txt +++ /dev/null @@ -1,14 +0,0 @@ -Australia -Fiji -Kiribati -Marshall Islands -Micronesia -Nauru -New Zealand -Palau -Papua New Guinea -Samoa -Solomon Islands -Tonga -Tuvalu -Vanuatu diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/South America.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/South America.txt deleted file mode 100644 index 777ffbfb..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/South America.txt +++ /dev/null @@ -1,12 +0,0 @@ -Argentina -Bolivia -Brazil -Chile -Colombia -Ecuador -Guyana -Paraguay -Peru -Suriname -Uruguay -Venezuela diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DAVERAGE.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DAVERAGE.php deleted file mode 100644 index 92d84014..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DAVERAGE.php +++ /dev/null @@ -1,56 +0,0 @@ -log('Returns the average of selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The Average yield of Apple trees over 10\' in height'); -$worksheet->setCellValue('B12', '=DAVERAGE(A4:E10,"Yield",A1:B2)'); - -$worksheet->setCellValue('A13', 'The Average age of all Apple and Pear trees in the orchard'); -$worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DAVERAGE() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DAVERAGE() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DCOUNT.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DCOUNT.php deleted file mode 100644 index d869a4bc..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DCOUNT.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Counts the cells that contain numbers in a database.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The Number of Apple trees over 10\' in height'); -$worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)'); - -$worksheet->setCellValue('A13', 'The Number of Apple and Pear trees in the orchard'); -$worksheet->setCellValue('B13', '=DCOUNT(A4:E10,3,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DCOUNT() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DCOUNT() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DGET.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DGET.php deleted file mode 100644 index 9f543c91..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DGET.php +++ /dev/null @@ -1,52 +0,0 @@ -log('Extracts a single value from a column of a list or database that matches conditions that you specify.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall'); -$worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$helper->log('ALL'); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMAX.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMAX.php deleted file mode 100644 index c48928d4..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMAX.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Returns the maximum value from selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The tallest tree in the orchard'); -$worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)'); - -$worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard'); -$worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$helper->log('ALL'); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMIN.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMIN.php deleted file mode 100644 index 7bcaa206..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMIN.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Returns the minimum value from selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The shortest tree in the orchard'); -$worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)'); - -$worksheet->setCellValue('A13', 'The Youngest apple tree in the orchard'); -$worksheet->setCellValue('B13', '=DMIN(A4:E10,3,A1:A2)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$helper->log('ALL'); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DMIN() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DMIN() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DPRODUCT.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DPRODUCT.php deleted file mode 100644 index 7c14ded6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DPRODUCT.php +++ /dev/null @@ -1,52 +0,0 @@ -log('Multiplies the values in a column of a list or database that match conditions that you specify.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The product of the yields of all Apple trees over 10\' in the orchard'); -$worksheet->setCellValue('B12', '=DPRODUCT(A4:E10,"Yield",A1:B2)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$helper->log('ALL'); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEV.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEV.php deleted file mode 100644 index 7f09fa59..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEV.php +++ /dev/null @@ -1,56 +0,0 @@ -log('Estimates the standard deviation based on a sample of selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The estimated standard deviation in the yield of Apple and Pear trees'); -$worksheet->setCellValue('B12', '=DSTDEV(A4:E10,"Yield",A1:A3)'); - -$worksheet->setCellValue('A13', 'The estimated standard deviation in height of Apple and Pear trees'); -$worksheet->setCellValue('B13', '=DSTDEV(A4:E10,2,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DSTDEV() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DSTDEV() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEVP.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEVP.php deleted file mode 100644 index 9e999a80..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEVP.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Calculates the standard deviation based on the entire population of selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The standard deviation in the yield of Apple and Pear trees'); -$worksheet->setCellValue('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)'); - -$worksheet->setCellValue('A13', 'The standard deviation in height of Apple and Pear trees'); -$worksheet->setCellValue('B13', '=DSTDEVP(A4:E10,2,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DSTDEVP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DSTDEVP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVAR.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVAR.php deleted file mode 100644 index 2a5f8749..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVAR.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Estimates variance based on a sample from selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The estimated variance in the yield of Apple and Pear trees'); -$worksheet->setCellValue('B12', '=DVAR(A4:E10,"Yield",A1:A3)'); - -$worksheet->setCellValue('A13', 'The estimated variance in height of Apple and Pear trees'); -$worksheet->setCellValue('B13', '=DVAR(A4:E10,2,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DVAR() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DVAR() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVARP.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVARP.php deleted file mode 100644 index 4f57113b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVARP.php +++ /dev/null @@ -1,56 +0,0 @@ -log('Calculates variance based on the entire population of selected database entries,'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The variance in the yield of Apple and Pear trees'); -$worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)'); - -$worksheet->setCellValue('A13', 'The variance in height of Apple and Pear trees'); -$worksheet->setCellValue('B13', '=DVARP(A4:E10,2,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DVARP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DVARP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATE.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATE.php deleted file mode 100644 index 5d758f76..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATE.php +++ /dev/null @@ -1,41 +0,0 @@ -log('Returns the serial number of a particular date.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$testDates = [[2012, 3, 26], [2012, 2, 29], [2012, 4, 1], [2012, 12, 25], - [2012, 10, 31], [2012, 11, 5], [2012, 1, 1], [2012, 3, 17], - [2011, 2, 29], [7, 5, 3], [2012, 13, 1], [2012, 11, 45], - [2012, 0, 0], [2012, 1, 0], [2012, 0, 1], - [2012, -2, 2], [2012, 2, -2], [2012, -2, -2], -]; -$testDateCount = count($testDates); - -$worksheet->fromArray($testDates, null, 'A1', true); - -for ($row = 1; $row <= $testDateCount; ++$row) { - $worksheet->setCellValue('D' . $row, '=DATE(A' . $row . ',B' . $row . ',C' . $row . ')'); - $worksheet->setCellValue('E' . $row, '=D' . $row); -} -$worksheet->getStyle('E1:E' . $testDateCount) - ->getNumberFormat() - ->setFormatCode('yyyy-mmm-dd'); - -// Test the formulae -for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log('Year: ' . $worksheet->getCell('A' . $row)->getFormattedValue()); - $helper->log('Month: ' . $worksheet->getCell('B' . $row)->getFormattedValue()); - $helper->log('Day: ' . $worksheet->getCell('C' . $row)->getFormattedValue()); - $helper->log('Formula: ' . $worksheet->getCell('D' . $row)->getValue()); - $helper->log('Excel DateStamp: ' . $worksheet->getCell('D' . $row)->getFormattedValue()); - $helper->log('Formatted DateStamp: ' . $worksheet->getCell('E' . $row)->getFormattedValue()); - $helper->log(''); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATEVALUE.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATEVALUE.php deleted file mode 100644 index 5cdb936d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATEVALUE.php +++ /dev/null @@ -1,39 +0,0 @@ -log('Converts a date in the form of text to a serial number.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$testDates = ['26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012', - '2012-Oct-31', '5th November', 'January 1st', 'April 2012', - '17-03', '03-2012', '29 Feb 2011', '03-05-07', - '03-MAY-07', '03-13-07', -]; -$testDateCount = count($testDates); - -for ($row = 1; $row <= $testDateCount; ++$row) { - $worksheet->setCellValue('A' . $row, $testDates[$row - 1]); - $worksheet->setCellValue('B' . $row, '=DATEVALUE(A' . $row . ')'); - $worksheet->setCellValue('C' . $row, '=B' . $row); -} - -$worksheet->getStyle('C1:C' . $testDateCount) - ->getNumberFormat() - ->setFormatCode('yyyy-mmm-dd'); - -// Test the formulae -$helper->log('Warning: The PhpSpreadsheet DATEVALUE() function accepts a wider range of date formats than MS Excel DATEFORMAT() function.'); -for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log('Date String: ' . $worksheet->getCell('A' . $row)->getFormattedValue()); - $helper->log('Formula: ' . $worksheet->getCell('B' . $row)->getValue()); - $helper->log('Excel DateStamp: ' . $worksheet->getCell('B' . $row)->getFormattedValue()); - $helper->log('Formatted DateStamp' . $worksheet->getCell('C' . $row)->getFormattedValue()); - $helper->log(''); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIME.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIME.php deleted file mode 100644 index 3d4208ad..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIME.php +++ /dev/null @@ -1,39 +0,0 @@ -log('Returns the serial number of a particular time.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$testDates = [[3, 15], [13, 15], [15, 15, 15], [3, 15, 30], - [15, 15, 15], [5], [9, 15, 0], [9, 15, -1], - [13, -14, -15], [0, 0, -1], -]; -$testDateCount = count($testDates); - -$worksheet->fromArray($testDates, null, 'A1', true); - -for ($row = 1; $row <= $testDateCount; ++$row) { - $worksheet->setCellValue('D' . $row, '=TIME(A' . $row . ',B' . $row . ',C' . $row . ')'); - $worksheet->setCellValue('E' . $row, '=D' . $row); -} -$worksheet->getStyle('E1:E' . $testDateCount) - ->getNumberFormat() - ->setFormatCode('hh:mm:ss'); - -// Test the formulae -for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log('Hour: ' . $worksheet->getCell('A' . $row)->getFormattedValue()); - $helper->log('Minute: ' . $worksheet->getCell('B' . $row)->getFormattedValue()); - $helper->log('Second: ' . $worksheet->getCell('C' . $row)->getFormattedValue()); - $helper->log('Formula: ' . $worksheet->getCell('D' . $row)->getValue()); - $helper->log('Excel TimeStamp: ' . $worksheet->getCell('D' . $row)->getFormattedValue()); - $helper->log('Formatted TimeStamp: ' . $worksheet->getCell('E' . $row)->getFormattedValue()); - $helper->log(''); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIMEVALUE.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIMEVALUE.php deleted file mode 100644 index f75393cd..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIMEVALUE.php +++ /dev/null @@ -1,35 +0,0 @@ -log('Converts a time in the form of text to a serial number.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$testDates = ['3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM', -]; -$testDateCount = count($testDates); - -for ($row = 1; $row <= $testDateCount; ++$row) { - $worksheet->setCellValue('A' . $row, $testDates[$row - 1]); - $worksheet->setCellValue('B' . $row, '=TIMEVALUE(A' . $row . ')'); - $worksheet->setCellValue('C' . $row, '=B' . $row); -} - -$worksheet->getStyle('C1:C' . $testDateCount) - ->getNumberFormat() - ->setFormatCode('hh:mm:ss'); - -// Test the formulae -for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log('Time String: ' . $worksheet->getCell('A' . $row)->getFormattedValue()); - $helper->log('Formula: ' . $worksheet->getCell('B' . $row)->getValue()); - $helper->log('Excel TimeStamp: ' . $worksheet->getCell('B' . $row)->getFormattedValue()); - $helper->log('Formatted TimeStamp: ' . $worksheet->getCell('C' . $row)->getFormattedValue()); - $helper->log(''); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write.php deleted file mode 100644 index ba711c06..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write.php +++ /dev/null @@ -1,83 +0,0 @@ - 1)) { - $inputFileNames = []; - for ($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = __DIR__ . '/../templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach ($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - $helper->log('File ' . $inputFileNameShort . ' does not exist'); - - continue; - } - $reader = IOFactory::createReader($inputFileType); - $reader->setIncludeCharts(true); - $callStartTime = microtime(true); - $spreadsheet = $reader->load($inputFileName); - $helper->logRead($inputFileType, $inputFileName, $callStartTime); - - $helper->log('Iterate worksheets looking at the charts'); - foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - $helper->log('Worksheet: ' . $sheetName); - - $chartNames = $worksheet->getChartNames(); - if (empty($chartNames)) { - $helper->log(' There are no charts in this worksheet'); - } else { - natsort($chartNames); - foreach ($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if ($chart->getTitle() !== null) { - $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - $helper->log(' ' . $chartName . ' - ' . $caption); - $indentation = str_repeat(' ', strlen($chartName) + 3); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - $helper->log($indentation . ' ' . $chartType); - } else { - $chartTypes = []; - for ($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - $helper->log($indentation . ' ' . $chartType); - } elseif (count($chartTypes) == 0) { - $helper->log($indentation . ' *** Type not yet implemented'); - } else { - $helper->log($indentation . ' Combination Chart'); - } - } - } - } - } - - $outputFileName = $helper->getFilename($inputFileName); - $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); - $writer->setIncludeCharts(true); - $callStartTime = microtime(true); - $writer->save($outputFileName); - $helper->logWrite($writer, $outputFileName, $callStartTime); - - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_HTML.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_HTML.php deleted file mode 100644 index 5febbf93..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_HTML.php +++ /dev/null @@ -1,89 +0,0 @@ - 1)) { - $inputFileNames = []; - for ($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = __DIR__ . '/../templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach ($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - $helper->log('File ' . $inputFileNameShort . ' does not exist'); - - continue; - } - - $helper->log("Load Test from $inputFileType file " . $inputFileNameShort); - - $reader = IOFactory::createReader($inputFileType); - $reader->setIncludeCharts(true); - $spreadsheet = $reader->load($inputFileName); - - $helper->log('Iterate worksheets looking at the charts'); - foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - $helper->log('Worksheet: ' . $sheetName); - - $chartNames = $worksheet->getChartNames(); - if (empty($chartNames)) { - $helper->log(' There are no charts in this worksheet'); - } else { - natsort($chartNames); - foreach ($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if ($chart->getTitle() !== null) { - $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - $helper->log(' ' . $chartName . ' - ' . $caption); - $helper->log(str_repeat(' ', strlen($chartName) + 3)); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - $helper->log(' ' . $chartType); - } else { - $chartTypes = []; - for ($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - $helper->log(' ' . $chartType); - } elseif (count($chartTypes) == 0) { - $helper->log(' *** Type not yet implemented'); - } else { - $helper->log(' Combination Chart'); - } - } - } - } - } - - // Save - $filename = $helper->getFilename($inputFileName, 'html'); - $writer = IOFactory::createWriter($spreadsheet, 'Html'); - $writer->setIncludeCharts(true); - $callStartTime = microtime(true); - $writer->save($filename); - $helper->logWrite($writer, $filename, $callStartTime); - - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_PDF.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_PDF.php deleted file mode 100644 index ee3ad0e0..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_PDF.php +++ /dev/null @@ -1,91 +0,0 @@ - 1)) { - $inputFileNames = []; - for ($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = __DIR__ . '/../templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach ($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - $helper->log('File ' . $inputFileNameShort . ' does not exist'); - - continue; - } - - $helper->log("Load Test from $inputFileType file " . $inputFileNameShort); - - $reader = IOFactory::createReader($inputFileType); - $reader->setIncludeCharts(true); - $spreadsheet = $reader->load($inputFileName); - - $helper->log('Iterate worksheets looking at the charts'); - foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - $helper->log('Worksheet: ' . $sheetName); - - $chartNames = $worksheet->getChartNames(); - if (empty($chartNames)) { - $helper->log(' There are no charts in this worksheet'); - } else { - natsort($chartNames); - foreach ($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if ($chart->getTitle() !== null) { - $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - $helper->log(' ' . $chartName . ' - ' . $caption); - $helper->log(str_repeat(' ', strlen($chartName) + 3)); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - $helper->log(' ' . $chartType); - } else { - $chartTypes = []; - for ($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - $helper->log(' ' . $chartType); - } elseif (count($chartTypes) == 0) { - $helper->log(' *** Type not yet implemented'); - } else { - $helper->log(' Combination Chart'); - } - } - } - } - } - - // Save - $filename = $helper->getFilename($inputFileName, 'pdf'); - $writer = IOFactory::createWriter($spreadsheet, 'Pdf'); - $writer->setIncludeCharts(true); - $callStartTime = microtime(true); - $writer->save($filename); - $helper->logWrite($writer, $filename, $callStartTime); - - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_area.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_area.php deleted file mode 100644 index 4478d2dd..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_area.php +++ /dev/null @@ -1,104 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_AREACHART, // plotType - DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false); - -$title = new Title('Test %age-Stacked Area Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar.php deleted file mode 100644 index a05cf927..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar.php +++ /dev/null @@ -1,15 +0,0 @@ -getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar_stacked.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar_stacked.php deleted file mode 100644 index 7ba4d8de..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar_stacked.php +++ /dev/null @@ -1,107 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_STACKED, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a horizontal bar rather than a vertical column graph -$series->setPlotDirection(DataSeries::DIRECTION_BAR); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Test Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column.php deleted file mode 100644 index 9ffe9d3f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column.php +++ /dev/null @@ -1,107 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series->setPlotDirection(DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Test Column Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column_2.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column_2.php deleted file mode 100644 index bba9210a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column_2.php +++ /dev/null @@ -1,116 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', '', 'Budget', 'Forecast', 'Actual'], - ['2010', 'Q1', 47, 44, 43], - ['', 'Q2', 56, 53, 50], - ['', 'Q3', 52, 46, 45], - ['', 'Q4', 45, 40, 40], - ['2011', 'Q1', 51, 42, 46], - ['', 'Q2', 53, 58, 56], - ['', 'Q3', 64, 66, 69], - ['', 'Q4', 54, 55, 56], - ['2012', 'Q1', 49, 52, 58], - ['', 'Q2', 68, 73, 86], - ['', 'Q3', 72, 78, 0], - ['', 'Q4', 50, 60, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 'Budget' - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 'Forecast' - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$E$1', null, 1), // 'Actual' -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$B$13', null, 12), // Q1 to Q4 for 2010 to 2012 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$E$2:$E$13', null, 12), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_CLUSTERED, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series->setPlotDirection(DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_BOTTOM, null, false); - -$title = new Title('Test Grouped Column Chart'); -$xAxisLabel = new Title('Financial Period'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - $xAxisLabel, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('G2'); -$chart->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_composite.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_composite.php deleted file mode 100644 index 83dc34a9..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_composite.php +++ /dev/null @@ -1,160 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 'Rainfall (mm)', 'Temperature (°F)', 'Humidity (%)'], - ['Jan', 78, 52, 61], - ['Feb', 64, 54, 62], - ['Mar', 62, 57, 63], - ['Apr', 21, 62, 59], - ['May', 11, 75, 60], - ['Jun', 1, 75, 57], - ['Jul', 1, 79, 56], - ['Aug', 1, 79, 59], - ['Sep', 10, 75, 60], - ['Oct', 40, 68, 63], - ['Nov', 69, 62, 64], - ['Dec', 89, 57, 66], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // Temperature -]; -$dataSeriesLabels2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // Rainfall -]; -$dataSeriesLabels3 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // Humidity -]; - -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec -]; - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$13', null, 12), -]; - -// Build the dataseries -$series1 = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_CLUSTERED, // plotGrouping - range(0, count($dataSeriesValues1) - 1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues1 // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series1->setPlotDirection(DataSeries::DIRECTION_COL); - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12), -]; - -// Build the dataseries -$series2 = new DataSeries( - DataSeries::TYPE_LINECHART, // plotType - DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels2, // plotLabel - [], // plotCategory - $dataSeriesValues2 // plotValues -); - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues3 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12), -]; - -// Build the dataseries -$series3 = new DataSeries( - DataSeries::TYPE_AREACHART, // plotType - DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels3, // plotLabel - [], // plotCategory - $dataSeriesValues3 // plotValues -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series1, $series2, $series3]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Average Weather Chart for Crete'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('F2'); -$chart->setBottomRightPosition('O16'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_line.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_line.php deleted file mode 100644 index bdaf0111..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_line.php +++ /dev/null @@ -1,105 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; -$dataSeriesValues[2]->setLineWidth(60000); - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_LINECHART, // plotType - DataSeries::GROUPING_STACKED, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false); - -$title = new Title('Test Stacked Line Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_multiple_charts.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_multiple_charts.php deleted file mode 100644 index 10a11e13..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_multiple_charts.php +++ /dev/null @@ -1,179 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series1 = new DataSeries( - DataSeries::TYPE_AREACHART, // plotType - DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping - range(0, count($dataSeriesValues1) - 1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues1, // plotCategory - $dataSeriesValues1 // plotValues -); - -// Set the series in the plot area -$plotArea1 = new PlotArea(null, [$series1]); -// Set the chart legend -$legend1 = new Legend(Legend::POSITION_TOPRIGHT, null, false); - -$title1 = new Title('Test %age-Stacked Area Chart'); -$yAxisLabel1 = new Title('Value ($k)'); - -// Create the chart -$chart1 = new Chart( - 'chart1', // name - $title1, // title - $legend1, // legend - $plotArea1, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel1 // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart1->setTopLeftPosition('A7'); -$chart1->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart1); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series2 = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels2, // plotLabel - $xAxisTickValues2, // plotCategory - $dataSeriesValues2 // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series2->setPlotDirection(DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea2 = new PlotArea(null, [$series2]); -// Set the chart legend -$legend2 = new Legend(Legend::POSITION_RIGHT, null, false); - -$title2 = new Title('Test Column Chart'); -$yAxisLabel2 = new Title('Value ($k)'); - -// Create the chart -$chart2 = new Chart( - 'chart2', // name - $title2, // title - $legend2, // legend - $plotArea2, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel2 // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart2->setTopLeftPosition('I7'); -$chart2->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart2); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie.php deleted file mode 100644 index d4ec0752..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie.php +++ /dev/null @@ -1,175 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), -]; - -// Build the dataseries -$series1 = new DataSeries( - DataSeries::TYPE_PIECHART, // plotType - null, // plotGrouping (Pie charts don't have any grouping) - range(0, count($dataSeriesValues1) - 1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues1, // plotCategory - $dataSeriesValues1 // plotValues -); - -// Set up a layout object for the Pie chart -$layout1 = new Layout(); -$layout1->setShowVal(true); -$layout1->setShowPercent(true); - -// Set the series in the plot area -$plotArea1 = new PlotArea($layout1, [$series1]); -// Set the chart legend -$legend1 = new Legend(Legend::POSITION_RIGHT, null, false); - -$title1 = new Title('Test Pie Chart'); - -// Create the chart -$chart1 = new Chart( - 'chart1', // name - $title1, // title - $legend1, // legend - $plotArea1, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel - Pie charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart1->setTopLeftPosition('A7'); -$chart1->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart1); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), -]; - -// Build the dataseries -$series2 = new DataSeries( - DataSeries::TYPE_DONUTCHART, // plotType - null, // plotGrouping (Donut charts don't have any grouping) - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels2, // plotLabel - $xAxisTickValues2, // plotCategory - $dataSeriesValues2 // plotValues -); - -// Set up a layout object for the Pie chart -$layout2 = new Layout(); -$layout2->setShowVal(true); -$layout2->setShowCatName(true); - -// Set the series in the plot area -$plotArea2 = new PlotArea($layout2, [$series2]); - -$title2 = new Title('Test Donut Chart'); - -// Create the chart -$chart2 = new Chart( - 'chart2', // name - $title2, // title - null, // legend - $plotArea2, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel - Like Pie charts, Donut charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart2->setTopLeftPosition('I7'); -$chart2->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart2); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie_custom_colors.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie_custom_colors.php deleted file mode 100644 index 727a0cde..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie_custom_colors.php +++ /dev/null @@ -1,183 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Custom colors for dataSeries (gray, blue, red, orange) -$colors = [ - 'cccccc', '00abb8', 'b8292f', 'eb8500', -]; - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -// Custom colors -$dataSeriesValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4, [], null, $colors), -]; - -// Build the dataseries -$series1 = new DataSeries( - DataSeries::TYPE_PIECHART, // plotType - null, // plotGrouping (Pie charts don't have any grouping) - range(0, count($dataSeriesValues1) - 1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues1, // plotCategory - $dataSeriesValues1 // plotValues -); - -// Set up a layout object for the Pie chart -$layout1 = new Layout(); -$layout1->setShowVal(true); -$layout1->setShowPercent(true); - -// Set the series in the plot area -$plotArea1 = new PlotArea($layout1, [$series1]); -// Set the chart legend -$legend1 = new Legend(Legend::POSITION_RIGHT, null, false); - -$title1 = new Title('Test Pie Chart'); - -// Create the chart -$chart1 = new Chart( - 'chart1', // name - $title1, // title - $legend1, // legend - $plotArea1, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel - Pie charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart1->setTopLeftPosition('A7'); -$chart1->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart1); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -// Custom colors -$dataSeriesValues2 = [ - $dataSeriesValues2Element = new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), -]; -$dataSeriesValues2Element->setFillColor($colors); - -// Build the dataseries -$series2 = new DataSeries( - DataSeries::TYPE_DONUTCHART, // plotType - null, // plotGrouping (Donut charts don't have any grouping) - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels2, // plotLabel - $xAxisTickValues2, // plotCategory - $dataSeriesValues2 // plotValues -); - -// Set up a layout object for the Pie chart -$layout2 = new Layout(); -$layout2->setShowVal(true); -$layout2->setShowCatName(true); - -// Set the series in the plot area -$plotArea2 = new PlotArea($layout2, [$series2]); - -$title2 = new Title('Test Donut Chart'); - -// Create the chart -$chart2 = new Chart( - 'chart2', // name - $title2, // title - null, // legend - $plotArea2, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel - Like Pie charts, Donut charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart2->setTopLeftPosition('I7'); -$chart2->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart2); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_radar.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_radar.php deleted file mode 100644 index e57914ab..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_radar.php +++ /dev/null @@ -1,117 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Jan', 47, 45, 71], - ['Feb', 56, 73, 86], - ['Mar', 52, 61, 69], - ['Apr', 40, 52, 60], - ['May', 42, 55, 71], - ['Jun', 58, 63, 76], - ['Jul', 53, 61, 89], - ['Aug', 46, 69, 85], - ['Sep', 62, 75, 81], - ['Oct', 51, 70, 96], - ['Nov', 55, 66, 89], - ['Dec', 68, 62, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_RADARCHART, // plotType - null, // plotGrouping (Radar charts don't have any grouping) - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues, // plotValues - null, // plotDirection - null, // smooth line - DataSeries::STYLE_MARKER // plotStyle -); - -// Set up a layout object for the Pie chart -$layout = new Layout(); - -// Set the series in the plot area -$plotArea = new PlotArea($layout, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Test Radar Chart'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel - Radar charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('F2'); -$chart->setBottomRightPosition('M15'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_scatter.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_scatter.php deleted file mode 100644 index 12fc2bdc..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_scatter.php +++ /dev/null @@ -1,101 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_SCATTERCHART, // plotType - null, // plotGrouping (Scatter charts don't have any grouping) - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues, // plotValues - null, // plotDirection - null, // smooth line - DataSeries::STYLE_LINEMARKER // plotStyle -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false); - -$title = new Title('Test Scatter Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_stock.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_stock.php deleted file mode 100644 index 7a9f7274..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_stock.php +++ /dev/null @@ -1,113 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['Counts', 'Max', 'Min', 'Min Threshold', 'Max Threshold'], - [10, 10, 5, 0, 50], - [30, 20, 10, 0, 50], - [20, 30, 15, 0, 50], - [40, 10, 0, 0, 50], - [100, 40, 5, 0, 50], - ], - null, - 'A1', - true -); -$worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER_00); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), //Max / Open - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), //Min / Close - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), //Min Threshold / Min - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$E$1', null, 1), //Max Threshold / Max -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$6', null, 5), // Counts -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$6', null, 5), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$6', null, 5), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$6', null, 5), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$E$2:$E$6', null, 5), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_STOCKCHART, // plotType - null, // plotGrouping - if we set this to not null, then xlsx throws error - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Test Stock Chart'); -$xAxisLabel = new Title('Counts'); -$yAxisLabel = new Title('Values'); - -// Create the chart -$chart = new Chart( - 'stock-chart', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - $xAxisLabel, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/34_Chart_update.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/34_Chart_update.php deleted file mode 100644 index 638d2e0a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/34_Chart_update.php +++ /dev/null @@ -1,38 +0,0 @@ -getTemporaryFilename(); -$writer = new Xlsx($sampleSpreadsheet); -$writer->save($filename); - -$helper->log('Load from Xlsx file'); -$reader = IOFactory::createReader('Xlsx'); -$reader->setIncludeCharts(true); -$spreadsheet = $reader->load($filename); - -$helper->log('Update cell data values that are displayed in the chart'); -$worksheet = $spreadsheet->getActiveSheet(); -$worksheet->fromArray( - [ - [50 - 12, 50 - 15, 50 - 21], - [50 - 56, 50 - 73, 50 - 86], - [50 - 52, 50 - 61, 50 - 69], - [50 - 30, 50 - 32, 50], - ], - null, - 'B2' -); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/35_Chart_render.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/35_Chart_render.php deleted file mode 100644 index 9638c679..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/35_Chart_render.php +++ /dev/null @@ -1,75 +0,0 @@ - 1)) { - $inputFileNames = []; - for ($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = __DIR__ . '/../templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach ($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - $helper->log('File ' . $inputFileNameShort . ' does not exist'); - - continue; - } - - $helper->log("Load Test from $inputFileType file " . $inputFileNameShort); - - $reader = IOFactory::createReader($inputFileType); - $reader->setIncludeCharts(true); - $spreadsheet = $reader->load($inputFileName); - - $helper->log('Iterate worksheets looking at the charts'); - foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - $helper->log('Worksheet: ' . $sheetName); - - $chartNames = $worksheet->getChartNames(); - if (empty($chartNames)) { - $helper->log(' There are no charts in this worksheet'); - } else { - natsort($chartNames); - foreach ($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if ($chart->getTitle() !== null) { - $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - $helper->log(' ' . $chartName . ' - ' . $caption); - - $jpegFile = $helper->getFilename('35-' . $inputFileNameShort, 'png'); - if (file_exists($jpegFile)) { - unlink($jpegFile); - } - - try { - $chart->render($jpegFile); - $helper->log('Rendered image: ' . $jpegFile); - } catch (Exception $e) { - $helper->log('Error rendering chart: ' . $e->getMessage()); - } - } - } - } - - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); -} - -$helper->log('Done rendering charts as images'); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Header.php b/vendor/phpoffice/phpspreadsheet/samples/Header.php deleted file mode 100644 index fb8bd986..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Header.php +++ /dev/null @@ -1,64 +0,0 @@ -isCli()) { - return; -} -?> - - - <?php echo $helper->getPageTitle(); ?> - - - - - - - - - - -
- - getPageHeading(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_Domdf.php b/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_Domdf.php deleted file mode 100644 index aea4c96d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_Domdf.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Hide grid lines'); -$spreadsheet->getActiveSheet()->setShowGridLines(false); - -$helper->log('Set orientation to landscape'); -$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); - -$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class; -$helper->log("Write to PDF format using {$className}"); -IOFactory::registerWriter('Pdf', $className); - -// Save -$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_TCPDF.php b/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_TCPDF.php deleted file mode 100644 index 9a8593e1..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_TCPDF.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Hide grid lines'); -$spreadsheet->getActiveSheet()->setShowGridLines(false); - -$helper->log('Set orientation to landscape'); -$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); - -$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf::class; -$helper->log("Write to PDF format using {$className}"); -IOFactory::registerWriter('Pdf', $className); - -// Save -$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_mPDF.php b/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_mPDF.php deleted file mode 100644 index b99c2250..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_mPDF.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Hide grid lines'); -$spreadsheet->getActiveSheet()->setShowGridLines(false); - -$helper->log('Set orientation to landscape'); -$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); - -$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class; -$helper->log("Write to PDF format using {$className}"); -IOFactory::registerWriter('Pdf', $className); - -// Save -$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/01_Simple_file_reader_using_IOFactory.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/01_Simple_file_reader_using_IOFactory.php deleted file mode 100644 index 584fd5be..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/01_Simple_file_reader_using_IOFactory.php +++ /dev/null @@ -1,11 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory to identify the format'); -$spreadsheet = IOFactory::load($inputFileName); -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/02_Simple_file_reader_using_a_specified_reader.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/02_Simple_file_reader_using_a_specified_reader.php deleted file mode 100644 index 9a705123..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/02_Simple_file_reader_using_a_specified_reader.php +++ /dev/null @@ -1,13 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using ' . Xls::class); -$reader = new Xls(); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php deleted file mode 100644 index 305651de..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php +++ /dev/null @@ -1,15 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php deleted file mode 100644 index 98aabfc6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php +++ /dev/null @@ -1,17 +0,0 @@ -log('File ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' has been identified as an ' . $inputFileType . ' file'); - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with the identified reader type'); -$reader = IOFactory::createReader($inputFileType); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php deleted file mode 100644 index d3ce9d82..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php +++ /dev/null @@ -1,17 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Turning Formatting off for Load'); -$reader->setReadDataOnly(true); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/06_Simple_file_reader_loading_all_worksheets.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/06_Simple_file_reader_loading_all_worksheets.php deleted file mode 100644 index 5507c52b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/06_Simple_file_reader_loading_all_worksheets.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading all WorkSheets'); -$reader->setLoadAllSheets(); -$spreadsheet = $reader->load($inputFileName); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log($sheetIndex . ' -> ' . $loadedSheetName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php deleted file mode 100644 index 142a17f8..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php +++ /dev/null @@ -1,21 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading Sheet "' . $sheetname . '" only'); -$reader->setLoadSheetsOnly($sheetname); -$spreadsheet = $reader->load($inputFileName); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log($sheetIndex . ' -> ' . $loadedSheetName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php deleted file mode 100644 index 66efc3e0..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php +++ /dev/null @@ -1,21 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading Sheet' . ((count($sheetnames) == 1) ? '' : 's') . ' "' . implode('" and "', $sheetnames) . '" only'); -$reader->setLoadSheetsOnly($sheetnames); -$spreadsheet = $reader->load($inputFileName); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log($sheetIndex . ' -> ' . $loadedSheetName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/09_Simple_file_reader_using_a_read_filter.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/09_Simple_file_reader_using_a_read_filter.php deleted file mode 100644 index 6e0eda14..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/09_Simple_file_reader_using_a_read_filter.php +++ /dev/null @@ -1,40 +0,0 @@ -= 1 && $row <= 7) { - if (in_array($column, range('A', 'E'))) { - return true; - } - } - - return false; - } -} - -$filterSubset = new MyReadFilter(); - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading Sheet "' . $sheetname . '" only'); -$reader->setLoadSheetsOnly($sheetname); -$helper->log('Loading Sheet using filter'); -$reader->setReadFilter($filterSubset); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php deleted file mode 100644 index 7b3fc440..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php +++ /dev/null @@ -1,52 +0,0 @@ -startRow = $startRow; - $this->endRow = $endRow; - $this->columns = $columns; - } - - public function readCell($column, $row, $worksheetName = '') - { - if ($row >= $this->startRow && $row <= $this->endRow) { - if (in_array($column, $this->columns)) { - return true; - } - } - - return false; - } -} - -$filterSubset = new MyReadFilter(9, 15, range('G', 'K')); - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading Sheet "' . $sheetname . '" only'); -$reader->setLoadSheetsOnly($sheetname); -$helper->log('Loading Sheet using configurable filter'); -$reader->setReadFilter($filterSubset); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php b/vendor/phpoffice/phpspreadsheet/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php deleted file mode 100644 index 18562217..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php +++ /dev/null @@ -1,64 +0,0 @@ -startRow = $startRow; - $this->endRow = $startRow + $chunkSize; - } - - public function readCell($column, $row, $worksheetName = '') - { - // Only read the heading row, and the rows that were configured in the constructor - if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { - return true; - } - - return false; - } -} - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -// Create a new Reader of the type defined in $inputFileType -$reader = IOFactory::createReader($inputFileType); - -// Define how many rows we want for each "chunk" -$chunkSize = 20; - -// Loop to read our worksheet in "chunk size" blocks -for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) { - $helper->log('Loading WorkSheet using configurable filter for headings row 1 and for rows ' . $startRow . ' to ' . ($startRow + $chunkSize - 1)); - // Create a new Instance of our Read Filter, passing in the limits on which rows we want to read - $chunkFilter = new ChunkReadFilter($startRow, $chunkSize); - // Tell the Reader that we want to use the new Read Filter that we've just Instantiated - $reader->setReadFilter($chunkFilter); - // Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object - $spreadsheet = $reader->load($inputFileName); - - // Do some processing here - - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php b/vendor/phpoffice/phpspreadsheet/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php deleted file mode 100644 index 1f39ec4d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php +++ /dev/null @@ -1,67 +0,0 @@ -startRow = $startRow; - $this->endRow = $startRow + $chunkSize; - } - - public function readCell($column, $row, $worksheetName = '') - { - // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow - if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { - return true; - } - - return false; - } -} - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -// Create a new Reader of the type defined in $inputFileType -$reader = IOFactory::createReader($inputFileType); - -// Define how many rows we want to read for each "chunk" -$chunkSize = 20; -// Create a new Instance of our Read Filter -$chunkFilter = new ChunkReadFilter(); - -// Tell the Reader that we want to use the Read Filter that we've Instantiated -$reader->setReadFilter($chunkFilter); - -// Loop to read our worksheet in "chunk size" blocks -for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) { - $helper->log('Loading WorkSheet using configurable filter for headings row 1 and for rows ' . $startRow . ' to ' . ($startRow + $chunkSize - 1)); - // Tell the Read Filter, the limits on which rows we want to read this iteration - $chunkFilter->setRows($startRow, $chunkSize); - // Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object - $spreadsheet = $reader->load($inputFileName); - - // Do some processing here - - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php deleted file mode 100644 index d4817e30..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php +++ /dev/null @@ -1,29 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' into WorkSheet #1 using IOFactory with a defined reader type of ' . $inputFileType); -$spreadsheet = $reader->load($inputFileName); -$spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME)); -foreach ($inputFileNames as $sheet => $inputFileName) { - $helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' into WorkSheet #' . ($sheet + 2) . ' using IOFactory with a defined reader type of ' . $inputFileType); - $reader->setSheetIndex($sheet + 1); - $reader->loadIntoExisting($inputFileName, $spreadsheet); - $spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME)); -} - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ''); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php deleted file mode 100644 index efe68582..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php +++ /dev/null @@ -1,86 +0,0 @@ -startRow = $startRow; - $this->endRow = $startRow + $chunkSize; - } - - public function readCell($column, $row, $worksheetName = '') - { - // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow - if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { - return true; - } - - return false; - } -} - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -// Create a new Reader of the type defined in $inputFileType -$reader = IOFactory::createReader($inputFileType); - -// Define how many rows we want to read for each "chunk" -$chunkSize = 100; -// Create a new Instance of our Read Filter -$chunkFilter = new ChunkReadFilter(); - -// Tell the Reader that we want to use the Read Filter that we've Instantiated -// and that we want to store it in contiguous rows/columns -$reader->setReadFilter($chunkFilter) - ->setContiguous(true); - -// Instantiate a new PhpSpreadsheet object manually -$spreadsheet = new Spreadsheet(); - -// Set a sheet index -$sheet = 0; -// Loop to read our worksheet in "chunk size" blocks -/** $startRow is set to 2 initially because we always read the headings in row #1 * */ -for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) { - $helper->log('Loading WorkSheet #' . ($sheet + 1) . ' using configurable filter for headings row 1 and for rows ' . $startRow . ' to ' . ($startRow + $chunkSize - 1)); - // Tell the Read Filter, the limits on which rows we want to read this iteration - $chunkFilter->setRows($startRow, $chunkSize); - - // Increment the worksheet index pointer for the Reader - $reader->setSheetIndex($sheet); - // Load only the rows that match our filter into a new worksheet in the PhpSpreadsheet Object - $reader->loadIntoExisting($inputFileName, $spreadsheet); - // Set the worksheet title (to reference the "sheet" of data that we've loaded) - // and increment the sheet index as well - $spreadsheet->getActiveSheet()->setTitle('Country Data #' . (++$sheet)); -} - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ''); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php deleted file mode 100644 index 8213678a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php +++ /dev/null @@ -1,41 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' into WorkSheet #1 using IOFactory with a defined reader type of ' . $inputFileType); -$reader->setDelimiter("\t"); -$spreadsheet = $reader->load($inputFileName); -$spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME)); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ' (Formatted)'); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} - -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ' (Unformatted)'); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, false, true); - var_dump($sheetData); -} - -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ' (Raw)'); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/16_Handling_loader_exceptions_using_TryCatch.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/16_Handling_loader_exceptions_using_TryCatch.php deleted file mode 100644 index 80bb371d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/16_Handling_loader_exceptions_using_TryCatch.php +++ /dev/null @@ -1,14 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory to identify the format'); - -try { - $spreadsheet = IOFactory::load($inputFileName); -} catch (InvalidArgumentException $e) { - $helper->log('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/17_Simple_file_reader_loading_several_named_worksheets.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/17_Simple_file_reader_loading_several_named_worksheets.php deleted file mode 100644 index db30bff8..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/17_Simple_file_reader_loading_several_named_worksheets.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); - -// Read the list of Worksheet Names from the Workbook file -$helper->log('Read the list of Worksheets in the WorkBook'); -$worksheetNames = $reader->listWorksheetNames($inputFileName); - -$helper->log('There are ' . count($worksheetNames) . ' worksheet' . ((count($worksheetNames) == 1) ? '' : 's') . ' in the workbook'); -foreach ($worksheetNames as $worksheetName) { - $helper->log($worksheetName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/18_Reading_list_of_worksheets_without_loading_entire_file.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/18_Reading_list_of_worksheets_without_loading_entire_file.php deleted file mode 100644 index bb58a2d5..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/18_Reading_list_of_worksheets_without_loading_entire_file.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' information using IOFactory with a defined reader type of ' . $inputFileType); - -$reader = IOFactory::createReader($inputFileType); -$worksheetNames = $reader->listWorksheetNames($inputFileName); - -$helper->log('

Worksheet Names

'); -$helper->log('
    '); -foreach ($worksheetNames as $worksheetName) { - $helper->log('
  1. ' . $worksheetName . '
  2. '); -} -$helper->log('
'); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/19_Reading_worksheet_information_without_loading_entire_file.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/19_Reading_worksheet_information_without_loading_entire_file.php deleted file mode 100644 index 5cdc4988..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/19_Reading_worksheet_information_without_loading_entire_file.php +++ /dev/null @@ -1,23 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' information using IOFactory with a defined reader type of ' . $inputFileType); - -$reader = IOFactory::createReader($inputFileType); -$worksheetData = $reader->listWorksheetInfo($inputFileName); - -$helper->log('

Worksheet Information

'); -$helper->log('
    '); -foreach ($worksheetData as $worksheet) { - $helper->log('
  1. ' . $worksheet['worksheetName']); - $helper->log('Rows: ' . $worksheet['totalRows'] . ' Columns: ' . $worksheet['totalColumns']); - $helper->log('Cell Range: A1:' . $worksheet['lastColumnLetter'] . $worksheet['totalRows']); - $helper->log('
  2. '); -} -$helper->log('
'); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/20_Reader_worksheet_hyperlink_image.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/20_Reader_worksheet_hyperlink_image.php deleted file mode 100644 index 9dad4b6c..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/20_Reader_worksheet_hyperlink_image.php +++ /dev/null @@ -1,54 +0,0 @@ -log('Start'); - -$spreadsheet = new Spreadsheet(); - -$aSheet = $spreadsheet->getActiveSheet(); - -$gdImage = @imagecreatetruecolor(120, 20); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - -$baseUrl = 'https://phpspreadsheet.readthedocs.io'; - -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing(); -$drawing->setName('In-Memory image 1'); -$drawing->setDescription('In-Memory image 1'); -$drawing->setCoordinates('A1'); -$drawing->setImageResource($gdImage); -$drawing->setRenderingFunction( - \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG -); -$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT); -$drawing->setHeight(36); -$helper->log('Write image'); - -$hyperLink = new \PhpOffice\PhpSpreadsheet\Cell\Hyperlink($baseUrl, 'test image'); -$drawing->setHyperlink($hyperLink); -$helper->log('Write link: ' . $baseUrl); - -$drawing->setWorksheet($aSheet); - -$filename = tempnam(\PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir(), 'phpspreadsheet-test'); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, $inputFileType); -$writer->save($filename); - -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -$reloadedSpreadsheet = $reader->load($filename); -unlink($filename); - -$helper->log('reloaded Spreadsheet'); - -foreach ($reloadedSpreadsheet->getActiveSheet()->getDrawingCollection() as $pDrawing) { - $helper->log('Read link: ' . $pDrawing->getHyperlink()->getUrl()); -} - -$helper->log('end'); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/21_Reader_CSV_Long_Integers_with_String_Value_Binder.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/21_Reader_CSV_Long_Integers_with_String_Value_Binder.php deleted file mode 100644 index 2c80de3b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/21_Reader_CSV_Long_Integers_with_String_Value_Binder.php +++ /dev/null @@ -1,27 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' into WorkSheet #1 using IOFactory with a defined reader type of ' . $inputFileType); - -$spreadsheet = $reader->load($inputFileName); -$spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME)); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ' (Formatted)'); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.csv b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.csv deleted file mode 100644 index b8cdf182..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.csv +++ /dev/null @@ -1,4 +0,0 @@ -First Name,Last Name,Nationality,Gender,Date of Birth,Time of Birth,Date/Time,PHP Coder,Sanity %Age -Mark,Baker,British,M,19-Dec-1960,01:30,=E2+F2,TRUE,32% -Toni,Baker,British,F,24-Nov-1950,20:00,=E3+F3,FALSE,95% -Rachel,Baker,British,F,7-Dec-1982,00:15,=E4+F4,FALSE,100% \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.tsv b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.tsv deleted file mode 100644 index 29c9297c..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.tsv +++ /dev/null @@ -1,4 +0,0 @@ -First Name Last Name Nationality Gender Date of Birth Time of Birth Date/Time PHP Coder Sanity %Age -Mark Baker British M 19-Dec-1960 01:30 =E2+F2 TRUE 32% -Toni Baker British F 24-Nov-1950 20:00 =E3+F3 FALSE 95% -Rachel Baker British F 7-Dec-1982 00:15 =E4+F4 FALSE 100% \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.xls b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.xls deleted file mode 100644 index bd9bb110..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.xls and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.csv b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.csv deleted file mode 100644 index 1750f1b6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.csv +++ /dev/null @@ -1,223 +0,0 @@ -"City","Country","Latitude","Longitude" -"Kabul","Afghanistan",34.528455,69.171703 -"Tirane","Albania",41.33,19.82 -"Algiers","Algeria",36.752887,3.042048 -"Pago Pago","American Samoa",-14.27933,-170.700897 -"Andorra la Vella","Andorra",42.507531,1.521816 -"Luanda","Angola",-8.838333,13.234444 -"Buenos Aires","Argentina",-34.608417,-58.373161 -"Yerevan","Armenia",40.183333,44.516667 -"Oranjestad","Aruba",12.52458,-70.026459 -"Canberra","Australia",-35.3075,149.124417 -"Vienna","Austria",48.208333,16.373056 -"Baku","Azerbaijan",40.379571,49.891233 -"Nassau","Bahamas",25.06,-77.345 -"Manama","Bahrain",26.216667,50.583333 -"Dhaka","Bangladesh",23.709921,90.407143 -"Bridgetown","Barbados",13.096111,-59.608333 -"Minsk","Belarus",53.9,27.566667 -"Brussels","Belgium",50.846281,4.354727 -"Belmopan","Belize",17.251389,-88.766944 -"Thimphu","Bhutan",27.466667,89.641667 -"La Paz","Bolivia",-16.49901,-68.146248 -"Sarajevo","Bosnia and Herzegovina",43.8476,18.3564 -"Gaborone","Botswana",-24.65411,25.908739 -"Brasilia","Brazil",-15.780148,-47.92917 -"Road Town","British Virgin Islands",18.433333,-64.616667 -"Bandar Seri Begawan","Brunei Darussalam",4.9431,114.9425 -"Sofia","Bulgaria",42.697626,23.322284 -"Ouagadougou","Burkina Faso",12.364637,-1.533864 -"Bujumbura","Burundi",-3.361378,29.359878 -"Phnom Penh","Cambodia",11.55,104.916667 -"Yaounde","Cameroon",3.866667,11.516667 -"Ottawa","Canada",45.423494,-75.697933 -"Praia","Cape Verde",14.920833,-23.508333 -"George Town","Cayman Islands",19.286932,-81.367439 -"Bangui","Central African Republic",4.361698,18.555975 -"N'Djamena","Chad",12.104797,15.044506 -"Santiago","Chile",-33.42536,-70.566466 -"Beijing","China",39.904667,116.408198 -"Bogota","Colombia",4.647302,-74.096268 -"Moroni","Comoros",-11.717216,43.247315 -"Brazzaville","Congo",-4.266667,15.283333 -"San Jose","Costa Rica",9.933333,-84.083333 -"Yamoussoukro","Cote d'Ivoire",6.816667,-5.283333 -"Zagreb","Croatia",45.814912,15.978515 -"Havana","Cuba",23.133333,-82.366667 -"Nicosia","Cyprus",35.166667,33.366667 -"Prague","Czech Republic",50.087811,14.42046 -"Kinshasa","Congo",-4.325,15.322222 -"Copenhagen","Denmark",55.676294,12.568116 -"Djibouti","Djibouti",11.588,43.145 -"Roseau","Dominica",15.301389,-61.388333 -"Santo Domingo","Dominican Republic",18.5,-69.983333 -"Dili","East Timor",-8.566667,125.566667 -"Quito","Ecuador",-0.229498,-78.524277 -"Cairo","Egypt",30.064742,31.249509 -"San Salvador","El Salvador",13.69,-89.190003 -"Malabo","Equatorial Guinea",3.75,8.783333 -"Asmara","Eritrea",15.33236,38.92617 -"Tallinn","Estonia",59.438862,24.754472 -"Addis Ababa","Ethiopia",9.022736,38.746799 -"Stanley","Falkland Islands",-51.700981,-57.84919 -"Torshavn","Faroe Islands",62.017707,-6.771879 -"Suva","Fiji",-18.1416,178.4419 -"Helsinki","Finland",60.169813,24.93824 -"Paris","France",48.856667,2.350987 -"Cayenne","French Guiana",4.9227,-52.3269 -"Papeete","French Polynesia",-17.535021,-149.569595 -"Libreville","Gabon",0.390841,9.453644 -"Banjul","Gambia",13.453056,-16.5775 -"T'bilisi","Georgia",41.716667,44.783333 -"Berlin","Germany",52.523405,13.4114 -"Accra","Ghana",5.555717,-0.196306 -"Athens","Greece",37.97918,23.716647 -"Nuuk","Greenland",64.18362,-51.721407 -"Basse-Terre","Guadeloupe",15.998503,-61.72202 -"Guatemala","Guatemala",14.641389,-90.513056 -"St. Peter Port","Guernsey",49.458858,-2.534752 -"Conakry","Guinea",9.537029,-13.67847 -"Bissau","Guinea-Bissau",11.866667,-15.6 -"Georgetown","Guyana",6.804611,-58.154831 -"Port-au-Prince","Haiti",18.539269,-72.336408 -"Tegucigalpa","Honduras",14.082054,-87.206285 -"Budapest","Hungary",47.498406,19.040758 -"Reykjavik","Iceland",64.135338,-21.89521 -"New Delhi","India",28.635308,77.22496 -"Jakarta","Indonesia",-6.211544,106.845172 -"Tehran","Iran",35.696216,51.422945 -"Baghdad","Iraq",33.3157,44.3922 -"Dublin","Ireland",53.344104,-6.267494 -"Jerusalem","Israel",31.7857,35.2007 -"Rome","Italy",41.895466,12.482324 -"Kingston","Jamaica",17.992731,-76.792009 -"St. Helier","Jersey",49.190278,-2.108611 -"Amman","Jordan",31.956578,35.945695 -"Astana","Kazakhstan",51.10,71.30 -"Nairobi","Kenya",-01.17,36.48 -"Tarawa","Kiribati",01.30,173.00 -"Seoul","South Korea",37.31,126.58 -"Kuwait City","Kuwait",29.30,48.00 -"Bishkek","Kyrgyzstan",42.54,74.46 -"Riga","Latvia",56.53,24.08 -"Beirut","Lebanon",33.53,35.31 -"Maseru","Lesotho",-29.18,27.30 -"Monrovia","Liberia",06.18,-10.47 -"Vaduz","Liechtenstein",47.08,09.31 -"Vilnius","Lithuania",54.38,25.19 -"Luxembourg","Luxembourg",49.37,06.09 -"Antananarivo","Madagascar",-18.55,47.31 -"Lilongwe","Malawi",-14.00,33.48 -"Kuala Lumpur","Malaysia",03.09,101.41 -"Male","Maldives",04.00,73.28 -"Bamako","Mali",12.34,-07.55 -"Valletta","Malta",35.54,14.31 -"Fort-de-France","Martinique",14.36,-61.02 -"Nouakchott","Mauritania",-20.10,57.30 -"Mamoudzou","Mayotte",-12.48,45.14 -"Mexico City","Mexico",19.20,-99.10 -"Palikir","Micronesia",06.55,158.09 -"Chisinau","Moldova",47.02,28.50 -"Maputo","Mozambique",-25.58,32.32 -"Yangon","Myanmar",16.45,96.20 -"Windhoek","Namibia",-22.35,17.04 -"Kathmandu","Nepal",27.45,85.20 -"Amsterdam","Netherlands",52.23,04.54 -"Willemstad","Netherlands Antilles",12.05,-69.00 -"Noumea","New Caledonia",-22.17,166.30 -"Wellington","New Zealand",-41.19,174.46 -"Managua","Nicaragua",12.06,-86.20 -"Niamey","Niger",13.27,02.06 -"Abuja","Nigeria",09.05,07.32 -"Kingston","Norfolk Island",-45.20,168.43 -"Saipan","Northern Mariana Islands",15.12,145.45 -"Oslo","Norway",59.55,10.45 -"Masqat","Oman",23.37,58.36 -"Islamabad","Pakistan",33.40,73.10 -"Koror","Palau",07.20,134.28 -"Panama City","Panama",09.00,-79.25 -"Port Moresby","Papua New Guinea",-09.24,147.08 -"Asuncion","Paraguay",-25.10,-57.30 -"Lima","Peru",-12.00,-77.00 -"Manila","Philippines",14.40,121.03 -"Warsaw","Poland",52.13,21.00 -"Lisbon","Portugal",38.42,-09.10 -"San Juan","Puerto Rico",18.28,-66.07 -"Doha","Qatar",25.15,51.35 -"Bucuresti","Romania",44.27,26.10 -"Moskva","Russian Federation",55.45,37.35 -"Kigali","Rawanda",-01.59,30.04 -"Basseterre","Saint Kitts and Nevis",17.17,-62.43 -"Castries","Saint Lucia",14.02,-60.58 -"Saint-Pierre","Saint Pierre and Miquelon",46.46,-56.12 -"Apia","Samoa",-13.50,-171.50 -"San Marino","San Marino",43.55,12.30 -"Sao Tome","Sao Tome and Principe",00.10,06.39 -"Riyadh","Saudi Arabia",24.41,46.42 -"Dakar","Senegal",14.34,-17.29 -"Freetown","Sierra Leone",08.30,-13.17 -"Bratislava","Slovakia",48.10,17.07 -"Ljubljana","Slovenia",46.04,14.33 -"Honiara","Solomon Islands",-09.27,159.57 -"Mogadishu","Somalia",02.02,45.25 -"Pretoria","South Africa",-25.44,28.12 -"Madrid","Spain",40.25,-03.45 -"Khartoum","Sudan",15.31,32.35 -"Paramaribo","Suriname",05.50,-55.10 -"Mbabane","Swaziland",-26.18,31.06 -"Stockholm","Sweden",59.20,18.03 -"Bern","Switzerland",46.57,07.28 -"Damascus","Syrian Arab Republic",33.30,36.18 -"Dushanbe","Tajikistan",38.33,68.48 -"Bangkok","Thailand",13.45,100.35 -"Lome","Togo",06.09,01.20 -"Nuku'alofa","Tonga",-21.10,-174.00 -"Tunis","Tunisia",36.50,10.11 -"Ankara","Turkey",39.57,32.54 -"Ashgabat","Turkmenistan",38.00,57.50 -"Funafuti","Tuvalu",-08.31,179.13 -"Kampala","Uganda",00.20,32.30 -"Kiev","Ukraine",50.30,30.28 -"Abu Dhabi","United Arab Emirates",24.28,54.22 -"London","United Kingdom",51.36,-00.05 -"Dodoma","Tanzania",-06.08,35.45 -"Washington DC","United States of America",39.91,-77.02 -"Montevideo","Uruguay",-34.50,-56.11 -"Tashkent","Uzbekistan",41.20,69.10 -"Port-Vila","Vanuatu",-17.45,168.18 -"Caracas","Venezuela",10.30,-66.55 -"Hanoi","Viet Nam",21.05,105.55 -"Belgrade","Yugoslavia",44.50,20.37 -"Lusaka","Zambia",-15.28,28.16 -"Harare","Zimbabwe",-17.43,31.02 -"St. John's","Antigua and Barbuda",17.08,-61.50 -"Porto Novo","Benin",06.30,02.47 -"Hamilton","Bermuda"","32.18,-64.48 -"Avarua","Cook Islands",-21.12,-159.46 -"St. George's","Grenada",12.04,-61.44 -"Agaa","Guam",13.28,144.45 -"Victoria","Hong Kong",22.16,114.13 -"Tokyo","Japan",35.40,139.45 -"Pyongyang","North Korea",39.00,125.47 -"Vientiane","Laos",17.59,102.38 -"Tripoli","Libya",32.54,013.11 -"Skopje","Macedonia",42.00,021.28 -"Majuro","Marshall Islands",07.05,171.08 -"Port Louis","Mauritius",-20.10,57.30 -"Monaco","Monaco",43.44,007.25 -"Ulan Bator","Mongolia",47.54,106.52 -"Plymouth","Montserrat",16.44,-62.14 -"Rabat","Morocco",34.02,-06.51 -"Alofi","Niue",-14.27,-178.05 -"Saint-Denis","Runion",-20.52,55.27 -"Victoria","Seychelles",-04.38,55.28 -"Singapore","Singapore",01.18,103.50 -"Colombo","Sri Lanka",06.55,79.52 -"Kingstown","St Vincent and the Grenadines",13.12,-61.14 -"Taipei","Taiwan",25.50,121.32 -"Port-of-Spain","Trinidad and Tobago",10.38,-61.31 -"Cockburn Harbour","Turks and Caicos Islands",21.30,-71.30 -"Charlotte Amalie","US Virgin Islands",18.22,-64.56 -"Vatican City","Vatican State",41.54,12.27 -"Layoune","Western Sahara",27.10,-13.11 -"San'a","Yemen",15.24,44.14 diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.xls b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.xls deleted file mode 100644 index dd213ab9..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.xls and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/longIntegers.csv b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/longIntegers.csv deleted file mode 100644 index 166f4a86..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/longIntegers.csv +++ /dev/null @@ -1,6 +0,0 @@ -"Column 1","Column 2" -123456789012345678901234,234567890123456789012345 -345678901234567890123456,456789012345678901234567 -567890123456789012345678,678901234567890123456789 -789012345678901234567890,890123456789012345678901 -901234567890123456789012,012345678901234567890123 diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_properties.php b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_properties.php deleted file mode 100644 index 1c222b50..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_properties.php +++ /dev/null @@ -1,53 +0,0 @@ -load($inputFileName); - -// Read an array list of any custom properties for this document -$customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); - -// Loop through the list of custom properties -foreach ($customPropertyList as $customPropertyName) { - $helper->log('' . $customPropertyName . ': '); - // Retrieve the property value - $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customPropertyName); - // Retrieve the property type - $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customPropertyName); - - // Manipulate properties as appropriate for display purposes - switch ($propertyType) { - case 'i': // integer - $propertyType = 'integer number'; - - break; - case 'f': // float - $propertyType = 'floating point number'; - - break; - case 's': // string - $propertyType = 'string'; - - break; - case 'd': // date - $propertyValue = date('l, d<\s\up>S F Y g:i A', $propertyValue); - $propertyType = 'date'; - - break; - case 'b': // boolean - $propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE'; - $propertyType = 'boolean'; - - break; - } - - $helper->log($propertyValue . ' (' . $propertyType . ')'); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_property_names.php b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_property_names.php deleted file mode 100644 index 0f287f04..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_property_names.php +++ /dev/null @@ -1,20 +0,0 @@ -load($inputFileName); - -// Read an array list of any custom properties for this document -$customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); - -foreach ($customPropertyList as $customPropertyName) { - $helper->log($customPropertyName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Properties.php b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Properties.php deleted file mode 100644 index 5bf25b8e..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Properties.php +++ /dev/null @@ -1,64 +0,0 @@ -load($inputFileName); - -// Read the document's creator property -$creator = $spreadsheet->getProperties()->getCreator(); -$helper->log('Document Creator: ' . $creator); - -// Read the Date when the workbook was created (as a PHP timestamp value) -$creationDatestamp = $spreadsheet->getProperties()->getCreated(); -// Format the date and time using the standard PHP date() function -$creationDate = date('l, d<\s\up>S F Y', $creationDatestamp); -$creationTime = date('g:i A', $creationDatestamp); -$helper->log('Created On: ' . $creationDate . ' at ' . $creationTime); - -// Read the name of the last person to modify this workbook -$modifiedBy = $spreadsheet->getProperties()->getLastModifiedBy(); -$helper->log('Last Modified By: ' . $modifiedBy); - -// Read the Date when the workbook was last modified (as a PHP timestamp value) -$modifiedDatestamp = $spreadsheet->getProperties()->getModified(); -// Format the date and time using the standard PHP date() function -$modifiedDate = date('l, d<\s\up>S F Y', $modifiedDatestamp); -$modifiedTime = date('g:i A', $modifiedDatestamp); -$helper->log('Last Modified On: ' . $modifiedDate . ' at ' . $modifiedTime); - -// Read the workbook title property -$workbookTitle = $spreadsheet->getProperties()->getTitle(); -$helper->log('Title: ' . $workbookTitle); - -// Read the workbook description property -$description = $spreadsheet->getProperties()->getDescription(); -$helper->log('Description: ' . $description); - -// Read the workbook subject property -$subject = $spreadsheet->getProperties()->getSubject(); -$helper->log('Subject: ' . $subject); - -// Read the workbook keywords property -$keywords = $spreadsheet->getProperties()->getKeywords(); -$helper->log('Keywords: ' . $keywords); - -// Read the workbook category property -$category = $spreadsheet->getProperties()->getCategory(); -$helper->log('Category: ' . $category); - -// Read the workbook company property -$company = $spreadsheet->getProperties()->getCompany(); -$helper->log('Company: ' . $company); - -// Read the workbook manager property -$manager = $spreadsheet->getProperties()->getManager(); -$helper->log('Manager: ' . $manager); -$s = new \PhpOffice\PhpSpreadsheet\Helper\Sample(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Worksheet_count_and_names.php b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Worksheet_count_and_names.php deleted file mode 100644 index 630312b7..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Worksheet_count_and_names.php +++ /dev/null @@ -1,24 +0,0 @@ -load($inputFileName); - -// Use the PhpSpreadsheet object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook -$sheetCount = $spreadsheet->getSheetCount(); -$helper->log('There ' . (($sheetCount == 1) ? 'is' : 'are') . ' ' . $sheetCount . ' WorkSheet' . (($sheetCount == 1) ? '' : 's') . ' in the WorkBook'); - -$helper->log('Reading the names of Worksheets in the WorkBook'); -// Use the PhpSpreadsheet object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook -$sheetNames = $spreadsheet->getSheetNames(); -foreach ($sheetNames as $sheetIndex => $sheetName) { - $helper->log('WorkSheet #' . $sheetIndex . ' is named "' . $sheetName . '"'); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xls b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xls deleted file mode 100644 index 0db0efdc..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xls and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xlsx b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xlsx deleted file mode 100644 index 2224dd4f..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xlsx and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example2.xls b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example2.xls deleted file mode 100644 index 18bfcf47..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example2.xls and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/bootstrap.min.css b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/bootstrap.min.css deleted file mode 100644 index ed3905e0..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/bootstrap.min.css +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Bootstrap v3.3.7 (http://getbootstrap.com) - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control::-ms-expand{background-color:transparent;border:0}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled.focus,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled].focus,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled.focus,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled].focus,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled.focus,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled].focus,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled.focus,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled].focus,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled.focus,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled].focus,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{padding-right:15px;padding-left:15px;border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;filter:alpha(opacity=0);opacity:0;line-break:auto}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);background-color:rgba(0,0,0,0);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.modal-header:after,.modal-header:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.modal-header:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} -/*# sourceMappingURL=bootstrap.min.css.map */ \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/font-awesome.min.css b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/font-awesome.min.css deleted file mode 100644 index 4ec92235..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/font-awesome.min.css +++ /dev/null @@ -1,4 +0,0 @@ -/*! - * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.6.3');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.6.3') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.6.3') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/phpspreadsheet.css b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/phpspreadsheet.css deleted file mode 100644 index 5ea37342..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/phpspreadsheet.css +++ /dev/null @@ -1,13 +0,0 @@ -body { - padding-top: 20px; - padding-bottom: 20px; -} -.navbar { - margin-bottom: 20px; -} -.passed { - color: #339900; -} -.failed { - color: #ff0000; -} \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/FontAwesome.otf b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/FontAwesome.otf deleted file mode 100644 index d4de13e8..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/FontAwesome.otf and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.eot b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.eot deleted file mode 100644 index c7b00d2b..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.eot and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.svg b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.svg deleted file mode 100644 index 8b66187f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.svg +++ /dev/null @@ -1,685 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.ttf b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.ttf deleted file mode 100644 index f221e50a..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff deleted file mode 100644 index 6e7483cf..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff2 b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff2 deleted file mode 100644 index 7eb74fd1..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff2 and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/bootstrap.min.js b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/bootstrap.min.js deleted file mode 100644 index 9bcd2fcc..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/bootstrap.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Bootstrap v3.3.7 (http://getbootstrap.com) - * Copyright 2011-2016 Twitter, Inc. - * Licensed under the MIT license - */ -if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/jquery.min.js b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/jquery.min.js deleted file mode 100644 index f6a6a99e..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/jquery.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */ -!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0, -r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;d0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function Xa(a,b,c,d,e){return new Xa.prototype.init(a,b,c,d,e)}r.Tween=Xa,Xa.prototype={constructor:Xa,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Xa.propHooks[this.prop];return a&&a.get?a.get(this):Xa.propHooks._default.get(this)},run:function(a){var b,c=Xa.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Xa.propHooks._default.set(this),this}},Xa.prototype.init.prototype=Xa.prototype,Xa.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Xa.propHooks.scrollTop=Xa.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Xa.prototype.init,r.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=/queueHooks$/;function ab(){Za&&(a.requestAnimationFrame(ab),r.fx.tick())}function bb(){return a.setTimeout(function(){Ya=void 0}),Ya=r.now()}function cb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=aa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function db(a,b,c){for(var d,e=(gb.tweeners[b]||[]).concat(gb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?hb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K); -if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),hb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ib[b]||r.find.attr;ib[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=ib[g],ib[g]=e,e=null!=c(a,b,d)?g:null,ib[g]=f),e}});var jb=/^(?:input|select|textarea|button)$/i,kb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):jb.test(a.nodeName)||kb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;function mb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,mb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,mb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,mb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=mb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(c)+" ").replace(lb," ").indexOf(b)>-1)return!0;return!1}});var nb=/\r/g,ob=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(nb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(ob," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,""),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(""); - $this->initialized = true; - } - - $title = '-'; - if (isset($context['request'])) { - $request = $context['request']; - $controller = "{$this->dumper->dump($request['controller'], true, ['maxDepth' => 0])}"; - $title = sprintf('%s %s', $request['method'], $uri = $request['uri'], $uri); - $dedupIdentifier = $request['identifier']; - } elseif (isset($context['cli'])) { - $title = '$ '.$context['cli']['command_line']; - $dedupIdentifier = $context['cli']['identifier']; - } else { - $dedupIdentifier = uniqid('', true); - } - - $sourceDescription = ''; - if (isset($context['source'])) { - $source = $context['source']; - $projectDir = $source['project_dir'] ?? null; - $sourceDescription = sprintf('%s on line %d', $source['name'], $source['line']); - if (isset($source['file_link'])) { - $sourceDescription = sprintf('%s', $source['file_link'], $sourceDescription); - } - } - - $isoDate = $this->extractDate($context, 'c'); - $tags = array_filter([ - 'controller' => $controller ?? null, - 'project dir' => $projectDir ?? null, - ]); - - $output->writeln(<< -
-
-

$title

- -
- {$this->renderTags($tags)} -
-
-

- $sourceDescription -

- {$this->dumper->dump($data, true)} -
- -HTML - ); - } - - private function extractDate(array $context, string $format = 'r'): string - { - return date($format, $context['timestamp']); - } - - private function renderTags(array $tags): string - { - if (!$tags) { - return ''; - } - - $renderedTags = ''; - foreach ($tags as $key => $value) { - $renderedTags .= sprintf('
  • %s%s
  • ', $key, $value); - } - - return << -
      - $renderedTags -
    - -HTML; - } -} diff --git a/vendor/symfony/var-dumper/Command/ServerDumpCommand.php b/vendor/symfony/var-dumper/Command/ServerDumpCommand.php deleted file mode 100644 index eb807e35..00000000 --- a/vendor/symfony/var-dumper/Command/ServerDumpCommand.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Command; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Command\Descriptor\CliDescriptor; -use Symfony\Component\VarDumper\Command\Descriptor\DumpDescriptorInterface; -use Symfony\Component\VarDumper\Command\Descriptor\HtmlDescriptor; -use Symfony\Component\VarDumper\Dumper\CliDumper; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; -use Symfony\Component\VarDumper\Server\DumpServer; - -/** - * Starts a dump server to collect and output dumps on a single place with multiple formats support. - * - * @author Maxime Steinhausser - * - * @final - */ -class ServerDumpCommand extends Command -{ - protected static $defaultName = 'server:dump'; - - private $server; - - /** @var DumpDescriptorInterface[] */ - private $descriptors; - - public function __construct(DumpServer $server, array $descriptors = []) - { - $this->server = $server; - $this->descriptors = $descriptors + [ - 'cli' => new CliDescriptor(new CliDumper()), - 'html' => new HtmlDescriptor(new HtmlDumper()), - ]; - - parent::__construct(); - } - - protected function configure() - { - $availableFormats = implode(', ', array_keys($this->descriptors)); - - $this - ->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format (%s)', $availableFormats), 'cli') - ->setDescription('Starts a dump server that collects and displays dumps in a single place') - ->setHelp(<<<'EOF' -%command.name% starts a dump server that collects and displays -dumps in a single place for debugging you application: - - php %command.full_name% - -You can consult dumped data in HTML format in your browser by providing the --format=html option -and redirecting the output to a file: - - php %command.full_name% --format="html" > dump.html - -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new SymfonyStyle($input, $output); - $format = $input->getOption('format'); - - if (!$descriptor = $this->descriptors[$format] ?? null) { - throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $format)); - } - - $errorIo = $io->getErrorStyle(); - $errorIo->title('Symfony Var Dumper Server'); - - $this->server->start(); - - $errorIo->success(sprintf('Server listening on %s', $this->server->getHost())); - $errorIo->comment('Quit the server with CONTROL-C.'); - - $this->server->listen(function (Data $data, array $context, int $clientId) use ($descriptor, $io) { - $descriptor->describe($io, $data, $context, $clientId); - }); - } -} diff --git a/vendor/symfony/var-dumper/Dumper/AbstractDumper.php b/vendor/symfony/var-dumper/Dumper/AbstractDumper.php deleted file mode 100644 index be8b3f72..00000000 --- a/vendor/symfony/var-dumper/Dumper/AbstractDumper.php +++ /dev/null @@ -1,213 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper; - -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Cloner\DumperInterface; - -/** - * Abstract mechanism for dumping a Data object. - * - * @author Nicolas Grekas - */ -abstract class AbstractDumper implements DataDumperInterface, DumperInterface -{ - const DUMP_LIGHT_ARRAY = 1; - const DUMP_STRING_LENGTH = 2; - const DUMP_COMMA_SEPARATOR = 4; - const DUMP_TRAILING_COMMA = 8; - - public static $defaultOutput = 'php://output'; - - protected $line = ''; - protected $lineDumper; - protected $outputStream; - protected $decimalPoint; // This is locale dependent - protected $indentPad = ' '; - protected $flags; - - private $charset = ''; - - /** - * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput - * @param string|null $charset The default character encoding to use for non-UTF8 strings - * @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation - */ - public function __construct($output = null, string $charset = null, int $flags = 0) - { - $this->flags = $flags; - $this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'); - $this->decimalPoint = localeconv(); - $this->decimalPoint = $this->decimalPoint['decimal_point']; - $this->setOutput($output ?: static::$defaultOutput); - if (!$output && \is_string(static::$defaultOutput)) { - static::$defaultOutput = $this->outputStream; - } - } - - /** - * Sets the output destination of the dumps. - * - * @param callable|resource|string $output A line dumper callable, an opened stream or an output path - * - * @return callable|resource|string The previous output destination - */ - public function setOutput($output) - { - $prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper; - - if (\is_callable($output)) { - $this->outputStream = null; - $this->lineDumper = $output; - } else { - if (\is_string($output)) { - $output = fopen($output, 'wb'); - } - $this->outputStream = $output; - $this->lineDumper = [$this, 'echoLine']; - } - - return $prev; - } - - /** - * Sets the default character encoding to use for non-UTF8 strings. - * - * @param string $charset The default character encoding to use for non-UTF8 strings - * - * @return string The previous charset - */ - public function setCharset($charset) - { - $prev = $this->charset; - - $charset = strtoupper($charset); - $charset = null === $charset || 'UTF-8' === $charset || 'UTF8' === $charset ? 'CP1252' : $charset; - - $this->charset = $charset; - - return $prev; - } - - /** - * Sets the indentation pad string. - * - * @param string $pad A string that will be prepended to dumped lines, repeated by nesting level - * - * @return string The previous indent pad - */ - public function setIndentPad($pad) - { - $prev = $this->indentPad; - $this->indentPad = $pad; - - return $prev; - } - - /** - * Dumps a Data object. - * - * @param Data $data A Data object - * @param callable|resource|string|true|null $output A line dumper callable, an opened stream, an output path or true to return the dump - * - * @return string|null The dump as string when $output is true - */ - public function dump(Data $data, $output = null) - { - $this->decimalPoint = localeconv(); - $this->decimalPoint = $this->decimalPoint['decimal_point']; - - if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(LC_NUMERIC, 0) : null) { - setlocale(LC_NUMERIC, 'C'); - } - - if ($returnDump = true === $output) { - $output = fopen('php://memory', 'r+b'); - } - if ($output) { - $prevOutput = $this->setOutput($output); - } - try { - $data->dump($this); - $this->dumpLine(-1); - - if ($returnDump) { - $result = stream_get_contents($output, -1, 0); - fclose($output); - - return $result; - } - } finally { - if ($output) { - $this->setOutput($prevOutput); - } - if ($locale) { - setlocale(LC_NUMERIC, $locale); - } - } - - return null; - } - - /** - * Dumps the current line. - * - * @param int $depth The recursive depth in the dumped structure for the line being dumped, - * or -1 to signal the end-of-dump to the line dumper callable - */ - protected function dumpLine($depth) - { - ($this->lineDumper)($this->line, $depth, $this->indentPad); - $this->line = ''; - } - - /** - * Generic line dumper callback. - * - * @param string $line The line to write - * @param int $depth The recursive depth in the dumped structure - * @param string $indentPad The line indent pad - */ - protected function echoLine($line, $depth, $indentPad) - { - if (-1 !== $depth) { - fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n"); - } - } - - /** - * Converts a non-UTF-8 string to UTF-8. - * - * @param string|null $s The non-UTF-8 string to convert - * - * @return string|null The string converted to UTF-8 - */ - protected function utf8Encode($s) - { - if (null === $s || preg_match('//u', $s)) { - return $s; - } - - if (!\function_exists('iconv')) { - throw new \RuntimeException('Unable to convert a non-UTF-8 string to UTF-8: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.'); - } - - if (false !== $c = @iconv($this->charset, 'UTF-8', $s)) { - return $c; - } - if ('CP1252' !== $this->charset && false !== $c = @iconv('CP1252', 'UTF-8', $s)) { - return $c; - } - - return iconv('CP850', 'UTF-8', $s); - } -} diff --git a/vendor/symfony/var-dumper/Dumper/CliDumper.php b/vendor/symfony/var-dumper/Dumper/CliDumper.php deleted file mode 100644 index 8b11ab92..00000000 --- a/vendor/symfony/var-dumper/Dumper/CliDumper.php +++ /dev/null @@ -1,643 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper; - -use Symfony\Component\VarDumper\Cloner\Cursor; -use Symfony\Component\VarDumper\Cloner\Stub; - -/** - * CliDumper dumps variables for command line output. - * - * @author Nicolas Grekas - */ -class CliDumper extends AbstractDumper -{ - public static $defaultColors; - public static $defaultOutput = 'php://stdout'; - - protected $colors; - protected $maxStringWidth = 0; - protected $styles = [ - // See http://en.wikipedia.org/wiki/ANSI_escape_code#graphics - 'default' => '0;38;5;208', - 'num' => '1;38;5;38', - 'const' => '1;38;5;208', - 'str' => '1;38;5;113', - 'note' => '38;5;38', - 'ref' => '38;5;247', - 'public' => '', - 'protected' => '', - 'private' => '', - 'meta' => '38;5;170', - 'key' => '38;5;113', - 'index' => '38;5;38', - ]; - - protected static $controlCharsRx = '/[\x00-\x1F\x7F]+/'; - protected static $controlCharsMap = [ - "\t" => '\t', - "\n" => '\n', - "\v" => '\v', - "\f" => '\f', - "\r" => '\r', - "\033" => '\e', - ]; - - protected $collapseNextHash = false; - protected $expandNextHash = false; - - private $displayOptions = [ - 'fileLinkFormat' => null, - ]; - - private $handlesHrefGracefully; - - /** - * {@inheritdoc} - */ - public function __construct($output = null, string $charset = null, int $flags = 0) - { - parent::__construct($output, $charset, $flags); - - if ('\\' === \DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) { - // Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI - $this->setStyles([ - 'default' => '31', - 'num' => '1;34', - 'const' => '1;31', - 'str' => '1;32', - 'note' => '34', - 'ref' => '1;30', - 'meta' => '35', - 'key' => '32', - 'index' => '34', - ]); - } - - $this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f'; - } - - /** - * Enables/disables colored output. - * - * @param bool $colors - */ - public function setColors($colors) - { - $this->colors = (bool) $colors; - } - - /** - * Sets the maximum number of characters per line for dumped strings. - * - * @param int $maxStringWidth - */ - public function setMaxStringWidth($maxStringWidth) - { - $this->maxStringWidth = (int) $maxStringWidth; - } - - /** - * Configures styles. - * - * @param array $styles A map of style names to style definitions - */ - public function setStyles(array $styles) - { - $this->styles = $styles + $this->styles; - } - - /** - * Configures display options. - * - * @param array $displayOptions A map of display options to customize the behavior - */ - public function setDisplayOptions(array $displayOptions) - { - $this->displayOptions = $displayOptions + $this->displayOptions; - } - - /** - * {@inheritdoc} - */ - public function dumpScalar(Cursor $cursor, $type, $value) - { - $this->dumpKey($cursor); - - $style = 'const'; - $attr = $cursor->attr; - - switch ($type) { - case 'default': - $style = 'default'; - break; - - case 'integer': - $style = 'num'; - break; - - case 'double': - $style = 'num'; - - switch (true) { - case INF === $value: $value = 'INF'; break; - case -INF === $value: $value = '-INF'; break; - case is_nan($value): $value = 'NAN'; break; - default: - $value = (string) $value; - if (false === strpos($value, $this->decimalPoint)) { - $value .= $this->decimalPoint.'0'; - } - break; - } - break; - - case 'NULL': - $value = 'null'; - break; - - case 'boolean': - $value = $value ? 'true' : 'false'; - break; - - default: - $attr += ['value' => $this->utf8Encode($value)]; - $value = $this->utf8Encode($type); - break; - } - - $this->line .= $this->style($style, $value, $attr); - - $this->endValue($cursor); - } - - /** - * {@inheritdoc} - */ - public function dumpString(Cursor $cursor, $str, $bin, $cut) - { - $this->dumpKey($cursor); - $attr = $cursor->attr; - - if ($bin) { - $str = $this->utf8Encode($str); - } - if ('' === $str) { - $this->line .= '""'; - $this->endValue($cursor); - } else { - $attr += [ - 'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0, - 'binary' => $bin, - ]; - $str = explode("\n", $str); - if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) { - unset($str[1]); - $str[0] .= "\n"; - } - $m = \count($str) - 1; - $i = $lineCut = 0; - - if (self::DUMP_STRING_LENGTH & $this->flags) { - $this->line .= '('.$attr['length'].') '; - } - if ($bin) { - $this->line .= 'b'; - } - - if ($m) { - $this->line .= '"""'; - $this->dumpLine($cursor->depth); - } else { - $this->line .= '"'; - } - - foreach ($str as $str) { - if ($i < $m) { - $str .= "\n"; - } - if (0 < $this->maxStringWidth && $this->maxStringWidth < $len = mb_strlen($str, 'UTF-8')) { - $str = mb_substr($str, 0, $this->maxStringWidth, 'UTF-8'); - $lineCut = $len - $this->maxStringWidth; - } - if ($m && 0 < $cursor->depth) { - $this->line .= $this->indentPad; - } - if ('' !== $str) { - $this->line .= $this->style('str', $str, $attr); - } - if ($i++ == $m) { - if ($m) { - if ('' !== $str) { - $this->dumpLine($cursor->depth); - if (0 < $cursor->depth) { - $this->line .= $this->indentPad; - } - } - $this->line .= '"""'; - } else { - $this->line .= '"'; - } - if ($cut < 0) { - $this->line .= '…'; - $lineCut = 0; - } elseif ($cut) { - $lineCut += $cut; - } - } - if ($lineCut) { - $this->line .= '…'.$lineCut; - $lineCut = 0; - } - - if ($i > $m) { - $this->endValue($cursor); - } else { - $this->dumpLine($cursor->depth); - } - } - } - } - - /** - * {@inheritdoc} - */ - public function enterHash(Cursor $cursor, $type, $class, $hasChild) - { - $this->dumpKey($cursor); - $attr = $cursor->attr; - - if ($this->collapseNextHash) { - $cursor->skipChildren = true; - $this->collapseNextHash = $hasChild = false; - } - - $class = $this->utf8Encode($class); - if (Cursor::HASH_OBJECT === $type) { - $prefix = $class && 'stdClass' !== $class ? $this->style('note', $class, $attr).' {' : '{'; - } elseif (Cursor::HASH_RESOURCE === $type) { - $prefix = $this->style('note', $class.' resource', $attr).($hasChild ? ' {' : ' '); - } else { - $prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class, $attr).' [' : '['; - } - - if ($cursor->softRefCount || 0 < $cursor->softRefHandle) { - $prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#').(0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), ['count' => $cursor->softRefCount]); - } elseif ($cursor->hardRefTo && !$cursor->refIndex && $class) { - $prefix .= $this->style('ref', '&'.$cursor->hardRefTo, ['count' => $cursor->hardRefCount]); - } elseif (!$hasChild && Cursor::HASH_RESOURCE === $type) { - $prefix = substr($prefix, 0, -1); - } - - $this->line .= $prefix; - - if ($hasChild) { - $this->dumpLine($cursor->depth); - } - } - - /** - * {@inheritdoc} - */ - public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut) - { - $this->dumpEllipsis($cursor, $hasChild, $cut); - $this->line .= Cursor::HASH_OBJECT === $type ? '}' : (Cursor::HASH_RESOURCE !== $type ? ']' : ($hasChild ? '}' : '')); - $this->endValue($cursor); - } - - /** - * Dumps an ellipsis for cut children. - * - * @param Cursor $cursor The Cursor position in the dump - * @param bool $hasChild When the dump of the hash has child item - * @param int $cut The number of items the hash has been cut by - */ - protected function dumpEllipsis(Cursor $cursor, $hasChild, $cut) - { - if ($cut) { - $this->line .= ' …'; - if (0 < $cut) { - $this->line .= $cut; - } - if ($hasChild) { - $this->dumpLine($cursor->depth + 1); - } - } - } - - /** - * Dumps a key in a hash structure. - * - * @param Cursor $cursor The Cursor position in the dump - */ - protected function dumpKey(Cursor $cursor) - { - if (null !== $key = $cursor->hashKey) { - if ($cursor->hashKeyIsBinary) { - $key = $this->utf8Encode($key); - } - $attr = ['binary' => $cursor->hashKeyIsBinary]; - $bin = $cursor->hashKeyIsBinary ? 'b' : ''; - $style = 'key'; - switch ($cursor->hashType) { - default: - case Cursor::HASH_INDEXED: - if (self::DUMP_LIGHT_ARRAY & $this->flags) { - break; - } - $style = 'index'; - // no break - case Cursor::HASH_ASSOC: - if (\is_int($key)) { - $this->line .= $this->style($style, $key).' => '; - } else { - $this->line .= $bin.'"'.$this->style($style, $key).'" => '; - } - break; - - case Cursor::HASH_RESOURCE: - $key = "\0~\0".$key; - // no break - case Cursor::HASH_OBJECT: - if (!isset($key[0]) || "\0" !== $key[0]) { - $this->line .= '+'.$bin.$this->style('public', $key).': '; - } elseif (0 < strpos($key, "\0", 1)) { - $key = explode("\0", substr($key, 1), 2); - - switch ($key[0][0]) { - case '+': // User inserted keys - $attr['dynamic'] = true; - $this->line .= '+'.$bin.'"'.$this->style('public', $key[1], $attr).'": '; - break 2; - case '~': - $style = 'meta'; - if (isset($key[0][1])) { - parse_str(substr($key[0], 1), $attr); - $attr += ['binary' => $cursor->hashKeyIsBinary]; - } - break; - case '*': - $style = 'protected'; - $bin = '#'.$bin; - break; - default: - $attr['class'] = $key[0]; - $style = 'private'; - $bin = '-'.$bin; - break; - } - - if (isset($attr['collapse'])) { - if ($attr['collapse']) { - $this->collapseNextHash = true; - } else { - $this->expandNextHash = true; - } - } - - $this->line .= $bin.$this->style($style, $key[1], $attr).(isset($attr['separator']) ? $attr['separator'] : ': '); - } else { - // This case should not happen - $this->line .= '-'.$bin.'"'.$this->style('private', $key, ['class' => '']).'": '; - } - break; - } - - if ($cursor->hardRefTo) { - $this->line .= $this->style('ref', '&'.($cursor->hardRefCount ? $cursor->hardRefTo : ''), ['count' => $cursor->hardRefCount]).' '; - } - } - } - - /** - * Decorates a value with some style. - * - * @param string $style The type of style being applied - * @param string $value The value being styled - * @param array $attr Optional context information - * - * @return string The value with style decoration - */ - protected function style($style, $value, $attr = []) - { - if (null === $this->colors) { - $this->colors = $this->supportsColors(); - } - - if (null === $this->handlesHrefGracefully) { - $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') && !getenv('KONSOLE_VERSION'); - } - - if (isset($attr['ellipsis'], $attr['ellipsis-type'])) { - $prefix = substr($value, 0, -$attr['ellipsis']); - if ('cli' === \PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === \DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) { - $prefix = '.'.substr($prefix, \strlen($_SERVER[$pwd])); - } - if (!empty($attr['ellipsis-tail'])) { - $prefix .= substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']); - $value = substr($value, -$attr['ellipsis'] + $attr['ellipsis-tail']); - } else { - $value = substr($value, -$attr['ellipsis']); - } - - $value = $this->style('default', $prefix).$this->style($style, $value); - - goto href; - } - - $map = static::$controlCharsMap; - $startCchr = $this->colors ? "\033[m\033[{$this->styles['default']}m" : ''; - $endCchr = $this->colors ? "\033[m\033[{$this->styles[$style]}m" : ''; - $value = preg_replace_callback(static::$controlCharsRx, function ($c) use ($map, $startCchr, $endCchr) { - $s = $startCchr; - $c = $c[$i = 0]; - do { - $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i])); - } while (isset($c[++$i])); - - return $s.$endCchr; - }, $value, -1, $cchrCount); - - if ($this->colors) { - if ($cchrCount && "\033" === $value[0]) { - $value = substr($value, \strlen($startCchr)); - } else { - $value = "\033[{$this->styles[$style]}m".$value; - } - if ($cchrCount && $endCchr === substr($value, -\strlen($endCchr))) { - $value = substr($value, 0, -\strlen($endCchr)); - } else { - $value .= "\033[{$this->styles['default']}m"; - } - } - - href: - if ($this->colors && $this->handlesHrefGracefully) { - if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) { - if ('note' === $style) { - $value .= "\033]8;;{$href}\033\\^\033]8;;\033\\"; - } else { - $attr['href'] = $href; - } - } - if (isset($attr['href'])) { - $value = "\033]8;;{$attr['href']}\033\\{$value}\033]8;;\033\\"; - } - } - - return $value; - } - - /** - * @return bool Tells if the current output stream supports ANSI colors or not - */ - protected function supportsColors() - { - if ($this->outputStream !== static::$defaultOutput) { - return $this->hasColorSupport($this->outputStream); - } - if (null !== static::$defaultColors) { - return static::$defaultColors; - } - if (isset($_SERVER['argv'][1])) { - $colors = $_SERVER['argv']; - $i = \count($colors); - while (--$i > 0) { - if (isset($colors[$i][5])) { - switch ($colors[$i]) { - case '--ansi': - case '--color': - case '--color=yes': - case '--color=force': - case '--color=always': - return static::$defaultColors = true; - - case '--no-ansi': - case '--color=no': - case '--color=none': - case '--color=never': - return static::$defaultColors = false; - } - } - } - } - - $h = stream_get_meta_data($this->outputStream) + ['wrapper_type' => null]; - $h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream; - - return static::$defaultColors = $this->hasColorSupport($h); - } - - /** - * {@inheritdoc} - */ - protected function dumpLine($depth, $endOfValue = false) - { - if ($this->colors) { - $this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line); - } - parent::dumpLine($depth); - } - - protected function endValue(Cursor $cursor) - { - if (Stub::ARRAY_INDEXED === $cursor->hashType || Stub::ARRAY_ASSOC === $cursor->hashType) { - if (self::DUMP_TRAILING_COMMA & $this->flags && 0 < $cursor->depth) { - $this->line .= ','; - } elseif (self::DUMP_COMMA_SEPARATOR & $this->flags && 1 < $cursor->hashLength - $cursor->hashIndex) { - $this->line .= ','; - } - } - - $this->dumpLine($cursor->depth, true); - } - - /** - * Returns true if the stream supports colorization. - * - * Reference: Composer\XdebugHandler\Process::supportsColor - * https://github.com/composer/xdebug-handler - * - * @param mixed $stream A CLI output stream - * - * @return bool - */ - private function hasColorSupport($stream) - { - if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) { - return false; - } - - if ('Hyper' === getenv('TERM_PROGRAM')) { - return true; - } - - if (\DIRECTORY_SEPARATOR === '\\') { - return (\function_exists('sapi_windows_vt100_support') - && @sapi_windows_vt100_support($stream)) - || false !== getenv('ANSICON') - || 'ON' === getenv('ConEmuANSI') - || 'xterm' === getenv('TERM'); - } - - if (\function_exists('stream_isatty')) { - return @stream_isatty($stream); - } - - if (\function_exists('posix_isatty')) { - return @posix_isatty($stream); - } - - $stat = @fstat($stream); - // Check if formatted mode is S_IFCHR - return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; - } - - /** - * Returns true if the Windows terminal supports true color. - * - * Note that this does not check an output stream, but relies on environment - * variables from known implementations, or a PHP and Windows version that - * supports true color. - * - * @return bool - */ - private function isWindowsTrueColor() - { - $result = 183 <= getenv('ANSICON_VER') - || 'ON' === getenv('ConEmuANSI') - || 'xterm' === getenv('TERM') - || 'Hyper' === getenv('TERM_PROGRAM'); - - if (!$result && \PHP_VERSION_ID >= 70200) { - $version = sprintf( - '%s.%s.%s', - PHP_WINDOWS_VERSION_MAJOR, - PHP_WINDOWS_VERSION_MINOR, - PHP_WINDOWS_VERSION_BUILD - ); - $result = $version >= '10.0.15063'; - } - - return $result; - } - - private function getSourceLink($file, $line) - { - if ($fmt = $this->displayOptions['fileLinkFormat']) { - return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : ($fmt->format($file, $line) ?: 'file://'.$file); - } - - return false; - } -} diff --git a/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php b/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php deleted file mode 100644 index e7f8ccf1..00000000 --- a/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper\ContextProvider; - -/** - * Tries to provide context on CLI. - * - * @author Maxime Steinhausser - */ -final class CliContextProvider implements ContextProviderInterface -{ - public function getContext(): ?array - { - if ('cli' !== \PHP_SAPI) { - return null; - } - - return [ - 'command_line' => $commandLine = implode(' ', $_SERVER['argv']), - 'identifier' => hash('crc32b', $commandLine.$_SERVER['REQUEST_TIME_FLOAT']), - ]; - } -} diff --git a/vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php b/vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php deleted file mode 100644 index 38ef3b0f..00000000 --- a/vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper\ContextProvider; - -/** - * Interface to provide contextual data about dump data clones sent to a server. - * - * @author Maxime Steinhausser - */ -interface ContextProviderInterface -{ - /** - * @return array|null Context data or null if unable to provide any context - */ - public function getContext(): ?array; -} diff --git a/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php b/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php deleted file mode 100644 index 3684a475..00000000 --- a/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper\ContextProvider; - -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\VarDumper\Caster\ReflectionCaster; -use Symfony\Component\VarDumper\Cloner\VarCloner; - -/** - * Tries to provide context from a request. - * - * @author Maxime Steinhausser - */ -final class RequestContextProvider implements ContextProviderInterface -{ - private $requestStack; - private $cloner; - - public function __construct(RequestStack $requestStack) - { - $this->requestStack = $requestStack; - $this->cloner = new VarCloner(); - $this->cloner->setMaxItems(0); - $this->cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO); - } - - public function getContext(): ?array - { - if (null === $request = $this->requestStack->getCurrentRequest()) { - return null; - } - - $controller = $request->attributes->get('_controller'); - - return [ - 'uri' => $request->getUri(), - 'method' => $request->getMethod(), - 'controller' => $controller ? $this->cloner->cloneVar($controller) : $controller, - 'identifier' => spl_object_hash($request), - ]; - } -} diff --git a/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php b/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php deleted file mode 100644 index e43e19f4..00000000 --- a/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper\ContextProvider; - -use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; -use Symfony\Component\VarDumper\VarDumper; -use Twig\Template; - -/** - * Tries to provide context from sources (class name, file, line, code excerpt, ...). - * - * @author Nicolas Grekas - * @author Maxime Steinhausser - */ -final class SourceContextProvider implements ContextProviderInterface -{ - private $limit; - private $charset; - private $projectDir; - private $fileLinkFormatter; - - public function __construct(string $charset = null, string $projectDir = null, FileLinkFormatter $fileLinkFormatter = null, int $limit = 9) - { - $this->charset = $charset; - $this->projectDir = $projectDir; - $this->fileLinkFormatter = $fileLinkFormatter; - $this->limit = $limit; - } - - public function getContext(): ?array - { - $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, $this->limit); - - $file = $trace[1]['file']; - $line = $trace[1]['line']; - $name = false; - $fileExcerpt = false; - - for ($i = 2; $i < $this->limit; ++$i) { - if (isset($trace[$i]['class'], $trace[$i]['function']) - && 'dump' === $trace[$i]['function'] - && VarDumper::class === $trace[$i]['class'] - ) { - $file = $trace[$i]['file']; - $line = $trace[$i]['line']; - - while (++$i < $this->limit) { - if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && 0 !== strpos($trace[$i]['function'], 'call_user_func')) { - $file = $trace[$i]['file']; - $line = $trace[$i]['line']; - - break; - } elseif (isset($trace[$i]['object']) && $trace[$i]['object'] instanceof Template) { - $template = $trace[$i]['object']; - $name = $template->getTemplateName(); - $src = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : false); - $info = $template->getDebugInfo(); - if (isset($info[$trace[$i - 1]['line']])) { - $line = $info[$trace[$i - 1]['line']]; - $file = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getPath() : null; - - if ($src) { - $src = explode("\n", $src); - $fileExcerpt = []; - - for ($i = max($line - 3, 1), $max = min($line + 3, \count($src)); $i <= $max; ++$i) { - $fileExcerpt[] = ''.$this->htmlEncode($src[$i - 1]).''; - } - - $fileExcerpt = '
      '.implode("\n", $fileExcerpt).'
    '; - } - } - break; - } - } - break; - } - } - - if (false === $name) { - $name = str_replace('\\', '/', $file); - $name = substr($name, strrpos($name, '/') + 1); - } - - $context = ['name' => $name, 'file' => $file, 'line' => $line]; - $context['file_excerpt'] = $fileExcerpt; - - if (null !== $this->projectDir) { - $context['project_dir'] = $this->projectDir; - if (0 === strpos($file, $this->projectDir)) { - $context['file_relative'] = ltrim(substr($file, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR); - } - } - - if ($this->fileLinkFormatter && $fileLink = $this->fileLinkFormatter->format($context['file'], $context['line'])) { - $context['file_link'] = $fileLink; - } - - return $context; - } - - private function htmlEncode(string $s): string - { - $html = ''; - - $dumper = new HtmlDumper(function ($line) use (&$html) { $html .= $line; }, $this->charset); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - - $cloner = new VarCloner(); - $dumper->dump($cloner->cloneVar($s)); - - return substr(strip_tags($html), 1, -1); - } -} diff --git a/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php b/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php deleted file mode 100644 index b173bccf..00000000 --- a/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper; - -use Symfony\Component\VarDumper\Cloner\Data; - -/** - * DataDumperInterface for dumping Data objects. - * - * @author Nicolas Grekas - */ -interface DataDumperInterface -{ - public function dump(Data $data); -} diff --git a/vendor/symfony/var-dumper/Dumper/HtmlDumper.php b/vendor/symfony/var-dumper/Dumper/HtmlDumper.php deleted file mode 100644 index e3845dff..00000000 --- a/vendor/symfony/var-dumper/Dumper/HtmlDumper.php +++ /dev/null @@ -1,969 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper; - -use Symfony\Component\VarDumper\Cloner\Cursor; -use Symfony\Component\VarDumper\Cloner\Data; - -/** - * HtmlDumper dumps variables as HTML. - * - * @author Nicolas Grekas - */ -class HtmlDumper extends CliDumper -{ - public static $defaultOutput = 'php://output'; - - protected static $themes = [ - 'dark' => [ - 'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all', - 'num' => 'font-weight:bold; color:#1299DA', - 'const' => 'font-weight:bold', - 'str' => 'font-weight:bold; color:#56DB3A', - 'note' => 'color:#1299DA', - 'ref' => 'color:#A0A0A0', - 'public' => 'color:#FFFFFF', - 'protected' => 'color:#FFFFFF', - 'private' => 'color:#FFFFFF', - 'meta' => 'color:#B729D9', - 'key' => 'color:#56DB3A', - 'index' => 'color:#1299DA', - 'ellipsis' => 'color:#FF8400', - 'ns' => 'user-select:none;', - ], - 'light' => [ - 'default' => 'background:none; color:#CC7832; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all', - 'num' => 'font-weight:bold; color:#1299DA', - 'const' => 'font-weight:bold', - 'str' => 'font-weight:bold; color:#629755;', - 'note' => 'color:#6897BB', - 'ref' => 'color:#6E6E6E', - 'public' => 'color:#262626', - 'protected' => 'color:#262626', - 'private' => 'color:#262626', - 'meta' => 'color:#B729D9', - 'key' => 'color:#789339', - 'index' => 'color:#1299DA', - 'ellipsis' => 'color:#CC7832', - 'ns' => 'user-select:none;', - ], - ]; - - protected $dumpHeader; - protected $dumpPrefix = '
    ';
    -    protected $dumpSuffix = '
    '; - protected $dumpId = 'sf-dump'; - protected $colors = true; - protected $headerIsDumped = false; - protected $lastDepth = -1; - protected $styles; - - private $displayOptions = [ - 'maxDepth' => 1, - 'maxStringLength' => 160, - 'fileLinkFormat' => null, - ]; - private $extraDisplayOptions = []; - - /** - * {@inheritdoc} - */ - public function __construct($output = null, string $charset = null, int $flags = 0) - { - AbstractDumper::__construct($output, $charset, $flags); - $this->dumpId = 'sf-dump-'.mt_rand(); - $this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - $this->styles = static::$themes['dark'] ?? self::$themes['dark']; - } - - /** - * {@inheritdoc} - */ - public function setStyles(array $styles) - { - $this->headerIsDumped = false; - $this->styles = $styles + $this->styles; - } - - public function setTheme(string $themeName) - { - if (!isset(static::$themes[$themeName])) { - throw new \InvalidArgumentException(sprintf('Theme "%s" does not exist in class "%s".', $themeName, static::class)); - } - - $this->setStyles(static::$themes[$themeName]); - } - - /** - * Configures display options. - * - * @param array $displayOptions A map of display options to customize the behavior - */ - public function setDisplayOptions(array $displayOptions) - { - $this->headerIsDumped = false; - $this->displayOptions = $displayOptions + $this->displayOptions; - } - - /** - * Sets an HTML header that will be dumped once in the output stream. - * - * @param string $header An HTML string - */ - public function setDumpHeader($header) - { - $this->dumpHeader = $header; - } - - /** - * Sets an HTML prefix and suffix that will encapse every single dump. - * - * @param string $prefix The prepended HTML string - * @param string $suffix The appended HTML string - */ - public function setDumpBoundaries($prefix, $suffix) - { - $this->dumpPrefix = $prefix; - $this->dumpSuffix = $suffix; - } - - /** - * {@inheritdoc} - */ - public function dump(Data $data, $output = null, array $extraDisplayOptions = []) - { - $this->extraDisplayOptions = $extraDisplayOptions; - $result = parent::dump($data, $output); - $this->dumpId = 'sf-dump-'.mt_rand(); - - return $result; - } - - /** - * Dumps the HTML header. - */ - protected function getDumpHeader() - { - $this->headerIsDumped = null !== $this->outputStream ? $this->outputStream : $this->lineDumper; - - if (null !== $this->dumpHeader) { - return $this->dumpHeader; - } - - $line = str_replace('{$options}', json_encode($this->displayOptions, JSON_FORCE_OBJECT), <<<'EOHTML' -'.$this->dumpHeader; - } - - /** - * {@inheritdoc} - */ - public function enterHash(Cursor $cursor, $type, $class, $hasChild) - { - parent::enterHash($cursor, $type, $class, false); - - if ($cursor->skipChildren) { - $cursor->skipChildren = false; - $eol = ' class=sf-dump-compact>'; - } elseif ($this->expandNextHash) { - $this->expandNextHash = false; - $eol = ' class=sf-dump-expanded>'; - } else { - $eol = '>'; - } - - if ($hasChild) { - $this->line .= 'refIndex) { - $r = Cursor::HASH_OBJECT !== $type ? 1 - (Cursor::HASH_RESOURCE !== $type) : 2; - $r .= $r && 0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->refIndex; - - $this->line .= sprintf(' id=%s-ref%s', $this->dumpId, $r); - } - $this->line .= $eol; - $this->dumpLine($cursor->depth); - } - } - - /** - * {@inheritdoc} - */ - public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut) - { - $this->dumpEllipsis($cursor, $hasChild, $cut); - if ($hasChild) { - $this->line .= ''; - } - parent::leaveHash($cursor, $type, $class, $hasChild, 0); - } - - /** - * {@inheritdoc} - */ - protected function style($style, $value, $attr = []) - { - if ('' === $value) { - return ''; - } - - $v = esc($value); - - if ('ref' === $style) { - if (empty($attr['count'])) { - return sprintf('%s', $v); - } - $r = ('#' !== $v[0] ? 1 - ('@' !== $v[0]) : 2).substr($value, 1); - - return sprintf('%s', $this->dumpId, $r, 1 + $attr['count'], $v); - } - - if ('const' === $style && isset($attr['value'])) { - $style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value']))); - } elseif ('public' === $style) { - $style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property'); - } elseif ('str' === $style && 1 < $attr['length']) { - $style .= sprintf(' title="%d%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : ''); - } elseif ('note' === $style && false !== $c = strrpos($v, '\\')) { - if (isset($attr['file']) && $link = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) { - $link = sprintf('^', esc($this->utf8Encode($link))); - } else { - $link = ''; - } - - return sprintf('%s%s', $v, $style, substr($v, $c + 1), $link); - } elseif ('protected' === $style) { - $style .= ' title="Protected property"'; - } elseif ('meta' === $style && isset($attr['title'])) { - $style .= sprintf(' title="%s"', esc($this->utf8Encode($attr['title']))); - } elseif ('private' === $style) { - $style .= sprintf(' title="Private property defined in class: `%s`"', esc($this->utf8Encode($attr['class']))); - } - $map = static::$controlCharsMap; - - if (isset($attr['ellipsis'])) { - $class = 'sf-dump-ellipsis'; - if (isset($attr['ellipsis-type'])) { - $class = sprintf('"%s sf-dump-ellipsis-%s"', $class, $attr['ellipsis-type']); - } - $label = esc(substr($value, -$attr['ellipsis'])); - $style = str_replace(' title="', " title=\"$v\n", $style); - $v = sprintf('%s', $class, substr($v, 0, -\strlen($label))); - - if (!empty($attr['ellipsis-tail'])) { - $tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']))); - $v .= sprintf('%s%s', substr($label, 0, $tail), substr($label, $tail)); - } else { - $v .= $label; - } - } - - $v = "".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) { - $s = $b = ''; - }, $v).''; - - if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) { - $attr['href'] = $href; - } - if (isset($attr['href'])) { - $target = isset($attr['file']) ? '' : ' target="_blank"'; - $v = sprintf('%s', esc($this->utf8Encode($attr['href'])), $target, $v); - } - if (isset($attr['lang'])) { - $v = sprintf('%s', esc($attr['lang']), $v); - } - - return $v; - } - - /** - * {@inheritdoc} - */ - protected function dumpLine($depth, $endOfValue = false) - { - if (-1 === $this->lastDepth) { - $this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line; - } - if ($this->headerIsDumped !== (null !== $this->outputStream ? $this->outputStream : $this->lineDumper)) { - $this->line = $this->getDumpHeader().$this->line; - } - - if (-1 === $depth) { - $args = ['"'.$this->dumpId.'"']; - if ($this->extraDisplayOptions) { - $args[] = json_encode($this->extraDisplayOptions, JSON_FORCE_OBJECT); - } - // Replace is for BC - $this->line .= sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args)); - } - $this->lastDepth = $depth; - - $this->line = mb_convert_encoding($this->line, 'HTML-ENTITIES', 'UTF-8'); - - if (-1 === $depth) { - AbstractDumper::dumpLine(0); - } - AbstractDumper::dumpLine($depth); - } - - private function getSourceLink($file, $line) - { - $options = $this->extraDisplayOptions + $this->displayOptions; - - if ($fmt = $options['fileLinkFormat']) { - return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line); - } - - return false; - } -} - -function esc($str) -{ - return htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); -} diff --git a/vendor/symfony/var-dumper/Dumper/ServerDumper.php b/vendor/symfony/var-dumper/Dumper/ServerDumper.php deleted file mode 100644 index 94795bf6..00000000 --- a/vendor/symfony/var-dumper/Dumper/ServerDumper.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Dumper; - -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface; -use Symfony\Component\VarDumper\Server\Connection; - -/** - * ServerDumper forwards serialized Data clones to a server. - * - * @author Maxime Steinhausser - */ -class ServerDumper implements DataDumperInterface -{ - private $connection; - private $wrappedDumper; - - /** - * @param string $host The server host - * @param DataDumperInterface|null $wrappedDumper A wrapped instance used whenever we failed contacting the server - * @param ContextProviderInterface[] $contextProviders Context providers indexed by context name - */ - public function __construct(string $host, DataDumperInterface $wrappedDumper = null, array $contextProviders = []) - { - $this->connection = new Connection($host, $contextProviders); - $this->wrappedDumper = $wrappedDumper; - } - - public function getContextProviders(): array - { - return $this->connection->getContextProviders(); - } - - /** - * {@inheritdoc} - */ - public function dump(Data $data) - { - if (!$this->connection->write($data) && $this->wrappedDumper) { - $this->wrappedDumper->dump($data); - } - } -} diff --git a/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php b/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php deleted file mode 100644 index af47753a..00000000 --- a/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Exception; - -/** - * @author Nicolas Grekas - */ -class ThrowingCasterException extends \Exception -{ - /** - * @param \Exception $prev The exception thrown from the caster - */ - public function __construct(\Exception $prev) - { - parent::__construct('Unexpected '.\get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev); - } -} diff --git a/vendor/symfony/var-dumper/LICENSE b/vendor/symfony/var-dumper/LICENSE deleted file mode 100644 index cf8b3ebe..00000000 --- a/vendor/symfony/var-dumper/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014-2019 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/symfony/var-dumper/README.md b/vendor/symfony/var-dumper/README.md deleted file mode 100644 index 339f73eb..00000000 --- a/vendor/symfony/var-dumper/README.md +++ /dev/null @@ -1,15 +0,0 @@ -VarDumper Component -=================== - -The VarDumper component provides mechanisms for walking through any arbitrary -PHP variable. It provides a better `dump()` function that you can use instead -of `var_dump`. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/var_dumper/introduction.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/var-dumper/Resources/bin/var-dump-server b/vendor/symfony/var-dumper/Resources/bin/var-dump-server deleted file mode 100644 index 98c813a0..00000000 --- a/vendor/symfony/var-dumper/Resources/bin/var-dump-server +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env php - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Starts a dump server to collect and output dumps on a single place with multiple formats support. - * - * @author Maxime Steinhausser - */ - -use Psr\Log\LoggerInterface; -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Logger\ConsoleLogger; -use Symfony\Component\Console\Output\ConsoleOutput; -use Symfony\Component\VarDumper\Command\ServerDumpCommand; -use Symfony\Component\VarDumper\Server\DumpServer; - -function includeIfExists(string $file): bool -{ - return file_exists($file) && include $file; -} - -if ( - !includeIfExists(__DIR__ . '/../../../../autoload.php') && - !includeIfExists(__DIR__ . '/../../vendor/autoload.php') && - !includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php') -) { - fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL); - exit(1); -} - -if (!class_exists(Application::class)) { - fwrite(STDERR, 'You need the "symfony/console" component in order to run the VarDumper server.'.PHP_EOL); - exit(1); -} - -$input = new ArgvInput(); -$output = new ConsoleOutput(); -$defaultHost = '127.0.0.1:9912'; -$host = $input->getParameterOption(['--host'], $_SERVER['VAR_DUMPER_SERVER'] ?? $defaultHost, true); -$logger = interface_exists(LoggerInterface::class) ? new ConsoleLogger($output->getErrorOutput()) : null; - -$app = new Application(); - -$app->getDefinition()->addOption( - new InputOption('--host', null, InputOption::VALUE_REQUIRED, 'The address the server should listen to', $defaultHost) -); - -$app->add($command = new ServerDumpCommand(new DumpServer($host, $logger))) - ->getApplication() - ->setDefaultCommand($command->getName(), true) - ->run($input, $output) -; diff --git a/vendor/symfony/var-dumper/Resources/css/htmlDescriptor.css b/vendor/symfony/var-dumper/Resources/css/htmlDescriptor.css deleted file mode 100644 index 8f706d64..00000000 --- a/vendor/symfony/var-dumper/Resources/css/htmlDescriptor.css +++ /dev/null @@ -1,130 +0,0 @@ -body { - display: flex; - flex-direction: column-reverse; - justify-content: flex-end; - max-width: 1140px; - margin: auto; - padding: 15px; - word-wrap: break-word; - background-color: #F9F9F9; - color: #222; - font-family: Helvetica, Arial, sans-serif; - font-size: 14px; - line-height: 1.4; -} -p { - margin: 0; -} -a { - color: #218BC3; - text-decoration: none; -} -a:hover { - text-decoration: underline; -} -.text-small { - font-size: 12px !important; -} -article { - margin: 5px; - margin-bottom: 10px; -} -article > header > .row { - display: flex; - flex-direction: row; - align-items: baseline; - margin-bottom: 10px; -} -article > header > .row > .col { - flex: 1; - display: flex; - align-items: baseline; -} -article > header > .row > h2 { - font-size: 14px; - color: #222; - font-weight: normal; - font-family: "Lucida Console", monospace, sans-serif; - word-break: break-all; - margin: 20px 5px 0 0; - user-select: all; -} -article > header > .row > h2 > code { - white-space: nowrap; - user-select: none; - color: #cc2255; - background-color: #f7f7f9; - border: 1px solid #e1e1e8; - border-radius: 3px; - margin-right: 5px; - padding: 0 3px; -} -article > header > .row > time.col { - flex: 0; - text-align: right; - white-space: nowrap; - color: #999; - font-style: italic; -} -article > header ul.tags { - list-style: none; - padding: 0; - margin: 0; - font-size: 12px; -} -article > header ul.tags > li { - user-select: all; - margin-bottom: 2px; -} -article > header ul.tags > li > span.badge { - display: inline-block; - padding: .25em .4em; - margin-right: 5px; - border-radius: 4px; - background-color: #6c757d3b; - color: #524d4d; - font-size: 12px; - text-align: center; - font-weight: 700; - line-height: 1; - white-space: nowrap; - vertical-align: baseline; - user-select: none; -} -article > section.body { - border: 1px solid #d8d8d8; - background: #FFF; - padding: 10px; - border-radius: 3px; -} -pre.sf-dump { - border-radius: 3px; - margin-bottom: 0; -} -.hidden { - display: none !important; -} -.dumped-tag > .sf-dump { - display: inline-block; - margin: 0; - padding: 1px 5px; - line-height: 1.4; - vertical-align: top; - background-color: transparent; - user-select: auto; -} -.dumped-tag > pre.sf-dump, -.dumped-tag > .sf-dump-default { - color: #CC7832; - background: none; -} -.dumped-tag > .sf-dump .sf-dump-str { color: #629755; } -.dumped-tag > .sf-dump .sf-dump-private, -.dumped-tag > .sf-dump .sf-dump-protected, -.dumped-tag > .sf-dump .sf-dump-public { color: #262626; } -.dumped-tag > .sf-dump .sf-dump-note { color: #6897BB; } -.dumped-tag > .sf-dump .sf-dump-key { color: #789339; } -.dumped-tag > .sf-dump .sf-dump-ref { color: #6E6E6E; } -.dumped-tag > .sf-dump .sf-dump-ellipsis { color: #CC7832; max-width: 100em; } -.dumped-tag > .sf-dump .sf-dump-ellipsis-path { max-width: 5em; } -.dumped-tag > .sf-dump .sf-dump-ns { user-select: none; } diff --git a/vendor/symfony/var-dumper/Resources/functions/dump.php b/vendor/symfony/var-dumper/Resources/functions/dump.php deleted file mode 100644 index e1543a8d..00000000 --- a/vendor/symfony/var-dumper/Resources/functions/dump.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Component\VarDumper\VarDumper; - -if (!function_exists('dump')) { - /** - * @author Nicolas Grekas - */ - function dump($var, ...$moreVars) - { - VarDumper::dump($var); - - foreach ($moreVars as $v) { - VarDumper::dump($v); - } - - if (1 < func_num_args()) { - return func_get_args(); - } - - return $var; - } -} - -if (!function_exists('dd')) { - function dd(...$vars) - { - foreach ($vars as $v) { - VarDumper::dump($v); - } - - die(1); - } -} diff --git a/vendor/symfony/var-dumper/Resources/js/htmlDescriptor.js b/vendor/symfony/var-dumper/Resources/js/htmlDescriptor.js deleted file mode 100644 index 63101e57..00000000 --- a/vendor/symfony/var-dumper/Resources/js/htmlDescriptor.js +++ /dev/null @@ -1,10 +0,0 @@ -document.addEventListener('DOMContentLoaded', function() { - let prev = null; - Array.from(document.getElementsByTagName('article')).reverse().forEach(function (article) { - const dedupId = article.dataset.dedupId; - if (dedupId === prev) { - article.getElementsByTagName('header')[0].classList.add('hidden'); - } - prev = dedupId; - }); -}); diff --git a/vendor/symfony/var-dumper/Server/Connection.php b/vendor/symfony/var-dumper/Server/Connection.php deleted file mode 100644 index 8b814cb6..00000000 --- a/vendor/symfony/var-dumper/Server/Connection.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Server; - -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface; - -/** - * Forwards serialized Data clones to a server. - * - * @author Maxime Steinhausser - */ -class Connection -{ - private $host; - private $contextProviders; - private $socket; - - /** - * @param string $host The server host - * @param ContextProviderInterface[] $contextProviders Context providers indexed by context name - */ - public function __construct(string $host, array $contextProviders = []) - { - if (false === strpos($host, '://')) { - $host = 'tcp://'.$host; - } - - $this->host = $host; - $this->contextProviders = $contextProviders; - } - - public function getContextProviders(): array - { - return $this->contextProviders; - } - - public function write(Data $data): bool - { - $socketIsFresh = !$this->socket; - if (!$this->socket = $this->socket ?: $this->createSocket()) { - return false; - } - - $context = ['timestamp' => microtime(true)]; - foreach ($this->contextProviders as $name => $provider) { - $context[$name] = $provider->getContext(); - } - $context = array_filter($context); - $encodedPayload = base64_encode(serialize([$data, $context]))."\n"; - - set_error_handler([self::class, 'nullErrorHandler']); - try { - if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) { - return true; - } - if (!$socketIsFresh) { - stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR); - fclose($this->socket); - $this->socket = $this->createSocket(); - } - if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) { - return true; - } - } finally { - restore_error_handler(); - } - - return false; - } - - private static function nullErrorHandler($t, $m) - { - // no-op - } - - private function createSocket() - { - set_error_handler([self::class, 'nullErrorHandler']); - try { - return stream_socket_client($this->host, $errno, $errstr, 3, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT); - } finally { - restore_error_handler(); - } - } -} diff --git a/vendor/symfony/var-dumper/Server/DumpServer.php b/vendor/symfony/var-dumper/Server/DumpServer.php deleted file mode 100644 index ad920bd4..00000000 --- a/vendor/symfony/var-dumper/Server/DumpServer.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Server; - -use Psr\Log\LoggerInterface; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Cloner\Stub; - -/** - * A server collecting Data clones sent by a ServerDumper. - * - * @author Maxime Steinhausser - * - * @final - */ -class DumpServer -{ - private $host; - private $socket; - private $logger; - - public function __construct(string $host, LoggerInterface $logger = null) - { - if (false === strpos($host, '://')) { - $host = 'tcp://'.$host; - } - - $this->host = $host; - $this->logger = $logger; - } - - public function start(): void - { - if (!$this->socket = stream_socket_server($this->host, $errno, $errstr)) { - throw new \RuntimeException(sprintf('Server start failed on "%s": %s %s.', $this->host, $errstr, $errno)); - } - } - - public function listen(callable $callback): void - { - if (null === $this->socket) { - $this->start(); - } - - foreach ($this->getMessages() as $clientId => $message) { - $payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class]]); - - // Impossible to decode the message, give up. - if (false === $payload) { - if ($this->logger) { - $this->logger->warning('Unable to decode a message from {clientId} client.', ['clientId' => $clientId]); - } - - continue; - } - - if (!\is_array($payload) || \count($payload) < 2 || !$payload[0] instanceof Data || !\is_array($payload[1])) { - if ($this->logger) { - $this->logger->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', ['clientId' => $clientId]); - } - - continue; - } - - list($data, $context) = $payload; - - $callback($data, $context, $clientId); - } - } - - public function getHost(): string - { - return $this->host; - } - - private function getMessages(): iterable - { - $sockets = [(int) $this->socket => $this->socket]; - $write = []; - - while (true) { - $read = $sockets; - stream_select($read, $write, $write, null); - - foreach ($read as $stream) { - if ($this->socket === $stream) { - $stream = stream_socket_accept($this->socket); - $sockets[(int) $stream] = $stream; - } elseif (feof($stream)) { - unset($sockets[(int) $stream]); - fclose($stream); - } else { - yield (int) $stream => fgets($stream); - } - } - } - } -} diff --git a/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php b/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php deleted file mode 100644 index 6aa965d9..00000000 --- a/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Test; - -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\CliDumper; - -/** - * @author Nicolas Grekas - */ -trait VarDumperTestTrait -{ - public function assertDumpEquals($expected, $data, $filter = 0, $message = '') - { - $this->assertSame($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); - } - - public function assertDumpMatchesFormat($expected, $data, $filter = 0, $message = '') - { - $this->assertStringMatchesFormat($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); - } - - /** - * @return string|null - */ - protected function getDump($data, $key = null, $filter = 0) - { - $flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0; - $flags |= getenv('DUMP_STRING_LENGTH') ? CliDumper::DUMP_STRING_LENGTH : 0; - $flags |= getenv('DUMP_COMMA_SEPARATOR') ? CliDumper::DUMP_COMMA_SEPARATOR : 0; - - $cloner = new VarCloner(); - $cloner->setMaxItems(-1); - $dumper = new CliDumper(null, null, $flags); - $dumper->setColors(false); - $data = $cloner->cloneVar($data, $filter)->withRefHandles(false); - if (null !== $key && null === $data = $data->seek($key)) { - return null; - } - - return rtrim($dumper->dump($data, true)); - } - - private function prepareExpectation($expected, $filter) - { - if (!\is_string($expected)) { - $expected = $this->getDump($expected, null, $filter); - } - - return rtrim($expected); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/CasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/CasterTest.php deleted file mode 100644 index 2c2189c8..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/CasterTest.php +++ /dev/null @@ -1,178 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Caster\Caster; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -/** - * @author Nicolas Grekas - */ -class CasterTest extends TestCase -{ - use VarDumperTestTrait; - - private $referenceArray = [ - 'null' => null, - 'empty' => false, - 'public' => 'pub', - "\0~\0virtual" => 'virt', - "\0+\0dynamic" => 'dyn', - "\0*\0protected" => 'prot', - "\0Foo\0private" => 'priv', - ]; - - /** - * @dataProvider provideFilter - */ - public function testFilter($filter, $expectedDiff, $listedProperties = null) - { - if (null === $listedProperties) { - $filteredArray = Caster::filter($this->referenceArray, $filter); - } else { - $filteredArray = Caster::filter($this->referenceArray, $filter, $listedProperties); - } - - $this->assertSame($expectedDiff, array_diff_assoc($this->referenceArray, $filteredArray)); - } - - public function provideFilter() - { - return [ - [ - 0, - [], - ], - [ - Caster::EXCLUDE_PUBLIC, - [ - 'null' => null, - 'empty' => false, - 'public' => 'pub', - ], - ], - [ - Caster::EXCLUDE_NULL, - [ - 'null' => null, - ], - ], - [ - Caster::EXCLUDE_EMPTY, - [ - 'null' => null, - 'empty' => false, - ], - ], - [ - Caster::EXCLUDE_VIRTUAL, - [ - "\0~\0virtual" => 'virt', - ], - ], - [ - Caster::EXCLUDE_DYNAMIC, - [ - "\0+\0dynamic" => 'dyn', - ], - ], - [ - Caster::EXCLUDE_PROTECTED, - [ - "\0*\0protected" => 'prot', - ], - ], - [ - Caster::EXCLUDE_PRIVATE, - [ - "\0Foo\0private" => 'priv', - ], - ], - [ - Caster::EXCLUDE_VERBOSE, - [ - 'public' => 'pub', - "\0*\0protected" => 'prot', - ], - ['public', "\0*\0protected"], - ], - [ - Caster::EXCLUDE_NOT_IMPORTANT, - [ - 'null' => null, - 'empty' => false, - "\0~\0virtual" => 'virt', - "\0+\0dynamic" => 'dyn', - "\0Foo\0private" => 'priv', - ], - ['public', "\0*\0protected"], - ], - [ - Caster::EXCLUDE_VIRTUAL | Caster::EXCLUDE_DYNAMIC, - [ - "\0~\0virtual" => 'virt', - "\0+\0dynamic" => 'dyn', - ], - ], - [ - Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE, - $this->referenceArray, - ['public', "\0*\0protected"], - ], - [ - Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY, - [ - 'null' => null, - 'empty' => false, - "\0~\0virtual" => 'virt', - "\0+\0dynamic" => 'dyn', - "\0*\0protected" => 'prot', - "\0Foo\0private" => 'priv', - ], - ['public', 'empty'], - ], - [ - Caster::EXCLUDE_VERBOSE | Caster::EXCLUDE_EMPTY | Caster::EXCLUDE_STRICT, - [ - 'empty' => false, - ], - ['public', 'empty'], - ], - ]; - } - - public function testAnonymousClass() - { - $c = eval('return new class extends stdClass { private $foo = "foo"; };'); - - $this->assertDumpMatchesFormat( - <<<'EOTXT' -stdClass@anonymous { - -foo: "foo" -} -EOTXT - , $c - ); - - $c = eval('return new class { private $foo = "foo"; };'); - - $this->assertDumpMatchesFormat( - <<<'EOTXT' -@anonymous { - -foo: "foo" -} -EOTXT - , $c - ); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php deleted file mode 100644 index dae13efe..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php +++ /dev/null @@ -1,390 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Caster\Caster; -use Symfony\Component\VarDumper\Caster\DateCaster; -use Symfony\Component\VarDumper\Cloner\Stub; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -/** - * @author Dany Maillard - */ -class DateCasterTest extends TestCase -{ - use VarDumperTestTrait; - - /** - * @dataProvider provideDateTimes - */ - public function testDumpDateTime($time, $timezone, $xDate, $xTimestamp) - { - $date = new \DateTime($time, new \DateTimeZone($timezone)); - - $xDump = <<assertDumpEquals($xDump, $date); - } - - /** - * @dataProvider provideDateTimes - */ - public function testCastDateTime($time, $timezone, $xDate, $xTimestamp, $xInfos) - { - $stub = new Stub(); - $date = new \DateTime($time, new \DateTimeZone($timezone)); - $cast = DateCaster::castDateTime($date, ['foo' => 'bar'], $stub, false, 0); - - $xDump = << $xDate -] -EODUMP; - - $this->assertDumpEquals($xDump, $cast); - - $xDump = <<assertDumpMatchesFormat($xDump, $cast["\0~\0date"]); - } - - public function provideDateTimes() - { - return [ - ['2017-04-30 00:00:00.000000', 'Europe/Zurich', '2017-04-30 00:00:00.0 Europe/Zurich (+02:00)', 1493503200, 'Sunday, April 30, 2017%Afrom now%ADST On'], - ['2017-12-31 00:00:00.000000', 'Europe/Zurich', '2017-12-31 00:00:00.0 Europe/Zurich (+01:00)', 1514674800, 'Sunday, December 31, 2017%Afrom now%ADST Off'], - ['2017-04-30 00:00:00.000000', '+02:00', '2017-04-30 00:00:00.0 +02:00', 1493503200, 'Sunday, April 30, 2017%Afrom now'], - - ['2017-04-30 00:00:00.100000', '+00:00', '2017-04-30 00:00:00.100 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'], - ['2017-04-30 00:00:00.120000', '+00:00', '2017-04-30 00:00:00.120 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'], - ['2017-04-30 00:00:00.123000', '+00:00', '2017-04-30 00:00:00.123 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'], - ['2017-04-30 00:00:00.123400', '+00:00', '2017-04-30 00:00:00.123400 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'], - ['2017-04-30 00:00:00.123450', '+00:00', '2017-04-30 00:00:00.123450 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'], - ['2017-04-30 00:00:00.123456', '+00:00', '2017-04-30 00:00:00.123456 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'], - ]; - } - - /** - * @dataProvider provideIntervals - */ - public function testDumpInterval($intervalSpec, $ms, $invert, $expected) - { - if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { - $this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.'); - } - - $interval = $this->createInterval($intervalSpec, $ms, $invert); - - $xDump = <<assertDumpMatchesFormat($xDump, $interval); - } - - /** - * @dataProvider provideIntervals - */ - public function testDumpIntervalExcludingVerbosity($intervalSpec, $ms, $invert, $expected) - { - if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { - $this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.'); - } - - $interval = $this->createInterval($intervalSpec, $ms, $invert); - - $xDump = <<assertDumpEquals($xDump, $interval, Caster::EXCLUDE_VERBOSE); - } - - /** - * @dataProvider provideIntervals - */ - public function testCastInterval($intervalSpec, $ms, $invert, $xInterval, $xSeconds) - { - if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { - $this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.'); - } - - $interval = $this->createInterval($intervalSpec, $ms, $invert); - $stub = new Stub(); - - $cast = DateCaster::castInterval($interval, ['foo' => 'bar'], $stub, false, Caster::EXCLUDE_VERBOSE); - - $xDump = << $xInterval -] -EODUMP; - - $this->assertDumpEquals($xDump, $cast); - - if (null === $xSeconds) { - return; - } - - $xDump = <<assertDumpMatchesFormat($xDump, $cast["\0~\0interval"]); - } - - public function provideIntervals() - { - return [ - ['PT0S', 0, 0, '0s', '0s'], - ['PT0S', 0.1, 0, '+ 00:00:00.100', '%is'], - ['PT1S', 0, 0, '+ 00:00:01.0', '%is'], - ['PT2M', 0, 0, '+ 00:02:00.0', '%is'], - ['PT3H', 0, 0, '+ 03:00:00.0', '%ss'], - ['P4D', 0, 0, '+ 4d', '%ss'], - ['P5M', 0, 0, '+ 5m', null], - ['P6Y', 0, 0, '+ 6y', null], - ['P1Y2M3DT4H5M6S', 0, 0, '+ 1y 2m 3d 04:05:06.0', null], - ['PT1M60S', 0, 0, '+ 00:02:00.0', null], - ['PT1H60M', 0, 0, '+ 02:00:00.0', null], - ['P1DT24H', 0, 0, '+ 2d', null], - ['P1M32D', 0, 0, '+ 1m 32d', null], - - ['PT0S', 0, 1, '0s', '0s'], - ['PT0S', 0.1, 1, '- 00:00:00.100', '%is'], - ['PT1S', 0, 1, '- 00:00:01.0', '%is'], - ['PT2M', 0, 1, '- 00:02:00.0', '%is'], - ['PT3H', 0, 1, '- 03:00:00.0', '%ss'], - ['P4D', 0, 1, '- 4d', '%ss'], - ['P5M', 0, 1, '- 5m', null], - ['P6Y', 0, 1, '- 6y', null], - ['P1Y2M3DT4H5M6S', 0, 1, '- 1y 2m 3d 04:05:06.0', null], - ['PT1M60S', 0, 1, '- 00:02:00.0', null], - ['PT1H60M', 0, 1, '- 02:00:00.0', null], - ['P1DT24H', 0, 1, '- 2d', null], - ['P1M32D', 0, 1, '- 1m 32d', null], - ]; - } - - /** - * @dataProvider provideTimeZones - */ - public function testDumpTimeZone($timezone, $expected) - { - $timezone = new \DateTimeZone($timezone); - - $xDump = <<assertDumpMatchesFormat($xDump, $timezone); - } - - /** - * @dataProvider provideTimeZones - */ - public function testDumpTimeZoneExcludingVerbosity($timezone, $expected) - { - $timezone = new \DateTimeZone($timezone); - - $xDump = <<assertDumpMatchesFormat($xDump, $timezone, Caster::EXCLUDE_VERBOSE); - } - - /** - * @dataProvider provideTimeZones - */ - public function testCastTimeZone($timezone, $xTimezone, $xRegion) - { - $timezone = new \DateTimeZone($timezone); - $stub = new Stub(); - - $cast = DateCaster::castTimeZone($timezone, ['foo' => 'bar'], $stub, false, Caster::EXCLUDE_VERBOSE); - - $xDump = << $xTimezone -] -EODUMP; - - $this->assertDumpMatchesFormat($xDump, $cast); - - $xDump = <<assertDumpMatchesFormat($xDump, $cast["\0~\0timezone"]); - } - - public function provideTimeZones() - { - $xRegion = \extension_loaded('intl') ? '%s' : ''; - - return [ - // type 1 (UTC offset) - ['-12:00', '-12:00', ''], - ['+00:00', '+00:00', ''], - ['+14:00', '+14:00', ''], - - // type 2 (timezone abbreviation) - ['GMT', '+00:00', ''], - ['a', '+01:00', ''], - ['b', '+02:00', ''], - ['z', '+00:00', ''], - - // type 3 (timezone identifier) - ['Africa/Tunis', 'Africa/Tunis (%s:00)', $xRegion], - ['America/Panama', 'America/Panama (%s:00)', $xRegion], - ['Asia/Jerusalem', 'Asia/Jerusalem (%s:00)', $xRegion], - ['Atlantic/Canary', 'Atlantic/Canary (%s:00)', $xRegion], - ['Australia/Perth', 'Australia/Perth (%s:00)', $xRegion], - ['Europe/Zurich', 'Europe/Zurich (%s:00)', $xRegion], - ['Pacific/Tahiti', 'Pacific/Tahiti (%s:00)', $xRegion], - ]; - } - - /** - * @dataProvider providePeriods - */ - public function testDumpPeriod($start, $interval, $end, $options, $expected) - { - $p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options); - - $xDump = <<assertDumpMatchesFormat($xDump, $p); - } - - /** - * @dataProvider providePeriods - */ - public function testCastPeriod($start, $interval, $end, $options, $xPeriod, $xDates) - { - $p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options); - $stub = new Stub(); - - $cast = DateCaster::castPeriod($p, [], $stub, false, 0); - - $xDump = << $xPeriod -] -EODUMP; - - $this->assertDumpEquals($xDump, $cast); - - $xDump = <<assertDumpMatchesFormat($xDump, $cast["\0~\0period"]); - } - - public function providePeriods() - { - $periods = [ - ['2017-01-01', 'P1D', '2017-01-03', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02'], - ['2017-01-01', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01%a2) 2017-01-02'], - - ['2017-01-01', 'P1D', '2017-01-04', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-04 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'], - ['2017-01-01', 'P1D', 2, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 3 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'], - - ['2017-01-01', 'P1D', '2017-01-05', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-05 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a1 more'], - ['2017-01-01', 'P1D', 3, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 4 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03%a1 more'], - - ['2017-01-01', 'P1D', '2017-01-21', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-21 00:00:00.0', '1) 2017-01-01%a17 more'], - ['2017-01-01', 'P1D', 19, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 20 time/s', '1) 2017-01-01%a17 more'], - - ['2017-01-01 01:00:00', 'P1D', '2017-01-03 01:00:00', 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) to 2017-01-03 01:00:00.0', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'], - ['2017-01-01 01:00:00', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'], - - ['2017-01-01', 'P1DT1H', '2017-01-03', 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'], - ['2017-01-01', 'P1DT1H', 1, 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'], - - ['2017-01-01', 'P1D', '2017-01-04', \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) to 2017-01-04 00:00:00.0', '1) 2017-01-02%a2) 2017-01-03'], - ['2017-01-01', 'P1D', 2, \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) recurring 2 time/s', '1) 2017-01-02%a2) 2017-01-03'], - ]; - - if (\PHP_VERSION_ID < 70107) { - array_walk($periods, function (&$i) { $i[5] = ''; }); - } - - return $periods; - } - - private function createInterval($intervalSpec, $ms, $invert) - { - $interval = new \DateInterval($intervalSpec); - $interval->f = $ms; - $interval->invert = $invert; - - return $interval; - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php deleted file mode 100644 index 76259770..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php +++ /dev/null @@ -1,244 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Caster\Caster; -use Symfony\Component\VarDumper\Caster\ExceptionCaster; -use Symfony\Component\VarDumper\Caster\FrameStub; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -class ExceptionCasterTest extends TestCase -{ - use VarDumperTestTrait; - - private function getTestException($msg, &$ref = null) - { - return new \Exception(''.$msg); - } - - protected function tearDown(): void - { - ExceptionCaster::$srcContext = 1; - ExceptionCaster::$traceArgs = true; - } - - public function testDefaultSettings() - { - $ref = ['foo']; - $e = $this->getTestException('foo', $ref); - - $expectedDump = <<<'EODUMP' -Exception { - #message: "foo" - #code: 0 - #file: "%sExceptionCasterTest.php" - #line: 28 - trace: { - %s%eTests%eCaster%eExceptionCasterTest.php:28 { - › { - › return new \Exception(''.$msg); - › } - } - %s%eTests%eCaster%eExceptionCasterTest.php:40 { …} -%A -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $e); - $this->assertSame(['foo'], $ref); - } - - public function testSeek() - { - $e = $this->getTestException(2); - - $expectedDump = <<<'EODUMP' -{ - %s%eTests%eCaster%eExceptionCasterTest.php:28 { - › { - › return new \Exception(''.$msg); - › } - } - %s%eTests%eCaster%eExceptionCasterTest.php:64 { …} -%A -EODUMP; - - $this->assertStringMatchesFormat($expectedDump, $this->getDump($e, 'trace')); - } - - public function testNoArgs() - { - $e = $this->getTestException(1); - ExceptionCaster::$traceArgs = false; - - $expectedDump = <<<'EODUMP' -Exception { - #message: "1" - #code: 0 - #file: "%sExceptionCasterTest.php" - #line: 28 - trace: { - %sExceptionCasterTest.php:28 { - › { - › return new \Exception(''.$msg); - › } - } - %s%eTests%eCaster%eExceptionCasterTest.php:82 { …} -%A -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $e); - } - - public function testNoSrcContext() - { - $e = $this->getTestException(1); - ExceptionCaster::$srcContext = -1; - - $expectedDump = <<<'EODUMP' -Exception { - #message: "1" - #code: 0 - #file: "%sExceptionCasterTest.php" - #line: 28 - trace: { - %s%eTests%eCaster%eExceptionCasterTest.php:28 - %s%eTests%eCaster%eExceptionCasterTest.php:%d -%A -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $e); - } - - public function testHtmlDump() - { - if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) { - $this->markTestSkipped('A custom file_link_format is defined.'); - } - - $e = $this->getTestException(1); - ExceptionCaster::$srcContext = -1; - - $cloner = new VarCloner(); - $cloner->setMaxItems(1); - $dumper = new HtmlDumper(); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $dump = $dumper->dump($cloner->cloneVar($e)->withRefHandles(false), true); - - $expectedDump = <<<'EODUMP' -Exception { - #message: "1" - #code: 0 - #file: "%s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php" - #line: 28 - trace: { - %s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php:28 - …%d - } -} - -EODUMP; - - $this->assertStringMatchesFormat($expectedDump, $dump); - } - - /** - * @requires function Twig\Template::getSourceContext - */ - public function testFrameWithTwig() - { - require_once \dirname(__DIR__).'/Fixtures/Twig.php'; - - $f = [ - new FrameStub([ - 'file' => \dirname(__DIR__).'/Fixtures/Twig.php', - 'line' => 20, - 'class' => '__TwigTemplate_VarDumperFixture_u75a09', - ]), - new FrameStub([ - 'file' => \dirname(__DIR__).'/Fixtures/Twig.php', - 'line' => 21, - 'class' => '__TwigTemplate_VarDumperFixture_u75a09', - 'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__), - ]), - ]; - - $expectedDump = <<<'EODUMP' -array:2 [ - 0 => { - class: "__TwigTemplate_VarDumperFixture_u75a09" - src: { - %sTwig.php:1 { - › - › foo bar - › twig source - } - } - } - 1 => { - class: "__TwigTemplate_VarDumperFixture_u75a09" - object: __TwigTemplate_VarDumperFixture_u75a09 { - %A - } - src: { - %sExceptionCasterTest.php:2 { - › foo bar - › twig source - › - } - } - } -] - -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $f); - } - - public function testExcludeVerbosity() - { - $e = $this->getTestException('foo'); - - $expectedDump = <<<'EODUMP' -Exception { - #message: "foo" - #code: 0 - #file: "%sExceptionCasterTest.php" - #line: 28 -} -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $e, Caster::EXCLUDE_VERBOSE); - } - - public function testAnonymous() - { - $e = new \Exception(sprintf('Boo "%s" ba.', \get_class(new class('Foo') extends \Exception { - }))); - - $expectedDump = <<<'EODUMP' -Exception { - #message: "Boo "Exception@anonymous" ba." - #code: 0 - #file: "%sExceptionCasterTest.php" - #line: %d -} -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $e, Caster::EXCLUDE_VERBOSE); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/GmpCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/GmpCasterTest.php deleted file mode 100644 index eb758e8e..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/GmpCasterTest.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Caster\GmpCaster; -use Symfony\Component\VarDumper\Cloner\Stub; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -class GmpCasterTest extends TestCase -{ - use VarDumperTestTrait; - - /** - * @requires extension gmp - */ - public function testCastGmp() - { - $gmpString = gmp_init('1234'); - $gmpOctal = gmp_init(010); - $gmp = gmp_init('01101'); - $gmpDump = << %s -] -EODUMP; - $this->assertDumpEquals(sprintf($gmpDump, $gmpString), GmpCaster::castGmp($gmpString, [], new Stub(), false, 0)); - $this->assertDumpEquals(sprintf($gmpDump, $gmpOctal), GmpCaster::castGmp($gmpOctal, [], new Stub(), false, 0)); - $this->assertDumpEquals(sprintf($gmpDump, $gmp), GmpCaster::castGmp($gmp, [], new Stub(), false, 0)); - - $dump = <<assertDumpEquals($dump, $gmp); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/IntlCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/IntlCasterTest.php deleted file mode 100644 index 0bff5bf4..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/IntlCasterTest.php +++ /dev/null @@ -1,297 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -/** - * @requires extension intl - */ -class IntlCasterTest extends TestCase -{ - use VarDumperTestTrait; - - public function testMessageFormatter() - { - $var = new \MessageFormatter('en', 'Hello {name}'); - - $expected = <<assertDumpEquals($expected, $var); - } - - public function testCastNumberFormatter() - { - $var = new \NumberFormatter('en', \NumberFormatter::DECIMAL); - - $expectedLocale = $var->getLocale(); - $expectedPattern = $var->getPattern(); - - $expectedAttribute1 = $var->getAttribute(\NumberFormatter::PARSE_INT_ONLY); - $expectedAttribute2 = $var->getAttribute(\NumberFormatter::GROUPING_USED); - $expectedAttribute3 = $var->getAttribute(\NumberFormatter::DECIMAL_ALWAYS_SHOWN); - $expectedAttribute4 = $var->getAttribute(\NumberFormatter::MAX_INTEGER_DIGITS); - $expectedAttribute5 = $var->getAttribute(\NumberFormatter::MIN_INTEGER_DIGITS); - $expectedAttribute6 = $var->getAttribute(\NumberFormatter::INTEGER_DIGITS); - $expectedAttribute7 = $var->getAttribute(\NumberFormatter::MAX_FRACTION_DIGITS); - $expectedAttribute8 = $var->getAttribute(\NumberFormatter::MIN_FRACTION_DIGITS); - $expectedAttribute9 = $var->getAttribute(\NumberFormatter::FRACTION_DIGITS); - $expectedAttribute10 = $var->getAttribute(\NumberFormatter::MULTIPLIER); - $expectedAttribute11 = $var->getAttribute(\NumberFormatter::GROUPING_SIZE); - $expectedAttribute12 = $var->getAttribute(\NumberFormatter::ROUNDING_MODE); - $expectedAttribute13 = number_format($var->getAttribute(\NumberFormatter::ROUNDING_INCREMENT), 1); - $expectedAttribute14 = $this->getDump($var->getAttribute(\NumberFormatter::FORMAT_WIDTH)); - $expectedAttribute15 = $var->getAttribute(\NumberFormatter::PADDING_POSITION); - $expectedAttribute16 = $var->getAttribute(\NumberFormatter::SECONDARY_GROUPING_SIZE); - $expectedAttribute17 = $var->getAttribute(\NumberFormatter::SIGNIFICANT_DIGITS_USED); - $expectedAttribute18 = $this->getDump($var->getAttribute(\NumberFormatter::MIN_SIGNIFICANT_DIGITS)); - $expectedAttribute19 = $this->getDump($var->getAttribute(\NumberFormatter::MAX_SIGNIFICANT_DIGITS)); - $expectedAttribute20 = $var->getAttribute(\NumberFormatter::LENIENT_PARSE); - - $expectedTextAttribute1 = $var->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX); - $expectedTextAttribute2 = $var->getTextAttribute(\NumberFormatter::POSITIVE_SUFFIX); - $expectedTextAttribute3 = $var->getTextAttribute(\NumberFormatter::NEGATIVE_PREFIX); - $expectedTextAttribute4 = $var->getTextAttribute(\NumberFormatter::NEGATIVE_SUFFIX); - $expectedTextAttribute5 = $var->getTextAttribute(\NumberFormatter::PADDING_CHARACTER); - $expectedTextAttribute6 = $var->getTextAttribute(\NumberFormatter::CURRENCY_CODE); - $expectedTextAttribute7 = $var->getTextAttribute(\NumberFormatter::DEFAULT_RULESET) ? 'true' : 'false'; - $expectedTextAttribute8 = $var->getTextAttribute(\NumberFormatter::PUBLIC_RULESETS) ? 'true' : 'false'; - - $expectedSymbol1 = $var->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); - $expectedSymbol2 = $var->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL); - $expectedSymbol3 = $var->getSymbol(\NumberFormatter::PATTERN_SEPARATOR_SYMBOL); - $expectedSymbol4 = $var->getSymbol(\NumberFormatter::PERCENT_SYMBOL); - $expectedSymbol5 = $var->getSymbol(\NumberFormatter::ZERO_DIGIT_SYMBOL); - $expectedSymbol6 = $var->getSymbol(\NumberFormatter::DIGIT_SYMBOL); - $expectedSymbol7 = $var->getSymbol(\NumberFormatter::MINUS_SIGN_SYMBOL); - $expectedSymbol8 = $var->getSymbol(\NumberFormatter::PLUS_SIGN_SYMBOL); - $expectedSymbol9 = $var->getSymbol(\NumberFormatter::CURRENCY_SYMBOL); - $expectedSymbol10 = $var->getSymbol(\NumberFormatter::INTL_CURRENCY_SYMBOL); - $expectedSymbol11 = $var->getSymbol(\NumberFormatter::MONETARY_SEPARATOR_SYMBOL); - $expectedSymbol12 = $var->getSymbol(\NumberFormatter::EXPONENTIAL_SYMBOL); - $expectedSymbol13 = $var->getSymbol(\NumberFormatter::PERMILL_SYMBOL); - $expectedSymbol14 = $var->getSymbol(\NumberFormatter::PAD_ESCAPE_SYMBOL); - $expectedSymbol15 = $var->getSymbol(\NumberFormatter::INFINITY_SYMBOL); - $expectedSymbol16 = $var->getSymbol(\NumberFormatter::NAN_SYMBOL); - $expectedSymbol17 = $var->getSymbol(\NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL); - $expectedSymbol18 = $var->getSymbol(\NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL); - - $expected = <<assertDumpEquals($expected, $var); - } - - public function testCastIntlTimeZoneWithDST() - { - $var = \IntlTimeZone::createTimeZone('America/Los_Angeles'); - - $expectedDisplayName = $var->getDisplayName(); - $expectedDSTSavings = $var->getDSTSavings(); - $expectedID = $var->getID(); - $expectedRawOffset = $var->getRawOffset(); - - $expected = <<assertDumpEquals($expected, $var); - } - - public function testCastIntlTimeZoneWithoutDST() - { - $var = \IntlTimeZone::createTimeZone('Asia/Bangkok'); - - $expectedDisplayName = $var->getDisplayName(); - $expectedID = $var->getID(); - $expectedRawOffset = $var->getRawOffset(); - - $expected = <<assertDumpEquals($expected, $var); - } - - public function testCastIntlCalendar() - { - $var = \IntlCalendar::createInstance('America/Los_Angeles', 'en'); - - $expectedType = $var->getType(); - $expectedFirstDayOfWeek = $var->getFirstDayOfWeek(); - $expectedMinimalDaysInFirstWeek = $var->getMinimalDaysInFirstWeek(); - $expectedRepeatedWallTimeOption = $var->getRepeatedWallTimeOption(); - $expectedSkippedWallTimeOption = $var->getSkippedWallTimeOption(); - $expectedTime = $var->getTime().'.0'; - $expectedInDaylightTime = $var->inDaylightTime() ? 'true' : 'false'; - $expectedIsLenient = $var->isLenient() ? 'true' : 'false'; - - $expectedTimeZone = $var->getTimeZone(); - $expectedTimeZoneDisplayName = $expectedTimeZone->getDisplayName(); - $expectedTimeZoneID = $expectedTimeZone->getID(); - $expectedTimeZoneRawOffset = $expectedTimeZone->getRawOffset(); - $expectedTimeZoneDSTSavings = $expectedTimeZone->getDSTSavings(); - - $expected = <<assertDumpEquals($expected, $var); - } - - public function testCastDateFormatter() - { - $var = new \IntlDateFormatter('en', \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::TRADITIONAL); - - $expectedLocale = $var->getLocale(); - $expectedPattern = $var->getPattern(); - $expectedCalendar = $var->getCalendar(); - $expectedTimeZoneId = $var->getTimeZoneId(); - $expectedTimeType = $var->getTimeType(); - $expectedDateType = $var->getDateType(); - - $expectedTimeZone = $var->getTimeZone(); - $expectedTimeZoneDisplayName = $expectedTimeZone->getDisplayName(); - $expectedTimeZoneID = $expectedTimeZone->getID(); - $expectedTimeZoneRawOffset = $expectedTimeZone->getRawOffset(); - $expectedTimeZoneDSTSavings = $expectedTimeZone->useDaylightTime() ? "\n dst_savings: ".$expectedTimeZone->getDSTSavings() : ''; - - $expectedCalendarObject = $var->getCalendarObject(); - $expectedCalendarObjectType = $expectedCalendarObject->getType(); - $expectedCalendarObjectFirstDayOfWeek = $expectedCalendarObject->getFirstDayOfWeek(); - $expectedCalendarObjectMinimalDaysInFirstWeek = $expectedCalendarObject->getMinimalDaysInFirstWeek(); - $expectedCalendarObjectRepeatedWallTimeOption = $expectedCalendarObject->getRepeatedWallTimeOption(); - $expectedCalendarObjectSkippedWallTimeOption = $expectedCalendarObject->getSkippedWallTimeOption(); - $expectedCalendarObjectTime = $expectedCalendarObject->getTime().'.0'; - $expectedCalendarObjectInDaylightTime = $expectedCalendarObject->inDaylightTime() ? 'true' : 'false'; - $expectedCalendarObjectIsLenient = $expectedCalendarObject->isLenient() ? 'true' : 'false'; - - $expectedCalendarObjectTimeZone = $expectedCalendarObject->getTimeZone(); - $expectedCalendarObjectTimeZoneDisplayName = $expectedCalendarObjectTimeZone->getDisplayName(); - $expectedCalendarObjectTimeZoneID = $expectedCalendarObjectTimeZone->getID(); - $expectedCalendarObjectTimeZoneRawOffset = $expectedCalendarObjectTimeZone->getRawOffset(); - $expectedCalendarObjectTimeZoneDSTSavings = $expectedTimeZone->useDaylightTime() ? "\n dst_savings: ".$expectedCalendarObjectTimeZone->getDSTSavings() : ''; - - $expected = <<assertDumpEquals($expected, $var); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/MemcachedCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/MemcachedCasterTest.php deleted file mode 100644 index df48390a..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/MemcachedCasterTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -/** - * @author Jan Schädlich - */ -class MemcachedCasterTest extends TestCase -{ - use VarDumperTestTrait; - - public function testCastMemcachedWithDefaultOptions() - { - if (!class_exists('Memcached')) { - $this->markTestSkipped('Memcached not available'); - } - - $var = new \Memcached(); - $var->addServer('127.0.0.1', 11211); - $var->addServer('127.0.0.2', 11212); - - $expected = << array:3 [ - "host" => "127.0.0.1" - "port" => 11211 - "type" => "TCP" - ] - 1 => array:3 [ - "host" => "127.0.0.2" - "port" => 11212 - "type" => "TCP" - ] - ] - options: {} -} -EOTXT; - $this->assertDumpEquals($expected, $var); - } - - public function testCastMemcachedWithCustomOptions() - { - if (!class_exists('Memcached')) { - $this->markTestSkipped('Memcached not available'); - } - - $var = new \Memcached(); - $var->addServer('127.0.0.1', 11211); - $var->addServer('127.0.0.2', 11212); - - // set a subset of non default options to test boolean, string and integer output - $var->setOption(\Memcached::OPT_COMPRESSION, false); - $var->setOption(\Memcached::OPT_PREFIX_KEY, 'pre'); - $var->setOption(\Memcached::OPT_DISTRIBUTION, \Memcached::DISTRIBUTION_CONSISTENT); - - $expected = <<<'EOTXT' -Memcached { - servers: array:2 [ - 0 => array:3 [ - "host" => "127.0.0.1" - "port" => 11211 - "type" => "TCP" - ] - 1 => array:3 [ - "host" => "127.0.0.2" - "port" => 11212 - "type" => "TCP" - ] - ] - options: { - OPT_COMPRESSION: false - OPT_PREFIX_KEY: "pre" - OPT_DISTRIBUTION: 1 - } -} -EOTXT; - - $this->assertDumpEquals($expected, $var); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php deleted file mode 100644 index 19bbe0f8..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Caster\PdoCaster; -use Symfony\Component\VarDumper\Cloner\Stub; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -/** - * @author Nicolas Grekas - */ -class PdoCasterTest extends TestCase -{ - use VarDumperTestTrait; - - /** - * @requires extension pdo_sqlite - */ - public function testCastPdo() - { - $pdo = new \PDO('sqlite::memory:'); - $pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, ['PDOStatement', [$pdo]]); - - $cast = PdoCaster::castPdo($pdo, [], new Stub(), false); - - $this->assertInstanceOf('Symfony\Component\VarDumper\Caster\EnumStub', $cast["\0~\0attributes"]); - - $attr = $cast["\0~\0attributes"] = $cast["\0~\0attributes"]->value; - $this->assertInstanceOf('Symfony\Component\VarDumper\Caster\ConstStub', $attr['CASE']); - $this->assertSame('NATURAL', $attr['CASE']->class); - $this->assertSame('BOTH', $attr['DEFAULT_FETCH_MODE']->class); - - $xDump = <<<'EODUMP' -array:2 [ - "\x00~\x00inTransaction" => false - "\x00~\x00attributes" => array:9 [ - "CASE" => NATURAL - "ERRMODE" => SILENT - "PERSISTENT" => false - "DRIVER_NAME" => "sqlite" - "ORACLE_NULLS" => NATURAL - "CLIENT_VERSION" => "%s" - "SERVER_VERSION" => "%s" - "STATEMENT_CLASS" => array:%d [ - 0 => "PDOStatement"%A - ] - "DEFAULT_FETCH_MODE" => BOTH - ] -] -EODUMP; - - $this->assertDumpMatchesFormat($xDump, $cast); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php deleted file mode 100644 index 3edbed63..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -/** - * @author Nicolas Grekas - * @requires extension redis - */ -class RedisCasterTest extends TestCase -{ - use VarDumperTestTrait; - - public function testNotConnected() - { - $redis = new \Redis(); - - $xCast = <<<'EODUMP' -Redis { - isConnected: false -} -EODUMP; - - $this->assertDumpMatchesFormat($xCast, $redis); - } - - public function testConnected() - { - $redis = new \Redis(); - if (!@$redis->connect('127.0.0.1')) { - $e = error_get_last(); - self::markTestSkipped($e['message']); - } - - $xCast = <<<'EODUMP' -Redis {%A - isConnected: true - host: "127.0.0.1" - port: 6379 - auth: null - mode: ATOMIC - dbNum: 0 - timeout: 0.0 - lastError: null - persistentId: null - options: { - TCP_KEEPALIVE: 0 - READ_TIMEOUT: 0.0 - COMPRESSION: NONE - SERIALIZER: NONE - PREFIX: null - SCAN: NORETRY - } -} -EODUMP; - - $this->assertDumpMatchesFormat($xCast, $redis); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php deleted file mode 100644 index a0b8e1d1..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php +++ /dev/null @@ -1,256 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Caster\Caster; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; -use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo; -use Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass; - -/** - * @author Nicolas Grekas - */ -class ReflectionCasterTest extends TestCase -{ - use VarDumperTestTrait; - - public function testReflectionCaster() - { - $var = new \ReflectionClass('ReflectionClass'); - - $this->assertDumpMatchesFormat( - <<<'EOTXT' -ReflectionClass { - +name: "ReflectionClass" -%Aimplements: array:%d [ - 0 => "Reflector" -%A] - constants: array:3 [ - "IS_IMPLICIT_ABSTRACT" => 16 - "IS_EXPLICIT_ABSTRACT" => %d - "IS_FINAL" => %d - ] - properties: array:%d [ - "name" => ReflectionProperty { -%A +name: "name" - +class: "ReflectionClass" -%A modifiers: "public" - } -%A] - methods: array:%d [ -%A - "export" => ReflectionMethod { - +name: "export" - +class: "ReflectionClass" -%A parameters: { - $%s: ReflectionParameter { -%A position: 0 -%A -} -EOTXT - , $var - ); - } - - public function testClosureCaster() - { - $a = $b = 123; - $var = function ($x) use ($a, &$b) {}; - - $this->assertDumpMatchesFormat( - <<<'EOTXT' -Closure($x) { -%Ause: { - $a: 123 - $b: & 123 - } - file: "%sReflectionCasterTest.php" - line: "68 to 68" -} -EOTXT - , $var - ); - } - - public function testFromCallableClosureCaster() - { - if (\defined('HHVM_VERSION_ID')) { - $this->markTestSkipped('Not for HHVM.'); - } - $var = [ - (new \ReflectionMethod($this, __FUNCTION__))->getClosure($this), - (new \ReflectionMethod(__CLASS__, 'stub'))->getClosure(), - ]; - - $this->assertDumpMatchesFormat( - << Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest::testFromCallableClosureCaster() { - this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …} - file: "%sReflectionCasterTest.php" - line: "%d to %d" - } - 1 => Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest::stub(): void { - returnType: "void" - file: "%sReflectionCasterTest.php" - line: "%d to %d" - } -] -EOTXT - , $var - ); - } - - public function testClosureCasterExcludingVerbosity() - { - $var = function &($a = 5) {}; - - $this->assertDumpEquals('Closure&($a = 5) { …5}', $var, Caster::EXCLUDE_VERBOSE); - } - - public function testReflectionParameter() - { - $var = new \ReflectionParameter(__NAMESPACE__.'\reflectionParameterFixture', 0); - - $this->assertDumpMatchesFormat( - <<<'EOTXT' -ReflectionParameter { - +name: "arg1" - position: 0 - typeHint: "Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass" - default: null -} -EOTXT - , $var - ); - } - - public function testReflectionParameterScalar() - { - $f = eval('return function (int $a) {};'); - $var = new \ReflectionParameter($f, 0); - - $this->assertDumpMatchesFormat( - <<<'EOTXT' -ReflectionParameter { - +name: "a" - position: 0 - typeHint: "int" -} -EOTXT - , $var - ); - } - - public function testReturnType() - { - $f = eval('return function ():int {};'); - $line = __LINE__ - 1; - - $this->assertDumpMatchesFormat( - <<markTestSkipped('xdebug is active'); - } - - $generator = new GeneratorDemo(); - $generator = $generator->baz(); - - $expectedDump = <<<'EODUMP' -Generator { - this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} - executing: { - Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() { - %sGeneratorDemo.php:14 { - › { - › yield from bar(); - › } - } - } - } - closed: false -} -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $generator); - - foreach ($generator as $v) { - break; - } - - $expectedDump = <<<'EODUMP' -array:2 [ - 0 => ReflectionGenerator { - this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} - trace: { - %s%eTests%eFixtures%eGeneratorDemo.php:9 { - › { - › yield 1; - › } - } - %s%eTests%eFixtures%eGeneratorDemo.php:20 { …} - %s%eTests%eFixtures%eGeneratorDemo.php:14 { …} - } - closed: false - } - 1 => Generator { - executing: { - Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() { - %sGeneratorDemo.php:10 { - › yield 1; - › } - › - } - } - } - closed: false - } -] -EODUMP; - - $r = new \ReflectionGenerator($generator); - $this->assertDumpMatchesFormat($expectedDump, [$r, $r->getExecutingGenerator()]); - - foreach ($generator as $v) { - } - - $expectedDump = <<<'EODUMP' -Generator { - closed: true -} -EODUMP; - $this->assertDumpMatchesFormat($expectedDump, $generator); - } - - public static function stub(): void - { - } -} - -function reflectionParameterFixture(NotLoadableClass $arg1 = null, $arg2) -{ -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php deleted file mode 100644 index e26c371d..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php +++ /dev/null @@ -1,226 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -/** - * @author Grégoire Pineau - */ -class SplCasterTest extends TestCase -{ - use VarDumperTestTrait; - - public function getCastFileInfoTests() - { - return [ - [__FILE__, <<<'EOTXT' -SplFileInfo { -%Apath: "%sCaster" - filename: "SplCasterTest.php" - basename: "SplCasterTest.php" - pathname: "%sSplCasterTest.php" - extension: "php" - realPath: "%sSplCasterTest.php" - aTime: %s-%s-%d %d:%d:%d - mTime: %s-%s-%d %d:%d:%d - cTime: %s-%s-%d %d:%d:%d - inode: %i - size: %d - perms: 0%d - owner: %d - group: %d - type: "file" - writable: true - readable: true - executable: false - file: true - dir: false - link: false -%A} -EOTXT - ], - ['https://example.com/about', <<<'EOTXT' -SplFileInfo { -%Apath: "https://example.com" - filename: "about" - basename: "about" - pathname: "https://example.com/about" - extension: "" - realPath: false -%A} -EOTXT - ], - ]; - } - - /** @dataProvider getCastFileInfoTests */ - public function testCastFileInfo($file, $dump) - { - $this->assertDumpMatchesFormat($dump, new \SplFileInfo($file)); - } - - public function testCastFileObject() - { - $var = new \SplFileObject(__FILE__); - $var->setFlags(\SplFileObject::DROP_NEW_LINE | \SplFileObject::SKIP_EMPTY); - $dump = <<<'EOTXT' -SplFileObject { -%Apath: "%sCaster" - filename: "SplCasterTest.php" - basename: "SplCasterTest.php" - pathname: "%sSplCasterTest.php" - extension: "php" - realPath: "%sSplCasterTest.php" - aTime: %s-%s-%d %d:%d:%d - mTime: %s-%s-%d %d:%d:%d - cTime: %s-%s-%d %d:%d:%d - inode: %i - size: %d - perms: 0%d - owner: %d - group: %d - type: "file" - writable: true - readable: true - executable: false - file: true - dir: false - link: false -%AcsvControl: array:%d [ - 0 => "," - 1 => """ -%A] - flags: DROP_NEW_LINE|SKIP_EMPTY - maxLineLen: 0 - fstat: array:26 [ - "dev" => %d - "ino" => %i - "nlink" => %d - "rdev" => 0 - "blksize" => %i - "blocks" => %i - …20 - ] - eof: false - key: 0 -} -EOTXT; - $this->assertDumpMatchesFormat($dump, $var); - } - - /** - * @dataProvider provideCastSplDoublyLinkedList - */ - public function testCastSplDoublyLinkedList($modeValue, $modeDump) - { - $var = new \SplDoublyLinkedList(); - $var->setIteratorMode($modeValue); - $dump = <<assertDumpMatchesFormat($dump, $var); - } - - public function provideCastSplDoublyLinkedList() - { - return [ - [\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'], - [\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'], - [\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'], - [\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'], - ]; - } - - public function testCastObjectStorageIsntModified() - { - $var = new \SplObjectStorage(); - $var->attach(new \stdClass()); - $var->rewind(); - $current = $var->current(); - - $this->assertDumpMatchesFormat('%A', $var); - $this->assertSame($current, $var->current()); - } - - public function testCastObjectStorageDumpsInfo() - { - $var = new \SplObjectStorage(); - $var->attach(new \stdClass(), new \DateTime()); - - $this->assertDumpMatchesFormat('%ADateTime%A', $var); - } - - public function testCastArrayObject() - { - $var = new \ArrayObject([123]); - $var->foo = 234; - - $expected = << 123 - ] -} -EOTXT; - $this->assertDumpEquals($expected, $var); - } - - public function testArrayIterator() - { - $var = new MyArrayIterator([234]); - - $expected = << 234 - ] -} -EOTXT; - $this->assertDumpEquals($expected, $var); - } - - public function testBadSplFileInfo() - { - $var = new BadSplFileInfo(); - - $expected = <<assertDumpEquals($expected, $var); - } -} - -class MyArrayIterator extends \ArrayIterator -{ - private $foo = 123; -} - -class BadSplFileInfo extends \SplFileInfo -{ - public function __construct() - { - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/StubCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/StubCasterTest.php deleted file mode 100644 index 8056f703..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/StubCasterTest.php +++ /dev/null @@ -1,213 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Caster\ArgsStub; -use Symfony\Component\VarDumper\Caster\ClassStub; -use Symfony\Component\VarDumper\Caster\LinkStub; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; -use Symfony\Component\VarDumper\Tests\Fixtures\FooInterface; - -class StubCasterTest extends TestCase -{ - use VarDumperTestTrait; - - public function testArgsStubWithDefaults($foo = 234, $bar = 456) - { - $args = [new ArgsStub([123], __FUNCTION__, __CLASS__)]; - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => { - $foo: 123 - } -] -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $args); - } - - public function testArgsStubWithExtraArgs($foo = 234) - { - $args = [new ArgsStub([123, 456], __FUNCTION__, __CLASS__)]; - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => { - $foo: 123 - ...: { - 456 - } - } -] -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $args); - } - - public function testArgsStubNoParamWithExtraArgs() - { - $args = [new ArgsStub([123], __FUNCTION__, __CLASS__)]; - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => { - 123 - } -] -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $args); - } - - public function testArgsStubWithClosure() - { - $args = [new ArgsStub([123], '{closure}', null)]; - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => { - 123 - } -] -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $args); - } - - public function testLinkStub() - { - $var = [new LinkStub(__CLASS__, 0, __FILE__)]; - - $cloner = new VarCloner(); - $dumper = new HtmlDumper(); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $dumper->setDisplayOptions(['fileLinkFormat' => '%f:%l']); - $dump = $dumper->dump($cloner->cloneVar($var), true); - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => "Symfony\Component\VarDumper\Tests\Caster\StubCasterTest" -] - -EODUMP; - - $this->assertStringMatchesFormat($expectedDump, $dump); - } - - public function testLinkStubWithNoFileLink() - { - $var = [new LinkStub('example.com', 0, 'http://example.com')]; - - $cloner = new VarCloner(); - $dumper = new HtmlDumper(); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $dumper->setDisplayOptions(['fileLinkFormat' => '%f:%l']); - $dump = $dumper->dump($cloner->cloneVar($var), true); - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => "example.com" -] - -EODUMP; - - $this->assertStringMatchesFormat($expectedDump, $dump); - } - - public function testClassStub() - { - $var = [new ClassStub('hello', [FooInterface::class, 'foo'])]; - - $cloner = new VarCloner(); - $dumper = new HtmlDumper(); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']); - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => "hello(?stdClass $a, stdClass $b = null)" -] - -EODUMP; - - $this->assertStringMatchesFormat($expectedDump, $dump); - } - - public function testClassStubWithNotExistingClass() - { - $var = [new ClassStub(NotExisting::class)]; - - $cloner = new VarCloner(); - $dumper = new HtmlDumper(); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $dump = $dumper->dump($cloner->cloneVar($var), true); - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => "Symfony\Component\VarDumper\Tests\Caster\NotExisting" -] - -EODUMP; - - $this->assertStringMatchesFormat($expectedDump, $dump); - } - - public function testClassStubWithNotExistingMethod() - { - $var = [new ClassStub('hello', [FooInterface::class, 'missing'])]; - - $cloner = new VarCloner(); - $dumper = new HtmlDumper(); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']); - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => "hello" -] - -EODUMP; - - $this->assertStringMatchesFormat($expectedDump, $dump); - } - - public function testClassStubWithAnonymousClass() - { - $var = [new ClassStub(\get_class(new class() extends \Exception { - }))]; - - $cloner = new VarCloner(); - $dumper = new HtmlDumper(); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']); - - $expectedDump = <<<'EODUMP' -array:1 [ - 0 => "Exception@anonymous" -] - -EODUMP; - - $this->assertStringMatchesFormat($expectedDump, $dump); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php deleted file mode 100644 index 8c0bc6ec..00000000 --- a/vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php +++ /dev/null @@ -1,248 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Caster; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -/** - * @author Baptiste Clavié - */ -class XmlReaderCasterTest extends TestCase -{ - use VarDumperTestTrait; - - /** @var \XmlReader */ - private $reader; - - protected function setUp(): void - { - $this->reader = new \XmlReader(); - $this->reader->open(__DIR__.'/../Fixtures/xml_reader.xml'); - } - - protected function tearDown(): void - { - $this->reader->close(); - } - - public function testParserProperty() - { - $this->reader->setParserProperty(\XMLReader::SUBST_ENTITIES, true); - - $expectedDump = <<<'EODUMP' -XMLReader { - +nodeType: NONE - parserProperties: { - SUBST_ENTITIES: true - …3 - } - …12 -} -EODUMP; - - $this->assertDumpMatchesFormat($expectedDump, $this->reader); - } - - /** - * @dataProvider provideNodes - */ - public function testNodes($seek, $expectedDump) - { - while ($seek--) { - $this->reader->read(); - } - $this->assertDumpMatchesFormat($expectedDump, $this->reader); - } - - public function provideNodes() - { - return [ - [0, <<<'EODUMP' -XMLReader { - +nodeType: NONE - …13 -} -EODUMP - ], - [1, <<<'EODUMP' -XMLReader { - +localName: "foo" - +nodeType: ELEMENT - +baseURI: "%sxml_reader.xml" - …11 -} -EODUMP - ], - [2, <<<'EODUMP' -XMLReader { - +localName: "#text" - +nodeType: SIGNIFICANT_WHITESPACE - +depth: 1 - +value: """ - \n - - """ - +baseURI: "%sxml_reader.xml" - …9 -} -EODUMP - ], - [3, <<<'EODUMP' -XMLReader { - +localName: "bar" - +nodeType: ELEMENT - +depth: 1 - +baseURI: "%sxml_reader.xml" - …10 -} -EODUMP - ], - [4, <<<'EODUMP' -XMLReader { - +localName: "bar" - +nodeType: END_ELEMENT - +depth: 1 - +baseURI: "%sxml_reader.xml" - …10 -} -EODUMP - ], - [6, <<<'EODUMP' -XMLReader { - +localName: "bar" - +nodeType: ELEMENT - +depth: 1 - +isEmptyElement: true - +baseURI: "%sxml_reader.xml" - …9 -} -EODUMP - ], - [9, <<<'EODUMP' -XMLReader { - +localName: "#text" - +nodeType: TEXT - +depth: 2 - +value: "With text" - +baseURI: "%sxml_reader.xml" - …9 -} -EODUMP - ], - [12, <<<'EODUMP' -XMLReader { - +localName: "bar" - +nodeType: ELEMENT - +depth: 1 - +attributeCount: 2 - +baseURI: "%sxml_reader.xml" - …9 -} -EODUMP - ], - [13, <<<'EODUMP' -XMLReader { - +localName: "bar" - +nodeType: END_ELEMENT - +depth: 1 - +baseURI: "%sxml_reader.xml" - …10 -} -EODUMP - ], - [15, <<<'EODUMP' -XMLReader { - +localName: "bar" - +nodeType: ELEMENT - +depth: 1 - +attributeCount: 1 - +baseURI: "%sxml_reader.xml" - …9 -} -EODUMP - ], - [16, <<<'EODUMP' -XMLReader { - +localName: "#text" - +nodeType: SIGNIFICANT_WHITESPACE - +depth: 2 - +value: """ - \n - - """ - +baseURI: "%sxml_reader.xml" - …9 -} -EODUMP - ], - [17, <<<'EODUMP' -XMLReader { - +localName: "baz" - +prefix: "baz" - +nodeType: ELEMENT - +depth: 2 - +namespaceURI: "http://symfony.com" - +baseURI: "%sxml_reader.xml" - …8 -} -EODUMP - ], - [18, <<<'EODUMP' -XMLReader { - +localName: "baz" - +prefix: "baz" - +nodeType: END_ELEMENT - +depth: 2 - +namespaceURI: "http://symfony.com" - +baseURI: "%sxml_reader.xml" - …8 -} -EODUMP - ], - [19, <<<'EODUMP' -XMLReader { - +localName: "#text" - +nodeType: SIGNIFICANT_WHITESPACE - +depth: 2 - +value: """ - \n - - """ - +baseURI: "%sxml_reader.xml" - …9 -} -EODUMP - ], - [21, <<<'EODUMP' -XMLReader { - +localName: "#text" - +nodeType: SIGNIFICANT_WHITESPACE - +depth: 1 - +value: "\n" - +baseURI: "%sxml_reader.xml" - …9 -} -EODUMP - ], - [22, <<<'EODUMP' -XMLReader { - +localName: "foo" - +nodeType: END_ELEMENT - +baseURI: "%sxml_reader.xml" - …11 -} -EODUMP - ], - ]; - } -} diff --git a/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php b/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php deleted file mode 100644 index d4b6c24c..00000000 --- a/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Cloner; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Caster\Caster; -use Symfony\Component\VarDumper\Caster\ClassStub; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Cloner\VarCloner; - -class DataTest extends TestCase -{ - public function testBasicData() - { - $values = [1 => 123, 4.5, 'abc', null, false]; - $data = $this->cloneVar($values); - $clonedValues = []; - - $this->assertInstanceOf(Data::class, $data); - $this->assertCount(\count($values), $data); - $this->assertFalse(isset($data->{0})); - $this->assertFalse(isset($data[0])); - - foreach ($data as $k => $v) { - $this->assertTrue(isset($data->{$k})); - $this->assertTrue(isset($data[$k])); - $this->assertSame(\gettype($values[$k]), $data->seek($k)->getType()); - $this->assertSame($values[$k], $data->seek($k)->getValue()); - $this->assertSame($values[$k], $data->{$k}); - $this->assertSame($values[$k], $data[$k]); - $this->assertSame((string) $values[$k], (string) $data->seek($k)); - - $clonedValues[$k] = $v->getValue(); - } - - $this->assertSame($values, $clonedValues); - } - - public function testObject() - { - $data = $this->cloneVar(new \Exception('foo')); - - $this->assertSame('Exception', $data->getType()); - - $this->assertSame('foo', $data->message); - $this->assertSame('foo', $data->{Caster::PREFIX_PROTECTED.'message'}); - - $this->assertSame('foo', $data['message']); - $this->assertSame('foo', $data[Caster::PREFIX_PROTECTED.'message']); - - $this->assertStringMatchesFormat('Exception (count=%d)', (string) $data); - } - - public function testArray() - { - $values = [[], [123]]; - $data = $this->cloneVar($values); - - $this->assertSame($values, $data->getValue(true)); - - $children = $data->getValue(); - - $this->assertIsArray($children); - - $this->assertInstanceOf(Data::class, $children[0]); - $this->assertInstanceOf(Data::class, $children[1]); - - $this->assertEquals($children[0], $data[0]); - $this->assertEquals($children[1], $data[1]); - - $this->assertSame($values[0], $children[0]->getValue(true)); - $this->assertSame($values[1], $children[1]->getValue(true)); - } - - public function testStub() - { - $data = $this->cloneVar([new ClassStub('stdClass')]); - $data = $data[0]; - - $this->assertSame('string', $data->getType()); - $this->assertSame('stdClass', $data->getValue()); - $this->assertSame('stdClass', (string) $data); - } - - public function testHardRefs() - { - $values = [[]]; - $values[1] = &$values[0]; - $values[2][0] = &$values[2]; - - $data = $this->cloneVar($values); - - $this->assertSame([], $data[0]->getValue()); - $this->assertSame([], $data[1]->getValue()); - $this->assertEquals([$data[2]->getValue()], $data[2]->getValue(true)); - - $this->assertSame('array (count=3)', (string) $data); - } - - private function cloneVar($value) - { - $cloner = new VarCloner(); - - return $cloner->cloneVar($value); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php b/vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php deleted file mode 100644 index 334d5879..00000000 --- a/vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php +++ /dev/null @@ -1,509 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Cloner; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Tests\Fixtures\Php74; - -/** - * @author Nicolas Grekas - */ -class VarClonerTest extends TestCase -{ - public function testMaxIntBoundary() - { - $data = [PHP_INT_MAX => 123]; - - $cloner = new VarCloner(); - $clone = $cloner->cloneVar($data); - - $expected = << Array - ( - [0] => Array - ( - [0] => Array - ( - [1] => 1 - ) - - ) - - [1] => Array - ( - [%s] => 123 - ) - - ) - - [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 - [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 - [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 -) - -EOTXT; - $this->assertSame(sprintf($expected, PHP_INT_MAX), print_r($clone, true)); - } - - public function testClone() - { - $json = json_decode('{"1":{"var":"val"},"2":{"var":"val"}}'); - - $cloner = new VarCloner(); - $clone = $cloner->cloneVar($json); - - $expected = << Array - ( - [0] => Array - ( - [0] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => 4 - [class] => stdClass - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 1 - [attr] => Array - ( - ) - - ) - - ) - - [1] => Array - ( - [\000+\0001] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => 4 - [class] => stdClass - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 2 - [attr] => Array - ( - ) - - ) - - [\000+\0002] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => 4 - [class] => stdClass - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 3 - [attr] => Array - ( - ) - - ) - - ) - - [2] => Array - ( - [\000+\000var] => val - ) - - [3] => Array - ( - [\000+\000var] => val - ) - - ) - - [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 - [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 - [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 -) - -EOTXT; - $this->assertStringMatchesFormat($expected, print_r($clone, true)); - } - - public function testLimits() - { - // Level 0: - $data = [ - // Level 1: - [ - // Level 2: - [ - // Level 3: - 'Level 3 Item 0', - 'Level 3 Item 1', - 'Level 3 Item 2', - 'Level 3 Item 3', - ], - [ - 'Level 3 Item 4', - 'Level 3 Item 5', - 'Level 3 Item 6', - ], - [ - 'Level 3 Item 7', - ], - ], - [ - [ - 'Level 3 Item 8', - ], - 'Level 2 Item 0', - ], - [ - 'Level 2 Item 1', - ], - 'Level 1 Item 0', - [ - // Test setMaxString: - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - 'SHORT', - ], - ]; - - $cloner = new VarCloner(); - $cloner->setMinDepth(2); - $cloner->setMaxItems(5); - $cloner->setMaxString(20); - $clone = $cloner->cloneVar($data); - - $expected = << Array - ( - [0] => Array - ( - [0] => Array - ( - [2] => 1 - ) - - ) - - [1] => Array - ( - [0] => Array - ( - [2] => 2 - ) - - [1] => Array - ( - [2] => 3 - ) - - [2] => Array - ( - [2] => 4 - ) - - [3] => Level 1 Item 0 - [4] => Array - ( - [2] => 5 - ) - - ) - - [2] => Array - ( - [0] => Array - ( - [2] => 6 - ) - - [1] => Array - ( - [0] => 2 - [2] => 7 - ) - - [2] => Array - ( - [0] => 1 - [2] => 0 - ) - - ) - - [3] => Array - ( - [0] => Array - ( - [0] => 1 - [2] => 0 - ) - - [1] => Level 2 Item 0 - ) - - [4] => Array - ( - [0] => Level 2 Item 1 - ) - - [5] => Array - ( - [0] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => 2 - [class] => 2 - [value] => ABCDEFGHIJKLMNOPQRST - [cut] => 6 - [handle] => 0 - [refCount] => 0 - [position] => 0 - [attr] => Array - ( - ) - - ) - - [1] => SHORT - ) - - [6] => Array - ( - [0] => Level 3 Item 0 - [1] => Level 3 Item 1 - [2] => Level 3 Item 2 - [3] => Level 3 Item 3 - ) - - [7] => Array - ( - [0] => Level 3 Item 4 - ) - - ) - - [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 - [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 - [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 -) - -EOTXT; - $this->assertStringMatchesFormat($expected, print_r($clone, true)); - } - - public function testJsonCast() - { - if (2 == ini_get('xdebug.overload_var_dump')) { - $this->markTestSkipped('xdebug is active'); - } - - $data = (array) json_decode('{"1":{}}'); - - $cloner = new VarCloner(); - $clone = $cloner->cloneVar($data); - - $expected = <<<'EOTXT' -object(Symfony\Component\VarDumper\Cloner\Data)#%i (6) { - ["data":"Symfony\Component\VarDumper\Cloner\Data":private]=> - array(2) { - [0]=> - array(1) { - [0]=> - array(1) { - [1]=> - int(1) - } - } - [1]=> - array(1) { - ["1"]=> - object(Symfony\Component\VarDumper\Cloner\Stub)#%i (8) { - ["type"]=> - int(4) - ["class"]=> - string(8) "stdClass" - ["value"]=> - NULL - ["cut"]=> - int(0) - ["handle"]=> - int(%i) - ["refCount"]=> - int(0) - ["position"]=> - int(0) - ["attr"]=> - array(0) { - } - } - } - } - ["position":"Symfony\Component\VarDumper\Cloner\Data":private]=> - int(0) - ["key":"Symfony\Component\VarDumper\Cloner\Data":private]=> - int(0) - ["maxDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=> - int(20) - ["maxItemsPerDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=> - int(-1) - ["useRefHandles":"Symfony\Component\VarDumper\Cloner\Data":private]=> - int(-1) -} - -EOTXT; - ob_start(); - var_dump($clone); - $this->assertStringMatchesFormat(\PHP_VERSION_ID >= 70200 ? str_replace('"1"', '1', $expected) : $expected, ob_get_clean()); - } - - public function testCaster() - { - $cloner = new VarCloner([ - '*' => function ($obj, $array) { - return ['foo' => 123]; - }, - __CLASS__ => function ($obj, $array) { - ++$array['foo']; - - return $array; - }, - ]); - $clone = $cloner->cloneVar($this); - - $expected = << Array - ( - [0] => Array - ( - [0] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => 4 - [class] => %s - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 1 - [attr] => Array - ( - [file] => %a%eVarClonerTest.php - [line] => 21 - ) - - ) - - ) - - [1] => Array - ( - [foo] => 124 - ) - - ) - - [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 - [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 - [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 -) - -EOTXT; - $this->assertStringMatchesFormat($expected, print_r($clone, true)); - } - - /** - * @requires PHP 7.4 - */ - public function testPhp74() - { - $data = new Php74(); - - $cloner = new VarCloner(); - $clone = $cloner->cloneVar($data); - - $expected = <<<'EOTXT' -Symfony\Component\VarDumper\Cloner\Data Object -( - [data:Symfony\Component\VarDumper\Cloner\Data:private] => Array - ( - [0] => Array - ( - [0] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => 4 - [class] => Symfony\Component\VarDumper\Tests\Fixtures\Php74 - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 1 - [attr] => Array - ( - [file] => %s - [line] => 5 - ) - - ) - - ) - - [1] => Array - ( - [p1] => 123 - [p2] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => 4 - [class] => stdClass - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 0 - [attr] => Array - ( - ) - - ) - - ) - - ) - - [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 - [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 - [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 -) - -EOTXT; - $this->assertStringMatchesFormat($expected, print_r($clone, true)); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Command/Descriptor/CliDescriptorTest.php b/vendor/symfony/var-dumper/Tests/Command/Descriptor/CliDescriptorTest.php deleted file mode 100644 index ccd8c507..00000000 --- a/vendor/symfony/var-dumper/Tests/Command/Descriptor/CliDescriptorTest.php +++ /dev/null @@ -1,173 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Command\Descriptor; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; -use Symfony\Component\Console\Output\BufferedOutput; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Command\Descriptor\CliDescriptor; -use Symfony\Component\VarDumper\Dumper\CliDumper; - -class CliDescriptorTest extends TestCase -{ - private static $timezone; - private static $prevTerminalEmulator; - - public static function setUpBeforeClass(): void - { - self::$timezone = date_default_timezone_get(); - date_default_timezone_set('UTC'); - - self::$prevTerminalEmulator = getenv('TERMINAL_EMULATOR'); - putenv('TERMINAL_EMULATOR'); - } - - public static function tearDownAfterClass(): void - { - date_default_timezone_set(self::$timezone); - putenv('TERMINAL_EMULATOR'.(self::$prevTerminalEmulator ? '='.self::$prevTerminalEmulator : '')); - } - - /** - * @dataProvider provideContext - */ - public function testDescribe(array $context, string $expectedOutput, bool $decorated = false) - { - $output = new BufferedOutput(); - $output->setDecorated($decorated); - $descriptor = new CliDescriptor(new CliDumper(function ($s) { - return $s; - })); - - $descriptor->describe($output, new Data([[123]]), $context + ['timestamp' => 1544804268.3668], 1); - - $this->assertStringMatchesFormat(trim($expectedOutput), str_replace(PHP_EOL, "\n", trim($output->fetch()))); - } - - public function provideContext() - { - yield 'source' => [ - [ - 'source' => [ - 'name' => 'CliDescriptorTest.php', - 'line' => 30, - 'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php', - ], - ], - << [ - [ - 'source' => [ - 'name' => 'CliDescriptorTest.php', - 'line' => 30, - 'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php', - 'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php', - 'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30', - ], - ], - method_exists(OutputFormatterStyle::class, 'setHref') ? - << [ - [ - 'source' => [ - 'name' => 'CliDescriptorTest.php', - 'line' => 30, - 'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php', - 'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30', - ], - ], - << [ - [ - 'cli' => [ - 'identifier' => 'd8bece1c', - 'command_line' => 'bin/phpunit', - ], - ], - << [ - [ - 'request' => [ - 'identifier' => 'd8bece1c', - 'controller' => new Data([['FooController.php']]), - 'method' => 'GET', - 'uri' => 'http://localhost/foo', - ], - ], - << - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Command\Descriptor; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\Output\BufferedOutput; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Command\Descriptor\HtmlDescriptor; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; - -class HtmlDescriptorTest extends TestCase -{ - private static $timezone; - - public static function setUpBeforeClass(): void - { - self::$timezone = date_default_timezone_get(); - date_default_timezone_set('UTC'); - } - - public static function tearDownAfterClass(): void - { - date_default_timezone_set(self::$timezone); - } - - public function testItOutputsStylesAndScriptsOnFirstDescribeCall() - { - $output = new BufferedOutput(); - $dumper = $this->createMock(HtmlDumper::class); - $dumper->method('dump')->willReturn('[DUMPED]'); - $descriptor = new HtmlDescriptor($dumper); - - $descriptor->describe($output, new Data([[123]]), ['timestamp' => 1544804268.3668], 1); - - $this->assertStringMatchesFormat('%A', $output->fetch(), 'styles & scripts are output'); - - $descriptor->describe($output, new Data([[123]]), ['timestamp' => 1544804268.3668], 1); - - $this->assertStringNotMatchesFormat('%A', $output->fetch(), 'styles & scripts are output only once'); - } - - /** - * @dataProvider provideContext - */ - public function testDescribe(array $context, string $expectedOutput) - { - $output = new BufferedOutput(); - $dumper = $this->createMock(HtmlDumper::class); - $dumper->method('dump')->willReturn('[DUMPED]'); - $descriptor = new HtmlDescriptor($dumper); - - $descriptor->describe($output, new Data([[123]]), $context + ['timestamp' => 1544804268.3668], 1); - - $this->assertStringMatchesFormat(trim($expectedOutput), trim(preg_replace('@@s', '', $output->fetch()))); - } - - public function provideContext() - { - yield 'source' => [ - [ - 'source' => [ - 'name' => 'CliDescriptorTest.php', - 'line' => 30, - 'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php', - ], - ], - << -
    -
    -

    -

    - -
    - -
    -
    -

    - CliDescriptorTest.php on line 30 -

    - [DUMPED] -
    - -TXT - ]; - - yield 'source full' => [ - [ - 'source' => [ - 'name' => 'CliDescriptorTest.php', - 'project_dir' => 'src/Symfony/', - 'line' => 30, - 'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php', - 'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php', - 'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30', - ], - ], - << -
    -
    -

    -

    - -
    -
    -
      -
    • project dirsrc/Symfony/
    • -
    -
    -
    -
    -

    - CliDescriptorTest.php on line 30 -

    - [DUMPED] -
    - -TXT - ]; - - yield 'cli' => [ - [ - 'cli' => [ - 'identifier' => 'd8bece1c', - 'command_line' => 'bin/phpunit', - ], - ], - << -
    -
    -

    $ bin/phpunit

    - -
    - -
    -
    -

    - -

    - [DUMPED] -
    - -TXT - ]; - - yield 'request' => [ - [ - 'request' => [ - 'identifier' => 'd8bece1c', - 'controller' => new Data([['FooController.php']]), - 'method' => 'GET', - 'uri' => 'http://localhost/foo', - ], - ], - << -
    -
    -

    GET http://localhost/foo

    - -
    -
    -
      -
    • controller[DUMPED]
    • -
    -
    -
    -
    -

    - -

    - [DUMPED] -
    - -TXT - ]; - } -} diff --git a/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php b/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php deleted file mode 100644 index fc623808..00000000 --- a/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php +++ /dev/null @@ -1,534 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\CliDumper; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; -use Twig\Environment; -use Twig\Loader\FilesystemLoader; - -/** - * @author Nicolas Grekas - */ -class CliDumperTest extends TestCase -{ - use VarDumperTestTrait; - - public function testGet() - { - require __DIR__.'/../Fixtures/dumb-var.php'; - - $dumper = new CliDumper('php://output'); - $dumper->setColors(false); - $cloner = new VarCloner(); - $cloner->addCasters([ - ':stream' => function ($res, $a) { - unset($a['uri'], $a['wrapper_data']); - - return $a; - }, - ]); - $data = $cloner->cloneVar($var); - - ob_start(); - $dumper->dump($data); - $out = ob_get_clean(); - $out = preg_replace('/[ \t]+$/m', '', $out); - $intMax = PHP_INT_MAX; - $res = (int) $var['res']; - - $this->assertStringMatchesFormat( - << 1 - 0 => &1 null - "const" => 1.1 - 1 => true - 2 => false - 3 => NAN - 4 => INF - 5 => -INF - 6 => {$intMax} - "str" => "déjà\\n" - 7 => b""" - é\\x00test\\t\\n - ing - """ - "[]" => [] - "res" => stream resource {@{$res} -%A wrapper_type: "plainfile" - stream_type: "STDIO" - mode: "r" - unread_bytes: 0 - seekable: true -%A options: [] - } - "obj" => Symfony\Component\VarDumper\Tests\Fixture\DumbFoo {#%d - +foo: "foo" - +"bar": "bar" - } - "closure" => Closure(\$a, PDO &\$b = null) {#%d - class: "Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest" - this: Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest {#%d …} - file: "%s%eTests%eFixtures%edumb-var.php" - line: "{$var['line']} to {$var['line']}" - } - "line" => {$var['line']} - "nobj" => array:1 [ - 0 => &3 {#%d} - ] - "recurs" => &4 array:1 [ - 0 => &4 array:1 [&4] - ] - 8 => &1 null - "sobj" => Symfony\Component\VarDumper\Tests\Fixture\DumbFoo {#%d} - "snobj" => &3 {#%d} - "snobj2" => {#%d} - "file" => "{$var['file']}" - b"bin-key-é" => "" -] - -EOTXT - , - $out - ); - } - - /** - * @dataProvider provideDumpWithCommaFlagTests - */ - public function testDumpWithCommaFlag($expected, $flags) - { - $dumper = new CliDumper(null, null, $flags); - $dumper->setColors(false); - $cloner = new VarCloner(); - - $var = [ - 'array' => ['a', 'b'], - 'string' => 'hello', - 'multiline string' => "this\nis\na\multiline\nstring", - ]; - - $dump = $dumper->dump($cloner->cloneVar($var), true); - - $this->assertSame($expected, $dump); - } - - public function testDumpWithCommaFlagsAndExceptionCodeExcerpt() - { - $dumper = new CliDumper(null, null, CliDumper::DUMP_TRAILING_COMMA); - $dumper->setColors(false); - $cloner = new VarCloner(); - - $ex = new \RuntimeException('foo'); - - $dump = $dumper->dump($cloner->cloneVar($ex)->withRefHandles(false), true); - - $this->assertStringMatchesFormat(<<<'EOTXT' -RuntimeException { - #message: "foo" - #code: 0 - #file: "%ACliDumperTest.php" - #line: %d - trace: { - %ACliDumperTest.php:%d { - › - › $ex = new \RuntimeException('foo'); - › - } - %A - } -} - -EOTXT - , $dump); - } - - public function provideDumpWithCommaFlagTests() - { - $expected = <<<'EOTXT' -array:3 [ - "array" => array:2 [ - 0 => "a", - 1 => "b" - ], - "string" => "hello", - "multiline string" => """ - this\n - is\n - a\multiline\n - string - """ -] - -EOTXT; - - yield [$expected, CliDumper::DUMP_COMMA_SEPARATOR]; - - $expected = <<<'EOTXT' -array:3 [ - "array" => array:2 [ - 0 => "a", - 1 => "b", - ], - "string" => "hello", - "multiline string" => """ - this\n - is\n - a\multiline\n - string - """, -] - -EOTXT; - - yield [$expected, CliDumper::DUMP_TRAILING_COMMA]; - } - - /** - * @requires extension xml - */ - public function testXmlResource() - { - $var = xml_parser_create(); - - $this->assertDumpMatchesFormat( - <<<'EOTXT' -xml resource { - current_byte_index: %i - current_column_number: %i - current_line_number: 1 - error_code: XML_ERROR_NONE -} -EOTXT - , - $var - ); - } - - public function testJsonCast() - { - $var = (array) json_decode('{"0":{},"1":null}'); - foreach ($var as &$v) { - } - $var[] = &$v; - $var[''] = 2; - - if (\PHP_VERSION_ID >= 70200) { - $this->assertDumpMatchesFormat( - <<<'EOTXT' -array:4 [ - 0 => {} - 1 => &1 null - 2 => &1 null - "" => 2 -] -EOTXT - , - $var - ); - } else { - $this->assertDumpMatchesFormat( - <<<'EOTXT' -array:4 [ - "0" => {} - "1" => &1 null - 0 => &1 null - "" => 2 -] -EOTXT - , - $var - ); - } - } - - public function testObjectCast() - { - $var = (object) [1 => 1]; - $var->{1} = 2; - - if (\PHP_VERSION_ID >= 70200) { - $this->assertDumpMatchesFormat( - <<<'EOTXT' -{ - +"1": 2 -} -EOTXT - , - $var - ); - } else { - $this->assertDumpMatchesFormat( - <<<'EOTXT' -{ - +1: 1 - +"1": 2 -} -EOTXT - , - $var - ); - } - } - - public function testClosedResource() - { - $var = fopen(__FILE__, 'r'); - fclose($var); - - $dumper = new CliDumper('php://output'); - $dumper->setColors(false); - $cloner = new VarCloner(); - $data = $cloner->cloneVar($var); - - ob_start(); - $dumper->dump($data); - $out = ob_get_clean(); - $res = (int) $var; - - $this->assertStringMatchesFormat( - << 'bar'], - ]; - - $this->assertDumpEquals( - << (3) "foo" - 2 => (3) "bar" - ] -] -EOTXT - , - $var - ); - - putenv('DUMP_LIGHT_ARRAY='); - putenv('DUMP_STRING_LENGTH='); - } - - /** - * @requires function Twig\Template::getSourceContext - */ - public function testThrowingCaster() - { - $out = fopen('php://memory', 'r+b'); - - require_once __DIR__.'/../Fixtures/Twig.php'; - $twig = new \__TwigTemplate_VarDumperFixture_u75a09(new Environment(new FilesystemLoader())); - - $dumper = new CliDumper(); - $dumper->setColors(false); - $cloner = new VarCloner(); - $cloner->addCasters([ - ':stream' => function ($res, $a) { - unset($a['wrapper_data']); - - return $a; - }, - ]); - $cloner->addCasters([ - ':stream' => eval('return function () use ($twig) { - try { - $twig->render([]); - } catch (\Twig\Error\RuntimeError $e) { - throw $e->getPrevious(); - } - };'), - ]); - $ref = (int) $out; - - $data = $cloner->cloneVar($out); - $dumper->dump($data, $out); - $out = stream_get_contents($out, -1, 0); - - $this->assertStringMatchesFormat( - << 'foo']; - $var->bar = &$var->foo; - - $dumper = new CliDumper(); - $dumper->setColors(false); - $cloner = new VarCloner(); - - $data = $cloner->cloneVar($var); - $out = $dumper->dump($data, true); - - $this->assertStringMatchesFormat( - <<getSpecialVars(); - - $this->assertDumpEquals( - <<<'EOTXT' -array:3 [ - 0 => array:1 [ - 0 => &1 array:1 [ - 0 => &1 array:1 [&1] - ] - ] - 1 => array:1 [ - "GLOBALS" => &2 array:1 [ - "GLOBALS" => &2 array:1 [&2] - ] - ] - 2 => &2 array:1 [&2] -] -EOTXT - , - $var - ); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testGlobals() - { - $var = $this->getSpecialVars(); - unset($var[0]); - $out = ''; - - $dumper = new CliDumper(function ($line, $depth) use (&$out) { - if ($depth >= 0) { - $out .= str_repeat(' ', $depth).$line."\n"; - } - }); - $dumper->setColors(false); - $cloner = new VarCloner(); - - $data = $cloner->cloneVar($var); - $dumper->dump($data); - - $this->assertSame( - <<<'EOTXT' -array:2 [ - 1 => array:1 [ - "GLOBALS" => &1 array:1 [ - "GLOBALS" => &1 array:1 [&1] - ] - ] - 2 => &1 array:1 [&1] -] - -EOTXT - , - $out - ); - } - - public function testIncompleteClass() - { - $unserializeCallbackHandler = ini_set('unserialize_callback_func', null); - $var = unserialize('O:8:"Foo\Buzz":0:{}'); - ini_set('unserialize_callback_func', $unserializeCallbackHandler); - - $this->assertDumpMatchesFormat( - << - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\CliDumper; -use Symfony\Component\VarDumper\VarDumper; - -class FunctionsTest extends TestCase -{ - public function testDumpReturnsFirstArg() - { - $this->setupVarDumper(); - - $var1 = 'a'; - - ob_start(); - $return = dump($var1); - ob_end_clean(); - - $this->assertEquals($var1, $return); - } - - public function testDumpReturnsAllArgsInArray() - { - $this->setupVarDumper(); - - $var1 = 'a'; - $var2 = 'b'; - $var3 = 'c'; - - ob_start(); - $return = dump($var1, $var2, $var3); - ob_end_clean(); - - $this->assertEquals([$var1, $var2, $var3], $return); - } - - protected function setupVarDumper() - { - $cloner = new VarCloner(); - $dumper = new CliDumper('php://output'); - VarDumper::setHandler(function ($var) use ($cloner, $dumper) { - $dumper->dump($cloner->cloneVar($var)); - }); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php b/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php deleted file mode 100644 index ae4ee8e6..00000000 --- a/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; - -/** - * @author Nicolas Grekas - */ -class HtmlDumperTest extends TestCase -{ - public function testGet() - { - if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) { - $this->markTestSkipped('A custom file_link_format is defined.'); - } - - require __DIR__.'/../Fixtures/dumb-var.php'; - - $dumper = new HtmlDumper('php://output'); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $cloner = new VarCloner(); - $cloner->addCasters([ - ':stream' => function ($res, $a) { - unset($a['uri'], $a['wrapper_data']); - - return $a; - }, - ]); - $data = $cloner->cloneVar($var); - - ob_start(); - $dumper->dump($data); - $out = ob_get_clean(); - $out = preg_replace('/[ \t]+$/m', '', $out); - $var['file'] = htmlspecialchars($var['file'], ENT_QUOTES, 'UTF-8'); - $intMax = PHP_INT_MAX; - preg_match('/sf-dump-\d+/', $out, $dumpId); - $dumpId = $dumpId[0]; - $res = (int) $var['res']; - - $this->assertStringMatchesFormat( - <<array:24 [ - "number" => 1 - 0 => &1 null - "const" => 1.1 - 1 => true - 2 => false - 3 => NAN - 4 => INF - 5 => -INF - 6 => {$intMax} - "str" => "d&%s;j&%s;\\n" - 7 => b""" - é\\x00test\\t\\n - ing - """ - "[]" => [] - "res" => stream resource @{$res} -%A wrapper_type: "plainfile" - stream_type: "STDIO" - mode: "r" - unread_bytes: 0 - seekable: true -%A options: [] - } - "obj" => DumbFoo {#%d - +foo: "foo" - +"bar": "bar" - } - "closure" => Closure(\$a, PDO &\$b = null) {#%d - class: "Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest" - this: HtmlDumperTest {#%d &%s;} - file: "%s%eVarDumper%eTests%eFixtures%edumb-var.php" - line: "{$var['line']} to {$var['line']}" - } - "line" => {$var['line']} - "nobj" => array:1 [ - 0 => &3 {#%d} - ] - "recurs" => &4 array:1 [ - 0 => &4 array:1 [&4] - ] - 8 => &1 null - "sobj" => DumbFoo {#%d} - "snobj" => &3 {#%d} - "snobj2" => {#%d} - "file" => "{$var['file']}" - b"bin-key-&%s;" => "" -] - - -EOTXT - , - - $out - ); - } - - public function testCharset() - { - $var = mb_convert_encoding('Словарь', 'CP1251', 'UTF-8'); - - $dumper = new HtmlDumper('php://output', 'CP1251'); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $cloner = new VarCloner(); - - $data = $cloner->cloneVar($var); - $out = $dumper->dump($data, true); - - $this->assertStringMatchesFormat( - <<<'EOTXT' -b"Словарь" - - -EOTXT - , - $out - ); - } - - public function testAppend() - { - $out = fopen('php://memory', 'r+b'); - - $dumper = new HtmlDumper(); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - $cloner = new VarCloner(); - - $dumper->dump($cloner->cloneVar(123), $out); - $dumper->dump($cloner->cloneVar(456), $out); - - $out = stream_get_contents($out, -1, 0); - - $this->assertSame(<<<'EOTXT' -123 - -456 - - -EOTXT - , - $out - ); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Dumper/ServerDumperTest.php b/vendor/symfony/var-dumper/Tests/Dumper/ServerDumperTest.php deleted file mode 100644 index b4bef49c..00000000 --- a/vendor/symfony/var-dumper/Tests/Dumper/ServerDumperTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Process\PhpProcess; -use Symfony\Component\Process\Process; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface; -use Symfony\Component\VarDumper\Dumper\DataDumperInterface; -use Symfony\Component\VarDumper\Dumper\ServerDumper; - -class ServerDumperTest extends TestCase -{ - private const VAR_DUMPER_SERVER = 'tcp://127.0.0.1:9913'; - - public function testDumpForwardsToWrappedDumperWhenServerIsUnavailable() - { - $wrappedDumper = $this->getMockBuilder(DataDumperInterface::class)->getMock(); - - $dumper = new ServerDumper(self::VAR_DUMPER_SERVER, $wrappedDumper); - - $cloner = new VarCloner(); - $data = $cloner->cloneVar('foo'); - - $wrappedDumper->expects($this->once())->method('dump')->with($data); - - $dumper->dump($data); - } - - public function testDump() - { - $wrappedDumper = $this->getMockBuilder(DataDumperInterface::class)->getMock(); - $wrappedDumper->expects($this->never())->method('dump'); // test wrapped dumper is not used - - $cloner = new VarCloner(); - $data = $cloner->cloneVar('foo'); - $dumper = new ServerDumper(self::VAR_DUMPER_SERVER, $wrappedDumper, [ - 'foo_provider' => new class() implements ContextProviderInterface { - public function getContext(): ?array - { - return ['foo']; - } - }, - ]); - - $dumped = null; - $process = $this->getServerProcess(); - $process->start(function ($type, $buffer) use ($process, &$dumped, $dumper, $data) { - if (Process::ERR === $type) { - $process->stop(); - $this->fail(); - } elseif ("READY\n" === $buffer) { - $dumper->dump($data); - } else { - $dumped .= $buffer; - } - }); - - $process->wait(); - - $this->assertTrue($process->isSuccessful()); - $this->assertStringMatchesFormat(<<<'DUMP' -(3) "foo" -[ - "timestamp" => %d.%d - "foo_provider" => [ - (3) "foo" - ] -] -%d -DUMP - , $dumped); - } - - private function getServerProcess(): Process - { - $process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, [ - 'COMPONENT_ROOT' => __DIR__.'/../../', - 'VAR_DUMPER_SERVER' => self::VAR_DUMPER_SERVER, - ]); - $process->inheritEnvironmentVariables(true); - - return $process->setTimeout(9); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Fixtures/FooInterface.php b/vendor/symfony/var-dumper/Tests/Fixtures/FooInterface.php deleted file mode 100644 index 172958b4..00000000 --- a/vendor/symfony/var-dumper/Tests/Fixtures/FooInterface.php +++ /dev/null @@ -1,11 +0,0 @@ -p2 = new \stdClass(); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Fixtures/Twig.php b/vendor/symfony/var-dumper/Tests/Fixtures/Twig.php deleted file mode 100644 index 8b84d820..00000000 --- a/vendor/symfony/var-dumper/Tests/Fixtures/Twig.php +++ /dev/null @@ -1,38 +0,0 @@ -parent = false; - $this->blocks = []; - $this->path = $path; - } - - protected function doDisplay(array $context, array $blocks = []) - { - // line 2 - throw new \Exception('Foobar'); - } - - public function getTemplateName() - { - return 'foo.twig'; - } - - public function getDebugInfo() - { - return [20 => 1, 21 => 2]; - } - - public function getSourceContext() - { - return new Twig\Source(" foo bar\n twig source\n\n", 'foo.twig', $this->path ?: __FILE__); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Fixtures/dumb-var.php b/vendor/symfony/var-dumper/Tests/Fixtures/dumb-var.php deleted file mode 100644 index dcce2372..00000000 --- a/vendor/symfony/var-dumper/Tests/Fixtures/dumb-var.php +++ /dev/null @@ -1,40 +0,0 @@ -bar = 'bar'; - -$g = fopen(__FILE__, 'r'); - -$var = [ - 'number' => 1, null, - 'const' => 1.1, true, false, NAN, INF, -INF, PHP_INT_MAX, - 'str' => "déjà\n", "\xE9\x00test\t\ning", - '[]' => [], - 'res' => $g, - 'obj' => $foo, - 'closure' => function ($a, \PDO &$b = null) {}, - 'line' => __LINE__ - 1, - 'nobj' => [(object) []], -]; - -$r = []; -$r[] = &$r; - -$var['recurs'] = &$r; -$var[] = &$var[0]; -$var['sobj'] = $var['obj']; -$var['snobj'] = &$var['nobj'][0]; -$var['snobj2'] = $var['nobj'][0]; -$var['file'] = __FILE__; -$var["bin-key-\xE9"] = ''; - -unset($g, $r); diff --git a/vendor/symfony/var-dumper/Tests/Fixtures/dump_server.php b/vendor/symfony/var-dumper/Tests/Fixtures/dump_server.php deleted file mode 100644 index ed8bbfba..00000000 --- a/vendor/symfony/var-dumper/Tests/Fixtures/dump_server.php +++ /dev/null @@ -1,38 +0,0 @@ -setMaxItems(-1); - -$dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_STRING_LENGTH); -$dumper->setColors(false); - -VarDumper::setHandler(function ($var) use ($cloner, $dumper) { - $data = $cloner->cloneVar($var)->withRefHandles(false); - $dumper->dump($data); -}); - -$server = new DumpServer(getenv('VAR_DUMPER_SERVER')); - -$server->start(); - -echo "READY\n"; - -$server->listen(function (Data $data, array $context, $clientId) { - dump((string) $data, $context, $clientId); - - exit(0); -}); diff --git a/vendor/symfony/var-dumper/Tests/Fixtures/xml_reader.xml b/vendor/symfony/var-dumper/Tests/Fixtures/xml_reader.xml deleted file mode 100644 index 740c399f..00000000 --- a/vendor/symfony/var-dumper/Tests/Fixtures/xml_reader.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - With text - - - - - diff --git a/vendor/symfony/var-dumper/Tests/Server/ConnectionTest.php b/vendor/symfony/var-dumper/Tests/Server/ConnectionTest.php deleted file mode 100644 index a67cb76b..00000000 --- a/vendor/symfony/var-dumper/Tests/Server/ConnectionTest.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Server; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Process\PhpProcess; -use Symfony\Component\Process\Process; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface; -use Symfony\Component\VarDumper\Server\Connection; - -class ConnectionTest extends TestCase -{ - private const VAR_DUMPER_SERVER = 'tcp://127.0.0.1:9913'; - - public function testDump() - { - $cloner = new VarCloner(); - $data = $cloner->cloneVar('foo'); - $connection = new Connection(self::VAR_DUMPER_SERVER, [ - 'foo_provider' => new class() implements ContextProviderInterface { - public function getContext(): ?array - { - return ['foo']; - } - }, - ]); - - $dumped = null; - $process = $this->getServerProcess(); - $process->start(function ($type, $buffer) use ($process, &$dumped, $connection, $data) { - if (Process::ERR === $type) { - $process->stop(); - $this->fail(); - } elseif ("READY\n" === $buffer) { - $connection->write($data); - } else { - $dumped .= $buffer; - } - }); - - $process->wait(); - - $this->assertTrue($process->isSuccessful()); - $this->assertStringMatchesFormat(<<<'DUMP' -(3) "foo" -[ - "timestamp" => %d.%d - "foo_provider" => [ - (3) "foo" - ] -] -%d - -DUMP - , $dumped); - } - - public function testNoServer() - { - $cloner = new VarCloner(); - $data = $cloner->cloneVar('foo'); - $connection = new Connection(self::VAR_DUMPER_SERVER); - $start = microtime(true); - $this->assertFalse($connection->write($data)); - $this->assertLessThan(4, microtime(true) - $start); - } - - private function getServerProcess(): Process - { - $process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, [ - 'COMPONENT_ROOT' => __DIR__.'/../../', - 'VAR_DUMPER_SERVER' => self::VAR_DUMPER_SERVER, - ]); - $process->inheritEnvironmentVariables(true); - - return $process->setTimeout(9); - } -} diff --git a/vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php b/vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php deleted file mode 100644 index a4d489cf..00000000 --- a/vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests\Test; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Test\VarDumperTestTrait; - -class VarDumperTestTraitTest extends TestCase -{ - use VarDumperTestTrait; - - public function testItComparesLargeData() - { - $howMany = 700; - $data = array_fill_keys(range(0, $howMany), ['a', 'b', 'c', 'd']); - - $expected = sprintf("array:%d [\n", $howMany + 1); - for ($i = 0; $i <= $howMany; ++$i) { - $expected .= << array:4 [ - 0 => "a" - 1 => "b" - 2 => "c" - 3 => "d" - ]\n -EODUMP; - } - $expected .= "]\n"; - - $this->assertDumpEquals($expected, $data); - } - - public function testAllowsNonScalarExpectation() - { - $this->assertDumpEquals(new \ArrayObject(['bim' => 'bam']), new \ArrayObject(['bim' => 'bam'])); - } -} diff --git a/vendor/symfony/var-dumper/VarDumper.php b/vendor/symfony/var-dumper/VarDumper.php deleted file mode 100644 index 009f662f..00000000 --- a/vendor/symfony/var-dumper/VarDumper.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper; - -use Symfony\Component\VarDumper\Caster\ReflectionCaster; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\CliDumper; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; - -// Load the global dump() function -require_once __DIR__.'/Resources/functions/dump.php'; - -/** - * @author Nicolas Grekas - */ -class VarDumper -{ - private static $handler; - - public static function dump($var) - { - if (null === self::$handler) { - $cloner = new VarCloner(); - $cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO); - - if (isset($_SERVER['VAR_DUMPER_FORMAT'])) { - $dumper = 'html' === $_SERVER['VAR_DUMPER_FORMAT'] ? new HtmlDumper() : new CliDumper(); - } else { - $dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper() : new HtmlDumper(); - } - - self::$handler = function ($var) use ($cloner, $dumper) { - $dumper->dump($cloner->cloneVar($var)); - }; - } - - return (self::$handler)($var); - } - - public static function setHandler(callable $callable = null) - { - $prevHandler = self::$handler; - self::$handler = $callable; - - return $prevHandler; - } -} diff --git a/vendor/symfony/var-dumper/composer.json b/vendor/symfony/var-dumper/composer.json deleted file mode 100644 index b0c02737..00000000 --- a/vendor/symfony/var-dumper/composer.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "symfony/var-dumper", - "type": "library", - "description": "Symfony mechanism for exploring and dumping PHP variables", - "keywords": ["dump", "debug"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "twig/twig": "~1.34|~2.4" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "autoload": { - "files": [ "Resources/functions/dump.php" ], - "psr-4": { "Symfony\\Component\\VarDumper\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "bin": [ - "Resources/bin/var-dump-server" - ], - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - } -} diff --git a/vendor/symfony/var-dumper/phpunit.xml.dist b/vendor/symfony/var-dumper/phpunit.xml.dist deleted file mode 100644 index 3243fcd0..00000000 --- a/vendor/symfony/var-dumper/phpunit.xml.dist +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/vendor/topthink/framework/.gitignore b/vendor/topthink/framework/.gitignore deleted file mode 100644 index b267fbae..00000000 --- a/vendor/topthink/framework/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/vendor -composer.phar -composer.lock -.DS_Store -Thumbs.db -/.idea -/.vscode \ No newline at end of file diff --git a/vendor/topthink/framework/.travis.yml b/vendor/topthink/framework/.travis.yml deleted file mode 100644 index 28987af8..00000000 --- a/vendor/topthink/framework/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -dist: xenial -language: php - -matrix: - fast_finish: true - include: - - php: 7.1 - - php: 7.2 - - php: 7.3 - -cache: - directories: - - $HOME/.composer/cache - -services: - - memcached - - redis-server - - mysql - -before_install: - - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo 'xdebug.mode = coverage' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - printf "\n" | pecl install -f redis - - travis_retry composer self-update - - mysql -e 'CREATE DATABASE test;' - -install: - - travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest - -script: - - vendor/bin/phpunit --coverage-clover build/logs/coverage.xml - -after_script: - - travis_retry wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/coverage.xml diff --git a/vendor/topthink/framework/CONTRIBUTING.md b/vendor/topthink/framework/CONTRIBUTING.md deleted file mode 100644 index efa3ad97..00000000 --- a/vendor/topthink/framework/CONTRIBUTING.md +++ /dev/null @@ -1,119 +0,0 @@ -如何贡献我的源代码 -=== - -此文档介绍了 ThinkPHP 团队的组成以及运转机制,您提交的代码将给 ThinkPHP 项目带来什么好处,以及如何才能加入我们的行列。 - -## 通过 Github 贡献代码 - -ThinkPHP 目前使用 Git 来控制程序版本,如果你想为 ThinkPHP 贡献源代码,请先大致了解 Git 的使用方法。我们目前把项目托管在 GitHub 上,任何 GitHub 用户都可以向我们贡献代码。 - -参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请并。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。 - -我们希望你贡献的代码符合: - -* ThinkPHP 的编码规范 -* 适当的注释,能让其他人读懂 -* 遵循 Apache2 开源协议 - -**如果想要了解更多细节或有任何疑问,请继续阅读下面的内容** - -### 注意事项 - -* 本项目代码格式化标准选用 [**PSR-2**](http://www.kancloud.cn/thinkphp/php-fig-psr/3141); -* 类名和类文件名遵循 [**PSR-4**](http://www.kancloud.cn/thinkphp/php-fig-psr/3144); -* 对于 Issues 的处理,请使用诸如 `fix #xxx(Issue ID)` 的 commit title 直接关闭 issue。 -* 系统会自动在 PHP 7.1 ~ 7.3 上测试修改,请确保你的修改符合 PHP 7.1 ~ 7.3 的语法规范; -* 管理员不会合并造成 CI faild 的修改,若出现 CI faild 请检查自己的源代码或修改相应的[单元测试文件](tests); - -## GitHub Issue - -GitHub 提供了 Issue 功能,该功能可以用于: - -* 提出 bug -* 提出功能改进 -* 反馈使用体验 - -该功能不应该用于: - - * 提出修改意见(涉及代码署名和修订追溯问题) - * 不友善的言论 - -## 快速修改 - -**GitHub 提供了快速编辑文件的功能** - -1. 登录 GitHub 帐号; -2. 浏览项目文件,找到要进行修改的文件; -3. 点击右上角铅笔图标进行修改; -4. 填写 `Commit changes` 相关内容(Title 必填); -5. 提交修改,等待 CI 验证和管理员合并。 - -**若您需要一次提交大量修改,请继续阅读下面的内容** - -## 完整流程 - -1. `fork`本项目; -2. 克隆(`clone`)你 `fork` 的项目到本地; -3. 新建分支(`branch`)并检出(`checkout`)新分支; -4. 添加本项目到你的本地 git 仓库作为上游(`upstream`); -5. 进行修改,若你的修改包含方法或函数的增减,请记得修改[单元测试文件](tests); -6. 变基(衍合 `rebase`)你的分支到上游 master 分支; -7. `push` 你的本地仓库到 GitHub; -8. 提交 `pull request`; -9. 等待 CI 验证(若不通过则重复 5~7,GitHub 会自动更新你的 `pull request`); -10. 等待管理员处理,并及时 `rebase` 你的分支到上游 master 分支(若上游 master 分支有修改)。 - -*若有必要,可以 `git push -f` 强行推送 rebase 后的分支到自己的 `fork`* - -*绝对不可以使用 `git push -f` 强行推送修改到上游* - -### 注意事项 - -* 若对上述流程有任何不清楚的地方,请查阅 GIT 教程,如 [这个](http://backlogtool.com/git-guide/cn/); -* 对于代码**不同方面**的修改,请在自己 `fork` 的项目中**创建不同的分支**(原因参见`完整流程`第9条备注部分); -* 变基及交互式变基操作参见 [Git 交互式变基](http://pakchoi.me/2015/03/17/git-interactive-rebase/) - -## 推荐资源 - -### 开发环境 - -* XAMPP for Windows 5.5.x -* WampServer (for Windows) -* upupw Apache PHP5.4 ( for Windows) - -或自行安装 - -- Apache / Nginx -- PHP 7.1 ~ 7.3 -- MySQL / MariaDB - -*Windows 用户推荐添加 PHP bin 目录到 PATH,方便使用 composer* - -*Linux 用户自行配置环境, Mac 用户推荐使用内置 Apache 配合 Homebrew 安装 PHP 和 MariaDB* - -### 编辑器 - -Sublime Text 3 + phpfmt 插件 - -phpfmt 插件参数 - -```json -{ - "autocomplete": true, - "enable_auto_align": true, - "format_on_save": true, - "indent_with_space": true, - "psr1_naming": false, - "psr2": true, - "version": 4 -} -``` - -或其他 编辑器 / IDE 配合 PSR2 自动格式化工具 - -### Git GUI - -* SourceTree -* GitHub Desktop - -或其他 Git 图形界面客户端 diff --git a/vendor/topthink/framework/LICENSE.txt b/vendor/topthink/framework/LICENSE.txt deleted file mode 100644 index 4e910bb2..00000000 --- a/vendor/topthink/framework/LICENSE.txt +++ /dev/null @@ -1,32 +0,0 @@ - -ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 -版权所有Copyright © 2006-2019 by ThinkPHP (http://thinkphp.cn) -All rights reserved。 -ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 - -Apache Licence是著名的非盈利开源组织Apache采用的协议。 -该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, -允许代码修改,再作为开源或商业软件发布。需要满足 -的条件: -1. 需要给代码的用户一份Apache Licence ; -2. 如果你修改了代码,需要在被修改的文件中说明; -3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 -带有原来代码中的协议,商标,专利声明和其他原来作者规 -定需要包含的说明; -4. 如果再发布的产品中包含一个Notice文件,则在Notice文 -件中需要带有本协议内容。你可以在Notice中增加自己的 -许可,但不可以表现为对Apache Licence构成更改。 -具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/topthink/framework/README.md b/vendor/topthink/framework/README.md deleted file mode 100644 index 0ea03c98..00000000 --- a/vendor/topthink/framework/README.md +++ /dev/null @@ -1,86 +0,0 @@ -![](https://box.kancloud.cn/5a0aaa69a5ff42657b5c4715f3d49221) - -ThinkPHP 6.0 -=============== - -[![Build Status](https://travis-ci.org/top-think/framework.svg?branch=6.0)](https://travis-ci.org/top-think/framework) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/top-think/framework/badges/quality-score.png?b=6.0)](https://scrutinizer-ci.com/g/top-think/framework/?branch=6.0) -[![Code Coverage](https://scrutinizer-ci.com/g/top-think/framework/badges/coverage.png?b=6.0)](https://scrutinizer-ci.com/g/top-think/framework/?branch=6.0) -[![Total Downloads](https://poser.pugx.org/topthink/framework/downloads)](https://packagist.org/packages/topthink/framework) -[![Latest Stable Version](https://poser.pugx.org/topthink/framework/v/stable)](https://packagist.org/packages/topthink/framework) -[![PHP Version](https://img.shields.io/badge/php-%3E%3D7.1-8892BF.svg)](http://www.php.net/) -[![License](https://poser.pugx.org/topthink/framework/license)](https://packagist.org/packages/topthink/framework) - -ThinkPHP6.0底层架构采用PHP7.1改写和进一步优化。 - -[官方应用服务市场](https://market.topthink.com) | [`ThinkAPI`——官方统一API服务](https://docs.topthink.com/think-api/) - -## 主要新特性 - -* 采用`PHP7`强类型(严格模式) -* 支持更多的`PSR`规范 -* 原生多应用支持 -* 系统服务注入支持 -* ORM作为独立组件使用 -* 增加Filesystem -* 全新的事件系统 -* 模板引擎分离出核心 -* 内部功能中间件化 -* SESSION机制改进 -* 日志多通道支持 -* 规范扩展接口 -* 更强大的控制台 -* 对Swoole以及协程支持改进 -* 对IDE更加友好 -* 统一和精简大量用法 - - -> ThinkPHP6.0的运行环境要求PHP7.1+,兼容PHP8.0。 - -## 安装 - -~~~ -composer create-project topthink/think tp -~~~ - -启动服务 - -~~~ -cd tp -php think run -~~~ - -然后就可以在浏览器中访问 - -~~~ -http://localhost:8000 -~~~ - -如果需要更新框架使用 -~~~ -composer update topthink/framework -~~~ - -## 文档 - -[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content) - -## 命名规范 - -`ThinkPHP6`遵循PSR-2命名规范和PSR-4自动加载规范。 - -## 参与开发 - -直接提交PR或者Issue即可 - -## 版权信息 - -ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 - -本项目包含的第三方源码和二进制文件之版权信息另行标注。 - -版权所有Copyright © 2006-2021 by ThinkPHP (http://thinkphp.cn) All rights reserved。 - -ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 - -更多细节参阅 [LICENSE.txt](LICENSE.txt) diff --git a/vendor/topthink/framework/composer.json b/vendor/topthink/framework/composer.json deleted file mode 100644 index 9afc513a..00000000 --- a/vendor/topthink/framework/composer.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "topthink/framework", - "description": "The ThinkPHP Framework.", - "keywords": [ - "framework", - "thinkphp", - "ORM" - ], - "homepage": "http://thinkphp.cn/", - "license": "Apache-2.0", - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - }, - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "require": { - "php": ">=7.1.0", - "ext-json": "*", - "ext-mbstring": "*", - "league/flysystem": "^1.0", - "league/flysystem-cached-adapter": "^1.0", - "psr/log": "~1.0", - "psr/container": "~1.0", - "psr/simple-cache": "^1.0", - "topthink/think-orm": "^2.0", - "topthink/think-helper": "^3.1.1" - }, - "require-dev": { - "mikey179/vfsstream": "^1.6", - "mockery/mockery": "^1.2", - "phpunit/phpunit": "^7.0" - }, - "autoload": { - "files": [], - "psr-4": { - "think\\": "src/think/" - } - }, - "autoload-dev": { - "psr-4": { - "think\\tests\\": "tests/" - } - }, - "minimum-stability": "dev", - "prefer-stable": true, - "config": { - "sort-packages": true - } -} diff --git a/vendor/topthink/framework/logo.png b/vendor/topthink/framework/logo.png deleted file mode 100644 index 25fd0593..00000000 Binary files a/vendor/topthink/framework/logo.png and /dev/null differ diff --git a/vendor/topthink/framework/phpunit.xml.dist b/vendor/topthink/framework/phpunit.xml.dist deleted file mode 100644 index e20a1338..00000000 --- a/vendor/topthink/framework/phpunit.xml.dist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - ./tests - - - - - ./src/think - - - diff --git a/vendor/topthink/framework/src/helper.php b/vendor/topthink/framework/src/helper.php deleted file mode 100644 index 650edcb9..00000000 --- a/vendor/topthink/framework/src/helper.php +++ /dev/null @@ -1,663 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -//------------------------ -// ThinkPHP 助手函数 -//------------------------- - -use think\App; -use think\Container; -use think\exception\HttpException; -use think\exception\HttpResponseException; -use think\facade\Cache; -use think\facade\Config; -use think\facade\Cookie; -use think\facade\Env; -use think\facade\Event; -use think\facade\Lang; -use think\facade\Log; -use think\facade\Request; -use think\facade\Route; -use think\facade\Session; -use think\Response; -use think\response\File; -use think\response\Json; -use think\response\Jsonp; -use think\response\Redirect; -use think\response\View; -use think\response\Xml; -use think\route\Url as UrlBuild; -use think\Validate; - -if (!function_exists('abort')) { - /** - * 抛出HTTP异常 - * @param integer|Response $code 状态码 或者 Response对象实例 - * @param string $message 错误信息 - * @param array $header 参数 - */ - function abort($code, string $message = '', array $header = []) - { - if ($code instanceof Response) { - throw new HttpResponseException($code); - } else { - throw new HttpException($code, $message, null, $header); - } - } -} - -if (!function_exists('app')) { - /** - * 快速获取容器中的实例 支持依赖注入 - * @param string $name 类名或标识 默认获取当前应用实例 - * @param array $args 参数 - * @param bool $newInstance 是否每次创建新的实例 - * @return object|App - */ - function app(string $name = '', array $args = [], bool $newInstance = false) - { - return Container::getInstance()->make($name ?: App::class, $args, $newInstance); - } -} - -if (!function_exists('bind')) { - /** - * 绑定一个类到容器 - * @param string|array $abstract 类标识、接口(支持批量绑定) - * @param mixed $concrete 要绑定的类、闭包或者实例 - * @return Container - */ - function bind($abstract, $concrete = null) - { - return Container::getInstance()->bind($abstract, $concrete); - } -} - -if (!function_exists('cache')) { - /** - * 缓存管理 - * @param string $name 缓存名称 - * @param mixed $value 缓存值 - * @param mixed $options 缓存参数 - * @param string $tag 缓存标签 - * @return mixed - */ - function cache(string $name = null, $value = '', $options = null, $tag = null) - { - if (is_null($name)) { - return app('cache'); - } - - if ('' === $value) { - // 获取缓存 - return 0 === strpos($name, '?') ? Cache::has(substr($name, 1)) : Cache::get($name); - } elseif (is_null($value)) { - // 删除缓存 - return Cache::delete($name); - } - - // 缓存数据 - if (is_array($options)) { - $expire = $options['expire'] ?? null; //修复查询缓存无法设置过期时间 - } else { - $expire = $options; - } - - if (is_null($tag)) { - return Cache::set($name, $value, $expire); - } else { - return Cache::tag($tag)->set($name, $value, $expire); - } - } -} - -if (!function_exists('config')) { - /** - * 获取和设置配置参数 - * @param string|array $name 参数名 - * @param mixed $value 参数值 - * @return mixed - */ - function config($name = '', $value = null) - { - if (is_array($name)) { - return Config::set($name, $value); - } - - return 0 === strpos($name, '?') ? Config::has(substr($name, 1)) : Config::get($name, $value); - } -} - -if (!function_exists('cookie')) { - /** - * Cookie管理 - * @param string $name cookie名称 - * @param mixed $value cookie值 - * @param mixed $option 参数 - * @return mixed - */ - function cookie(string $name, $value = '', $option = null) - { - if (is_null($value)) { - // 删除 - Cookie::delete($name); - } elseif ('' === $value) { - // 获取 - return 0 === strpos($name, '?') ? Cookie::has(substr($name, 1)) : Cookie::get($name); - } else { - // 设置 - return Cookie::set($name, $value, $option); - } - } -} - -if (!function_exists('download')) { - /** - * 获取\think\response\Download对象实例 - * @param string $filename 要下载的文件 - * @param string $name 显示文件名 - * @param bool $content 是否为内容 - * @param int $expire 有效期(秒) - * @return \think\response\File - */ - function download(string $filename, string $name = '', bool $content = false, int $expire = 180): File - { - return Response::create($filename, 'file')->name($name)->isContent($content)->expire($expire); - } -} - -if (!function_exists('dump')) { - /** - * 浏览器友好的变量输出 - * @param mixed $vars 要输出的变量 - * @return void - */ - function dump(...$vars) - { - ob_start(); - var_dump(...$vars); - - $output = ob_get_clean(); - $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); - - if (PHP_SAPI == 'cli') { - $output = PHP_EOL . $output . PHP_EOL; - } else { - if (!extension_loaded('xdebug')) { - $output = htmlspecialchars($output, ENT_SUBSTITUTE); - } - $output = '
    ' . $output . '
    '; - } - - echo $output; - } -} - -if (!function_exists('env')) { - /** - * 获取环境变量值 - * @access public - * @param string $name 环境变量名(支持二级 .号分割) - * @param string $default 默认值 - * @return mixed - */ - function env(string $name = null, $default = null) - { - return Env::get($name, $default); - } -} - -if (!function_exists('event')) { - /** - * 触发事件 - * @param mixed $event 事件名(或者类名) - * @param mixed $args 参数 - * @return mixed - */ - function event($event, $args = null) - { - return Event::trigger($event, $args); - } -} - -if (!function_exists('halt')) { - /** - * 调试变量并且中断输出 - * @param mixed $vars 调试变量或者信息 - */ - function halt(...$vars) - { - dump(...$vars); - - throw new HttpResponseException(Response::create()); - } -} - -if (!function_exists('input')) { - /** - * 获取输入数据 支持默认值和过滤 - * @param string $key 获取的变量名 - * @param mixed $default 默认值 - * @param string $filter 过滤方法 - * @return mixed - */ - function input(string $key = '', $default = null, $filter = '') - { - if (0 === strpos($key, '?')) { - $key = substr($key, 1); - $has = true; - } - - if ($pos = strpos($key, '.')) { - // 指定参数来源 - $method = substr($key, 0, $pos); - if (in_array($method, ['get', 'post', 'put', 'patch', 'delete', 'route', 'param', 'request', 'session', 'cookie', 'server', 'env', 'path', 'file'])) { - $key = substr($key, $pos + 1); - if ('server' == $method && is_null($default)) { - $default = ''; - } - } else { - $method = 'param'; - } - } else { - // 默认为自动判断 - $method = 'param'; - } - - return isset($has) ? - request()->has($key, $method) : - request()->$method($key, $default, $filter); - } -} - -if (!function_exists('invoke')) { - /** - * 调用反射实例化对象或者执行方法 支持依赖注入 - * @param mixed $call 类名或者callable - * @param array $args 参数 - * @return mixed - */ - function invoke($call, array $args = []) - { - if (is_callable($call)) { - return Container::getInstance()->invoke($call, $args); - } - - return Container::getInstance()->invokeClass($call, $args); - } -} - -if (!function_exists('json')) { - /** - * 获取\think\response\Json对象实例 - * @param mixed $data 返回的数据 - * @param int $code 状态码 - * @param array $header 头部 - * @param array $options 参数 - * @return \think\response\Json - */ - function json($data = [], $code = 200, $header = [], $options = []): Json - { - return Response::create($data, 'json', $code)->header($header)->options($options); - } -} - -if (!function_exists('jsonp')) { - /** - * 获取\think\response\Jsonp对象实例 - * @param mixed $data 返回的数据 - * @param int $code 状态码 - * @param array $header 头部 - * @param array $options 参数 - * @return \think\response\Jsonp - */ - function jsonp($data = [], $code = 200, $header = [], $options = []): Jsonp - { - return Response::create($data, 'jsonp', $code)->header($header)->options($options); - } -} - -if (!function_exists('lang')) { - /** - * 获取语言变量值 - * @param string $name 语言变量名 - * @param array $vars 动态变量值 - * @param string $lang 语言 - * @return mixed - */ - function lang(string $name, array $vars = [], string $lang = '') - { - return Lang::get($name, $vars, $lang); - } -} - -if (!function_exists('parse_name')) { - /** - * 字符串命名风格转换 - * type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格 - * @param string $name 字符串 - * @param int $type 转换类型 - * @param bool $ucfirst 首字母是否大写(驼峰规则) - * @return string - */ - function parse_name(string $name, int $type = 0, bool $ucfirst = true): string - { - if ($type) { - $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { - return strtoupper($match[1]); - }, $name); - - return $ucfirst ? ucfirst($name) : lcfirst($name); - } - - return strtolower(trim(preg_replace('/[A-Z]/', '_\\0', $name), '_')); - } -} - -if (!function_exists('redirect')) { - /** - * 获取\think\response\Redirect对象实例 - * @param string $url 重定向地址 - * @param int $code 状态码 - * @return \think\response\Redirect - */ - function redirect(string $url = '', int $code = 302): Redirect - { - return Response::create($url, 'redirect', $code); - } -} - -if (!function_exists('request')) { - /** - * 获取当前Request对象实例 - * @return Request - */ - function request(): \think\Request - { - return app('request'); - } -} - -if (!function_exists('response')) { - /** - * 创建普通 Response 对象实例 - * @param mixed $data 输出数据 - * @param int|string $code 状态码 - * @param array $header 头信息 - * @param string $type - * @return Response - */ - function response($data = '', $code = 200, $header = [], $type = 'html'): Response - { - return Response::create($data, $type, $code)->header($header); - } -} - -if (!function_exists('session')) { - /** - * Session管理 - * @param string $name session名称 - * @param mixed $value session值 - * @return mixed - */ - function session($name = '', $value = '') - { - if (is_null($name)) { - // 清除 - Session::clear(); - } elseif ('' === $name) { - return Session::all(); - } elseif (is_null($value)) { - // 删除 - Session::delete($name); - } elseif ('' === $value) { - // 判断或获取 - return 0 === strpos($name, '?') ? Session::has(substr($name, 1)) : Session::get($name); - } else { - // 设置 - Session::set($name, $value); - } - } -} - -if (!function_exists('token')) { - /** - * 获取Token令牌 - * @param string $name 令牌名称 - * @param mixed $type 令牌生成方法 - * @return string - */ - function token(string $name = '__token__', string $type = 'md5'): string - { - return Request::buildToken($name, $type); - } -} - -if (!function_exists('token_field')) { - /** - * 生成令牌隐藏表单 - * @param string $name 令牌名称 - * @param mixed $type 令牌生成方法 - * @return string - */ - function token_field(string $name = '__token__', string $type = 'md5'): string - { - $token = Request::buildToken($name, $type); - - return ''; - } -} - -if (!function_exists('token_meta')) { - /** - * 生成令牌meta - * @param string $name 令牌名称 - * @param mixed $type 令牌生成方法 - * @return string - */ - function token_meta(string $name = '__token__', string $type = 'md5'): string - { - $token = Request::buildToken($name, $type); - - return ''; - } -} - -if (!function_exists('trace')) { - /** - * 记录日志信息 - * @param mixed $log log信息 支持字符串和数组 - * @param string $level 日志级别 - * @return array|void - */ - function trace($log = '[think]', string $level = 'log') - { - if ('[think]' === $log) { - return Log::getLog(); - } - - Log::record($log, $level); - } -} - -if (!function_exists('url')) { - /** - * Url生成 - * @param string $url 路由地址 - * @param array $vars 变量 - * @param bool|string $suffix 生成的URL后缀 - * @param bool|string $domain 域名 - * @return UrlBuild - */ - function url(string $url = '', array $vars = [], $suffix = true, $domain = false): UrlBuild - { - return Route::buildUrl($url, $vars)->suffix($suffix)->domain($domain); - } -} - -if (!function_exists('validate')) { - /** - * 生成验证对象 - * @param string|array $validate 验证器类名或者验证规则数组 - * @param array $message 错误提示信息 - * @param bool $batch 是否批量验证 - * @param bool $failException 是否抛出异常 - * @return Validate - */ - function validate($validate = '', array $message = [], bool $batch = false, bool $failException = true): Validate - { - if (is_array($validate) || '' === $validate) { - $v = new Validate(); - if (is_array($validate)) { - $v->rule($validate); - } - } else { - if (strpos($validate, '.')) { - // 支持场景 - [$validate, $scene] = explode('.', $validate); - } - - $class = false !== strpos($validate, '\\') ? $validate : app()->parseClass('validate', $validate); - - $v = new $class(); - - if (!empty($scene)) { - $v->scene($scene); - } - } - - return $v->message($message)->batch($batch)->failException($failException); - } -} - -if (!function_exists('view')) { - /** - * 渲染模板输出 - * @param string $template 模板文件 - * @param array $vars 模板变量 - * @param int $code 状态码 - * @param callable $filter 内容过滤 - * @return \think\response\View - */ - function view(string $template = '', $vars = [], $code = 200, $filter = null): View - { - return Response::create($template, 'view', $code)->assign($vars)->filter($filter); - } -} - -if (!function_exists('display')) { - /** - * 渲染模板输出 - * @param string $content 渲染内容 - * @param array $vars 模板变量 - * @param int $code 状态码 - * @param callable $filter 内容过滤 - * @return \think\response\View - */ - function display(string $content, $vars = [], $code = 200, $filter = null): View - { - return Response::create($content, 'view', $code)->isContent(true)->assign($vars)->filter($filter); - } -} - -if (!function_exists('xml')) { - /** - * 获取\think\response\Xml对象实例 - * @param mixed $data 返回的数据 - * @param int $code 状态码 - * @param array $header 头部 - * @param array $options 参数 - * @return \think\response\Xml - */ - function xml($data = [], $code = 200, $header = [], $options = []): Xml - { - return Response::create($data, 'xml', $code)->header($header)->options($options); - } -} - -if (!function_exists('app_path')) { - /** - * 获取当前应用目录 - * - * @param string $path - * @return string - */ - function app_path($path = '') - { - return app()->getAppPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); - } -} - -if (!function_exists('base_path')) { - /** - * 获取应用基础目录 - * - * @param string $path - * @return string - */ - function base_path($path = '') - { - return app()->getBasePath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); - } -} - -if (!function_exists('config_path')) { - /** - * 获取应用配置目录 - * - * @param string $path - * @return string - */ - function config_path($path = '') - { - return app()->getConfigPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); - } -} - -if (!function_exists('public_path')) { - /** - * 获取web根目录 - * - * @param string $path - * @return string - */ - function public_path($path = '') - { - return app()->getRootPath() . 'public' . DIRECTORY_SEPARATOR . ($path ? ltrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $path); - } -} - -if (!function_exists('runtime_path')) { - /** - * 获取应用运行时目录 - * - * @param string $path - * @return string - */ - function runtime_path($path = '') - { - return app()->getRuntimePath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); - } -} - -if (!function_exists('root_path')) { - /** - * 获取项目根目录 - * - * @param string $path - * @return string - */ - function root_path($path = '') - { - return app()->getRootPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); - } -} diff --git a/vendor/topthink/framework/src/lang/zh-cn.php b/vendor/topthink/framework/src/lang/zh-cn.php deleted file mode 100644 index a546330a..00000000 --- a/vendor/topthink/framework/src/lang/zh-cn.php +++ /dev/null @@ -1,148 +0,0 @@ - -// +---------------------------------------------------------------------- - -// 核心中文语言包 -return [ - // 系统错误提示 - 'Undefined variable' => '未定义变量', - 'Undefined index' => '未定义数组索引', - 'Undefined offset' => '未定义数组下标', - 'Parse error' => '语法解析错误', - 'Type error' => '类型错误', - 'Fatal error' => '致命错误', - 'syntax error' => '语法错误', - - // 框架核心错误提示 - 'dispatch type not support' => '不支持的调度类型', - 'method param miss' => '方法参数错误', - 'method not exists' => '方法不存在', - 'function not exists' => '函数不存在', - 'app not exists' => '应用不存在', - 'controller not exists' => '控制器不存在', - 'class not exists' => '类不存在', - 'property not exists' => '类的属性不存在', - 'template not exists' => '模板文件不存在', - 'illegal controller name' => '非法的控制器名称', - 'illegal action name' => '非法的操作名称', - 'url suffix deny' => '禁止的URL后缀访问', - 'Undefined cache config' => '缓存配置未定义', - 'Route Not Found' => '当前访问路由未定义或不匹配', - 'Undefined db config' => '数据库配置未定义', - 'Undefined log config' => '日志配置未定义', - 'Undefined db type' => '未定义数据库类型', - 'variable type error' => '变量类型错误', - 'PSR-4 error' => 'PSR-4 规范错误', - 'not support type' => '不支持的分页索引字段类型', - 'not support total' => '简洁模式下不能获取数据总数', - 'not support last' => '简洁模式下不能获取最后一页', - 'error session handler' => '错误的SESSION处理器类', - 'not allow php tag' => '模板不允许使用PHP语法', - 'not support' => '不支持', - 'database config error' => '数据库配置信息错误', - 'redisd master' => 'Redisd 主服务器错误', - 'redisd slave' => 'Redisd 从服务器错误', - 'must run at sae' => '必须在SAE运行', - 'memcache init error' => '未开通Memcache服务,请在SAE管理平台初始化Memcache服务', - 'KVDB init error' => '没有初始化KVDB,请在SAE管理平台初始化KVDB服务', - 'fields not exists' => '数据表字段不存在', - 'where express error' => '查询表达式错误', - 'no data to update' => '没有任何数据需要更新', - 'miss data to insert' => '缺少需要写入的数据', - 'miss complex primary data' => '缺少复合主键数据', - 'miss update condition' => '缺少更新条件', - 'model data Not Found' => '模型数据不存在', - 'table data not Found' => '表数据不存在', - 'delete without condition' => '没有条件不会执行删除操作', - 'miss relation data' => '缺少关联表数据', - 'tag attr must' => '模板标签属性必须', - 'tag error' => '模板标签错误', - 'cache write error' => '缓存写入失败', - 'sae mc write error' => 'SAE mc 写入错误', - 'route name not exists' => '路由标识不存在(或参数不够)', - 'invalid request' => '非法请求', - 'bind attr has exists' => '模型的属性已经存在', - 'relation data not exists' => '关联数据不存在', - 'relation not support' => '关联不支持', - 'chunk not support order' => 'Chunk不支持调用order方法', - 'route pattern error' => '路由变量规则定义错误', - 'route behavior will not support' => '路由行为废弃(使用中间件替代)', - 'closure not support cache(true)' => '使用闭包查询不支持cache(true),请指定缓存Key', - - // 上传错误信息 - 'unknown upload error' => '未知上传错误!', - 'file write error' => '文件写入失败!', - 'upload temp dir not found' => '找不到临时文件夹!', - 'no file to uploaded' => '没有文件被上传!', - 'only the portion of file is uploaded' => '文件只有部分被上传!', - 'upload File size exceeds the maximum value' => '上传文件大小超过了最大值!', - 'upload write error' => '文件上传保存错误!', - 'has the same filename: {:filename}' => '存在同名文件:{:filename}', - 'upload illegal files' => '非法上传文件', - 'illegal image files' => '非法图片文件', - 'extensions to upload is not allowed' => '上传文件后缀不允许', - 'mimetype to upload is not allowed' => '上传文件MIME类型不允许!', - 'filesize not match' => '上传文件大小不符!', - 'directory {:path} creation failed' => '目录 {:path} 创建失败!', - - 'The middleware must return Response instance' => '中间件方法必须返回Response对象实例', - 'The queue was exhausted, with no response returned' => '中间件队列为空', - // Validate Error Message - ':attribute require' => ':attribute不能为空', - ':attribute must' => ':attribute必须', - ':attribute must be numeric' => ':attribute必须是数字', - ':attribute must be integer' => ':attribute必须是整数', - ':attribute must be float' => ':attribute必须是浮点数', - ':attribute must be bool' => ':attribute必须是布尔值', - ':attribute not a valid email address' => ':attribute格式不符', - ':attribute not a valid mobile' => ':attribute格式不符', - ':attribute must be a array' => ':attribute必须是数组', - ':attribute must be yes,on or 1' => ':attribute必须是yes、on或者1', - ':attribute not a valid datetime' => ':attribute不是一个有效的日期或时间格式', - ':attribute not a valid file' => ':attribute不是有效的上传文件', - ':attribute not a valid image' => ':attribute不是有效的图像文件', - ':attribute must be alpha' => ':attribute只能是字母', - ':attribute must be alpha-numeric' => ':attribute只能是字母和数字', - ':attribute must be alpha-numeric, dash, underscore' => ':attribute只能是字母、数字和下划线_及破折号-', - ':attribute not a valid domain or ip' => ':attribute不是有效的域名或者IP', - ':attribute must be chinese' => ':attribute只能是汉字', - ':attribute must be chinese or alpha' => ':attribute只能是汉字、字母', - ':attribute must be chinese,alpha-numeric' => ':attribute只能是汉字、字母和数字', - ':attribute must be chinese,alpha-numeric,underscore, dash' => ':attribute只能是汉字、字母、数字和下划线_及破折号-', - ':attribute not a valid url' => ':attribute不是有效的URL地址', - ':attribute not a valid ip' => ':attribute不是有效的IP地址', - ':attribute must be dateFormat of :rule' => ':attribute必须使用日期格式 :rule', - ':attribute must be in :rule' => ':attribute必须在 :rule 范围内', - ':attribute be notin :rule' => ':attribute不能在 :rule 范围内', - ':attribute must between :1 - :2' => ':attribute只能在 :1 - :2 之间', - ':attribute not between :1 - :2' => ':attribute不能在 :1 - :2 之间', - 'size of :attribute must be :rule' => ':attribute长度不符合要求 :rule', - 'max size of :attribute must be :rule' => ':attribute长度不能超过 :rule', - 'min size of :attribute must be :rule' => ':attribute长度不能小于 :rule', - ':attribute cannot be less than :rule' => ':attribute日期不能小于 :rule', - ':attribute cannot exceed :rule' => ':attribute日期不能超过 :rule', - ':attribute not within :rule' => '不在有效期内 :rule', - 'access IP is not allowed' => '不允许的IP访问', - 'access IP denied' => '禁止的IP访问', - ':attribute out of accord with :2' => ':attribute和确认字段:2不一致', - ':attribute cannot be same with :2' => ':attribute和比较字段:2不能相同', - ':attribute must greater than or equal :rule' => ':attribute必须大于等于 :rule', - ':attribute must greater than :rule' => ':attribute必须大于 :rule', - ':attribute must less than or equal :rule' => ':attribute必须小于等于 :rule', - ':attribute must less than :rule' => ':attribute必须小于 :rule', - ':attribute must equal :rule' => ':attribute必须等于 :rule', - ':attribute has exists' => ':attribute已存在', - ':attribute not conform to the rules' => ':attribute不符合指定规则', - 'invalid Request method' => '无效的请求类型', - 'invalid token' => '令牌数据无效', - 'not conform to the rules' => '规则错误', - - 'record has update' => '记录已经被更新了', -]; diff --git a/vendor/topthink/framework/src/think/App.php b/vendor/topthink/framework/src/think/App.php deleted file mode 100644 index cdcfeb8d..00000000 --- a/vendor/topthink/framework/src/think/App.php +++ /dev/null @@ -1,639 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use think\event\AppInit; -use think\helper\Str; -use think\initializer\BootService; -use think\initializer\Error; -use think\initializer\RegisterService; - -/** - * App 基础类 - * @property Route $route - * @property Config $config - * @property Cache $cache - * @property Request $request - * @property Http $http - * @property Console $console - * @property Env $env - * @property Event $event - * @property Middleware $middleware - * @property Log $log - * @property Lang $lang - * @property Db $db - * @property Cookie $cookie - * @property Session $session - * @property Validate $validate - * @property Filesystem $filesystem - */ -class App extends Container -{ - const VERSION = '6.0.8'; - - /** - * 应用调试模式 - * @var bool - */ - protected $appDebug = false; - - /** - * 环境变量标识 - * @var string - */ - protected $envName = ''; - - /** - * 应用开始时间 - * @var float - */ - protected $beginTime; - - /** - * 应用内存初始占用 - * @var integer - */ - protected $beginMem; - - /** - * 当前应用类库命名空间 - * @var string - */ - protected $namespace = 'app'; - - /** - * 应用根目录 - * @var string - */ - protected $rootPath = ''; - - /** - * 框架目录 - * @var string - */ - protected $thinkPath = ''; - - /** - * 应用目录 - * @var string - */ - protected $appPath = ''; - - /** - * Runtime目录 - * @var string - */ - protected $runtimePath = ''; - - /** - * 路由定义目录 - * @var string - */ - protected $routePath = ''; - - /** - * 配置后缀 - * @var string - */ - protected $configExt = '.php'; - - /** - * 应用初始化器 - * @var array - */ - protected $initializers = [ - Error::class, - RegisterService::class, - BootService::class, - ]; - - /** - * 注册的系统服务 - * @var array - */ - protected $services = []; - - /** - * 初始化 - * @var bool - */ - protected $initialized = false; - - /** - * 容器绑定标识 - * @var array - */ - protected $bind = [ - 'app' => App::class, - 'cache' => Cache::class, - 'config' => Config::class, - 'console' => Console::class, - 'cookie' => Cookie::class, - 'db' => Db::class, - 'env' => Env::class, - 'event' => Event::class, - 'http' => Http::class, - 'lang' => Lang::class, - 'log' => Log::class, - 'middleware' => Middleware::class, - 'request' => Request::class, - 'response' => Response::class, - 'route' => Route::class, - 'session' => Session::class, - 'validate' => Validate::class, - 'view' => View::class, - 'filesystem' => Filesystem::class, - 'think\DbManager' => Db::class, - 'think\LogManager' => Log::class, - 'think\CacheManager' => Cache::class, - - // 接口依赖注入 - 'Psr\Log\LoggerInterface' => Log::class, - ]; - - /** - * 架构方法 - * @access public - * @param string $rootPath 应用根目录 - */ - public function __construct(string $rootPath = '') - { - $this->thinkPath = dirname(__DIR__) . DIRECTORY_SEPARATOR; - $this->rootPath = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $this->getDefaultRootPath(); - $this->appPath = $this->rootPath . 'app' . DIRECTORY_SEPARATOR; - $this->runtimePath = $this->rootPath . 'runtime' . DIRECTORY_SEPARATOR; - - if (is_file($this->appPath . 'provider.php')) { - $this->bind(include $this->appPath . 'provider.php'); - } - - static::setInstance($this); - - $this->instance('app', $this); - $this->instance('think\Container', $this); - } - - /** - * 注册服务 - * @access public - * @param Service|string $service 服务 - * @param bool $force 强制重新注册 - * @return Service|null - */ - public function register($service, bool $force = false) - { - $registered = $this->getService($service); - - if ($registered && !$force) { - return $registered; - } - - if (is_string($service)) { - $service = new $service($this); - } - - if (method_exists($service, 'register')) { - $service->register(); - } - - if (property_exists($service, 'bind')) { - $this->bind($service->bind); - } - - $this->services[] = $service; - } - - /** - * 执行服务 - * @access public - * @param Service $service 服务 - * @return mixed - */ - public function bootService($service) - { - if (method_exists($service, 'boot')) { - return $this->invoke([$service, 'boot']); - } - } - - /** - * 获取服务 - * @param string|Service $service - * @return Service|null - */ - public function getService($service) - { - $name = is_string($service) ? $service : get_class($service); - return array_values(array_filter($this->services, function ($value) use ($name) { - return $value instanceof $name; - }, ARRAY_FILTER_USE_BOTH))[0] ?? null; - } - - /** - * 开启应用调试模式 - * @access public - * @param bool $debug 开启应用调试模式 - * @return $this - */ - public function debug(bool $debug = true) - { - $this->appDebug = $debug; - return $this; - } - - /** - * 是否为调试模式 - * @access public - * @return bool - */ - public function isDebug(): bool - { - return $this->appDebug; - } - - /** - * 设置应用命名空间 - * @access public - * @param string $namespace 应用命名空间 - * @return $this - */ - public function setNamespace(string $namespace) - { - $this->namespace = $namespace; - return $this; - } - - /** - * 获取应用类库命名空间 - * @access public - * @return string - */ - public function getNamespace(): string - { - return $this->namespace; - } - - /** - * 设置环境变量标识 - * @access public - * @param string $name 环境标识 - * @return $this - */ - public function setEnvName(string $name) - { - $this->envName = $name; - return $this; - } - - /** - * 获取框架版本 - * @access public - * @return string - */ - public function version(): string - { - return static::VERSION; - } - - /** - * 获取应用根目录 - * @access public - * @return string - */ - public function getRootPath(): string - { - return $this->rootPath; - } - - /** - * 获取应用基础目录 - * @access public - * @return string - */ - public function getBasePath(): string - { - return $this->rootPath . 'app' . DIRECTORY_SEPARATOR; - } - - /** - * 获取当前应用目录 - * @access public - * @return string - */ - public function getAppPath(): string - { - return $this->appPath; - } - - /** - * 设置应用目录 - * @param string $path 应用目录 - */ - public function setAppPath(string $path) - { - $this->appPath = $path; - } - - /** - * 获取应用运行时目录 - * @access public - * @return string - */ - public function getRuntimePath(): string - { - return $this->runtimePath; - } - - /** - * 设置runtime目录 - * @param string $path 定义目录 - */ - public function setRuntimePath(string $path): void - { - $this->runtimePath = $path; - } - - /** - * 获取核心框架目录 - * @access public - * @return string - */ - public function getThinkPath(): string - { - return $this->thinkPath; - } - - /** - * 获取应用配置目录 - * @access public - * @return string - */ - public function getConfigPath(): string - { - return $this->rootPath . 'config' . DIRECTORY_SEPARATOR; - } - - /** - * 获取配置后缀 - * @access public - * @return string - */ - public function getConfigExt(): string - { - return $this->configExt; - } - - /** - * 获取应用开启时间 - * @access public - * @return float - */ - public function getBeginTime(): float - { - return $this->beginTime; - } - - /** - * 获取应用初始内存占用 - * @access public - * @return integer - */ - public function getBeginMem(): int - { - return $this->beginMem; - } - - /** - * 加载环境变量定义 - * @access public - * @param string $envName 环境标识 - * @return void - */ - public function loadEnv(string $envName = ''): void - { - // 加载环境变量 - $envFile = $envName ? $this->rootPath . '.env.' . $envName : $this->rootPath . '.env'; - - if (is_file($envFile)) { - $this->env->load($envFile); - } - } - - /** - * 初始化应用 - * @access public - * @return $this - */ - public function initialize() - { - $this->initialized = true; - - $this->beginTime = microtime(true); - $this->beginMem = memory_get_usage(); - - $this->loadEnv($this->envName); - - $this->configExt = $this->env->get('config_ext', '.php'); - - $this->debugModeInit(); - - // 加载全局初始化文件 - $this->load(); - - // 加载框架默认语言包 - $langSet = $this->lang->defaultLangSet(); - - $this->lang->load($this->thinkPath . 'lang' . DIRECTORY_SEPARATOR . $langSet . '.php'); - - // 加载应用默认语言包 - $this->loadLangPack($langSet); - - // 监听AppInit - $this->event->trigger(AppInit::class); - - date_default_timezone_set($this->config->get('app.default_timezone', 'Asia/Shanghai')); - - // 初始化 - foreach ($this->initializers as $initializer) { - $this->make($initializer)->init($this); - } - - return $this; - } - - /** - * 是否初始化过 - * @return bool - */ - public function initialized() - { - return $this->initialized; - } - - /** - * 加载语言包 - * @param string $langset 语言 - * @return void - */ - public function loadLangPack($langset) - { - if (empty($langset)) { - return; - } - - // 加载系统语言包 - $files = glob($this->appPath . 'lang' . DIRECTORY_SEPARATOR . $langset . '.*'); - $this->lang->load($files); - - // 加载扩展(自定义)语言包 - $list = $this->config->get('lang.extend_list', []); - - if (isset($list[$langset])) { - $this->lang->load($list[$langset]); - } - } - - /** - * 引导应用 - * @access public - * @return void - */ - public function boot(): void - { - array_walk($this->services, function ($service) { - $this->bootService($service); - }); - } - - /** - * 加载应用文件和配置 - * @access protected - * @return void - */ - protected function load(): void - { - $appPath = $this->getAppPath(); - - if (is_file($appPath . 'common.php')) { - include_once $appPath . 'common.php'; - } - - include_once $this->thinkPath . 'helper.php'; - - $configPath = $this->getConfigPath(); - - $files = []; - - if (is_dir($configPath)) { - $files = glob($configPath . '*' . $this->configExt); - } - - foreach ($files as $file) { - $this->config->load($file, pathinfo($file, PATHINFO_FILENAME)); - } - - if (is_file($appPath . 'event.php')) { - $this->loadEvent(include $appPath . 'event.php'); - } - - if (is_file($appPath . 'service.php')) { - $services = include $appPath . 'service.php'; - foreach ($services as $service) { - $this->register($service); - } - } - } - - /** - * 调试模式设置 - * @access protected - * @return void - */ - protected function debugModeInit(): void - { - // 应用调试模式 - if (!$this->appDebug) { - $this->appDebug = $this->env->get('app_debug') ? true : false; - ini_set('display_errors', 'Off'); - } - - if (!$this->runningInConsole()) { - //重新申请一块比较大的buffer - if (ob_get_level() > 0) { - $output = ob_get_clean(); - } - ob_start(); - if (!empty($output)) { - echo $output; - } - } - } - - /** - * 注册应用事件 - * @access protected - * @param array $event 事件数据 - * @return void - */ - public function loadEvent(array $event): void - { - if (isset($event['bind'])) { - $this->event->bind($event['bind']); - } - - if (isset($event['listen'])) { - $this->event->listenEvents($event['listen']); - } - - if (isset($event['subscribe'])) { - $this->event->subscribe($event['subscribe']); - } - } - - /** - * 解析应用类的类名 - * @access public - * @param string $layer 层名 controller model ... - * @param string $name 类名 - * @return string - */ - public function parseClass(string $layer, string $name): string - { - $name = str_replace(['/', '.'], '\\', $name); - $array = explode('\\', $name); - $class = Str::studly(array_pop($array)); - $path = $array ? implode('\\', $array) . '\\' : ''; - - return $this->namespace . '\\' . $layer . '\\' . $path . $class; - } - - /** - * 是否运行在命令行下 - * @return bool - */ - public function runningInConsole(): bool - { - return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; - } - - /** - * 获取应用根目录 - * @access protected - * @return string - */ - protected function getDefaultRootPath(): string - { - return dirname($this->thinkPath, 4) . DIRECTORY_SEPARATOR; - } - -} diff --git a/vendor/topthink/framework/src/think/Cache.php b/vendor/topthink/framework/src/think/Cache.php deleted file mode 100644 index f802b556..00000000 --- a/vendor/topthink/framework/src/think/Cache.php +++ /dev/null @@ -1,197 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use Psr\SimpleCache\CacheInterface; -use think\cache\Driver; -use think\cache\TagSet; -use think\exception\InvalidArgumentException; -use think\helper\Arr; - -/** - * 缓存管理类 - * @mixin Driver - * @mixin \think\cache\driver\File - */ -class Cache extends Manager implements CacheInterface -{ - - protected $namespace = '\\think\\cache\\driver\\'; - - /** - * 默认驱动 - * @return string|null - */ - public function getDefaultDriver() - { - return $this->getConfig('default'); - } - - /** - * 获取缓存配置 - * @access public - * @param null|string $name 名称 - * @param mixed $default 默认值 - * @return mixed - */ - public function getConfig(string $name = null, $default = null) - { - if (!is_null($name)) { - return $this->app->config->get('cache.' . $name, $default); - } - - return $this->app->config->get('cache'); - } - - /** - * 获取驱动配置 - * @param string $store - * @param string $name - * @param null $default - * @return array - */ - public function getStoreConfig(string $store, string $name = null, $default = null) - { - if ($config = $this->getConfig("stores.{$store}")) { - return Arr::get($config, $name, $default); - } - - throw new \InvalidArgumentException("Store [$store] not found."); - } - - protected function resolveType(string $name) - { - return $this->getStoreConfig($name, 'type', 'file'); - } - - protected function resolveConfig(string $name) - { - return $this->getStoreConfig($name); - } - - /** - * 连接或者切换缓存 - * @access public - * @param string $name 连接配置名 - * @return Driver - */ - public function store(string $name = null) - { - return $this->driver($name); - } - - /** - * 清空缓冲池 - * @access public - * @return bool - */ - public function clear(): bool - { - return $this->store()->clear(); - } - - /** - * 读取缓存 - * @access public - * @param string $key 缓存变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function get($key, $default = null) - { - return $this->store()->get($key, $default); - } - - /** - * 写入缓存 - * @access public - * @param string $key 缓存变量名 - * @param mixed $value 存储数据 - * @param int|\DateTime $ttl 有效时间 0为永久 - * @return bool - */ - public function set($key, $value, $ttl = null): bool - { - return $this->store()->set($key, $value, $ttl); - } - - /** - * 删除缓存 - * @access public - * @param string $key 缓存变量名 - * @return bool - */ - public function delete($key): bool - { - return $this->store()->delete($key); - } - - /** - * 读取缓存 - * @access public - * @param iterable $keys 缓存变量名 - * @param mixed $default 默认值 - * @return iterable - * @throws InvalidArgumentException - */ - public function getMultiple($keys, $default = null): iterable - { - return $this->store()->getMultiple($keys, $default); - } - - /** - * 写入缓存 - * @access public - * @param iterable $values 缓存数据 - * @param null|int|\DateInterval $ttl 有效时间 0为永久 - * @return bool - */ - public function setMultiple($values, $ttl = null): bool - { - return $this->store()->setMultiple($values, $ttl); - } - - /** - * 删除缓存 - * @access public - * @param iterable $keys 缓存变量名 - * @return bool - * @throws InvalidArgumentException - */ - public function deleteMultiple($keys): bool - { - return $this->store()->deleteMultiple($keys); - } - - /** - * 判断缓存是否存在 - * @access public - * @param string $key 缓存变量名 - * @return bool - */ - public function has($key): bool - { - return $this->store()->has($key); - } - - /** - * 缓存标签 - * @access public - * @param string|array $name 标签名 - * @return TagSet - */ - public function tag($name): TagSet - { - return $this->store()->tag($name); - } -} diff --git a/vendor/topthink/framework/src/think/Config.php b/vendor/topthink/framework/src/think/Config.php deleted file mode 100644 index 9162e82f..00000000 --- a/vendor/topthink/framework/src/think/Config.php +++ /dev/null @@ -1,197 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -/** - * 配置管理类 - * @package think - */ -class Config -{ - /** - * 配置参数 - * @var array - */ - protected $config = []; - - /** - * 配置文件目录 - * @var string - */ - protected $path; - - /** - * 配置文件后缀 - * @var string - */ - protected $ext; - - /** - * 构造方法 - * @access public - */ - public function __construct(string $path = null, string $ext = '.php') - { - $this->path = $path ?: ''; - $this->ext = $ext; - } - - public static function __make(App $app) - { - $path = $app->getConfigPath(); - $ext = $app->getConfigExt(); - - return new static($path, $ext); - } - - /** - * 加载配置文件(多种格式) - * @access public - * @param string $file 配置文件名 - * @param string $name 一级配置名 - * @return array - */ - public function load(string $file, string $name = ''): array - { - if (is_file($file)) { - $filename = $file; - } elseif (is_file($this->path . $file . $this->ext)) { - $filename = $this->path . $file . $this->ext; - } - - if (isset($filename)) { - return $this->parse($filename, $name); - } - - return $this->config; - } - - /** - * 解析配置文件 - * @access public - * @param string $file 配置文件名 - * @param string $name 一级配置名 - * @return array - */ - protected function parse(string $file, string $name): array - { - $type = pathinfo($file, PATHINFO_EXTENSION); - $config = []; - switch ($type) { - case 'php': - $config = include $file; - break; - case 'yml': - case 'yaml': - if (function_exists('yaml_parse_file')) { - $config = yaml_parse_file($file); - } - break; - case 'ini': - $config = parse_ini_file($file, true, INI_SCANNER_TYPED) ?: []; - break; - case 'json': - $config = json_decode(file_get_contents($file), true); - break; - } - - return is_array($config) ? $this->set($config, strtolower($name)) : []; - } - - /** - * 检测配置是否存在 - * @access public - * @param string $name 配置参数名(支持多级配置 .号分割) - * @return bool - */ - public function has(string $name): bool - { - if (false === strpos($name, '.') && !isset($this->config[strtolower($name)])) { - return false; - } - - return !is_null($this->get($name)); - } - - /** - * 获取一级配置 - * @access protected - * @param string $name 一级配置名 - * @return array - */ - protected function pull(string $name): array - { - $name = strtolower($name); - - return $this->config[$name] ?? []; - } - - /** - * 获取配置参数 为空则获取所有配置 - * @access public - * @param string $name 配置参数名(支持多级配置 .号分割) - * @param mixed $default 默认值 - * @return mixed - */ - public function get(string $name = null, $default = null) - { - // 无参数时获取所有 - if (empty($name)) { - return $this->config; - } - - if (false === strpos($name, '.')) { - return $this->pull($name); - } - - $name = explode('.', $name); - $name[0] = strtolower($name[0]); - $config = $this->config; - - // 按.拆分成多维数组进行判断 - foreach ($name as $val) { - if (isset($config[$val])) { - $config = $config[$val]; - } else { - return $default; - } - } - - return $config; - } - - /** - * 设置配置参数 name为数组则为批量设置 - * @access public - * @param array $config 配置参数 - * @param string $name 配置名 - * @return array - */ - public function set(array $config, string $name = null): array - { - if (!empty($name)) { - if (isset($this->config[$name])) { - $result = array_merge($this->config[$name], $config); - } else { - $result = $config; - } - - $this->config[$name] = $result; - } else { - $result = $this->config = array_merge($this->config, array_change_key_case($config)); - } - - return $result; - } - -} diff --git a/vendor/topthink/framework/src/think/Console.php b/vendor/topthink/framework/src/think/Console.php deleted file mode 100644 index 389d104d..00000000 --- a/vendor/topthink/framework/src/think/Console.php +++ /dev/null @@ -1,787 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use Closure; -use InvalidArgumentException; -use LogicException; -use think\console\Command; -use think\console\command\Clear; -use think\console\command\Help; -use think\console\command\Help as HelpCommand; -use think\console\command\Lists; -use think\console\command\make\Command as MakeCommand; -use think\console\command\make\Controller; -use think\console\command\make\Event; -use think\console\command\make\Listener; -use think\console\command\make\Middleware; -use think\console\command\make\Model; -use think\console\command\make\Service; -use think\console\command\make\Subscribe; -use think\console\command\make\Validate; -use think\console\command\optimize\Route; -use think\console\command\optimize\Schema; -use think\console\command\RouteList; -use think\console\command\RunServer; -use think\console\command\ServiceDiscover; -use think\console\command\VendorPublish; -use think\console\command\Version; -use think\console\Input; -use think\console\input\Argument as InputArgument; -use think\console\input\Definition as InputDefinition; -use think\console\input\Option as InputOption; -use think\console\Output; -use think\console\output\driver\Buffer; - -/** - * 控制台应用管理类 - */ -class Console -{ - - protected $app; - - /** @var Command[] */ - protected $commands = []; - - protected $wantHelps = false; - - protected $catchExceptions = true; - protected $autoExit = true; - protected $definition; - protected $defaultCommand = 'list'; - - protected $defaultCommands = [ - 'help' => Help::class, - 'list' => Lists::class, - 'clear' => Clear::class, - 'make:command' => MakeCommand::class, - 'make:controller' => Controller::class, - 'make:model' => Model::class, - 'make:middleware' => Middleware::class, - 'make:validate' => Validate::class, - 'make:event' => Event::class, - 'make:listener' => Listener::class, - 'make:service' => Service::class, - 'make:subscribe' => Subscribe::class, - 'optimize:route' => Route::class, - 'optimize:schema' => Schema::class, - 'run' => RunServer::class, - 'version' => Version::class, - 'route:list' => RouteList::class, - 'service:discover' => ServiceDiscover::class, - 'vendor:publish' => VendorPublish::class, - ]; - - /** - * 启动器 - * @var array - */ - protected static $startCallbacks = []; - - public function __construct(App $app) - { - $this->app = $app; - - $this->initialize(); - - $this->definition = $this->getDefaultInputDefinition(); - - //加载指令 - $this->loadCommands(); - - $this->start(); - } - - /** - * 初始化 - */ - protected function initialize() - { - if (!$this->app->initialized()) { - $this->app->initialize(); - } - $this->makeRequest(); - } - - /** - * 构造request - */ - protected function makeRequest() - { - $uri = $this->app->config->get('app.url', 'http://localhost'); - - $components = parse_url($uri); - - $server = $_SERVER; - - if (isset($components['path'])) { - $server = array_merge($server, [ - 'SCRIPT_FILENAME' => $components['path'], - 'SCRIPT_NAME' => $components['path'], - ]); - } - - if (isset($components['host'])) { - $server['SERVER_NAME'] = $components['host']; - $server['HTTP_HOST'] = $components['host']; - } - - if (isset($components['scheme'])) { - if ('https' === $components['scheme']) { - $server['HTTPS'] = 'on'; - $server['SERVER_PORT'] = 443; - } else { - unset($server['HTTPS']); - $server['SERVER_PORT'] = 80; - } - } - - if (isset($components['port'])) { - $server['SERVER_PORT'] = $components['port']; - $server['HTTP_HOST'] .= ':' . $components['port']; - } - - $server['REQUEST_URI'] = $uri; - - /** @var Request $request */ - $request = $this->app->make('request'); - - $request->withServer($server); - } - - /** - * 添加初始化器 - * @param Closure $callback - */ - public static function starting(Closure $callback): void - { - static::$startCallbacks[] = $callback; - } - - /** - * 清空启动器 - */ - public static function flushStartCallbacks(): void - { - static::$startCallbacks = []; - } - - /** - * 设置执行用户 - * @param $user - */ - public static function setUser(string $user): void - { - if (extension_loaded('posix')) { - $user = posix_getpwnam($user); - - if (!empty($user)) { - posix_setgid($user['gid']); - posix_setuid($user['uid']); - } - } - } - - /** - * 启动 - */ - protected function start(): void - { - foreach (static::$startCallbacks as $callback) { - $callback($this); - } - } - - /** - * 加载指令 - * @access protected - */ - protected function loadCommands(): void - { - $commands = $this->app->config->get('console.commands', []); - $commands = array_merge($this->defaultCommands, $commands); - - $this->addCommands($commands); - } - - /** - * @access public - * @param string $command - * @param array $parameters - * @param string $driver - * @return Output|Buffer - */ - public function call(string $command, array $parameters = [], string $driver = 'buffer') - { - array_unshift($parameters, $command); - - $input = new Input($parameters); - $output = new Output($driver); - - $this->setCatchExceptions(false); - $this->find($command)->run($input, $output); - - return $output; - } - - /** - * 执行当前的指令 - * @access public - * @return int - * @throws \Exception - * @api - */ - public function run() - { - $input = new Input(); - $output = new Output(); - - $this->configureIO($input, $output); - - try { - $exitCode = $this->doRun($input, $output); - } catch (\Exception $e) { - if (!$this->catchExceptions) { - throw $e; - } - - $output->renderException($e); - - $exitCode = $e->getCode(); - if (is_numeric($exitCode)) { - $exitCode = (int) $exitCode; - if (0 === $exitCode) { - $exitCode = 1; - } - } else { - $exitCode = 1; - } - } - - if ($this->autoExit) { - if ($exitCode > 255) { - $exitCode = 255; - } - - exit($exitCode); - } - - return $exitCode; - } - - /** - * 执行指令 - * @access public - * @param Input $input - * @param Output $output - * @return int - */ - public function doRun(Input $input, Output $output) - { - if (true === $input->hasParameterOption(['--version', '-V'])) { - $output->writeln($this->getLongVersion()); - - return 0; - } - - $name = $this->getCommandName($input); - - if (true === $input->hasParameterOption(['--help', '-h'])) { - if (!$name) { - $name = 'help'; - $input = new Input(['help']); - } else { - $this->wantHelps = true; - } - } - - if (!$name) { - $name = $this->defaultCommand; - $input = new Input([$this->defaultCommand]); - } - - $command = $this->find($name); - - return $this->doRunCommand($command, $input, $output); - } - - /** - * 设置输入参数定义 - * @access public - * @param InputDefinition $definition - */ - public function setDefinition(InputDefinition $definition): void - { - $this->definition = $definition; - } - - /** - * 获取输入参数定义 - * @access public - * @return InputDefinition The InputDefinition instance - */ - public function getDefinition(): InputDefinition - { - return $this->definition; - } - - /** - * Gets the help message. - * @access public - * @return string A help message. - */ - public function getHelp(): string - { - return $this->getLongVersion(); - } - - /** - * 是否捕获异常 - * @access public - * @param bool $boolean - * @api - */ - public function setCatchExceptions(bool $boolean): void - { - $this->catchExceptions = $boolean; - } - - /** - * 是否自动退出 - * @access public - * @param bool $boolean - * @api - */ - public function setAutoExit(bool $boolean): void - { - $this->autoExit = $boolean; - } - - /** - * 获取完整的版本号 - * @access public - * @return string - */ - public function getLongVersion(): string - { - if ($this->app->version()) { - return sprintf('version %s', $this->app->version()); - } - - return 'Console Tool'; - } - - /** - * 添加指令集 - * @access public - * @param array $commands - */ - public function addCommands(array $commands): void - { - foreach ($commands as $key => $command) { - if (is_subclass_of($command, Command::class)) { - // 注册指令 - $this->addCommand($command, is_numeric($key) ? '' : $key); - } - } - } - - /** - * 添加一个指令 - * @access public - * @param string|Command $command 指令对象或者指令类名 - * @param string $name 指令名 留空则自动获取 - * @return Command|void - */ - public function addCommand($command, string $name = '') - { - if ($name) { - $this->commands[$name] = $command; - return; - } - - if (is_string($command)) { - $command = $this->app->invokeClass($command); - } - - $command->setConsole($this); - - if (!$command->isEnabled()) { - $command->setConsole(null); - return; - } - - $command->setApp($this->app); - - if (null === $command->getDefinition()) { - throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command))); - } - - $this->commands[$command->getName()] = $command; - - foreach ($command->getAliases() as $alias) { - $this->commands[$alias] = $command; - } - - return $command; - } - - /** - * 获取指令 - * @access public - * @param string $name 指令名称 - * @return Command - * @throws InvalidArgumentException - */ - public function getCommand(string $name): Command - { - if (!isset($this->commands[$name])) { - throw new InvalidArgumentException(sprintf('The command "%s" does not exist.', $name)); - } - - $command = $this->commands[$name]; - - if (is_string($command)) { - $command = $this->app->invokeClass($command); - /** @var Command $command */ - $command->setConsole($this); - $command->setApp($this->app); - } - - if ($this->wantHelps) { - $this->wantHelps = false; - - /** @var HelpCommand $helpCommand */ - $helpCommand = $this->getCommand('help'); - $helpCommand->setCommand($command); - - return $helpCommand; - } - - return $command; - } - - /** - * 某个指令是否存在 - * @access public - * @param string $name 指令名称 - * @return bool - */ - public function hasCommand(string $name): bool - { - return isset($this->commands[$name]); - } - - /** - * 获取所有的命名空间 - * @access public - * @return array - */ - public function getNamespaces(): array - { - $namespaces = []; - foreach ($this->commands as $key => $command) { - if (is_string($command)) { - $namespaces = array_merge($namespaces, $this->extractAllNamespaces($key)); - } else { - $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName())); - - foreach ($command->getAliases() as $alias) { - $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias)); - } - } - } - - return array_values(array_unique(array_filter($namespaces))); - } - - /** - * 查找注册命名空间中的名称或缩写。 - * @access public - * @param string $namespace - * @return string - * @throws InvalidArgumentException - */ - public function findNamespace(string $namespace): string - { - $allNamespaces = $this->getNamespaces(); - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { - return preg_quote($matches[1]) . '[^:]*'; - }, $namespace); - $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); - - if (empty($namespaces)) { - $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); - - if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) { - if (1 == count($alternatives)) { - $message .= "\n\nDid you mean this?\n "; - } else { - $message .= "\n\nDid you mean one of these?\n "; - } - - $message .= implode("\n ", $alternatives); - } - - throw new InvalidArgumentException($message); - } - - $exact = in_array($namespace, $namespaces, true); - if (count($namespaces) > 1 && !$exact) { - throw new InvalidArgumentException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces)))); - } - - return $exact ? $namespace : reset($namespaces); - } - - /** - * 查找指令 - * @access public - * @param string $name 名称或者别名 - * @return Command - * @throws InvalidArgumentException - */ - public function find(string $name): Command - { - $allCommands = array_keys($this->commands); - - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { - return preg_quote($matches[1]) . '[^:]*'; - }, $name); - - $commands = preg_grep('{^' . $expr . '}', $allCommands); - - if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) { - if (false !== $pos = strrpos($name, ':')) { - $this->findNamespace(substr($name, 0, $pos)); - } - - $message = sprintf('Command "%s" is not defined.', $name); - - if ($alternatives = $this->findAlternatives($name, $allCommands)) { - if (1 == count($alternatives)) { - $message .= "\n\nDid you mean this?\n "; - } else { - $message .= "\n\nDid you mean one of these?\n "; - } - $message .= implode("\n ", $alternatives); - } - - throw new InvalidArgumentException($message); - } - - $exact = in_array($name, $commands, true); - if (count($commands) > 1 && !$exact) { - $suggestions = $this->getAbbreviationSuggestions(array_values($commands)); - - throw new InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions)); - } - - return $this->getCommand($exact ? $name : reset($commands)); - } - - /** - * 获取所有的指令 - * @access public - * @param string $namespace 命名空间 - * @return Command[] - * @api - */ - public function all(string $namespace = null): array - { - if (null === $namespace) { - return $this->commands; - } - - $commands = []; - foreach ($this->commands as $name => $command) { - if ($this->extractNamespace($name, substr_count($namespace, ':') + 1) === $namespace) { - $commands[$name] = $command; - } - } - - return $commands; - } - - /** - * 配置基于用户的参数和选项的输入和输出实例。 - * @access protected - * @param Input $input 输入实例 - * @param Output $output 输出实例 - */ - protected function configureIO(Input $input, Output $output): void - { - if (true === $input->hasParameterOption(['--ansi'])) { - $output->setDecorated(true); - } elseif (true === $input->hasParameterOption(['--no-ansi'])) { - $output->setDecorated(false); - } - - if (true === $input->hasParameterOption(['--no-interaction', '-n'])) { - $input->setInteractive(false); - } - - if (true === $input->hasParameterOption(['--quiet', '-q'])) { - $output->setVerbosity(Output::VERBOSITY_QUIET); - } elseif ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) { - $output->setVerbosity(Output::VERBOSITY_DEBUG); - } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) { - $output->setVerbosity(Output::VERBOSITY_VERY_VERBOSE); - } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) { - $output->setVerbosity(Output::VERBOSITY_VERBOSE); - } - } - - /** - * 执行指令 - * @access protected - * @param Command $command 指令实例 - * @param Input $input 输入实例 - * @param Output $output 输出实例 - * @return int - * @throws \Exception - */ - protected function doRunCommand(Command $command, Input $input, Output $output) - { - return $command->run($input, $output); - } - - /** - * 获取指令的基础名称 - * @access protected - * @param Input $input - * @return string - */ - protected function getCommandName(Input $input): string - { - return $input->getFirstArgument() ?: ''; - } - - /** - * 获取默认输入定义 - * @access protected - * @return InputDefinition - */ - protected function getDefaultInputDefinition(): InputDefinition - { - return new InputDefinition([ - new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this console version'), - new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), - new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), - new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), - new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), - new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'), - ]); - } - - /** - * 获取可能的建议 - * @access private - * @param array $abbrevs - * @return string - */ - private function getAbbreviationSuggestions(array $abbrevs): string - { - return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : ''); - } - - /** - * 返回命名空间部分 - * @access public - * @param string $name 指令 - * @param int $limit 部分的命名空间的最大数量 - * @return string - */ - public function extractNamespace(string $name, int $limit = 0): string - { - $parts = explode(':', $name); - array_pop($parts); - - return implode(':', 0 === $limit ? $parts : array_slice($parts, 0, $limit)); - } - - /** - * 查找可替代的建议 - * @access private - * @param string $name - * @param array|\Traversable $collection - * @return array - */ - private function findAlternatives(string $name, $collection): array - { - $threshold = 1e3; - $alternatives = []; - - $collectionParts = []; - foreach ($collection as $item) { - $collectionParts[$item] = explode(':', $item); - } - - foreach (explode(':', $name) as $i => $subname) { - foreach ($collectionParts as $collectionName => $parts) { - $exists = isset($alternatives[$collectionName]); - if (!isset($parts[$i]) && $exists) { - $alternatives[$collectionName] += $threshold; - continue; - } elseif (!isset($parts[$i])) { - continue; - } - - $lev = levenshtein($subname, $parts[$i]); - if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) { - $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev; - } elseif ($exists) { - $alternatives[$collectionName] += $threshold; - } - } - } - - foreach ($collection as $item) { - $lev = levenshtein($name, $item); - if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { - $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; - } - } - - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { - return $lev < 2 * $threshold; - }); - asort($alternatives); - - return array_keys($alternatives); - } - - /** - * 返回所有的命名空间 - * @access private - * @param string $name - * @return array - */ - private function extractAllNamespaces(string $name): array - { - $parts = explode(':', $name, -1); - $namespaces = []; - - foreach ($parts as $part) { - if (count($namespaces)) { - $namespaces[] = end($namespaces) . ':' . $part; - } else { - $namespaces[] = $part; - } - } - - return $namespaces; - } - -} diff --git a/vendor/topthink/framework/src/think/Container.php b/vendor/topthink/framework/src/think/Container.php deleted file mode 100644 index 74026bb0..00000000 --- a/vendor/topthink/framework/src/think/Container.php +++ /dev/null @@ -1,554 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use ArrayAccess; -use ArrayIterator; -use Closure; -use Countable; -use InvalidArgumentException; -use IteratorAggregate; -use Psr\Container\ContainerInterface; -use ReflectionClass; -use ReflectionException; -use ReflectionFunction; -use ReflectionFunctionAbstract; -use ReflectionMethod; -use think\exception\ClassNotFoundException; -use think\exception\FuncNotFoundException; -use think\helper\Str; - -/** - * 容器管理类 支持PSR-11 - */ -class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, Countable -{ - /** - * 容器对象实例 - * @var Container|Closure - */ - protected static $instance; - - /** - * 容器中的对象实例 - * @var array - */ - protected $instances = []; - - /** - * 容器绑定标识 - * @var array - */ - protected $bind = []; - - /** - * 容器回调 - * @var array - */ - protected $invokeCallback = []; - - /** - * 获取当前容器的实例(单例) - * @access public - * @return static - */ - public static function getInstance() - { - if (is_null(static::$instance)) { - static::$instance = new static; - } - - if (static::$instance instanceof Closure) { - return (static::$instance)(); - } - - return static::$instance; - } - - /** - * 设置当前容器的实例 - * @access public - * @param object|Closure $instance - * @return void - */ - public static function setInstance($instance): void - { - static::$instance = $instance; - } - - /** - * 注册一个容器对象回调 - * - * @param string|Closure $abstract - * @param Closure|null $callback - * @return void - */ - public function resolving($abstract, Closure $callback = null): void - { - if ($abstract instanceof Closure) { - $this->invokeCallback['*'][] = $abstract; - return; - } - - $abstract = $this->getAlias($abstract); - - $this->invokeCallback[$abstract][] = $callback; - } - - /** - * 获取容器中的对象实例 不存在则创建 - * @access public - * @param string $abstract 类名或者标识 - * @param array|true $vars 变量 - * @param bool $newInstance 是否每次创建新的实例 - * @return object - */ - public static function pull(string $abstract, array $vars = [], bool $newInstance = false) - { - return static::getInstance()->make($abstract, $vars, $newInstance); - } - - /** - * 获取容器中的对象实例 - * @access public - * @param string $abstract 类名或者标识 - * @return object - */ - public function get($abstract) - { - if ($this->has($abstract)) { - return $this->make($abstract); - } - - throw new ClassNotFoundException('class not exists: ' . $abstract, $abstract); - } - - /** - * 绑定一个类、闭包、实例、接口实现到容器 - * @access public - * @param string|array $abstract 类标识、接口 - * @param mixed $concrete 要绑定的类、闭包或者实例 - * @return $this - */ - public function bind($abstract, $concrete = null) - { - if (is_array($abstract)) { - foreach ($abstract as $key => $val) { - $this->bind($key, $val); - } - } elseif ($concrete instanceof Closure) { - $this->bind[$abstract] = $concrete; - } elseif (is_object($concrete)) { - $this->instance($abstract, $concrete); - } else { - $abstract = $this->getAlias($abstract); - if ($abstract != $concrete) { - $this->bind[$abstract] = $concrete; - } - } - - return $this; - } - - /** - * 根据别名获取真实类名 - * @param string $abstract - * @return string - */ - public function getAlias(string $abstract): string - { - if (isset($this->bind[$abstract])) { - $bind = $this->bind[$abstract]; - - if (is_string($bind)) { - return $this->getAlias($bind); - } - } - - return $abstract; - } - - /** - * 绑定一个类实例到容器 - * @access public - * @param string $abstract 类名或者标识 - * @param object $instance 类的实例 - * @return $this - */ - public function instance(string $abstract, $instance) - { - $abstract = $this->getAlias($abstract); - - $this->instances[$abstract] = $instance; - - return $this; - } - - /** - * 判断容器中是否存在类及标识 - * @access public - * @param string $abstract 类名或者标识 - * @return bool - */ - public function bound(string $abstract): bool - { - return isset($this->bind[$abstract]) || isset($this->instances[$abstract]); - } - - /** - * 判断容器中是否存在类及标识 - * @access public - * @param string $name 类名或者标识 - * @return bool - */ - public function has($name): bool - { - return $this->bound($name); - } - - /** - * 判断容器中是否存在对象实例 - * @access public - * @param string $abstract 类名或者标识 - * @return bool - */ - public function exists(string $abstract): bool - { - $abstract = $this->getAlias($abstract); - - return isset($this->instances[$abstract]); - } - - /** - * 创建类的实例 已经存在则直接获取 - * @access public - * @param string $abstract 类名或者标识 - * @param array $vars 变量 - * @param bool $newInstance 是否每次创建新的实例 - * @return mixed - */ - public function make(string $abstract, array $vars = [], bool $newInstance = false) - { - $abstract = $this->getAlias($abstract); - - if (isset($this->instances[$abstract]) && !$newInstance) { - return $this->instances[$abstract]; - } - - if (isset($this->bind[$abstract]) && $this->bind[$abstract] instanceof Closure) { - $object = $this->invokeFunction($this->bind[$abstract], $vars); - } else { - $object = $this->invokeClass($abstract, $vars); - } - - if (!$newInstance) { - $this->instances[$abstract] = $object; - } - - return $object; - } - - /** - * 删除容器中的对象实例 - * @access public - * @param string $name 类名或者标识 - * @return void - */ - public function delete($name) - { - $name = $this->getAlias($name); - - if (isset($this->instances[$name])) { - unset($this->instances[$name]); - } - } - - /** - * 执行函数或者闭包方法 支持参数调用 - * @access public - * @param string|Closure $function 函数或者闭包 - * @param array $vars 参数 - * @return mixed - */ - public function invokeFunction($function, array $vars = []) - { - try { - $reflect = new ReflectionFunction($function); - } catch (ReflectionException $e) { - throw new FuncNotFoundException("function not exists: {$function}()", $function, $e); - } - - $args = $this->bindParams($reflect, $vars); - - return $function(...$args); - } - - /** - * 调用反射执行类的方法 支持参数绑定 - * @access public - * @param mixed $method 方法 - * @param array $vars 参数 - * @param bool $accessible 设置是否可访问 - * @return mixed - */ - public function invokeMethod($method, array $vars = [], bool $accessible = false) - { - if (is_array($method)) { - [$class, $method] = $method; - - $class = is_object($class) ? $class : $this->invokeClass($class); - } else { - // 静态方法 - [$class, $method] = explode('::', $method); - } - - try { - $reflect = new ReflectionMethod($class, $method); - } catch (ReflectionException $e) { - $class = is_object($class) ? get_class($class) : $class; - throw new FuncNotFoundException('method not exists: ' . $class . '::' . $method . '()', "{$class}::{$method}", $e); - } - - $args = $this->bindParams($reflect, $vars); - - if ($accessible) { - $reflect->setAccessible($accessible); - } - - return $reflect->invokeArgs(is_object($class) ? $class : null, $args); - } - - /** - * 调用反射执行类的方法 支持参数绑定 - * @access public - * @param object $instance 对象实例 - * @param mixed $reflect 反射类 - * @param array $vars 参数 - * @return mixed - */ - public function invokeReflectMethod($instance, $reflect, array $vars = []) - { - $args = $this->bindParams($reflect, $vars); - - return $reflect->invokeArgs($instance, $args); - } - - /** - * 调用反射执行callable 支持参数绑定 - * @access public - * @param mixed $callable - * @param array $vars 参数 - * @param bool $accessible 设置是否可访问 - * @return mixed - */ - public function invoke($callable, array $vars = [], bool $accessible = false) - { - if ($callable instanceof Closure) { - return $this->invokeFunction($callable, $vars); - } elseif (is_string($callable) && false === strpos($callable, '::')) { - return $this->invokeFunction($callable, $vars); - } else { - return $this->invokeMethod($callable, $vars, $accessible); - } - } - - /** - * 调用反射执行类的实例化 支持依赖注入 - * @access public - * @param string $class 类名 - * @param array $vars 参数 - * @return mixed - */ - public function invokeClass(string $class, array $vars = []) - { - try { - $reflect = new ReflectionClass($class); - } catch (ReflectionException $e) { - throw new ClassNotFoundException('class not exists: ' . $class, $class, $e); - } - - if ($reflect->hasMethod('__make')) { - $method = $reflect->getMethod('__make'); - if ($method->isPublic() && $method->isStatic()) { - $args = $this->bindParams($method, $vars); - $object = $method->invokeArgs(null, $args); - $this->invokeAfter($class, $object); - return $object; - } - } - - $constructor = $reflect->getConstructor(); - - $args = $constructor ? $this->bindParams($constructor, $vars) : []; - - $object = $reflect->newInstanceArgs($args); - - $this->invokeAfter($class, $object); - - return $object; - } - - /** - * 执行invokeClass回调 - * @access protected - * @param string $class 对象类名 - * @param object $object 容器对象实例 - * @return void - */ - protected function invokeAfter(string $class, $object): void - { - if (isset($this->invokeCallback['*'])) { - foreach ($this->invokeCallback['*'] as $callback) { - $callback($object, $this); - } - } - - if (isset($this->invokeCallback[$class])) { - foreach ($this->invokeCallback[$class] as $callback) { - $callback($object, $this); - } - } - } - - /** - * 绑定参数 - * @access protected - * @param ReflectionFunctionAbstract $reflect 反射类 - * @param array $vars 参数 - * @return array - */ - protected function bindParams(ReflectionFunctionAbstract $reflect, array $vars = []): array - { - if ($reflect->getNumberOfParameters() == 0) { - return []; - } - - // 判断数组类型 数字数组时按顺序绑定参数 - reset($vars); - $type = key($vars) === 0 ? 1 : 0; - $params = $reflect->getParameters(); - $args = []; - - foreach ($params as $param) { - $name = $param->getName(); - $lowerName = Str::snake($name); - $reflectionType = $param->getType(); - - if ($reflectionType && $reflectionType->isBuiltin() === false) { - $args[] = $this->getObjectParam($reflectionType->getName(), $vars); - } elseif (1 == $type && !empty($vars)) { - $args[] = array_shift($vars); - } elseif (0 == $type && array_key_exists($name, $vars)) { - $args[] = $vars[$name]; - } elseif (0 == $type && array_key_exists($lowerName, $vars)) { - $args[] = $vars[$lowerName]; - } elseif ($param->isDefaultValueAvailable()) { - $args[] = $param->getDefaultValue(); - } else { - throw new InvalidArgumentException('method param miss:' . $name); - } - } - - return $args; - } - - /** - * 创建工厂对象实例 - * @param string $name 工厂类名 - * @param string $namespace 默认命名空间 - * @param array $args - * @return mixed - * @deprecated - * @access public - */ - public static function factory(string $name, string $namespace = '', ...$args) - { - $class = false !== strpos($name, '\\') ? $name : $namespace . ucwords($name); - - return Container::getInstance()->invokeClass($class, $args); - } - - /** - * 获取对象类型的参数值 - * @access protected - * @param string $className 类名 - * @param array $vars 参数 - * @return mixed - */ - protected function getObjectParam(string $className, array &$vars) - { - $array = $vars; - $value = array_shift($array); - - if ($value instanceof $className) { - $result = $value; - array_shift($vars); - } else { - $result = $this->make($className); - } - - return $result; - } - - public function __set($name, $value) - { - $this->bind($name, $value); - } - - public function __get($name) - { - return $this->get($name); - } - - public function __isset($name): bool - { - return $this->exists($name); - } - - public function __unset($name) - { - $this->delete($name); - } - - public function offsetExists($key) - { - return $this->exists($key); - } - - public function offsetGet($key) - { - return $this->make($key); - } - - public function offsetSet($key, $value) - { - $this->bind($key, $value); - } - - public function offsetUnset($key) - { - $this->delete($key); - } - - //Countable - public function count() - { - return count($this->instances); - } - - //IteratorAggregate - public function getIterator() - { - return new ArrayIterator($this->instances); - } -} diff --git a/vendor/topthink/framework/src/think/Cookie.php b/vendor/topthink/framework/src/think/Cookie.php deleted file mode 100644 index ebbfd64e..00000000 --- a/vendor/topthink/framework/src/think/Cookie.php +++ /dev/null @@ -1,230 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use DateTimeInterface; - -/** - * Cookie管理类 - * @package think - */ -class Cookie -{ - /** - * 配置参数 - * @var array - */ - protected $config = [ - // cookie 保存时间 - 'expire' => 0, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => false, - // samesite 设置,支持 'strict' 'lax' - 'samesite' => '', - ]; - - /** - * Cookie写入数据 - * @var array - */ - protected $cookie = []; - - /** - * 当前Request对象 - * @var Request - */ - protected $request; - - /** - * 构造方法 - * @access public - */ - public function __construct(Request $request, array $config = []) - { - $this->request = $request; - $this->config = array_merge($this->config, array_change_key_case($config)); - } - - public static function __make(Request $request, Config $config) - { - return new static($request, $config->get('cookie')); - } - - /** - * 获取cookie - * @access public - * @param mixed $name 数据名称 - * @param string $default 默认值 - * @return mixed - */ - public function get(string $name = '', $default = null) - { - return $this->request->cookie($name, $default); - } - - /** - * 是否存在Cookie参数 - * @access public - * @param string $name 变量名 - * @return bool - */ - public function has(string $name): bool - { - return $this->request->has($name, 'cookie'); - } - - /** - * Cookie 设置 - * - * @access public - * @param string $name cookie名称 - * @param string $value cookie值 - * @param mixed $option 可选参数 - * @return void - */ - public function set(string $name, string $value, $option = null): void - { - // 参数设置(会覆盖黙认设置) - if (!is_null($option)) { - if (is_numeric($option) || $option instanceof DateTimeInterface) { - $option = ['expire' => $option]; - } - - $config = array_merge($this->config, array_change_key_case($option)); - } else { - $config = $this->config; - } - - if ($config['expire'] instanceof DateTimeInterface) { - $expire = $config['expire']->getTimestamp(); - } else { - $expire = !empty($config['expire']) ? time() + intval($config['expire']) : 0; - } - - $this->setCookie($name, $value, $expire, $config); - } - - /** - * Cookie 保存 - * - * @access public - * @param string $name cookie名称 - * @param string $value cookie值 - * @param int $expire 有效期 - * @param array $option 可选参数 - * @return void - */ - protected function setCookie(string $name, string $value, int $expire, array $option = []): void - { - $this->cookie[$name] = [$value, $expire, $option]; - } - - /** - * 永久保存Cookie数据 - * @access public - * @param string $name cookie名称 - * @param string $value cookie值 - * @param mixed $option 可选参数 可能会是 null|integer|string - * @return void - */ - public function forever(string $name, string $value = '', $option = null): void - { - if (is_null($option) || is_numeric($option)) { - $option = []; - } - - $option['expire'] = 315360000; - - $this->set($name, $value, $option); - } - - /** - * Cookie删除 - * @access public - * @param string $name cookie名称 - * @return void - */ - public function delete(string $name): void - { - $this->setCookie($name, '', time() - 3600, $this->config); - } - - /** - * 获取cookie保存数据 - * @access public - * @return array - */ - public function getCookie(): array - { - return $this->cookie; - } - - /** - * 保存Cookie - * @access public - * @return void - */ - public function save(): void - { - foreach ($this->cookie as $name => $val) { - [$value, $expire, $option] = $val; - - $this->saveCookie( - $name, - $value, - $expire, - $option['path'], - $option['domain'], - $option['secure'] ? true : false, - $option['httponly'] ? true : false, - $option['samesite'] - ); - } - } - - /** - * 保存Cookie - * @access public - * @param string $name cookie名称 - * @param string $value cookie值 - * @param int $expire cookie过期时间 - * @param string $path 有效的服务器路径 - * @param string $domain 有效域名/子域名 - * @param bool $secure 是否仅仅通过HTTPS - * @param bool $httponly 仅可通过HTTP访问 - * @param string $samesite 防止CSRF攻击和用户追踪 - * @return void - */ - protected function saveCookie(string $name, string $value, int $expire, string $path, string $domain, bool $secure, bool $httponly, string $samesite): void - { - if (version_compare(PHP_VERSION, '7.3.0', '>=')) { - setcookie($name, $value, [ - 'expires' => $expire, - 'path' => $path, - 'domain' => $domain, - 'secure' => $secure, - 'httponly' => $httponly, - 'samesite' => $samesite, - ]); - } else { - setcookie($name, $value, $expire, $path, $domain, $secure, $httponly); - } - } - -} diff --git a/vendor/topthink/framework/src/think/Db.php b/vendor/topthink/framework/src/think/Db.php deleted file mode 100644 index 0048874f..00000000 --- a/vendor/topthink/framework/src/think/Db.php +++ /dev/null @@ -1,117 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -/** - * 数据库管理类 - * @package think - * @property Config $config - */ -class Db extends DbManager -{ - /** - * @param Event $event - * @param Config $config - * @param Log $log - * @param Cache $cache - * @return Db - * @codeCoverageIgnore - */ - public static function __make(Event $event, Config $config, Log $log, Cache $cache) - { - $db = new static(); - $db->setConfig($config); - $db->setEvent($event); - $db->setLog($log); - - $store = $db->getConfig('cache_store'); - $db->setCache($cache->store($store)); - $db->triggerSql(); - - return $db; - } - - /** - * 注入模型对象 - * @access public - * @return void - */ - protected function modelMaker() - { - } - - /** - * 设置配置对象 - * @access public - * @param Config $config 配置对象 - * @return void - */ - public function setConfig($config): void - { - $this->config = $config; - } - - /** - * 获取配置参数 - * @access public - * @param string $name 配置参数 - * @param mixed $default 默认值 - * @return mixed - */ - public function getConfig(string $name = '', $default = null) - { - if ('' !== $name) { - return $this->config->get('database.' . $name, $default); - } - - return $this->config->get('database', []); - } - - /** - * 设置Event对象 - * @param Event $event - */ - public function setEvent(Event $event): void - { - $this->event = $event; - } - - /** - * 注册回调方法 - * @access public - * @param string $event 事件名 - * @param callable $callback 回调方法 - * @return void - */ - public function event(string $event, callable $callback): void - { - if ($this->event) { - $this->event->listen('db.' . $event, $callback); - } - } - - /** - * 触发事件 - * @access public - * @param string $event 事件名 - * @param mixed $params 传入参数 - * @param bool $once - * @return mixed - */ - public function trigger(string $event, $params = null, bool $once = false) - { - if ($this->event) { - return $this->event->trigger('db.' . $event, $params, $once); - } - } -} diff --git a/vendor/topthink/framework/src/think/Env.php b/vendor/topthink/framework/src/think/Env.php deleted file mode 100644 index 4c26b33a..00000000 --- a/vendor/topthink/framework/src/think/Env.php +++ /dev/null @@ -1,181 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use ArrayAccess; - -/** - * Env管理类 - * @package think - */ -class Env implements ArrayAccess -{ - /** - * 环境变量数据 - * @var array - */ - protected $data = []; - - public function __construct() - { - $this->data = $_ENV; - } - - /** - * 读取环境变量定义文件 - * @access public - * @param string $file 环境变量定义文件 - * @return void - */ - public function load(string $file): void - { - $env = parse_ini_file($file, true) ?: []; - $this->set($env); - } - - /** - * 获取环境变量值 - * @access public - * @param string $name 环境变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function get(string $name = null, $default = null) - { - if (is_null($name)) { - return $this->data; - } - - $name = strtoupper(str_replace('.', '_', $name)); - - if (isset($this->data[$name])) { - return $this->data[$name]; - } - - return $this->getEnv($name, $default); - } - - protected function getEnv(string $name, $default = null) - { - $result = getenv('PHP_' . $name); - - if (false === $result) { - return $default; - } - - if ('false' === $result) { - $result = false; - } elseif ('true' === $result) { - $result = true; - } - - if (!isset($this->data[$name])) { - $this->data[$name] = $result; - } - - return $result; - } - - /** - * 设置环境变量值 - * @access public - * @param string|array $env 环境变量 - * @param mixed $value 值 - * @return void - */ - public function set($env, $value = null): void - { - if (is_array($env)) { - $env = array_change_key_case($env, CASE_UPPER); - - foreach ($env as $key => $val) { - if (is_array($val)) { - foreach ($val as $k => $v) { - $this->data[$key . '_' . strtoupper($k)] = $v; - } - } else { - $this->data[$key] = $val; - } - } - } else { - $name = strtoupper(str_replace('.', '_', $env)); - - $this->data[$name] = $value; - } - } - - /** - * 检测是否存在环境变量 - * @access public - * @param string $name 参数名 - * @return bool - */ - public function has(string $name): bool - { - return !is_null($this->get($name)); - } - - /** - * 设置环境变量 - * @access public - * @param string $name 参数名 - * @param mixed $value 值 - */ - public function __set(string $name, $value): void - { - $this->set($name, $value); - } - - /** - * 获取环境变量 - * @access public - * @param string $name 参数名 - * @return mixed - */ - public function __get(string $name) - { - return $this->get($name); - } - - /** - * 检测是否存在环境变量 - * @access public - * @param string $name 参数名 - * @return bool - */ - public function __isset(string $name): bool - { - return $this->has($name); - } - - // ArrayAccess - public function offsetSet($name, $value): void - { - $this->set($name, $value); - } - - public function offsetExists($name): bool - { - return $this->__isset($name); - } - - public function offsetUnset($name) - { - throw new Exception('not support: unset'); - } - - public function offsetGet($name) - { - return $this->get($name); - } -} diff --git a/vendor/topthink/framework/src/think/Event.php b/vendor/topthink/framework/src/think/Event.php deleted file mode 100644 index 6a0eb1f0..00000000 --- a/vendor/topthink/framework/src/think/Event.php +++ /dev/null @@ -1,263 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use ReflectionClass; -use ReflectionMethod; - -/** - * 事件管理类 - * @package think - */ -class Event -{ - /** - * 监听者 - * @var array - */ - protected $listener = []; - - /** - * 事件别名 - * @var array - */ - protected $bind = [ - 'AppInit' => event\AppInit::class, - 'HttpRun' => event\HttpRun::class, - 'HttpEnd' => event\HttpEnd::class, - 'RouteLoaded' => event\RouteLoaded::class, - 'LogWrite' => event\LogWrite::class, - ]; - - /** - * 应用对象 - * @var App - */ - protected $app; - - public function __construct(App $app) - { - $this->app = $app; - } - - /** - * 批量注册事件监听 - * @access public - * @param array $events 事件定义 - * @return $this - */ - public function listenEvents(array $events) - { - foreach ($events as $event => $listeners) { - if (isset($this->bind[$event])) { - $event = $this->bind[$event]; - } - - $this->listener[$event] = array_merge($this->listener[$event] ?? [], $listeners); - } - - return $this; - } - - /** - * 注册事件监听 - * @access public - * @param string $event 事件名称 - * @param mixed $listener 监听操作(或者类名) - * @param bool $first 是否优先执行 - * @return $this - */ - public function listen(string $event, $listener, bool $first = false) - { - if (isset($this->bind[$event])) { - $event = $this->bind[$event]; - } - - if ($first && isset($this->listener[$event])) { - array_unshift($this->listener[$event], $listener); - } else { - $this->listener[$event][] = $listener; - } - - return $this; - } - - /** - * 是否存在事件监听 - * @access public - * @param string $event 事件名称 - * @return bool - */ - public function hasListener(string $event): bool - { - if (isset($this->bind[$event])) { - $event = $this->bind[$event]; - } - - return isset($this->listener[$event]); - } - - /** - * 移除事件监听 - * @access public - * @param string $event 事件名称 - * @return void - */ - public function remove(string $event): void - { - if (isset($this->bind[$event])) { - $event = $this->bind[$event]; - } - - unset($this->listener[$event]); - } - - /** - * 指定事件别名标识 便于调用 - * @access public - * @param array $events 事件别名 - * @return $this - */ - public function bind(array $events) - { - $this->bind = array_merge($this->bind, $events); - - return $this; - } - - /** - * 注册事件订阅者 - * @access public - * @param mixed $subscriber 订阅者 - * @return $this - */ - public function subscribe($subscriber) - { - $subscribers = (array) $subscriber; - - foreach ($subscribers as $subscriber) { - if (is_string($subscriber)) { - $subscriber = $this->app->make($subscriber); - } - - if (method_exists($subscriber, 'subscribe')) { - // 手动订阅 - $subscriber->subscribe($this); - } else { - // 智能订阅 - $this->observe($subscriber); - } - } - - return $this; - } - - /** - * 自动注册事件观察者 - * @access public - * @param string|object $observer 观察者 - * @param null|string $prefix 事件名前缀 - * @return $this - */ - public function observe($observer, string $prefix = '') - { - if (is_string($observer)) { - $observer = $this->app->make($observer); - } - - $reflect = new ReflectionClass($observer); - $methods = $reflect->getMethods(ReflectionMethod::IS_PUBLIC); - - if (empty($prefix) && $reflect->hasProperty('eventPrefix')) { - $reflectProperty = $reflect->getProperty('eventPrefix'); - $reflectProperty->setAccessible(true); - $prefix = $reflectProperty->getValue($observer); - } - - foreach ($methods as $method) { - $name = $method->getName(); - if (0 === strpos($name, 'on')) { - $this->listen($prefix . substr($name, 2), [$observer, $name]); - } - } - - return $this; - } - - /** - * 触发事件 - * @access public - * @param string|object $event 事件名称 - * @param mixed $params 传入参数 - * @param bool $once 只获取一个有效返回值 - * @return mixed - */ - public function trigger($event, $params = null, bool $once = false) - { - if (is_object($event)) { - $params = $event; - $event = get_class($event); - } - - if (isset($this->bind[$event])) { - $event = $this->bind[$event]; - } - - $result = []; - $listeners = $this->listener[$event] ?? []; - $listeners = array_unique($listeners, SORT_REGULAR); - - foreach ($listeners as $key => $listener) { - $result[$key] = $this->dispatch($listener, $params); - - if (false === $result[$key] || (!is_null($result[$key]) && $once)) { - break; - } - } - - return $once ? end($result) : $result; - } - - /** - * 触发事件(只获取一个有效返回值) - * @param $event - * @param null $params - * @return mixed - */ - public function until($event, $params = null) - { - return $this->trigger($event, $params, true); - } - - /** - * 执行事件调度 - * @access protected - * @param mixed $event 事件方法 - * @param mixed $params 参数 - * @return mixed - */ - protected function dispatch($event, $params = null) - { - if (!is_string($event)) { - $call = $event; - } elseif (strpos($event, '::')) { - $call = $event; - } else { - $obj = $this->app->make($event); - $call = [$obj, 'handle']; - } - - return $this->app->invoke($call, [$params]); - } - -} diff --git a/vendor/topthink/framework/src/think/Exception.php b/vendor/topthink/framework/src/think/Exception.php deleted file mode 100644 index 5cf79548..00000000 --- a/vendor/topthink/framework/src/think/Exception.php +++ /dev/null @@ -1,60 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -/** - * 异常基础类 - * @package think - */ -class Exception extends \Exception -{ - /** - * 保存异常页面显示的额外Debug数据 - * @var array - */ - protected $data = []; - - /** - * 设置异常额外的Debug数据 - * 数据将会显示为下面的格式 - * - * Exception Data - * -------------------------------------------------- - * Label 1 - * key1 value1 - * key2 value2 - * Label 2 - * key1 value1 - * key2 value2 - * - * @access protected - * @param string $label 数据分类,用于异常页面显示 - * @param array $data 需要显示的数据,必须为关联数组 - */ - final protected function setData(string $label, array $data) - { - $this->data[$label] = $data; - } - - /** - * 获取异常额外Debug数据 - * 主要用于输出到异常页面便于调试 - * @access public - * @return array 由setData设置的Debug数据 - */ - final public function getData() - { - return $this->data; - } - -} diff --git a/vendor/topthink/framework/src/think/Facade.php b/vendor/topthink/framework/src/think/Facade.php deleted file mode 100644 index 9a0e3339..00000000 --- a/vendor/topthink/framework/src/think/Facade.php +++ /dev/null @@ -1,98 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think; - -/** - * Facade管理类 - */ -class Facade -{ - /** - * 始终创建新的对象实例 - * @var bool - */ - protected static $alwaysNewInstance; - - /** - * 创建Facade实例 - * @static - * @access protected - * @param string $class 类名或标识 - * @param array $args 变量 - * @param bool $newInstance 是否每次创建新的实例 - * @return object - */ - protected static function createFacade(string $class = '', array $args = [], bool $newInstance = false) - { - $class = $class ?: static::class; - - $facadeClass = static::getFacadeClass(); - - if ($facadeClass) { - $class = $facadeClass; - } - - if (static::$alwaysNewInstance) { - $newInstance = true; - } - - return Container::getInstance()->make($class, $args, $newInstance); - } - - /** - * 获取当前Facade对应类名 - * @access protected - * @return string - */ - protected static function getFacadeClass() - {} - - /** - * 带参数实例化当前Facade类 - * @access public - * @return object - */ - public static function instance(...$args) - { - if (__CLASS__ != static::class) { - return self::createFacade('', $args); - } - } - - /** - * 调用类的实例 - * @access public - * @param string $class 类名或者标识 - * @param array|true $args 变量 - * @param bool $newInstance 是否每次创建新的实例 - * @return object - */ - public static function make(string $class, $args = [], $newInstance = false) - { - if (__CLASS__ != static::class) { - return self::__callStatic('make', func_get_args()); - } - - if (true === $args) { - // 总是创建新的实例化对象 - $newInstance = true; - $args = []; - } - - return self::createFacade($class, $args, $newInstance); - } - - // 调用实际类的方法 - public static function __callStatic($method, $params) - { - return call_user_func_array([static::createFacade(), $method], $params); - } -} diff --git a/vendor/topthink/framework/src/think/File.php b/vendor/topthink/framework/src/think/File.php deleted file mode 100644 index f7c37bdb..00000000 --- a/vendor/topthink/framework/src/think/File.php +++ /dev/null @@ -1,187 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use SplFileInfo; -use think\exception\FileException; - -/** - * 文件上传类 - * @package think - */ -class File extends SplFileInfo -{ - - /** - * 文件hash规则 - * @var array - */ - protected $hash = []; - - protected $hashName; - - public function __construct(string $path, bool $checkPath = true) - { - if ($checkPath && !is_file($path)) { - throw new FileException(sprintf('The file "%s" does not exist', $path)); - } - - parent::__construct($path); - } - - /** - * 获取文件的哈希散列值 - * @access public - * @param string $type - * @return string - */ - public function hash(string $type = 'sha1'): string - { - if (!isset($this->hash[$type])) { - $this->hash[$type] = hash_file($type, $this->getPathname()); - } - - return $this->hash[$type]; - } - - /** - * 获取文件的MD5值 - * @access public - * @return string - */ - public function md5(): string - { - return $this->hash('md5'); - } - - /** - * 获取文件的SHA1值 - * @access public - * @return string - */ - public function sha1(): string - { - return $this->hash('sha1'); - } - - /** - * 获取文件类型信息 - * @access public - * @return string - */ - public function getMime(): string - { - $finfo = finfo_open(FILEINFO_MIME_TYPE); - - return finfo_file($finfo, $this->getPathname()); - } - - /** - * 移动文件 - * @access public - * @param string $directory 保存路径 - * @param string|null $name 保存的文件名 - * @return File - */ - public function move(string $directory, string $name = null): File - { - $target = $this->getTargetFile($directory, $name); - - set_error_handler(function ($type, $msg) use (&$error) { - $error = $msg; - }); - $renamed = rename($this->getPathname(), (string) $target); - restore_error_handler(); - if (!$renamed) { - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error))); - } - - @chmod((string) $target, 0666 & ~umask()); - - return $target; - } - - /** - * 实例化一个新文件 - * @param string $directory - * @param null|string $name - * @return File - */ - protected function getTargetFile(string $directory, string $name = null): File - { - if (!is_dir($directory)) { - if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) { - throw new FileException(sprintf('Unable to create the "%s" directory', $directory)); - } - } elseif (!is_writable($directory)) { - throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); - } - - $target = rtrim($directory, '/\\') . \DIRECTORY_SEPARATOR . (null === $name ? $this->getBasename() : $this->getName($name)); - - return new self($target, false); - } - - /** - * 获取文件名 - * @param string $name - * @return string - */ - protected function getName(string $name): string - { - $originalName = str_replace('\\', '/', $name); - $pos = strrpos($originalName, '/'); - $originalName = false === $pos ? $originalName : substr($originalName, $pos + 1); - - return $originalName; - } - - /** - * 文件扩展名 - * @return string - */ - public function extension(): string - { - return $this->getExtension(); - } - - /** - * 自动生成文件名 - * @access public - * @param string|\Closure $rule - * @return string - */ - public function hashName($rule = ''): string - { - if (!$this->hashName) { - if ($rule instanceof \Closure) { - $this->hashName = call_user_func_array($rule, [$this]); - } else { - switch (true) { - case in_array($rule, hash_algos()): - $hash = $this->hash($rule); - $this->hashName = substr($hash, 0, 2) . DIRECTORY_SEPARATOR . substr($hash, 2); - break; - case is_callable($rule): - $this->hashName = call_user_func($rule); - break; - default: - $this->hashName = date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true)); - break; - } - } - } - - return $this->hashName . '.' . $this->extension(); - } -} diff --git a/vendor/topthink/framework/src/think/Filesystem.php b/vendor/topthink/framework/src/think/Filesystem.php deleted file mode 100644 index 0aee929f..00000000 --- a/vendor/topthink/framework/src/think/Filesystem.php +++ /dev/null @@ -1,89 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use InvalidArgumentException; -use think\filesystem\Driver; -use think\filesystem\driver\Local; -use think\helper\Arr; - -/** - * Class Filesystem - * @package think - * @mixin Driver - * @mixin Local - */ -class Filesystem extends Manager -{ - protected $namespace = '\\think\\filesystem\\driver\\'; - - /** - * @param null|string $name - * @return Driver - */ - public function disk(string $name = null): Driver - { - return $this->driver($name); - } - - protected function resolveType(string $name) - { - return $this->getDiskConfig($name, 'type', 'local'); - } - - protected function resolveConfig(string $name) - { - return $this->getDiskConfig($name); - } - - /** - * 获取缓存配置 - * @access public - * @param null|string $name 名称 - * @param mixed $default 默认值 - * @return mixed - */ - public function getConfig(string $name = null, $default = null) - { - if (!is_null($name)) { - return $this->app->config->get('filesystem.' . $name, $default); - } - - return $this->app->config->get('filesystem'); - } - - /** - * 获取磁盘配置 - * @param string $disk - * @param null $name - * @param null $default - * @return array - */ - public function getDiskConfig($disk, $name = null, $default = null) - { - if ($config = $this->getConfig("disks.{$disk}")) { - return Arr::get($config, $name, $default); - } - - throw new InvalidArgumentException("Disk [$disk] not found."); - } - - /** - * 默认驱动 - * @return string|null - */ - public function getDefaultDriver() - { - return $this->getConfig('default'); - } -} diff --git a/vendor/topthink/framework/src/think/Http.php b/vendor/topthink/framework/src/think/Http.php deleted file mode 100644 index 4e49c88c..00000000 --- a/vendor/topthink/framework/src/think/Http.php +++ /dev/null @@ -1,288 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use think\event\HttpEnd; -use think\event\HttpRun; -use think\event\RouteLoaded; -use think\exception\Handle; -use Throwable; - -/** - * Web应用管理类 - * @package think - */ -class Http -{ - - /** - * @var App - */ - protected $app; - - /** - * 应用名称 - * @var string - */ - protected $name; - - /** - * 应用路径 - * @var string - */ - protected $path; - - /** - * 路由路径 - * @var string - */ - protected $routePath; - - /** - * 是否绑定应用 - * @var bool - */ - protected $isBind = false; - - public function __construct(App $app) - { - $this->app = $app; - - $this->routePath = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR; - } - - /** - * 设置应用名称 - * @access public - * @param string $name 应用名称 - * @return $this - */ - public function name(string $name) - { - $this->name = $name; - return $this; - } - - /** - * 获取应用名称 - * @access public - * @return string - */ - public function getName(): string - { - return $this->name ?: ''; - } - - /** - * 设置应用目录 - * @access public - * @param string $path 应用目录 - * @return $this - */ - public function path(string $path) - { - if (substr($path, -1) != DIRECTORY_SEPARATOR) { - $path .= DIRECTORY_SEPARATOR; - } - - $this->path = $path; - return $this; - } - - /** - * 获取应用路径 - * @access public - * @return string - */ - public function getPath(): string - { - return $this->path ?: ''; - } - - /** - * 获取路由目录 - * @access public - * @return string - */ - public function getRoutePath(): string - { - return $this->routePath; - } - - /** - * 设置路由目录 - * @access public - * @param string $path 路由定义目录 - */ - public function setRoutePath(string $path): void - { - $this->routePath = $path; - } - - /** - * 设置应用绑定 - * @access public - * @param bool $bind 是否绑定 - * @return $this - */ - public function setBind(bool $bind = true) - { - $this->isBind = $bind; - return $this; - } - - /** - * 是否绑定应用 - * @access public - * @return bool - */ - public function isBind(): bool - { - return $this->isBind; - } - - /** - * 执行应用程序 - * @access public - * @param Request|null $request - * @return Response - */ - public function run(Request $request = null): Response - { - //初始化 - $this->initialize(); - - //自动创建request对象 - $request = $request ?? $this->app->make('request', [], true); - $this->app->instance('request', $request); - - try { - $response = $this->runWithRequest($request); - } catch (Throwable $e) { - $this->reportException($e); - - $response = $this->renderException($request, $e); - } - - return $response; - } - - /** - * 初始化 - */ - protected function initialize() - { - if (!$this->app->initialized()) { - $this->app->initialize(); - } - } - - /** - * 执行应用程序 - * @param Request $request - * @return mixed - */ - protected function runWithRequest(Request $request) - { - // 加载全局中间件 - $this->loadMiddleware(); - - // 监听HttpRun - $this->app->event->trigger(HttpRun::class); - - return $this->app->middleware->pipeline() - ->send($request) - ->then(function ($request) { - return $this->dispatchToRoute($request); - }); - } - - protected function dispatchToRoute($request) - { - $withRoute = $this->app->config->get('app.with_route', true) ? function () { - $this->loadRoutes(); - } : null; - - return $this->app->route->dispatch($request, $withRoute); - } - - /** - * 加载全局中间件 - */ - protected function loadMiddleware(): void - { - if (is_file($this->app->getBasePath() . 'middleware.php')) { - $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php'); - } - } - - /** - * 加载路由 - * @access protected - * @return void - */ - protected function loadRoutes(): void - { - // 加载路由定义 - $routePath = $this->getRoutePath(); - - if (is_dir($routePath)) { - $files = glob($routePath . '*.php'); - foreach ($files as $file) { - include $file; - } - } - - $this->app->event->trigger(RouteLoaded::class); - } - - /** - * Report the exception to the exception handler. - * - * @param Throwable $e - * @return void - */ - protected function reportException(Throwable $e) - { - $this->app->make(Handle::class)->report($e); - } - - /** - * Render the exception to a response. - * - * @param Request $request - * @param Throwable $e - * @return Response - */ - protected function renderException($request, Throwable $e) - { - return $this->app->make(Handle::class)->render($request, $e); - } - - /** - * HttpEnd - * @param Response $response - * @return void - */ - public function end(Response $response): void - { - $this->app->event->trigger(HttpEnd::class, $response); - - //执行中间件 - $this->app->middleware->end($response); - - // 写入日志 - $this->app->log->save(); - } - -} diff --git a/vendor/topthink/framework/src/think/Lang.php b/vendor/topthink/framework/src/think/Lang.php deleted file mode 100644 index 0b79b760..00000000 --- a/vendor/topthink/framework/src/think/Lang.php +++ /dev/null @@ -1,294 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -/** - * 多语言管理类 - * @package think - */ -class Lang -{ - /** - * 配置参数 - * @var array - */ - protected $config = [ - // 默认语言 - 'default_lang' => 'zh-cn', - // 允许的语言列表 - 'allow_lang_list' => [], - // 是否使用Cookie记录 - 'use_cookie' => true, - // 扩展语言包 - 'extend_list' => [], - // 多语言cookie变量 - 'cookie_var' => 'think_lang', - // 多语言header变量 - 'header_var' => 'think-lang', - // 多语言自动侦测变量名 - 'detect_var' => 'lang', - // Accept-Language转义为对应语言包名称 - 'accept_language' => [ - 'zh-hans-cn' => 'zh-cn', - ], - // 是否支持语言分组 - 'allow_group' => false, - ]; - - /** - * 多语言信息 - * @var array - */ - private $lang = []; - - /** - * 当前语言 - * @var string - */ - private $range = 'zh-cn'; - - /** - * 构造方法 - * @access public - * @param array $config - */ - public function __construct(array $config = []) - { - $this->config = array_merge($this->config, array_change_key_case($config)); - $this->range = $this->config['default_lang']; - } - - public static function __make(Config $config) - { - return new static($config->get('lang')); - } - - /** - * 设置当前语言 - * @access public - * @param string $lang 语言 - * @return void - */ - public function setLangSet(string $lang): void - { - $this->range = $lang; - } - - /** - * 获取当前语言 - * @access public - * @return string - */ - public function getLangSet(): string - { - return $this->range; - } - - /** - * 获取默认语言 - * @access public - * @return string - */ - public function defaultLangSet() - { - return $this->config['default_lang']; - } - - /** - * 加载语言定义(不区分大小写) - * @access public - * @param string|array $file 语言文件 - * @param string $range 语言作用域 - * @return array - */ - public function load($file, $range = ''): array - { - $range = $range ?: $this->range; - if (!isset($this->lang[$range])) { - $this->lang[$range] = []; - } - - $lang = []; - - foreach ((array) $file as $name) { - if (is_file($name)) { - $result = $this->parse($name); - $lang = array_change_key_case($result) + $lang; - } - } - - if (!empty($lang)) { - $this->lang[$range] = $lang + $this->lang[$range]; - } - - return $this->lang[$range]; - } - - /** - * 解析语言文件 - * @access protected - * @param string $file 语言文件名 - * @return array - */ - protected function parse(string $file): array - { - $type = pathinfo($file, PATHINFO_EXTENSION); - - switch ($type) { - case 'php': - $result = include $file; - break; - case 'yml': - case 'yaml': - if (function_exists('yaml_parse_file')) { - $result = yaml_parse_file($file); - } - break; - case 'json': - $data = file_get_contents($file); - - if (false !== $data) { - $data = json_decode($data, true); - - if (json_last_error() === JSON_ERROR_NONE) { - $result = $data; - } - } - - break; - } - - return isset($result) && is_array($result) ? $result : []; - } - - /** - * 判断是否存在语言定义(不区分大小写) - * @access public - * @param string|null $name 语言变量 - * @param string $range 语言作用域 - * @return bool - */ - public function has(string $name, string $range = ''): bool - { - $range = $range ?: $this->range; - - if ($this->config['allow_group'] && strpos($name, '.')) { - [$name1, $name2] = explode('.', $name, 2); - return isset($this->lang[$range][strtolower($name1)][$name2]); - } - - return isset($this->lang[$range][strtolower($name)]); - } - - /** - * 获取语言定义(不区分大小写) - * @access public - * @param string|null $name 语言变量 - * @param array $vars 变量替换 - * @param string $range 语言作用域 - * @return mixed - */ - public function get(string $name = null, array $vars = [], string $range = '') - { - $range = $range ?: $this->range; - - // 空参数返回所有定义 - if (is_null($name)) { - return $this->lang[$range] ?? []; - } - - if ($this->config['allow_group'] && strpos($name, '.')) { - [$name1, $name2] = explode('.', $name, 2); - - $value = $this->lang[$range][strtolower($name1)][$name2] ?? $name; - } else { - $value = $this->lang[$range][strtolower($name)] ?? $name; - } - - // 变量解析 - if (!empty($vars) && is_array($vars)) { - /** - * Notes: - * 为了检测的方便,数字索引的判断仅仅是参数数组的第一个元素的key为数字0 - * 数字索引采用的是系统的 sprintf 函数替换,用法请参考 sprintf 函数 - */ - if (key($vars) === 0) { - // 数字索引解析 - array_unshift($vars, $value); - $value = call_user_func_array('sprintf', $vars); - } else { - // 关联索引解析 - $replace = array_keys($vars); - foreach ($replace as &$v) { - $v = "{:{$v}}"; - } - $value = str_replace($replace, $vars, $value); - } - } - - return $value; - } - - /** - * 自动侦测设置获取语言选择 - * @access public - * @param Request $request - * @return string - */ - public function detect(Request $request): string - { - // 自动侦测设置获取语言选择 - $langSet = ''; - - if ($request->get($this->config['detect_var'])) { - // url中设置了语言变量 - $langSet = strtolower($request->get($this->config['detect_var'])); - } elseif ($request->header($this->config['header_var'])) { - // Header中设置了语言变量 - $langSet = strtolower($request->header($this->config['header_var'])); - } elseif ($request->cookie($this->config['cookie_var'])) { - // Cookie中设置了语言变量 - $langSet = strtolower($request->cookie($this->config['cookie_var'])); - } elseif ($request->server('HTTP_ACCEPT_LANGUAGE')) { - // 自动侦测浏览器语言 - $match = preg_match('/^([a-z\d\-]+)/i', $request->server('HTTP_ACCEPT_LANGUAGE'), $matches); - if ($match) { - $langSet = strtolower($matches[1]); - if (isset($this->config['accept_language'][$langSet])) { - $langSet = $this->config['accept_language'][$langSet]; - } - } - } - - if (empty($this->config['allow_lang_list']) || in_array($langSet, $this->config['allow_lang_list'])) { - // 合法的语言 - $this->range = $langSet; - } - - return $this->range; - } - - /** - * 保存当前语言到Cookie - * @access public - * @param Cookie $cookie Cookie对象 - * @return void - */ - public function saveToCookie(Cookie $cookie) - { - if ($this->config['use_cookie']) { - $cookie->set($this->config['cookie_var'], $this->range); - } - } - -} diff --git a/vendor/topthink/framework/src/think/Log.php b/vendor/topthink/framework/src/think/Log.php deleted file mode 100644 index c31210ce..00000000 --- a/vendor/topthink/framework/src/think/Log.php +++ /dev/null @@ -1,342 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use InvalidArgumentException; -use Psr\Log\LoggerInterface; -use think\event\LogWrite; -use think\helper\Arr; -use think\log\Channel; -use think\log\ChannelSet; - -/** - * 日志管理类 - * @package think - * @mixin Channel - */ -class Log extends Manager implements LoggerInterface -{ - const EMERGENCY = 'emergency'; - const ALERT = 'alert'; - const CRITICAL = 'critical'; - const ERROR = 'error'; - const WARNING = 'warning'; - const NOTICE = 'notice'; - const INFO = 'info'; - const DEBUG = 'debug'; - const SQL = 'sql'; - - protected $namespace = '\\think\\log\\driver\\'; - - /** - * 默认驱动 - * @return string|null - */ - public function getDefaultDriver() - { - return $this->getConfig('default'); - } - - /** - * 获取日志配置 - * @access public - * @param null|string $name 名称 - * @param mixed $default 默认值 - * @return mixed - */ - public function getConfig(string $name = null, $default = null) - { - if (!is_null($name)) { - return $this->app->config->get('log.' . $name, $default); - } - - return $this->app->config->get('log'); - } - - /** - * 获取渠道配置 - * @param string $channel - * @param null $name - * @param null $default - * @return array - */ - public function getChannelConfig($channel, $name = null, $default = null) - { - if ($config = $this->getConfig("channels.{$channel}")) { - return Arr::get($config, $name, $default); - } - - throw new InvalidArgumentException("Channel [$channel] not found."); - } - - /** - * driver()的别名 - * @param string|array $name 渠道名 - * @return Channel|ChannelSet - */ - public function channel($name = null) - { - if (is_array($name)) { - return new ChannelSet($this, $name); - } - - return $this->driver($name); - } - - protected function resolveType(string $name) - { - return $this->getChannelConfig($name, 'type', 'file'); - } - - public function createDriver(string $name) - { - $driver = parent::createDriver($name); - - $lazy = !$this->getChannelConfig($name, "realtime_write", false) && !$this->app->runningInConsole(); - $allow = array_merge($this->getConfig("level", []), $this->getChannelConfig($name, "level", [])); - - return new Channel($name, $driver, $allow, $lazy, $this->app->event); - } - - protected function resolveConfig(string $name) - { - return $this->getChannelConfig($name); - } - - /** - * 清空日志信息 - * @access public - * @param string|array $channel 日志通道名 - * @return $this - */ - public function clear($channel = '*') - { - if ('*' == $channel) { - $channel = array_keys($this->drivers); - } - - $this->channel($channel)->clear(); - - return $this; - } - - /** - * 关闭本次请求日志写入 - * @access public - * @param string|array $channel 日志通道名 - * @return $this - */ - public function close($channel = '*') - { - if ('*' == $channel) { - $channel = array_keys($this->drivers); - } - - $this->channel($channel)->close(); - - return $this; - } - - /** - * 获取日志信息 - * @access public - * @param string $channel 日志通道名 - * @return array - */ - public function getLog(string $channel = null): array - { - return $this->channel($channel)->getLog(); - } - - /** - * 保存日志信息 - * @access public - * @return bool - */ - public function save(): bool - { - /** @var Channel $channel */ - foreach ($this->drivers as $channel) { - $channel->save(); - } - - return true; - } - - /** - * 记录日志信息 - * @access public - * @param mixed $msg 日志信息 - * @param string $type 日志级别 - * @param array $context 替换内容 - * @param bool $lazy - * @return $this - */ - public function record($msg, string $type = 'info', array $context = [], bool $lazy = true) - { - $channel = $this->getConfig('type_channel.' . $type); - - $this->channel($channel)->record($msg, $type, $context, $lazy); - - return $this; - } - - /** - * 实时写入日志信息 - * @access public - * @param mixed $msg 调试信息 - * @param string $type 日志级别 - * @param array $context 替换内容 - * @return $this - */ - public function write($msg, string $type = 'info', array $context = []) - { - return $this->record($msg, $type, $context, false); - } - - /** - * 注册日志写入事件监听 - * @param $listener - * @return Event - */ - public function listen($listener) - { - return $this->app->event->listen(LogWrite::class, $listener); - } - - /** - * 记录日志信息 - * @access public - * @param string $level 日志级别 - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function log($level, $message, array $context = []): void - { - $this->record($message, $level, $context); - } - - /** - * 记录emergency信息 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function emergency($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * 记录警报信息 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function alert($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * 记录紧急情况 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function critical($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * 记录错误信息 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function error($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * 记录warning信息 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function warning($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * 记录notice信息 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function notice($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * 记录一般信息 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function info($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * 记录调试信息 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function debug($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * 记录sql信息 - * @access public - * @param mixed $message 日志信息 - * @param array $context 替换内容 - * @return void - */ - public function sql($message, array $context = []): void - { - $this->log(__FUNCTION__, $message, $context); - } - - public function __call($method, $parameters) - { - $this->log($method, ...$parameters); - } -} diff --git a/vendor/topthink/framework/src/think/Manager.php b/vendor/topthink/framework/src/think/Manager.php deleted file mode 100644 index ca3f6a5a..00000000 --- a/vendor/topthink/framework/src/think/Manager.php +++ /dev/null @@ -1,177 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use InvalidArgumentException; -use think\helper\Str; - -abstract class Manager -{ - /** @var App */ - protected $app; - - /** - * 驱动 - * @var array - */ - protected $drivers = []; - - /** - * 驱动的命名空间 - * @var string - */ - protected $namespace = null; - - public function __construct(App $app) - { - $this->app = $app; - } - - /** - * 获取驱动实例 - * @param null|string $name - * @return mixed - */ - protected function driver(string $name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - if (is_null($name)) { - throw new InvalidArgumentException(sprintf( - 'Unable to resolve NULL driver for [%s].', - static::class - )); - } - - return $this->drivers[$name] = $this->getDriver($name); - } - - /** - * 获取驱动实例 - * @param string $name - * @return mixed - */ - protected function getDriver(string $name) - { - return $this->drivers[$name] ?? $this->createDriver($name); - } - - /** - * 获取驱动类型 - * @param string $name - * @return mixed - */ - protected function resolveType(string $name) - { - return $name; - } - - /** - * 获取驱动配置 - * @param string $name - * @return mixed - */ - protected function resolveConfig(string $name) - { - return $name; - } - - /** - * 获取驱动类 - * @param string $type - * @return string - */ - protected function resolveClass(string $type): string - { - if ($this->namespace || false !== strpos($type, '\\')) { - $class = false !== strpos($type, '\\') ? $type : $this->namespace . Str::studly($type); - - if (class_exists($class)) { - return $class; - } - } - - throw new InvalidArgumentException("Driver [$type] not supported."); - } - - /** - * 获取驱动参数 - * @param $name - * @return array - */ - protected function resolveParams($name): array - { - $config = $this->resolveConfig($name); - return [$config]; - } - - /** - * 创建驱动 - * - * @param string $name - * @return mixed - * - */ - protected function createDriver(string $name) - { - $type = $this->resolveType($name); - - $method = 'create' . Str::studly($type) . 'Driver'; - - $params = $this->resolveParams($name); - - if (method_exists($this, $method)) { - return $this->$method(...$params); - } - - $class = $this->resolveClass($type); - - return $this->app->invokeClass($class, $params); - } - - /** - * 移除一个驱动实例 - * - * @param array|string|null $name - * @return $this - */ - public function forgetDriver($name = null) - { - $name = $name ?? $this->getDefaultDriver(); - - foreach ((array) $name as $cacheName) { - if (isset($this->drivers[$cacheName])) { - unset($this->drivers[$cacheName]); - } - } - - return $this; - } - - /** - * 默认驱动 - * @return string|null - */ - abstract public function getDefaultDriver(); - - /** - * 动态调用 - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->driver()->$method(...$parameters); - } -} diff --git a/vendor/topthink/framework/src/think/Middleware.php b/vendor/topthink/framework/src/think/Middleware.php deleted file mode 100644 index a3db0f2f..00000000 --- a/vendor/topthink/framework/src/think/Middleware.php +++ /dev/null @@ -1,257 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use Closure; -use InvalidArgumentException; -use LogicException; -use think\exception\Handle; -use Throwable; - -/** - * 中间件管理类 - * @package think - */ -class Middleware -{ - /** - * 中间件执行队列 - * @var array - */ - protected $queue = []; - - /** - * 应用对象 - * @var App - */ - protected $app; - - public function __construct(App $app) - { - $this->app = $app; - } - - /** - * 导入中间件 - * @access public - * @param array $middlewares - * @param string $type 中间件类型 - * @return void - */ - public function import(array $middlewares = [], string $type = 'global'): void - { - foreach ($middlewares as $middleware) { - $this->add($middleware, $type); - } - } - - /** - * 注册中间件 - * @access public - * @param mixed $middleware - * @param string $type 中间件类型 - * @return void - */ - public function add($middleware, string $type = 'global'): void - { - $middleware = $this->buildMiddleware($middleware, $type); - - if (!empty($middleware)) { - $this->queue[$type][] = $middleware; - $this->queue[$type] = array_unique($this->queue[$type], SORT_REGULAR); - } - } - - /** - * 注册路由中间件 - * @access public - * @param mixed $middleware - * @return void - */ - public function route($middleware): void - { - $this->add($middleware, 'route'); - } - - /** - * 注册控制器中间件 - * @access public - * @param mixed $middleware - * @return void - */ - public function controller($middleware): void - { - $this->add($middleware, 'controller'); - } - - /** - * 注册中间件到开始位置 - * @access public - * @param mixed $middleware - * @param string $type 中间件类型 - */ - public function unshift($middleware, string $type = 'global') - { - $middleware = $this->buildMiddleware($middleware, $type); - - if (!empty($middleware)) { - if (!isset($this->queue[$type])) { - $this->queue[$type] = []; - } - - array_unshift($this->queue[$type], $middleware); - } - } - - /** - * 获取注册的中间件 - * @access public - * @param string $type 中间件类型 - * @return array - */ - public function all(string $type = 'global'): array - { - return $this->queue[$type] ?? []; - } - - /** - * 调度管道 - * @access public - * @param string $type 中间件类型 - * @return Pipeline - */ - public function pipeline(string $type = 'global') - { - return (new Pipeline()) - ->through(array_map(function ($middleware) { - return function ($request, $next) use ($middleware) { - [$call, $params] = $middleware; - if (is_array($call) && is_string($call[0])) { - $call = [$this->app->make($call[0]), $call[1]]; - } - $response = call_user_func($call, $request, $next, ...$params); - - if (!$response instanceof Response) { - throw new LogicException('The middleware must return Response instance'); - } - return $response; - }; - }, $this->sortMiddleware($this->queue[$type] ?? []))) - ->whenException([$this, 'handleException']); - } - - /** - * 结束调度 - * @param Response $response - */ - public function end(Response $response) - { - foreach ($this->queue as $queue) { - foreach ($queue as $middleware) { - [$call] = $middleware; - if (is_array($call) && is_string($call[0])) { - $instance = $this->app->make($call[0]); - if (method_exists($instance, 'end')) { - $instance->end($response); - } - } - } - } - } - - /** - * 异常处理 - * @param Request $passable - * @param Throwable $e - * @return Response - */ - public function handleException($passable, Throwable $e) - { - /** @var Handle $handler */ - $handler = $this->app->make(Handle::class); - - $handler->report($e); - - return $handler->render($passable, $e); - } - - /** - * 解析中间件 - * @access protected - * @param mixed $middleware - * @param string $type 中间件类型 - * @return array - */ - protected function buildMiddleware($middleware, string $type): array - { - if (is_array($middleware)) { - [$middleware, $params] = $middleware; - } - - if ($middleware instanceof Closure) { - return [$middleware, $params ?? []]; - } - - if (!is_string($middleware)) { - throw new InvalidArgumentException('The middleware is invalid'); - } - - //中间件别名检查 - $alias = $this->app->config->get('middleware.alias', []); - - if (isset($alias[$middleware])) { - $middleware = $alias[$middleware]; - } - - if (is_array($middleware)) { - $this->import($middleware, $type); - return []; - } - - return [[$middleware, 'handle'], $params ?? []]; - } - - /** - * 中间件排序 - * @param array $middlewares - * @return array - */ - protected function sortMiddleware(array $middlewares) - { - $priority = $this->app->config->get('middleware.priority', []); - uasort($middlewares, function ($a, $b) use ($priority) { - $aPriority = $this->getMiddlewarePriority($priority, $a); - $bPriority = $this->getMiddlewarePriority($priority, $b); - return $bPriority - $aPriority; - }); - - return $middlewares; - } - - /** - * 获取中间件优先级 - * @param $priority - * @param $middleware - * @return int - */ - protected function getMiddlewarePriority($priority, $middleware) - { - [$call] = $middleware; - if (is_array($call) && is_string($call[0])) { - $index = array_search($call[0], array_reverse($priority)); - return false === $index ? -1 : $index; - } - return -1; - } - -} diff --git a/vendor/topthink/framework/src/think/Pipeline.php b/vendor/topthink/framework/src/think/Pipeline.php deleted file mode 100644 index 77151f3a..00000000 --- a/vendor/topthink/framework/src/think/Pipeline.php +++ /dev/null @@ -1,107 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think; - -use Closure; -use Exception; -use Throwable; - -class Pipeline -{ - protected $passable; - - protected $pipes = []; - - protected $exceptionHandler; - - /** - * 初始数据 - * @param $passable - * @return $this - */ - public function send($passable) - { - $this->passable = $passable; - return $this; - } - - /** - * 调用栈 - * @param $pipes - * @return $this - */ - public function through($pipes) - { - $this->pipes = is_array($pipes) ? $pipes : func_get_args(); - return $this; - } - - /** - * 执行 - * @param Closure $destination - * @return mixed - */ - public function then(Closure $destination) - { - $pipeline = array_reduce( - array_reverse($this->pipes), - $this->carry(), - function ($passable) use ($destination) { - try { - return $destination($passable); - } catch (Throwable | Exception $e) { - return $this->handleException($passable, $e); - } - } - ); - - return $pipeline($this->passable); - } - - /** - * 设置异常处理器 - * @param callable $handler - * @return $this - */ - public function whenException($handler) - { - $this->exceptionHandler = $handler; - return $this; - } - - protected function carry() - { - return function ($stack, $pipe) { - return function ($passable) use ($stack, $pipe) { - try { - return $pipe($passable, $stack); - } catch (Throwable | Exception $e) { - return $this->handleException($passable, $e); - } - }; - }; - } - - /** - * 异常处理 - * @param $passable - * @param $e - * @return mixed - */ - protected function handleException($passable, Throwable $e) - { - if ($this->exceptionHandler) { - return call_user_func($this->exceptionHandler, $passable, $e); - } - throw $e; - } - -} diff --git a/vendor/topthink/framework/src/think/Request.php b/vendor/topthink/framework/src/think/Request.php deleted file mode 100644 index a21976df..00000000 --- a/vendor/topthink/framework/src/think/Request.php +++ /dev/null @@ -1,2167 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use ArrayAccess; -use think\file\UploadedFile; -use think\route\Rule; - -/** - * 请求管理类 - * @package think - */ -class Request implements ArrayAccess -{ - /** - * 兼容PATH_INFO获取 - * @var array - */ - protected $pathinfoFetch = ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL']; - - /** - * PATHINFO变量名 用于兼容模式 - * @var string - */ - protected $varPathinfo = 's'; - - /** - * 请求类型 - * @var string - */ - protected $varMethod = '_method'; - - /** - * 表单ajax伪装变量 - * @var string - */ - protected $varAjax = '_ajax'; - - /** - * 表单pjax伪装变量 - * @var string - */ - protected $varPjax = '_pjax'; - - /** - * 域名根 - * @var string - */ - protected $rootDomain = ''; - - /** - * HTTPS代理标识 - * @var string - */ - protected $httpsAgentName = ''; - - /** - * 前端代理服务器IP - * @var array - */ - protected $proxyServerIp = []; - - /** - * 前端代理服务器真实IP头 - * @var array - */ - protected $proxyServerIpHeader = ['HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP']; - - /** - * 请求类型 - * @var string - */ - protected $method; - - /** - * 域名(含协议及端口) - * @var string - */ - protected $domain; - - /** - * HOST(含端口) - * @var string - */ - protected $host; - - /** - * 子域名 - * @var string - */ - protected $subDomain; - - /** - * 泛域名 - * @var string - */ - protected $panDomain; - - /** - * 当前URL地址 - * @var string - */ - protected $url; - - /** - * 基础URL - * @var string - */ - protected $baseUrl; - - /** - * 当前执行的文件 - * @var string - */ - protected $baseFile; - - /** - * 访问的ROOT地址 - * @var string - */ - protected $root; - - /** - * pathinfo - * @var string - */ - protected $pathinfo; - - /** - * pathinfo(不含后缀) - * @var string - */ - protected $path; - - /** - * 当前请求的IP地址 - * @var string - */ - protected $realIP; - - /** - * 当前控制器名 - * @var string - */ - protected $controller; - - /** - * 当前操作名 - * @var string - */ - protected $action; - - /** - * 当前请求参数 - * @var array - */ - protected $param = []; - - /** - * 当前GET参数 - * @var array - */ - protected $get = []; - - /** - * 当前POST参数 - * @var array - */ - protected $post = []; - - /** - * 当前REQUEST参数 - * @var array - */ - protected $request = []; - - /** - * 当前路由对象 - * @var Rule - */ - protected $rule; - - /** - * 当前ROUTE参数 - * @var array - */ - protected $route = []; - - /** - * 中间件传递的参数 - * @var array - */ - protected $middleware = []; - - /** - * 当前PUT参数 - * @var array - */ - protected $put; - - /** - * SESSION对象 - * @var Session - */ - protected $session; - - /** - * COOKIE数据 - * @var array - */ - protected $cookie = []; - - /** - * ENV对象 - * @var Env - */ - protected $env; - - /** - * 当前SERVER参数 - * @var array - */ - protected $server = []; - - /** - * 当前FILE参数 - * @var array - */ - protected $file = []; - - /** - * 当前HEADER参数 - * @var array - */ - protected $header = []; - - /** - * 资源类型定义 - * @var array - */ - protected $mimeType = [ - 'xml' => 'application/xml,text/xml,application/x-xml', - 'json' => 'application/json,text/x-json,application/jsonrequest,text/json', - 'js' => 'text/javascript,application/javascript,application/x-javascript', - 'css' => 'text/css', - 'rss' => 'application/rss+xml', - 'yaml' => 'application/x-yaml,text/yaml', - 'atom' => 'application/atom+xml', - 'pdf' => 'application/pdf', - 'text' => 'text/plain', - 'image' => 'image/png,image/jpg,image/jpeg,image/pjpeg,image/gif,image/webp,image/*', - 'csv' => 'text/csv', - 'html' => 'text/html,application/xhtml+xml,*/*', - ]; - - /** - * 当前请求内容 - * @var string - */ - protected $content; - - /** - * 全局过滤规则 - * @var array - */ - protected $filter; - - /** - * php://input内容 - * @var string - */ - // php://input - protected $input; - - /** - * 请求安全Key - * @var string - */ - protected $secureKey; - - /** - * 是否合并Param - * @var bool - */ - protected $mergeParam = false; - - /** - * 架构函数 - * @access public - */ - public function __construct() - { - // 保存 php://input - $this->input = file_get_contents('php://input'); - } - - public static function __make(App $app) - { - $request = new static(); - - if (function_exists('apache_request_headers') && $result = apache_request_headers()) { - $header = $result; - } else { - $header = []; - $server = $_SERVER; - foreach ($server as $key => $val) { - if (0 === strpos($key, 'HTTP_')) { - $key = str_replace('_', '-', strtolower(substr($key, 5))); - $header[$key] = $val; - } - } - if (isset($server['CONTENT_TYPE'])) { - $header['content-type'] = $server['CONTENT_TYPE']; - } - if (isset($server['CONTENT_LENGTH'])) { - $header['content-length'] = $server['CONTENT_LENGTH']; - } - } - - $request->header = array_change_key_case($header); - $request->server = $_SERVER; - $request->env = $app->env; - - $inputData = $request->getInputData($request->input); - - $request->get = $_GET; - $request->post = $_POST ?: $inputData; - $request->put = $inputData; - $request->request = $_REQUEST; - $request->cookie = $_COOKIE; - $request->file = $_FILES ?? []; - - return $request; - } - - /** - * 设置当前包含协议的域名 - * @access public - * @param string $domain 域名 - * @return $this - */ - public function setDomain(string $domain) - { - $this->domain = $domain; - return $this; - } - - /** - * 获取当前包含协议的域名 - * @access public - * @param bool $port 是否需要去除端口号 - * @return string - */ - public function domain(bool $port = false): string - { - return $this->scheme() . '://' . $this->host($port); - } - - /** - * 获取当前根域名 - * @access public - * @return string - */ - public function rootDomain(): string - { - $root = $this->rootDomain; - - if (!$root) { - $item = explode('.', $this->host()); - $count = count($item); - $root = $count > 1 ? $item[$count - 2] . '.' . $item[$count - 1] : $item[0]; - } - - return $root; - } - - /** - * 设置当前泛域名的值 - * @access public - * @param string $domain 域名 - * @return $this - */ - public function setSubDomain(string $domain) - { - $this->subDomain = $domain; - return $this; - } - - /** - * 获取当前子域名 - * @access public - * @return string - */ - public function subDomain(): string - { - if (is_null($this->subDomain)) { - // 获取当前主域名 - $rootDomain = $this->rootDomain(); - - if ($rootDomain) { - $this->subDomain = rtrim(stristr($this->host(), $rootDomain, true), '.'); - } else { - $this->subDomain = ''; - } - } - - return $this->subDomain; - } - - /** - * 设置当前泛域名的值 - * @access public - * @param string $domain 域名 - * @return $this - */ - public function setPanDomain(string $domain) - { - $this->panDomain = $domain; - return $this; - } - - /** - * 获取当前泛域名的值 - * @access public - * @return string - */ - public function panDomain(): string - { - return $this->panDomain ?: ''; - } - - /** - * 设置当前完整URL 包括QUERY_STRING - * @access public - * @param string $url URL地址 - * @return $this - */ - public function setUrl(string $url) - { - $this->url = $url; - return $this; - } - - /** - * 获取当前完整URL 包括QUERY_STRING - * @access public - * @param bool $complete 是否包含完整域名 - * @return string - */ - public function url(bool $complete = false): string - { - if ($this->url) { - $url = $this->url; - } elseif ($this->server('HTTP_X_REWRITE_URL')) { - $url = $this->server('HTTP_X_REWRITE_URL'); - } elseif ($this->server('REQUEST_URI')) { - $url = $this->server('REQUEST_URI'); - } elseif ($this->server('ORIG_PATH_INFO')) { - $url = $this->server('ORIG_PATH_INFO') . (!empty($this->server('QUERY_STRING')) ? '?' . $this->server('QUERY_STRING') : ''); - } elseif (isset($_SERVER['argv'][1])) { - $url = $_SERVER['argv'][1]; - } else { - $url = ''; - } - - return $complete ? $this->domain() . $url : $url; - } - - /** - * 设置当前URL 不含QUERY_STRING - * @access public - * @param string $url URL地址 - * @return $this - */ - public function setBaseUrl(string $url) - { - $this->baseUrl = $url; - return $this; - } - - /** - * 获取当前URL 不含QUERY_STRING - * @access public - * @param bool $complete 是否包含完整域名 - * @return string - */ - public function baseUrl(bool $complete = false): string - { - if (!$this->baseUrl) { - $str = $this->url(); - $this->baseUrl = strpos($str, '?') ? strstr($str, '?', true) : $str; - } - - return $complete ? $this->domain() . $this->baseUrl : $this->baseUrl; - } - - /** - * 获取当前执行的文件 SCRIPT_NAME - * @access public - * @param bool $complete 是否包含完整域名 - * @return string - */ - public function baseFile(bool $complete = false): string - { - if (!$this->baseFile) { - $url = ''; - if (!$this->isCli()) { - $script_name = basename($this->server('SCRIPT_FILENAME')); - if (basename($this->server('SCRIPT_NAME')) === $script_name) { - $url = $this->server('SCRIPT_NAME'); - } elseif (basename($this->server('PHP_SELF')) === $script_name) { - $url = $this->server('PHP_SELF'); - } elseif (basename($this->server('ORIG_SCRIPT_NAME')) === $script_name) { - $url = $this->server('ORIG_SCRIPT_NAME'); - } elseif (($pos = strpos($this->server('PHP_SELF'), '/' . $script_name)) !== false) { - $url = substr($this->server('SCRIPT_NAME'), 0, $pos) . '/' . $script_name; - } elseif ($this->server('DOCUMENT_ROOT') && strpos($this->server('SCRIPT_FILENAME'), $this->server('DOCUMENT_ROOT')) === 0) { - $url = str_replace('\\', '/', str_replace($this->server('DOCUMENT_ROOT'), '', $this->server('SCRIPT_FILENAME'))); - } - } - $this->baseFile = $url; - } - - return $complete ? $this->domain() . $this->baseFile : $this->baseFile; - } - - /** - * 设置URL访问根地址 - * @access public - * @param string $url URL地址 - * @return $this - */ - public function setRoot(string $url) - { - $this->root = $url; - return $this; - } - - /** - * 获取URL访问根地址 - * @access public - * @param bool $complete 是否包含完整域名 - * @return string - */ - public function root(bool $complete = false): string - { - if (!$this->root) { - $file = $this->baseFile(); - if ($file && 0 !== strpos($this->url(), $file)) { - $file = str_replace('\\', '/', dirname($file)); - } - $this->root = rtrim($file, '/'); - } - - return $complete ? $this->domain() . $this->root : $this->root; - } - - /** - * 获取URL访问根目录 - * @access public - * @return string - */ - public function rootUrl(): string - { - $base = $this->root(); - $root = strpos($base, '.') ? ltrim(dirname($base), DIRECTORY_SEPARATOR) : $base; - - if ('' != $root) { - $root = '/' . ltrim($root, '/'); - } - - return $root; - } - - /** - * 设置当前请求的pathinfo - * @access public - * @param string $pathinfo - * @return $this - */ - public function setPathinfo(string $pathinfo) - { - $this->pathinfo = $pathinfo; - return $this; - } - - /** - * 获取当前请求URL的pathinfo信息(含URL后缀) - * @access public - * @return string - */ - public function pathinfo(): string - { - if (is_null($this->pathinfo)) { - if (isset($_GET[$this->varPathinfo])) { - // 判断URL里面是否有兼容模式参数 - $pathinfo = $_GET[$this->varPathinfo]; - unset($_GET[$this->varPathinfo]); - unset($this->get[$this->varPathinfo]); - } elseif ($this->server('PATH_INFO')) { - $pathinfo = $this->server('PATH_INFO'); - } elseif (false !== strpos(PHP_SAPI, 'cli')) { - $pathinfo = strpos($this->server('REQUEST_URI'), '?') ? strstr($this->server('REQUEST_URI'), '?', true) : $this->server('REQUEST_URI'); - } - - // 分析PATHINFO信息 - if (!isset($pathinfo)) { - foreach ($this->pathinfoFetch as $type) { - if ($this->server($type)) { - $pathinfo = (0 === strpos($this->server($type), $this->server('SCRIPT_NAME'))) ? - substr($this->server($type), strlen($this->server('SCRIPT_NAME'))) : $this->server($type); - break; - } - } - } - - if (!empty($pathinfo)) { - unset($this->get[$pathinfo], $this->request[$pathinfo]); - } - - $this->pathinfo = empty($pathinfo) || '/' == $pathinfo ? '' : ltrim($pathinfo, '/'); - } - - return $this->pathinfo; - } - - /** - * 当前URL的访问后缀 - * @access public - * @return string - */ - public function ext(): string - { - return pathinfo($this->pathinfo(), PATHINFO_EXTENSION); - } - - /** - * 获取当前请求的时间 - * @access public - * @param bool $float 是否使用浮点类型 - * @return integer|float - */ - public function time(bool $float = false) - { - return $float ? $this->server('REQUEST_TIME_FLOAT') : $this->server('REQUEST_TIME'); - } - - /** - * 当前请求的资源类型 - * @access public - * @return string - */ - public function type(): string - { - $accept = $this->server('HTTP_ACCEPT'); - - if (empty($accept)) { - return ''; - } - - foreach ($this->mimeType as $key => $val) { - $array = explode(',', $val); - foreach ($array as $k => $v) { - if (stristr($accept, $v)) { - return $key; - } - } - } - - return ''; - } - - /** - * 设置资源类型 - * @access public - * @param string|array $type 资源类型名 - * @param string $val 资源类型 - * @return void - */ - public function mimeType($type, $val = ''): void - { - if (is_array($type)) { - $this->mimeType = array_merge($this->mimeType, $type); - } else { - $this->mimeType[$type] = $val; - } - } - - /** - * 设置请求类型 - * @access public - * @param string $method 请求类型 - * @return $this - */ - public function setMethod(string $method) - { - $this->method = strtoupper($method); - return $this; - } - - /** - * 当前的请求类型 - * @access public - * @param bool $origin 是否获取原始请求类型 - * @return string - */ - public function method(bool $origin = false): string - { - if ($origin) { - // 获取原始请求类型 - return $this->server('REQUEST_METHOD') ?: 'GET'; - } elseif (!$this->method) { - if (isset($this->post[$this->varMethod])) { - $method = strtolower($this->post[$this->varMethod]); - if (in_array($method, ['get', 'post', 'put', 'patch', 'delete'])) { - $this->method = strtoupper($method); - $this->{$method} = $this->post; - } else { - $this->method = 'POST'; - } - unset($this->post[$this->varMethod]); - } elseif ($this->server('HTTP_X_HTTP_METHOD_OVERRIDE')) { - $this->method = strtoupper($this->server('HTTP_X_HTTP_METHOD_OVERRIDE')); - } else { - $this->method = $this->server('REQUEST_METHOD') ?: 'GET'; - } - } - - return $this->method; - } - - /** - * 是否为GET请求 - * @access public - * @return bool - */ - public function isGet(): bool - { - return $this->method() == 'GET'; - } - - /** - * 是否为POST请求 - * @access public - * @return bool - */ - public function isPost(): bool - { - return $this->method() == 'POST'; - } - - /** - * 是否为PUT请求 - * @access public - * @return bool - */ - public function isPut(): bool - { - return $this->method() == 'PUT'; - } - - /** - * 是否为DELTE请求 - * @access public - * @return bool - */ - public function isDelete(): bool - { - return $this->method() == 'DELETE'; - } - - /** - * 是否为HEAD请求 - * @access public - * @return bool - */ - public function isHead(): bool - { - return $this->method() == 'HEAD'; - } - - /** - * 是否为PATCH请求 - * @access public - * @return bool - */ - public function isPatch(): bool - { - return $this->method() == 'PATCH'; - } - - /** - * 是否为OPTIONS请求 - * @access public - * @return bool - */ - public function isOptions(): bool - { - return $this->method() == 'OPTIONS'; - } - - /** - * 是否为cli - * @access public - * @return bool - */ - public function isCli(): bool - { - return PHP_SAPI == 'cli'; - } - - /** - * 是否为cgi - * @access public - * @return bool - */ - public function isCgi(): bool - { - return strpos(PHP_SAPI, 'cgi') === 0; - } - - /** - * 获取当前请求的参数 - * @access public - * @param string|array $name 变量名 - * @param mixed $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function param($name = '', $default = null, $filter = '') - { - if (empty($this->mergeParam)) { - $method = $this->method(true); - - // 自动获取请求变量 - switch ($method) { - case 'POST': - $vars = $this->post(false); - break; - case 'PUT': - case 'DELETE': - case 'PATCH': - $vars = $this->put(false); - break; - default: - $vars = []; - } - - // 当前请求参数和URL地址中的参数合并 - $this->param = array_merge($this->param, $this->get(false), $vars, $this->route(false)); - - $this->mergeParam = true; - } - - if (is_array($name)) { - return $this->only($name, $this->param, $filter); - } - - return $this->input($this->param, $name, $default, $filter); - } - - /** - * 获取包含文件在内的请求参数 - * @access public - * @param string|array $name 变量名 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function all($name = '', $filter = '') - { - $data = array_merge($this->param(), $this->file()); - - if (is_array($name)) { - $data = $this->only($name, $data, $filter); - } - - return $data; - } - - /** - * 设置路由变量 - * @access public - * @param Rule $rule 路由对象 - * @return $this - */ - public function setRule(Rule $rule) - { - $this->rule = $rule; - return $this; - } - - /** - * 获取当前路由对象 - * @access public - * @return Rule|null - */ - public function rule() - { - return $this->rule; - } - - /** - * 设置路由变量 - * @access public - * @param array $route 路由变量 - * @return $this - */ - public function setRoute(array $route) - { - $this->route = array_merge($this->route, $route); - $this->mergeParam = false; - return $this; - } - - /** - * 获取路由参数 - * @access public - * @param string|array $name 变量名 - * @param mixed $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function route($name = '', $default = null, $filter = '') - { - if (is_array($name)) { - return $this->only($name, $this->route, $filter); - } - - return $this->input($this->route, $name, $default, $filter); - } - - /** - * 获取GET参数 - * @access public - * @param string|array $name 变量名 - * @param mixed $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function get($name = '', $default = null, $filter = '') - { - if (is_array($name)) { - return $this->only($name, $this->get, $filter); - } - - return $this->input($this->get, $name, $default, $filter); - } - - /** - * 获取中间件传递的参数 - * @access public - * @param mixed $name 变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function middleware($name, $default = null) - { - return $this->middleware[$name] ?? $default; - } - - /** - * 获取POST参数 - * @access public - * @param string|array $name 变量名 - * @param mixed $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function post($name = '', $default = null, $filter = '') - { - if (is_array($name)) { - return $this->only($name, $this->post, $filter); - } - - return $this->input($this->post, $name, $default, $filter); - } - - /** - * 获取PUT参数 - * @access public - * @param string|array $name 变量名 - * @param mixed $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function put($name = '', $default = null, $filter = '') - { - if (is_array($name)) { - return $this->only($name, $this->put, $filter); - } - - return $this->input($this->put, $name, $default, $filter); - } - - protected function getInputData($content): array - { - $contentType = $this->contentType(); - if ('application/x-www-form-urlencoded' == $contentType) { - parse_str($content, $data); - return $data; - } elseif (false !== strpos($contentType, 'json')) { - return (array) json_decode($content, true); - } - - return []; - } - - /** - * 设置获取DELETE参数 - * @access public - * @param mixed $name 变量名 - * @param mixed $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function delete($name = '', $default = null, $filter = '') - { - return $this->put($name, $default, $filter); - } - - /** - * 设置获取PATCH参数 - * @access public - * @param mixed $name 变量名 - * @param mixed $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function patch($name = '', $default = null, $filter = '') - { - return $this->put($name, $default, $filter); - } - - /** - * 获取request变量 - * @access public - * @param string|array $name 数据名称 - * @param mixed $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function request($name = '', $default = null, $filter = '') - { - if (is_array($name)) { - return $this->only($name, $this->request, $filter); - } - - return $this->input($this->request, $name, $default, $filter); - } - - /** - * 获取环境变量 - * @access public - * @param string $name 数据名称 - * @param string $default 默认值 - * @return mixed - */ - public function env(string $name = '', string $default = null) - { - if (empty($name)) { - return $this->env->get(); - } else { - $name = strtoupper($name); - } - - return $this->env->get($name, $default); - } - - /** - * 获取session数据 - * @access public - * @param string $name 数据名称 - * @param string $default 默认值 - * @return mixed - */ - public function session(string $name = '', $default = null) - { - if ('' === $name) { - return $this->session->all(); - } - return $this->session->get($name, $default); - } - - /** - * 获取cookie参数 - * @access public - * @param mixed $name 数据名称 - * @param string $default 默认值 - * @param string|array $filter 过滤方法 - * @return mixed - */ - public function cookie(string $name = '', $default = null, $filter = '') - { - if (!empty($name)) { - $data = $this->getData($this->cookie, $name, $default); - } else { - $data = $this->cookie; - } - - // 解析过滤器 - $filter = $this->getFilter($filter, $default); - - if (is_array($data)) { - array_walk_recursive($data, [$this, 'filterValue'], $filter); - } else { - $this->filterValue($data, $name, $filter); - } - - return $data; - } - - /** - * 获取server参数 - * @access public - * @param string $name 数据名称 - * @param string $default 默认值 - * @return mixed - */ - public function server(string $name = '', string $default = '') - { - if (empty($name)) { - return $this->server; - } else { - $name = strtoupper($name); - } - - return $this->server[$name] ?? $default; - } - - /** - * 获取上传的文件信息 - * @access public - * @param string $name 名称 - * @return null|array|UploadedFile - */ - public function file(string $name = '') - { - $files = $this->file; - if (!empty($files)) { - - if (strpos($name, '.')) { - [$name, $sub] = explode('.', $name); - } - - // 处理上传文件 - $array = $this->dealUploadFile($files, $name); - - if ('' === $name) { - // 获取全部文件 - return $array; - } elseif (isset($sub) && isset($array[$name][$sub])) { - return $array[$name][$sub]; - } elseif (isset($array[$name])) { - return $array[$name]; - } - } - } - - protected function dealUploadFile(array $files, string $name): array - { - $array = []; - foreach ($files as $key => $file) { - if (is_array($file['name'])) { - $item = []; - $keys = array_keys($file); - $count = count($file['name']); - - for ($i = 0; $i < $count; $i++) { - if ($file['error'][$i] > 0) { - if ($name == $key) { - $this->throwUploadFileError($file['error'][$i]); - } else { - continue; - } - } - - $temp['key'] = $key; - - foreach ($keys as $_key) { - $temp[$_key] = $file[$_key][$i]; - } - - $item[] = new UploadedFile($temp['tmp_name'], $temp['name'], $temp['type'], $temp['error']); - } - - $array[$key] = $item; - } else { - if ($file instanceof File) { - $array[$key] = $file; - } else { - if ($file['error'] > 0) { - if ($key == $name) { - $this->throwUploadFileError($file['error']); - } else { - continue; - } - } - - $array[$key] = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error']); - } - } - } - - return $array; - } - - protected function throwUploadFileError($error) - { - static $fileUploadErrors = [ - 1 => 'upload File size exceeds the maximum value', - 2 => 'upload File size exceeds the maximum value', - 3 => 'only the portion of file is uploaded', - 4 => 'no file to uploaded', - 6 => 'upload temp dir not found', - 7 => 'file write error', - ]; - - $msg = $fileUploadErrors[$error]; - throw new Exception($msg, $error); - } - - /** - * 设置或者获取当前的Header - * @access public - * @param string $name header名称 - * @param string $default 默认值 - * @return string|array - */ - public function header(string $name = '', string $default = null) - { - if ('' === $name) { - return $this->header; - } - - $name = str_replace('_', '-', strtolower($name)); - - return $this->header[$name] ?? $default; - } - - /** - * 获取变量 支持过滤和默认值 - * @access public - * @param array $data 数据源 - * @param string|false $name 字段名 - * @param mixed $default 默认值 - * @param string|array $filter 过滤函数 - * @return mixed - */ - public function input(array $data = [], $name = '', $default = null, $filter = '') - { - if (false === $name) { - // 获取原始数据 - return $data; - } - - $name = (string) $name; - if ('' != $name) { - // 解析name - if (strpos($name, '/')) { - [$name, $type] = explode('/', $name); - } - - $data = $this->getData($data, $name); - - if (is_null($data)) { - return $default; - } - - if (is_object($data)) { - return $data; - } - } - - $data = $this->filterData($data, $filter, $name, $default); - - if (isset($type) && $data !== $default) { - // 强制类型转换 - $this->typeCast($data, $type); - } - - return $data; - } - - protected function filterData($data, $filter, $name, $default) - { - // 解析过滤器 - $filter = $this->getFilter($filter, $default); - - if (is_array($data)) { - array_walk_recursive($data, [$this, 'filterValue'], $filter); - } else { - $this->filterValue($data, $name, $filter); - } - - return $data; - } - - /** - * 强制类型转换 - * @access public - * @param mixed $data - * @param string $type - * @return mixed - */ - private function typeCast(&$data, string $type) - { - switch (strtolower($type)) { - // 数组 - case 'a': - $data = (array) $data; - break; - // 数字 - case 'd': - $data = (int) $data; - break; - // 浮点 - case 'f': - $data = (float) $data; - break; - // 布尔 - case 'b': - $data = (boolean) $data; - break; - // 字符串 - case 's': - if (is_scalar($data)) { - $data = (string) $data; - } else { - throw new \InvalidArgumentException('variable type error:' . gettype($data)); - } - break; - } - } - - /** - * 获取数据 - * @access public - * @param array $data 数据源 - * @param string $name 字段名 - * @param mixed $default 默认值 - * @return mixed - */ - protected function getData(array $data, string $name, $default = null) - { - foreach (explode('.', $name) as $val) { - if (isset($data[$val])) { - $data = $data[$val]; - } else { - return $default; - } - } - - return $data; - } - - /** - * 设置或获取当前的过滤规则 - * @access public - * @param mixed $filter 过滤规则 - * @return mixed - */ - public function filter($filter = null) - { - if (is_null($filter)) { - return $this->filter; - } - - $this->filter = $filter; - - return $this; - } - - protected function getFilter($filter, $default): array - { - if (is_null($filter)) { - $filter = []; - } else { - $filter = $filter ?: $this->filter; - if (is_string($filter) && false === strpos($filter, '/')) { - $filter = explode(',', $filter); - } else { - $filter = (array) $filter; - } - } - - $filter[] = $default; - - return $filter; - } - - /** - * 递归过滤给定的值 - * @access public - * @param mixed $value 键值 - * @param mixed $key 键名 - * @param array $filters 过滤方法+默认值 - * @return mixed - */ - public function filterValue(&$value, $key, $filters) - { - $default = array_pop($filters); - - foreach ($filters as $filter) { - if (is_callable($filter)) { - // 调用函数或者方法过滤 - $value = call_user_func($filter, $value); - } elseif (is_scalar($value)) { - if (is_string($filter) && false !== strpos($filter, '/')) { - // 正则过滤 - if (!preg_match($filter, $value)) { - // 匹配不成功返回默认值 - $value = $default; - break; - } - } elseif (!empty($filter)) { - // filter函数不存在时, 则使用filter_var进行过滤 - // filter为非整形值时, 调用filter_id取得过滤id - $value = filter_var($value, is_int($filter) ? $filter : filter_id($filter)); - if (false === $value) { - $value = $default; - break; - } - } - } - } - - return $value; - } - - /** - * 是否存在某个请求参数 - * @access public - * @param string $name 变量名 - * @param string $type 变量类型 - * @param bool $checkEmpty 是否检测空值 - * @return bool - */ - public function has(string $name, string $type = 'param', bool $checkEmpty = false): bool - { - if (!in_array($type, ['param', 'get', 'post', 'put', 'patch', 'route', 'delete', 'cookie', 'session', 'env', 'request', 'server', 'header', 'file'])) { - return false; - } - - $param = empty($this->$type) ? $this->$type() : $this->$type; - - if (is_object($param)) { - return $param->has($name); - } - - // 按.拆分成多维数组进行判断 - foreach (explode('.', $name) as $val) { - if (isset($param[$val])) { - $param = $param[$val]; - } else { - return false; - } - } - - return ($checkEmpty && '' === $param) ? false : true; - } - - /** - * 获取指定的参数 - * @access public - * @param array $name 变量名 - * @param mixed $data 数据或者变量类型 - * @param string|array $filter 过滤方法 - * @return array - */ - public function only(array $name, $data = 'param', $filter = ''): array - { - $data = is_array($data) ? $data : $this->$data(); - - $item = []; - foreach ($name as $key => $val) { - - if (is_int($key)) { - $default = null; - $key = $val; - if (!isset($data[$key])) { - continue; - } - } else { - $default = $val; - } - - $item[$key] = $this->filterData($data[$key] ?? $default, $filter, $key, $default); - } - - return $item; - } - - /** - * 排除指定参数获取 - * @access public - * @param array $name 变量名 - * @param string $type 变量类型 - * @return mixed - */ - public function except(array $name, string $type = 'param'): array - { - $param = $this->$type(); - - foreach ($name as $key) { - if (isset($param[$key])) { - unset($param[$key]); - } - } - - return $param; - } - - /** - * 当前是否ssl - * @access public - * @return bool - */ - public function isSsl(): bool - { - if ($this->server('HTTPS') && ('1' == $this->server('HTTPS') || 'on' == strtolower($this->server('HTTPS')))) { - return true; - } elseif ('https' == $this->server('REQUEST_SCHEME')) { - return true; - } elseif ('443' == $this->server('SERVER_PORT')) { - return true; - } elseif ('https' == $this->server('HTTP_X_FORWARDED_PROTO')) { - return true; - } elseif ($this->httpsAgentName && $this->server($this->httpsAgentName)) { - return true; - } - - return false; - } - - /** - * 当前是否JSON请求 - * @access public - * @return bool - */ - public function isJson(): bool - { - $acceptType = $this->type(); - - return false !== strpos($acceptType, 'json'); - } - - /** - * 当前是否Ajax请求 - * @access public - * @param bool $ajax true 获取原始ajax请求 - * @return bool - */ - public function isAjax(bool $ajax = false): bool - { - $value = $this->server('HTTP_X_REQUESTED_WITH'); - $result = $value && 'xmlhttprequest' == strtolower($value) ? true : false; - - if (true === $ajax) { - return $result; - } - - return $this->param($this->varAjax) ? true : $result; - } - - /** - * 当前是否Pjax请求 - * @access public - * @param bool $pjax true 获取原始pjax请求 - * @return bool - */ - public function isPjax(bool $pjax = false): bool - { - $result = !empty($this->server('HTTP_X_PJAX')) ? true : false; - - if (true === $pjax) { - return $result; - } - - return $this->param($this->varPjax) ? true : $result; - } - - /** - * 获取客户端IP地址 - * @access public - * @return string - */ - public function ip(): string - { - if (!empty($this->realIP)) { - return $this->realIP; - } - - $this->realIP = $this->server('REMOTE_ADDR', ''); - - // 如果指定了前端代理服务器IP以及其会发送的IP头 - // 则尝试获取前端代理服务器发送过来的真实IP - $proxyIp = $this->proxyServerIp; - $proxyIpHeader = $this->proxyServerIpHeader; - - if (count($proxyIp) > 0 && count($proxyIpHeader) > 0) { - // 从指定的HTTP头中依次尝试获取IP地址 - // 直到获取到一个合法的IP地址 - foreach ($proxyIpHeader as $header) { - $tempIP = $this->server($header); - - if (empty($tempIP)) { - continue; - } - - $tempIP = trim(explode(',', $tempIP)[0]); - - if (!$this->isValidIP($tempIP)) { - $tempIP = null; - } else { - break; - } - } - - // tempIP不为空,说明获取到了一个IP地址 - // 这时我们检查 REMOTE_ADDR 是不是指定的前端代理服务器之一 - // 如果是的话说明该 IP头 是由前端代理服务器设置的 - // 否则则是伪装的 - if (!empty($tempIP)) { - $realIPBin = $this->ip2bin($this->realIP); - - foreach ($proxyIp as $ip) { - $serverIPElements = explode('/', $ip); - $serverIP = $serverIPElements[0]; - $serverIPPrefix = $serverIPElements[1] ?? 128; - $serverIPBin = $this->ip2bin($serverIP); - - // IP类型不符 - if (strlen($realIPBin) !== strlen($serverIPBin)) { - continue; - } - - if (strncmp($realIPBin, $serverIPBin, (int) $serverIPPrefix) === 0) { - $this->realIP = $tempIP; - break; - } - } - } - } - - if (!$this->isValidIP($this->realIP)) { - $this->realIP = '0.0.0.0'; - } - - return $this->realIP; - } - - /** - * 检测是否是合法的IP地址 - * - * @param string $ip IP地址 - * @param string $type IP地址类型 (ipv4, ipv6) - * - * @return boolean - */ - public function isValidIP(string $ip, string $type = ''): bool - { - switch (strtolower($type)) { - case 'ipv4': - $flag = FILTER_FLAG_IPV4; - break; - case 'ipv6': - $flag = FILTER_FLAG_IPV6; - break; - default: - $flag = 0; - break; - } - - return boolval(filter_var($ip, FILTER_VALIDATE_IP, $flag)); - } - - /** - * 将IP地址转换为二进制字符串 - * - * @param string $ip - * - * @return string - */ - public function ip2bin(string $ip): string - { - if ($this->isValidIP($ip, 'ipv6')) { - $IPHex = str_split(bin2hex(inet_pton($ip)), 4); - foreach ($IPHex as $key => $value) { - $IPHex[$key] = intval($value, 16); - } - $IPBin = vsprintf('%016b%016b%016b%016b%016b%016b%016b%016b', $IPHex); - } else { - $IPHex = str_split(bin2hex(inet_pton($ip)), 2); - foreach ($IPHex as $key => $value) { - $IPHex[$key] = intval($value, 16); - } - $IPBin = vsprintf('%08b%08b%08b%08b', $IPHex); - } - - return $IPBin; - } - - /** - * 检测是否使用手机访问 - * @access public - * @return bool - */ - public function isMobile(): bool - { - if ($this->server('HTTP_VIA') && stristr($this->server('HTTP_VIA'), "wap")) { - return true; - } elseif ($this->server('HTTP_ACCEPT') && strpos(strtoupper($this->server('HTTP_ACCEPT')), "VND.WAP.WML")) { - return true; - } elseif ($this->server('HTTP_X_WAP_PROFILE') || $this->server('HTTP_PROFILE')) { - return true; - } elseif ($this->server('HTTP_USER_AGENT') && preg_match('/(blackberry|configuration\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $this->server('HTTP_USER_AGENT'))) { - return true; - } - - return false; - } - - /** - * 当前URL地址中的scheme参数 - * @access public - * @return string - */ - public function scheme(): string - { - return $this->isSsl() ? 'https' : 'http'; - } - - /** - * 当前请求URL地址中的query参数 - * @access public - * @return string - */ - public function query(): string - { - return $this->server('QUERY_STRING', ''); - } - - /** - * 设置当前请求的host(包含端口) - * @access public - * @param string $host 主机名(含端口) - * @return $this - */ - public function setHost(string $host) - { - $this->host = $host; - - return $this; - } - - /** - * 当前请求的host - * @access public - * @param bool $strict true 仅仅获取HOST - * @return string - */ - public function host(bool $strict = false): string - { - if ($this->host) { - $host = $this->host; - } else { - $host = strval($this->server('HTTP_X_FORWARDED_HOST') ?: $this->server('HTTP_HOST')); - } - - return true === $strict && strpos($host, ':') ? strstr($host, ':', true) : $host; - } - - /** - * 当前请求URL地址中的port参数 - * @access public - * @return int - */ - public function port(): int - { - return (int) ($this->server('HTTP_X_FORWARDED_PORT') ?: $this->server('SERVER_PORT', '')); - } - - /** - * 当前请求 SERVER_PROTOCOL - * @access public - * @return string - */ - public function protocol(): string - { - return $this->server('SERVER_PROTOCOL', ''); - } - - /** - * 当前请求 REMOTE_PORT - * @access public - * @return int - */ - public function remotePort(): int - { - return (int) $this->server('REMOTE_PORT', ''); - } - - /** - * 当前请求 HTTP_CONTENT_TYPE - * @access public - * @return string - */ - public function contentType(): string - { - $contentType = $this->header('Content-Type'); - - if ($contentType) { - if (strpos($contentType, ';')) { - [$type] = explode(';', $contentType); - } else { - $type = $contentType; - } - return trim($type); - } - - return ''; - } - - /** - * 获取当前请求的安全Key - * @access public - * @return string - */ - public function secureKey(): string - { - if (is_null($this->secureKey)) { - $this->secureKey = uniqid('', true); - } - - return $this->secureKey; - } - - /** - * 设置当前的控制器名 - * @access public - * @param string $controller 控制器名 - * @return $this - */ - public function setController(string $controller) - { - $this->controller = $controller; - return $this; - } - - /** - * 设置当前的操作名 - * @access public - * @param string $action 操作名 - * @return $this - */ - public function setAction(string $action) - { - $this->action = $action; - return $this; - } - - /** - * 获取当前的控制器名 - * @access public - * @param bool $convert 转换为小写 - * @return string - */ - public function controller(bool $convert = false): string - { - $name = $this->controller ?: ''; - return $convert ? strtolower($name) : $name; - } - - /** - * 获取当前的操作名 - * @access public - * @param bool $convert 转换为小写 - * @return string - */ - public function action(bool $convert = false): string - { - $name = $this->action ?: ''; - return $convert ? strtolower($name) : $name; - } - - /** - * 设置或者获取当前请求的content - * @access public - * @return string - */ - public function getContent(): string - { - if (is_null($this->content)) { - $this->content = $this->input; - } - - return $this->content; - } - - /** - * 获取当前请求的php://input - * @access public - * @return string - */ - public function getInput(): string - { - return $this->input; - } - - /** - * 生成请求令牌 - * @access public - * @param string $name 令牌名称 - * @param mixed $type 令牌生成方法 - * @return string - */ - public function buildToken(string $name = '__token__', $type = 'md5'): string - { - $type = is_callable($type) ? $type : 'md5'; - $token = call_user_func($type, $this->server('REQUEST_TIME_FLOAT')); - - $this->session->set($name, $token); - - return $token; - } - - /** - * 检查请求令牌 - * @access public - * @param string $token 令牌名称 - * @param array $data 表单数据 - * @return bool - */ - public function checkToken(string $token = '__token__', array $data = []): bool - { - if (in_array($this->method(), ['GET', 'HEAD', 'OPTIONS'], true)) { - return true; - } - - if (!$this->session->has($token)) { - // 令牌数据无效 - return false; - } - - // Header验证 - if ($this->header('X-CSRF-TOKEN') && $this->session->get($token) === $this->header('X-CSRF-TOKEN')) { - // 防止重复提交 - $this->session->delete($token); // 验证完成销毁session - return true; - } - - if (empty($data)) { - $data = $this->post(); - } - - // 令牌验证 - if (isset($data[$token]) && $this->session->get($token) === $data[$token]) { - // 防止重复提交 - $this->session->delete($token); // 验证完成销毁session - return true; - } - - // 开启TOKEN重置 - $this->session->delete($token); - return false; - } - - /** - * 设置在中间件传递的数据 - * @access public - * @param array $middleware 数据 - * @return $this - */ - public function withMiddleware(array $middleware) - { - $this->middleware = array_merge($this->middleware, $middleware); - return $this; - } - - /** - * 设置GET数据 - * @access public - * @param array $get 数据 - * @return $this - */ - public function withGet(array $get) - { - $this->get = $get; - return $this; - } - - /** - * 设置POST数据 - * @access public - * @param array $post 数据 - * @return $this - */ - public function withPost(array $post) - { - $this->post = $post; - return $this; - } - - /** - * 设置COOKIE数据 - * @access public - * @param array $cookie 数据 - * @return $this - */ - public function withCookie(array $cookie) - { - $this->cookie = $cookie; - return $this; - } - - /** - * 设置SESSION数据 - * @access public - * @param Session $session 数据 - * @return $this - */ - public function withSession(Session $session) - { - $this->session = $session; - return $this; - } - - /** - * 设置SERVER数据 - * @access public - * @param array $server 数据 - * @return $this - */ - public function withServer(array $server) - { - $this->server = array_change_key_case($server, CASE_UPPER); - return $this; - } - - /** - * 设置HEADER数据 - * @access public - * @param array $header 数据 - * @return $this - */ - public function withHeader(array $header) - { - $this->header = array_change_key_case($header); - return $this; - } - - /** - * 设置ENV数据 - * @access public - * @param Env $env 数据 - * @return $this - */ - public function withEnv(Env $env) - { - $this->env = $env; - return $this; - } - - /** - * 设置php://input数据 - * @access public - * @param string $input RAW数据 - * @return $this - */ - public function withInput(string $input) - { - $this->input = $input; - if (!empty($input)) { - $inputData = $this->getInputData($input); - if (!empty($inputData)) { - $this->post = $inputData; - $this->put = $inputData; - } - } - return $this; - } - - /** - * 设置文件上传数据 - * @access public - * @param array $files 上传信息 - * @return $this - */ - public function withFiles(array $files) - { - $this->file = $files; - return $this; - } - - /** - * 设置ROUTE变量 - * @access public - * @param array $route 数据 - * @return $this - */ - public function withRoute(array $route) - { - $this->route = $route; - return $this; - } - - /** - * 设置中间传递数据 - * @access public - * @param string $name 参数名 - * @param mixed $value 值 - */ - public function __set(string $name, $value) - { - $this->middleware[$name] = $value; - } - - /** - * 获取中间传递数据的值 - * @access public - * @param string $name 名称 - * @return mixed - */ - public function __get(string $name) - { - return $this->middleware($name); - } - - /** - * 检测中间传递数据的值 - * @access public - * @param string $name 名称 - * @return boolean - */ - public function __isset(string $name): bool - { - return isset($this->middleware[$name]); - } - - // ArrayAccess - public function offsetExists($name): bool - { - return $this->has($name); - } - - public function offsetGet($name) - { - return $this->param($name); - } - - public function offsetSet($name, $value) - {} - - public function offsetUnset($name) - {} - -} diff --git a/vendor/topthink/framework/src/think/Response.php b/vendor/topthink/framework/src/think/Response.php deleted file mode 100644 index a8a61ffb..00000000 --- a/vendor/topthink/framework/src/think/Response.php +++ /dev/null @@ -1,410 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -/** - * 响应输出基础类 - * @package think - */ -abstract class Response -{ - /** - * 原始数据 - * @var mixed - */ - protected $data; - - /** - * 当前contentType - * @var string - */ - protected $contentType = 'text/html'; - - /** - * 字符集 - * @var string - */ - protected $charset = 'utf-8'; - - /** - * 状态码 - * @var integer - */ - protected $code = 200; - - /** - * 是否允许请求缓存 - * @var bool - */ - protected $allowCache = true; - - /** - * 输出参数 - * @var array - */ - protected $options = []; - - /** - * header参数 - * @var array - */ - protected $header = []; - - /** - * 输出内容 - * @var string - */ - protected $content = null; - - /** - * Cookie对象 - * @var Cookie - */ - protected $cookie; - - /** - * Session对象 - * @var Session - */ - protected $session; - - /** - * 初始化 - * @access protected - * @param mixed $data 输出数据 - * @param int $code 状态码 - */ - protected function init($data = '', int $code = 200) - { - $this->data($data); - $this->code = $code; - - $this->contentType($this->contentType, $this->charset); - } - - /** - * 创建Response对象 - * @access public - * @param mixed $data 输出数据 - * @param string $type 输出类型 - * @param int $code 状态码 - * @return Response - */ - public static function create($data = '', string $type = 'html', int $code = 200): Response - { - $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\' . ucfirst(strtolower($type)); - - return Container::getInstance()->invokeClass($class, [$data, $code]); - } - - /** - * 设置Session对象 - * @access public - * @param Session $session Session对象 - * @return $this - */ - public function setSession(Session $session) - { - $this->session = $session; - return $this; - } - - /** - * 发送数据到客户端 - * @access public - * @return void - * @throws \InvalidArgumentException - */ - public function send(): void - { - // 处理输出数据 - $data = $this->getContent(); - - if (!headers_sent() && !empty($this->header)) { - // 发送状态码 - http_response_code($this->code); - // 发送头部信息 - foreach ($this->header as $name => $val) { - header($name . (!is_null($val) ? ':' . $val : '')); - } - } - if ($this->cookie) { - $this->cookie->save(); - } - - $this->sendData($data); - - if (function_exists('fastcgi_finish_request')) { - // 提高页面响应 - fastcgi_finish_request(); - } - } - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - */ - protected function output($data) - { - return $data; - } - - /** - * 输出数据 - * @access protected - * @param string $data 要处理的数据 - * @return void - */ - protected function sendData(string $data): void - { - echo $data; - } - - /** - * 输出的参数 - * @access public - * @param mixed $options 输出参数 - * @return $this - */ - public function options(array $options = []) - { - $this->options = array_merge($this->options, $options); - - return $this; - } - - /** - * 输出数据设置 - * @access public - * @param mixed $data 输出数据 - * @return $this - */ - public function data($data) - { - $this->data = $data; - - return $this; - } - - /** - * 是否允许请求缓存 - * @access public - * @param bool $cache 允许请求缓存 - * @return $this - */ - public function allowCache(bool $cache) - { - $this->allowCache = $cache; - - return $this; - } - - /** - * 是否允许请求缓存 - * @access public - * @return bool - */ - public function isAllowCache() - { - return $this->allowCache; - } - - /** - * 设置Cookie - * @access public - * @param string $name cookie名称 - * @param string $value cookie值 - * @param mixed $option 可选参数 - * @return $this - */ - public function cookie(string $name, string $value, $option = null) - { - $this->cookie->set($name, $value, $option); - - return $this; - } - - /** - * 设置响应头 - * @access public - * @param array $header 参数 - * @return $this - */ - public function header(array $header = []) - { - $this->header = array_merge($this->header, $header); - - return $this; - } - - /** - * 设置页面输出内容 - * @access public - * @param mixed $content - * @return $this - */ - public function content($content) - { - if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([ - $content, - '__toString', - ]) - ) { - throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content))); - } - - $this->content = (string) $content; - - return $this; - } - - /** - * 发送HTTP状态 - * @access public - * @param integer $code 状态码 - * @return $this - */ - public function code(int $code) - { - $this->code = $code; - - return $this; - } - - /** - * LastModified - * @access public - * @param string $time - * @return $this - */ - public function lastModified(string $time) - { - $this->header['Last-Modified'] = $time; - - return $this; - } - - /** - * Expires - * @access public - * @param string $time - * @return $this - */ - public function expires(string $time) - { - $this->header['Expires'] = $time; - - return $this; - } - - /** - * ETag - * @access public - * @param string $eTag - * @return $this - */ - public function eTag(string $eTag) - { - $this->header['ETag'] = $eTag; - - return $this; - } - - /** - * 页面缓存控制 - * @access public - * @param string $cache 状态码 - * @return $this - */ - public function cacheControl(string $cache) - { - $this->header['Cache-control'] = $cache; - - return $this; - } - - /** - * 页面输出类型 - * @access public - * @param string $contentType 输出类型 - * @param string $charset 输出编码 - * @return $this - */ - public function contentType(string $contentType, string $charset = 'utf-8') - { - $this->header['Content-Type'] = $contentType . '; charset=' . $charset; - - return $this; - } - - /** - * 获取头部信息 - * @access public - * @param string $name 头部名称 - * @return mixed - */ - public function getHeader(string $name = '') - { - if (!empty($name)) { - return $this->header[$name] ?? null; - } - - return $this->header; - } - - /** - * 获取原始数据 - * @access public - * @return mixed - */ - public function getData() - { - return $this->data; - } - - /** - * 获取输出数据 - * @access public - * @return string - */ - public function getContent(): string - { - if (null == $this->content) { - $content = $this->output($this->data); - - if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([ - $content, - '__toString', - ]) - ) { - throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content))); - } - - $this->content = (string) $content; - } - - return $this->content; - } - - /** - * 获取状态码 - * @access public - * @return integer - */ - public function getCode(): int - { - return $this->code; - } -} diff --git a/vendor/topthink/framework/src/think/Route.php b/vendor/topthink/framework/src/think/Route.php deleted file mode 100644 index a3acf85b..00000000 --- a/vendor/topthink/framework/src/think/Route.php +++ /dev/null @@ -1,926 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use Closure; -use think\exception\RouteNotFoundException; -use think\route\Dispatch; -use think\route\dispatch\Callback; -use think\route\dispatch\Url as UrlDispatch; -use think\route\Domain; -use think\route\Resource; -use think\route\Rule; -use think\route\RuleGroup; -use think\route\RuleItem; -use think\route\RuleName; -use think\route\Url as UrlBuild; - -/** - * 路由管理类 - * @package think - */ -class Route -{ - /** - * REST定义 - * @var array - */ - protected $rest = [ - 'index' => ['get', '', 'index'], - 'create' => ['get', '/create', 'create'], - 'edit' => ['get', '//edit', 'edit'], - 'read' => ['get', '/', 'read'], - 'save' => ['post', '', 'save'], - 'update' => ['put', '/', 'update'], - 'delete' => ['delete', '/', 'delete'], - ]; - - /** - * 配置参数 - * @var array - */ - protected $config = [ - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 去除斜杠 - 'remove_slash' => false, - // 使用注解路由 - 'route_annotation' => false, - // 默认的路由变量规则 - 'default_route_pattern' => '[\w\.]+', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // 访问控制器层名称 - 'controller_layer' => 'controller', - // 空控制器名 - 'empty_controller' => 'Error', - // 是否使用控制器后缀 - 'controller_suffix' => false, - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', - // 操作方法后缀 - 'action_suffix' => '', - // 非路由变量是否使用普通参数方式(用于URL生成) - 'url_common_param' => true, - ]; - - /** - * 当前应用 - * @var App - */ - protected $app; - - /** - * 请求对象 - * @var Request - */ - protected $request; - - /** - * @var RuleName - */ - protected $ruleName; - - /** - * 当前HOST - * @var string - */ - protected $host; - - /** - * 当前分组对象 - * @var RuleGroup - */ - protected $group; - - /** - * 路由绑定 - * @var array - */ - protected $bind = []; - - /** - * 域名对象 - * @var Domain[] - */ - protected $domains = []; - - /** - * 跨域路由规则 - * @var RuleGroup - */ - protected $cross; - - /** - * 路由是否延迟解析 - * @var bool - */ - protected $lazy = false; - - /** - * 路由是否测试模式 - * @var bool - */ - protected $isTest = false; - - /** - * (分组)路由规则是否合并解析 - * @var bool - */ - protected $mergeRuleRegex = false; - - /** - * 是否去除URL最后的斜线 - * @var bool - */ - protected $removeSlash = false; - - public function __construct(App $app) - { - $this->app = $app; - $this->ruleName = new RuleName(); - $this->setDefaultDomain(); - - if (is_file($this->app->getRuntimePath() . 'route.php')) { - // 读取路由映射文件 - $this->import(include $this->app->getRuntimePath() . 'route.php'); - } - - $this->config = array_merge($this->config, $this->app->config->get('route')); - } - - protected function init() - { - if (!empty($this->config['middleware'])) { - $this->app->middleware->import($this->config['middleware'], 'route'); - } - - $this->lazy($this->config['url_lazy_route']); - $this->mergeRuleRegex = $this->config['route_rule_merge']; - $this->removeSlash = $this->config['remove_slash']; - - $this->group->removeSlash($this->removeSlash); - } - - public function config(string $name = null) - { - if (is_null($name)) { - return $this->config; - } - - return $this->config[$name] ?? null; - } - - /** - * 设置路由域名及分组(包括资源路由)是否延迟解析 - * @access public - * @param bool $lazy 路由是否延迟解析 - * @return $this - */ - public function lazy(bool $lazy = true) - { - $this->lazy = $lazy; - return $this; - } - - /** - * 设置路由为测试模式 - * @access public - * @param bool $test 路由是否测试模式 - * @return void - */ - public function setTestMode(bool $test): void - { - $this->isTest = $test; - } - - /** - * 检查路由是否为测试模式 - * @access public - * @return bool - */ - public function isTest(): bool - { - return $this->isTest; - } - - /** - * 设置路由域名及分组(包括资源路由)是否合并解析 - * @access public - * @param bool $merge 路由是否合并解析 - * @return $this - */ - public function mergeRuleRegex(bool $merge = true) - { - $this->mergeRuleRegex = $merge; - $this->group->mergeRuleRegex($merge); - - return $this; - } - - /** - * 初始化默认域名 - * @access protected - * @return void - */ - protected function setDefaultDomain(): void - { - // 注册默认域名 - $domain = new Domain($this); - - $this->domains['-'] = $domain; - - // 默认分组 - $this->group = $domain; - } - - /** - * 设置当前分组 - * @access public - * @param RuleGroup $group 域名 - * @return void - */ - public function setGroup(RuleGroup $group): void - { - $this->group = $group; - } - - /** - * 获取指定标识的路由分组 不指定则获取当前分组 - * @access public - * @param string $name 分组标识 - * @return RuleGroup - */ - public function getGroup(string $name = null) - { - return $name ? $this->ruleName->getGroup($name) : $this->group; - } - - /** - * 注册变量规则 - * @access public - * @param array $pattern 变量规则 - * @return $this - */ - public function pattern(array $pattern) - { - $this->group->pattern($pattern); - - return $this; - } - - /** - * 注册路由参数 - * @access public - * @param array $option 参数 - * @return $this - */ - public function option(array $option) - { - $this->group->option($option); - - return $this; - } - - /** - * 注册域名路由 - * @access public - * @param string|array $name 子域名 - * @param mixed $rule 路由规则 - * @return Domain - */ - public function domain($name, $rule = null): Domain - { - // 支持多个域名使用相同路由规则 - $domainName = is_array($name) ? array_shift($name) : $name; - - if (!isset($this->domains[$domainName])) { - $domain = (new Domain($this, $domainName, $rule)) - ->lazy($this->lazy) - ->removeSlash($this->removeSlash) - ->mergeRuleRegex($this->mergeRuleRegex); - - $this->domains[$domainName] = $domain; - } else { - $domain = $this->domains[$domainName]; - $domain->parseGroupRule($rule); - } - - if (is_array($name) && !empty($name)) { - foreach ($name as $item) { - $this->domains[$item] = $domainName; - } - } - - // 返回域名对象 - return $domain; - } - - /** - * 获取域名 - * @access public - * @return array - */ - public function getDomains(): array - { - return $this->domains; - } - - /** - * 获取RuleName对象 - * @access public - * @return RuleName - */ - public function getRuleName(): RuleName - { - return $this->ruleName; - } - - /** - * 设置路由绑定 - * @access public - * @param string $bind 绑定信息 - * @param string $domain 域名 - * @return $this - */ - public function bind(string $bind, string $domain = null) - { - $domain = is_null($domain) ? '-' : $domain; - - $this->bind[$domain] = $bind; - - return $this; - } - - /** - * 读取路由绑定信息 - * @access public - * @return array - */ - public function getBind(): array - { - return $this->bind; - } - - /** - * 读取路由绑定 - * @access public - * @param string $domain 域名 - * @return string|null - */ - public function getDomainBind(string $domain = null) - { - if (is_null($domain)) { - $domain = $this->host; - } elseif (false === strpos($domain, '.') && $this->request) { - $domain .= '.' . $this->request->rootDomain(); - } - - if ($this->request) { - $subDomain = $this->request->subDomain(); - - if (strpos($subDomain, '.')) { - $name = '*' . strstr($subDomain, '.'); - } - } - - if (isset($this->bind[$domain])) { - $result = $this->bind[$domain]; - } elseif (isset($name) && isset($this->bind[$name])) { - $result = $this->bind[$name]; - } elseif (!empty($subDomain) && isset($this->bind['*'])) { - $result = $this->bind['*']; - } else { - $result = null; - } - - return $result; - } - - /** - * 读取路由标识 - * @access public - * @param string $name 路由标识 - * @param string $domain 域名 - * @param string $method 请求类型 - * @return array - */ - public function getName(string $name = null, string $domain = null, string $method = '*'): array - { - return $this->ruleName->getName($name, $domain, $method); - } - - /** - * 批量导入路由标识 - * @access public - * @param array $name 路由标识 - * @return void - */ - public function import(array $name): void - { - $this->ruleName->import($name); - } - - /** - * 注册路由标识 - * @access public - * @param string $name 路由标识 - * @param RuleItem $ruleItem 路由规则 - * @param bool $first 是否优先 - * @return void - */ - public function setName(string $name, RuleItem $ruleItem, bool $first = false): void - { - $this->ruleName->setName($name, $ruleItem, $first); - } - - /** - * 保存路由规则 - * @access public - * @param string $rule 路由规则 - * @param RuleItem $ruleItem RuleItem对象 - * @return void - */ - public function setRule(string $rule, RuleItem $ruleItem = null): void - { - $this->ruleName->setRule($rule, $ruleItem); - } - - /** - * 读取路由 - * @access public - * @param string $rule 路由规则 - * @return RuleItem[] - */ - public function getRule(string $rule): array - { - return $this->ruleName->getRule($rule); - } - - /** - * 读取路由列表 - * @access public - * @return array - */ - public function getRuleList(): array - { - return $this->ruleName->getRuleList(); - } - - /** - * 清空路由规则 - * @access public - * @return void - */ - public function clear(): void - { - $this->ruleName->clear(); - - if ($this->group) { - $this->group->clear(); - } - } - - /** - * 注册路由规则 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @param string $method 请求类型 - * @return RuleItem - */ - public function rule(string $rule, $route = null, string $method = '*'): RuleItem - { - if ($route instanceof Response) { - // 兼容之前的路由到响应对象,感觉不需要,使用场景很少,闭包就能实现 - $route = function () use ($route) { - return $route; - }; - } - return $this->group->addRule($rule, $route, $method); - } - - /** - * 设置跨域有效路由规则 - * @access public - * @param Rule $rule 路由规则 - * @param string $method 请求类型 - * @return $this - */ - public function setCrossDomainRule(Rule $rule, string $method = '*') - { - if (!isset($this->cross)) { - $this->cross = (new RuleGroup($this))->mergeRuleRegex($this->mergeRuleRegex); - } - - $this->cross->addRuleItem($rule, $method); - - return $this; - } - - /** - * 注册路由分组 - * @access public - * @param string|\Closure $name 分组名称或者参数 - * @param mixed $route 分组路由 - * @return RuleGroup - */ - public function group($name, $route = null): RuleGroup - { - if ($name instanceof Closure) { - $route = $name; - $name = ''; - } - - return (new RuleGroup($this, $this->group, $name, $route)) - ->lazy($this->lazy) - ->removeSlash($this->removeSlash) - ->mergeRuleRegex($this->mergeRuleRegex); - } - - /** - * 注册路由 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @return RuleItem - */ - public function any(string $rule, $route): RuleItem - { - return $this->rule($rule, $route, '*'); - } - - /** - * 注册GET路由 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @return RuleItem - */ - public function get(string $rule, $route): RuleItem - { - return $this->rule($rule, $route, 'GET'); - } - - /** - * 注册POST路由 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @return RuleItem - */ - public function post(string $rule, $route): RuleItem - { - return $this->rule($rule, $route, 'POST'); - } - - /** - * 注册PUT路由 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @return RuleItem - */ - public function put(string $rule, $route): RuleItem - { - return $this->rule($rule, $route, 'PUT'); - } - - /** - * 注册DELETE路由 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @return RuleItem - */ - public function delete(string $rule, $route): RuleItem - { - return $this->rule($rule, $route, 'DELETE'); - } - - /** - * 注册PATCH路由 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @return RuleItem - */ - public function patch(string $rule, $route): RuleItem - { - return $this->rule($rule, $route, 'PATCH'); - } - - /** - * 注册OPTIONS路由 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @return RuleItem - */ - public function options(string $rule, $route): RuleItem - { - return $this->rule($rule, $route, 'OPTIONS'); - } - - /** - * 注册资源路由 - * @access public - * @param string $rule 路由规则 - * @param string $route 路由地址 - * @return Resource - */ - public function resource(string $rule, string $route): Resource - { - return (new Resource($this, $this->group, $rule, $route, $this->rest)) - ->lazy($this->lazy); - } - - /** - * 注册视图路由 - * @access public - * @param string $rule 路由规则 - * @param string $template 路由模板地址 - * @param array $vars 模板变量 - * @return RuleItem - */ - public function view(string $rule, string $template = '', array $vars = []): RuleItem - { - return $this->rule($rule, function () use ($vars, $template) { - return Response::create($template, 'view')->assign($vars); - }, 'GET'); - } - - /** - * 注册重定向路由 - * @access public - * @param string $rule 路由规则 - * @param string $route 路由地址 - * @param int $status 状态码 - * @return RuleItem - */ - public function redirect(string $rule, string $route = '', int $status = 301): RuleItem - { - return $this->rule($rule, function (Request $request) use ($status, $route) { - $search = $replace = []; - $matches = $request->rule()->getVars(); - - foreach ($matches as $key => $value) { - $search[] = '<' . $key . '>'; - $replace[] = $value; - - $search[] = ':' . $key; - $replace[] = $value; - } - - $route = str_replace($search, $replace, $route); - return Response::create($route, 'redirect')->code($status); - }, '*'); - } - - /** - * rest方法定义和修改 - * @access public - * @param string|array $name 方法名称 - * @param array|bool $resource 资源 - * @return $this - */ - public function rest($name, $resource = []) - { - if (is_array($name)) { - $this->rest = $resource ? $name : array_merge($this->rest, $name); - } else { - $this->rest[$name] = $resource; - } - - return $this; - } - - /** - * 获取rest方法定义的参数 - * @access public - * @param string $name 方法名称 - * @return array|null - */ - public function getRest(string $name = null) - { - if (is_null($name)) { - return $this->rest; - } - - return $this->rest[$name] ?? null; - } - - /** - * 注册未匹配路由规则后的处理 - * @access public - * @param string|Closure $route 路由地址 - * @param string $method 请求类型 - * @return RuleItem - */ - public function miss($route, string $method = '*'): RuleItem - { - return $this->group->miss($route, $method); - } - - /** - * 路由调度 - * @param Request $request - * @param Closure|bool $withRoute - * @return Response - */ - public function dispatch(Request $request, $withRoute = true) - { - $this->request = $request; - $this->host = $this->request->host(true); - $this->init(); - - if ($withRoute) { - //加载路由 - if ($withRoute instanceof Closure) { - $withRoute(); - } - $dispatch = $this->check(); - } else { - $dispatch = $this->url($this->path()); - } - - $dispatch->init($this->app); - - return $this->app->middleware->pipeline('route') - ->send($request) - ->then(function () use ($dispatch) { - return $dispatch->run(); - }); - } - - /** - * 检测URL路由 - * @access public - * @return Dispatch|false - * @throws RouteNotFoundException - */ - public function check() - { - // 自动检测域名路由 - $url = str_replace($this->config['pathinfo_depr'], '|', $this->path()); - - $completeMatch = $this->config['route_complete_match']; - - $result = $this->checkDomain()->check($this->request, $url, $completeMatch); - - if (false === $result && !empty($this->cross)) { - // 检测跨域路由 - $result = $this->cross->check($this->request, $url, $completeMatch); - } - - if (false !== $result) { - return $result; - } elseif ($this->config['url_route_must']) { - throw new RouteNotFoundException(); - } - - return $this->url($url); - } - - /** - * 获取当前请求URL的pathinfo信息(不含URL后缀) - * @access protected - * @return string - */ - protected function path(): string - { - $suffix = $this->config['url_html_suffix']; - $pathinfo = $this->request->pathinfo(); - - if (false === $suffix) { - // 禁止伪静态访问 - $path = $pathinfo; - } elseif ($suffix) { - // 去除正常的URL后缀 - $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo); - } else { - // 允许任何后缀访问 - $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo); - } - - return $path; - } - - /** - * 默认URL解析 - * @access public - * @param string $url URL地址 - * @return Dispatch - */ - public function url(string $url): Dispatch - { - if ($this->request->method() == 'OPTIONS') { - // 自动响应options请求 - return new Callback($this->request, $this->group, function () { - return Response::create('', 'html', 204)->header(['Allow' => 'GET, POST, PUT, DELETE']); - }); - } - - return new UrlDispatch($this->request, $this->group, $url); - } - - /** - * 检测域名的路由规则 - * @access protected - * @return Domain - */ - protected function checkDomain(): Domain - { - $item = false; - - if (count($this->domains) > 1) { - // 获取当前子域名 - $subDomain = $this->request->subDomain(); - - $domain = $subDomain ? explode('.', $subDomain) : []; - $domain2 = $domain ? array_pop($domain) : ''; - - if ($domain) { - // 存在三级域名 - $domain3 = array_pop($domain); - } - - if (isset($this->domains[$this->host])) { - // 子域名配置 - $item = $this->domains[$this->host]; - } elseif (isset($this->domains[$subDomain])) { - $item = $this->domains[$subDomain]; - } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) { - // 泛三级域名 - $item = $this->domains['*.' . $domain2]; - $panDomain = $domain3; - } elseif (isset($this->domains['*']) && !empty($domain2)) { - // 泛二级域名 - if ('www' != $domain2) { - $item = $this->domains['*']; - $panDomain = $domain2; - } - } - - if (isset($panDomain)) { - // 保存当前泛域名 - $this->request->setPanDomain($panDomain); - } - } - - if (false === $item) { - // 检测全局域名规则 - $item = $this->domains['-']; - } - - if (is_string($item)) { - $item = $this->domains[$item]; - } - - return $item; - } - - /** - * URL生成 支持路由反射 - * @access public - * @param string $url 路由地址 - * @param array $vars 参数 ['a'=>'val1', 'b'=>'val2'] - * @return UrlBuild - */ - public function buildUrl(string $url = '', array $vars = []): UrlBuild - { - return $this->app->make(UrlBuild::class, [$this, $this->app, $url, $vars], true); - } - - /** - * 设置全局的路由分组参数 - * @access public - * @param string $method 方法名 - * @param array $args 调用参数 - * @return RuleGroup - */ - public function __call($method, $args) - { - return call_user_func_array([$this->group, $method], $args); - } -} diff --git a/vendor/topthink/framework/src/think/Service.php b/vendor/topthink/framework/src/think/Service.php deleted file mode 100644 index d9e89601..00000000 --- a/vendor/topthink/framework/src/think/Service.php +++ /dev/null @@ -1,66 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use Closure; -use think\event\RouteLoaded; - -/** - * 系统服务基础类 - * @method void register() - * @method void boot() - */ -abstract class Service -{ - protected $app; - - public function __construct(App $app) - { - $this->app = $app; - } - - /** - * 加载路由 - * @access protected - * @param string $path 路由路径 - */ - protected function loadRoutesFrom($path) - { - $this->registerRoutes(function () use ($path) { - include $path; - }); - } - - /** - * 注册路由 - * @param Closure $closure - */ - protected function registerRoutes(Closure $closure) - { - $this->app->event->listen(RouteLoaded::class, $closure); - } - - /** - * 添加指令 - * @access protected - * @param array|string $commands 指令 - */ - protected function commands($commands) - { - $commands = is_array($commands) ? $commands : func_get_args(); - - Console::starting(function (Console $console) use ($commands) { - $console->addCommands($commands); - }); - } -} diff --git a/vendor/topthink/framework/src/think/Session.php b/vendor/topthink/framework/src/think/Session.php deleted file mode 100644 index 6c84faf8..00000000 --- a/vendor/topthink/framework/src/think/Session.php +++ /dev/null @@ -1,65 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use think\helper\Arr; -use think\session\Store; - -/** - * Session管理类 - * @package think - * @mixin Store - */ -class Session extends Manager -{ - protected $namespace = '\\think\\session\\driver\\'; - - protected function createDriver(string $name) - { - $handler = parent::createDriver($name); - - return new Store($this->getConfig('name') ?: 'PHPSESSID', $handler, $this->getConfig('serialize')); - } - - /** - * 获取Session配置 - * @access public - * @param null|string $name 名称 - * @param mixed $default 默认值 - * @return mixed - */ - public function getConfig(string $name = null, $default = null) - { - if (!is_null($name)) { - return $this->app->config->get('session.' . $name, $default); - } - - return $this->app->config->get('session'); - } - - protected function resolveConfig(string $name) - { - $config = $this->app->config->get('session', []); - Arr::forget($config, 'type'); - return $config; - } - - /** - * 默认驱动 - * @return string|null - */ - public function getDefaultDriver() - { - return $this->app->config->get('session.type', 'file'); - } -} diff --git a/vendor/topthink/framework/src/think/Validate.php b/vendor/topthink/framework/src/think/Validate.php deleted file mode 100644 index 07884064..00000000 --- a/vendor/topthink/framework/src/think/Validate.php +++ /dev/null @@ -1,1688 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use Closure; -use think\exception\ValidateException; -use think\helper\Str; -use think\validate\ValidateRule; - -/** - * 数据验证类 - * @package think - */ -class Validate -{ - /** - * 自定义验证类型 - * @var array - */ - protected $type = []; - - /** - * 验证类型别名 - * @var array - */ - protected $alias = [ - '>' => 'gt', '>=' => 'egt', '<' => 'lt', '<=' => 'elt', '=' => 'eq', 'same' => 'eq', - ]; - - /** - * 当前验证规则 - * @var array - */ - protected $rule = []; - - /** - * 验证提示信息 - * @var array - */ - protected $message = []; - - /** - * 验证字段描述 - * @var array - */ - protected $field = []; - - /** - * 默认规则提示 - * @var array - */ - protected $typeMsg = [ - 'require' => ':attribute require', - 'must' => ':attribute must', - 'number' => ':attribute must be numeric', - 'integer' => ':attribute must be integer', - 'float' => ':attribute must be float', - 'boolean' => ':attribute must be bool', - 'email' => ':attribute not a valid email address', - 'mobile' => ':attribute not a valid mobile', - 'array' => ':attribute must be a array', - 'accepted' => ':attribute must be yes,on or 1', - 'date' => ':attribute not a valid datetime', - 'file' => ':attribute not a valid file', - 'image' => ':attribute not a valid image', - 'alpha' => ':attribute must be alpha', - 'alphaNum' => ':attribute must be alpha-numeric', - 'alphaDash' => ':attribute must be alpha-numeric, dash, underscore', - 'activeUrl' => ':attribute not a valid domain or ip', - 'chs' => ':attribute must be chinese', - 'chsAlpha' => ':attribute must be chinese or alpha', - 'chsAlphaNum' => ':attribute must be chinese,alpha-numeric', - 'chsDash' => ':attribute must be chinese,alpha-numeric,underscore, dash', - 'url' => ':attribute not a valid url', - 'ip' => ':attribute not a valid ip', - 'dateFormat' => ':attribute must be dateFormat of :rule', - 'in' => ':attribute must be in :rule', - 'notIn' => ':attribute be notin :rule', - 'between' => ':attribute must between :1 - :2', - 'notBetween' => ':attribute not between :1 - :2', - 'length' => 'size of :attribute must be :rule', - 'max' => 'max size of :attribute must be :rule', - 'min' => 'min size of :attribute must be :rule', - 'after' => ':attribute cannot be less than :rule', - 'before' => ':attribute cannot exceed :rule', - 'expire' => ':attribute not within :rule', - 'allowIp' => 'access IP is not allowed', - 'denyIp' => 'access IP denied', - 'confirm' => ':attribute out of accord with :2', - 'different' => ':attribute cannot be same with :2', - 'egt' => ':attribute must greater than or equal :rule', - 'gt' => ':attribute must greater than :rule', - 'elt' => ':attribute must less than or equal :rule', - 'lt' => ':attribute must less than :rule', - 'eq' => ':attribute must equal :rule', - 'unique' => ':attribute has exists', - 'regex' => ':attribute not conform to the rules', - 'method' => 'invalid Request method', - 'token' => 'invalid token', - 'fileSize' => 'filesize not match', - 'fileExt' => 'extensions to upload is not allowed', - 'fileMime' => 'mimetype to upload is not allowed', - ]; - - /** - * 当前验证场景 - * @var string - */ - protected $currentScene; - - /** - * 内置正则验证规则 - * @var array - */ - protected $defaultRegex = [ - 'alpha' => '/^[A-Za-z]+$/', - 'alphaNum' => '/^[A-Za-z0-9]+$/', - 'alphaDash' => '/^[A-Za-z0-9\-\_]+$/', - 'chs' => '/^[\x{4e00}-\x{9fa5}\x{9fa6}-\x{9fef}\x{3400}-\x{4db5}\x{20000}-\x{2ebe0}]+$/u', - 'chsAlpha' => '/^[\x{4e00}-\x{9fa5}\x{9fa6}-\x{9fef}\x{3400}-\x{4db5}\x{20000}-\x{2ebe0}a-zA-Z]+$/u', - 'chsAlphaNum' => '/^[\x{4e00}-\x{9fa5}\x{9fa6}-\x{9fef}\x{3400}-\x{4db5}\x{20000}-\x{2ebe0}a-zA-Z0-9]+$/u', - 'chsDash' => '/^[\x{4e00}-\x{9fa5}\x{9fa6}-\x{9fef}\x{3400}-\x{4db5}\x{20000}-\x{2ebe0}a-zA-Z0-9\_\-]+$/u', - 'mobile' => '/^1[3-9]\d{9}$/', - 'idCard' => '/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/', - 'zip' => '/\d{6}/', - ]; - - /** - * Filter_var 规则 - * @var array - */ - protected $filter = [ - 'email' => FILTER_VALIDATE_EMAIL, - 'ip' => [FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6], - 'integer' => FILTER_VALIDATE_INT, - 'url' => FILTER_VALIDATE_URL, - 'macAddr' => FILTER_VALIDATE_MAC, - 'float' => FILTER_VALIDATE_FLOAT, - ]; - - /** - * 验证场景定义 - * @var array - */ - protected $scene = []; - - /** - * 验证失败错误信息 - * @var string|array - */ - protected $error = []; - - /** - * 是否批量验证 - * @var bool - */ - protected $batch = false; - - /** - * 验证失败是否抛出异常 - * @var bool - */ - protected $failException = false; - - /** - * 场景需要验证的规则 - * @var array - */ - protected $only = []; - - /** - * 场景需要移除的验证规则 - * @var array - */ - protected $remove = []; - - /** - * 场景需要追加的验证规则 - * @var array - */ - protected $append = []; - - /** - * 验证正则定义 - * @var array - */ - protected $regex = []; - - /** - * Db对象 - * @var Db - */ - protected $db; - - /** - * 语言对象 - * @var Lang - */ - protected $lang; - - /** - * 请求对象 - * @var Request - */ - protected $request; - - /** - * @var Closure[] - */ - protected static $maker = []; - - /** - * 构造方法 - * @access public - */ - public function __construct() - { - if (!empty(static::$maker)) { - foreach (static::$maker as $maker) { - call_user_func($maker, $this); - } - } - } - - /** - * 设置服务注入 - * @access public - * @param Closure $maker - * @return void - */ - public static function maker(Closure $maker) - { - static::$maker[] = $maker; - } - - /** - * 设置Lang对象 - * @access public - * @param Lang $lang Lang对象 - * @return void - */ - public function setLang(Lang $lang) - { - $this->lang = $lang; - } - - /** - * 设置Db对象 - * @access public - * @param Db $db Db对象 - * @return void - */ - public function setDb(Db $db) - { - $this->db = $db; - } - - /** - * 设置Request对象 - * @access public - * @param Request $request Request对象 - * @return void - */ - public function setRequest(Request $request) - { - $this->request = $request; - } - - /** - * 添加字段验证规则 - * @access protected - * @param string|array $name 字段名称或者规则数组 - * @param mixed $rule 验证规则或者字段描述信息 - * @return $this - */ - public function rule($name, $rule = '') - { - if (is_array($name)) { - $this->rule = $name + $this->rule; - if (is_array($rule)) { - $this->field = array_merge($this->field, $rule); - } - } else { - $this->rule[$name] = $rule; - } - - return $this; - } - - /** - * 注册验证(类型)规则 - * @access public - * @param string $type 验证规则类型 - * @param callable $callback callback方法(或闭包) - * @param string $message 验证失败提示信息 - * @return $this - */ - public function extend(string $type, callable $callback = null, string $message = null) - { - $this->type[$type] = $callback; - - if ($message) { - $this->typeMsg[$type] = $message; - } - - return $this; - } - - /** - * 设置验证规则的默认提示信息 - * @access public - * @param string|array $type 验证规则类型名称或者数组 - * @param string $msg 验证提示信息 - * @return void - */ - public function setTypeMsg($type, string $msg = null): void - { - if (is_array($type)) { - $this->typeMsg = array_merge($this->typeMsg, $type); - } else { - $this->typeMsg[$type] = $msg; - } - } - - /** - * 设置提示信息 - * @access public - * @param array $message 错误信息 - * @return Validate - */ - public function message(array $message) - { - $this->message = array_merge($this->message, $message); - - return $this; - } - - /** - * 设置验证场景 - * @access public - * @param string $name 场景名 - * @return $this - */ - public function scene(string $name) - { - // 设置当前场景 - $this->currentScene = $name; - - return $this; - } - - /** - * 判断是否存在某个验证场景 - * @access public - * @param string $name 场景名 - * @return bool - */ - public function hasScene(string $name): bool - { - return isset($this->scene[$name]) || method_exists($this, 'scene' . $name); - } - - /** - * 设置批量验证 - * @access public - * @param bool $batch 是否批量验证 - * @return $this - */ - public function batch(bool $batch = true) - { - $this->batch = $batch; - - return $this; - } - - /** - * 设置验证失败后是否抛出异常 - * @access protected - * @param bool $fail 是否抛出异常 - * @return $this - */ - public function failException(bool $fail = true) - { - $this->failException = $fail; - - return $this; - } - - /** - * 指定需要验证的字段列表 - * @access public - * @param array $fields 字段名 - * @return $this - */ - public function only(array $fields) - { - $this->only = $fields; - - return $this; - } - - /** - * 移除某个字段的验证规则 - * @access public - * @param string|array $field 字段名 - * @param mixed $rule 验证规则 true 移除所有规则 - * @return $this - */ - public function remove($field, $rule = null) - { - if (is_array($field)) { - foreach ($field as $key => $rule) { - if (is_int($key)) { - $this->remove($rule); - } else { - $this->remove($key, $rule); - } - } - } else { - if (is_string($rule)) { - $rule = explode('|', $rule); - } - - $this->remove[$field] = $rule; - } - - return $this; - } - - /** - * 追加某个字段的验证规则 - * @access public - * @param string|array $field 字段名 - * @param mixed $rule 验证规则 - * @return $this - */ - public function append($field, $rule = null) - { - if (is_array($field)) { - foreach ($field as $key => $rule) { - $this->append($key, $rule); - } - } else { - if (is_string($rule)) { - $rule = explode('|', $rule); - } - - $this->append[$field] = $rule; - } - - return $this; - } - - /** - * 数据自动验证 - * @access public - * @param array $data 数据 - * @param array $rules 验证规则 - * @return bool - */ - public function check(array $data, array $rules = []): bool - { - $this->error = []; - - if ($this->currentScene) { - $this->getScene($this->currentScene); - } - - if (empty($rules)) { - // 读取验证规则 - $rules = $this->rule; - } - - foreach ($this->append as $key => $rule) { - if (!isset($rules[$key])) { - $rules[$key] = $rule; - unset($this->append[$key]); - } - } - - foreach ($rules as $key => $rule) { - // field => 'rule1|rule2...' field => ['rule1','rule2',...] - if (strpos($key, '|')) { - // 字段|描述 用于指定属性名称 - [$key, $title] = explode('|', $key); - } else { - $title = $this->field[$key] ?? $key; - } - - // 场景检测 - if (!empty($this->only) && !in_array($key, $this->only)) { - continue; - } - - // 获取数据 支持二维数组 - $value = $this->getDataValue($data, $key); - - // 字段验证 - if ($rule instanceof Closure) { - $result = call_user_func_array($rule, [$value, $data]); - } elseif ($rule instanceof ValidateRule) { - // 验证因子 - $result = $this->checkItem($key, $value, $rule->getRule(), $data, $rule->getTitle() ?: $title, $rule->getMsg()); - } else { - $result = $this->checkItem($key, $value, $rule, $data, $title); - } - - if (true !== $result) { - // 没有返回true 则表示验证失败 - if (!empty($this->batch)) { - // 批量验证 - $this->error[$key] = $result; - } elseif ($this->failException) { - throw new ValidateException($result); - } else { - $this->error = $result; - return false; - } - } - } - - if (!empty($this->error)) { - if ($this->failException) { - throw new ValidateException($this->error); - } - return false; - } - - return true; - } - - /** - * 根据验证规则验证数据 - * @access public - * @param mixed $value 字段值 - * @param mixed $rules 验证规则 - * @return bool - */ - public function checkRule($value, $rules): bool - { - if ($rules instanceof Closure) { - return call_user_func_array($rules, [$value]); - } elseif ($rules instanceof ValidateRule) { - $rules = $rules->getRule(); - } elseif (is_string($rules)) { - $rules = explode('|', $rules); - } - - foreach ($rules as $key => $rule) { - if ($rule instanceof Closure) { - $result = call_user_func_array($rule, [$value]); - } else { - // 判断验证类型 - [$type, $rule] = $this->getValidateType($key, $rule); - - $callback = $this->type[$type] ?? [$this, $type]; - - $result = call_user_func_array($callback, [$value, $rule]); - } - - if (true !== $result) { - if ($this->failException) { - throw new ValidateException($result); - } - - return $result; - } - } - - return true; - } - - /** - * 验证单个字段规则 - * @access protected - * @param string $field 字段名 - * @param mixed $value 字段值 - * @param mixed $rules 验证规则 - * @param array $data 数据 - * @param string $title 字段描述 - * @param array $msg 提示信息 - * @return mixed - */ - protected function checkItem(string $field, $value, $rules, $data, string $title = '', array $msg = []) - { - if (isset($this->remove[$field]) && true === $this->remove[$field] && empty($this->append[$field])) { - // 字段已经移除 无需验证 - return true; - } - - // 支持多规则验证 require|in:a,b,c|... 或者 ['require','in'=>'a,b,c',...] - if (is_string($rules)) { - $rules = explode('|', $rules); - } - - if (isset($this->append[$field])) { - // 追加额外的验证规则 - $rules = array_unique(array_merge($rules, $this->append[$field]), SORT_REGULAR); - unset($this->append[$field]); - } - - if (empty($rules)) { - return true; - } - - $i = 0; - foreach ($rules as $key => $rule) { - if ($rule instanceof Closure) { - $result = call_user_func_array($rule, [$value, $data]); - $info = is_numeric($key) ? '' : $key; - } else { - // 判断验证类型 - [$type, $rule, $info] = $this->getValidateType($key, $rule); - - if (isset($this->append[$field]) && in_array($info, $this->append[$field])) { - } elseif (isset($this->remove[$field]) && in_array($info, $this->remove[$field])) { - // 规则已经移除 - $i++; - continue; - } - - if (isset($this->type[$type])) { - $result = call_user_func_array($this->type[$type], [$value, $rule, $data, $field, $title]); - } elseif ('must' == $info || 0 === strpos($info, 'require') || (!is_null($value) && '' !== $value)) { - $result = call_user_func_array([$this, $type], [$value, $rule, $data, $field, $title]); - } else { - $result = true; - } - } - - if (false === $result) { - // 验证失败 返回错误信息 - if (!empty($msg[$i])) { - $message = $msg[$i]; - if (is_string($message) && strpos($message, '{%') === 0) { - $message = $this->lang->get(substr($message, 2, -1)); - } - } else { - $message = $this->getRuleMsg($field, $title, $info, $rule); - } - - return $message; - } elseif (true !== $result) { - // 返回自定义错误信息 - if (is_string($result) && false !== strpos($result, ':')) { - $result = str_replace(':attribute', $title, $result); - - if (strpos($result, ':rule') && is_scalar($rule)) { - $result = str_replace(':rule', (string) $rule, $result); - } - } - - return $result; - } - $i++; - } - - return $result ?? true; - } - - /** - * 获取当前验证类型及规则 - * @access public - * @param mixed $key - * @param mixed $rule - * @return array - */ - protected function getValidateType($key, $rule): array - { - // 判断验证类型 - if (!is_numeric($key)) { - if (isset($this->alias[$key])) { - // 判断别名 - $key = $this->alias[$key]; - } - return [$key, $rule, $key]; - } - - if (strpos($rule, ':')) { - [$type, $rule] = explode(':', $rule, 2); - if (isset($this->alias[$type])) { - // 判断别名 - $type = $this->alias[$type]; - } - $info = $type; - } elseif (method_exists($this, $rule)) { - $type = $rule; - $info = $rule; - $rule = ''; - } else { - $type = 'is'; - $info = $rule; - } - - return [$type, $rule, $info]; - } - - /** - * 验证是否和某个字段的值一致 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @param string $field 字段名 - * @return bool - */ - public function confirm($value, $rule, array $data = [], string $field = ''): bool - { - if ('' == $rule) { - if (strpos($field, '_confirm')) { - $rule = strstr($field, '_confirm', true); - } else { - $rule = $field . '_confirm'; - } - } - - return $this->getDataValue($data, $rule) === $value; - } - - /** - * 验证是否和某个字段的值是否不同 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function different($value, $rule, array $data = []): bool - { - return $this->getDataValue($data, $rule) != $value; - } - - /** - * 验证是否大于等于某个值 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function egt($value, $rule, array $data = []): bool - { - return $value >= $this->getDataValue($data, $rule); - } - - /** - * 验证是否大于某个值 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function gt($value, $rule, array $data = []): bool - { - return $value > $this->getDataValue($data, $rule); - } - - /** - * 验证是否小于等于某个值 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function elt($value, $rule, array $data = []): bool - { - return $value <= $this->getDataValue($data, $rule); - } - - /** - * 验证是否小于某个值 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function lt($value, $rule, array $data = []): bool - { - return $value < $this->getDataValue($data, $rule); - } - - /** - * 验证是否等于某个值 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function eq($value, $rule): bool - { - return $value == $rule; - } - - /** - * 必须验证 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function must($value, $rule = null): bool - { - return !empty($value) || '0' == $value; - } - - /** - * 验证字段值是否为有效格式 - * @access public - * @param mixed $value 字段值 - * @param string $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function is($value, string $rule, array $data = []): bool - { - switch (Str::camel($rule)) { - case 'require': - // 必须 - $result = !empty($value) || '0' == $value; - break; - case 'accepted': - // 接受 - $result = in_array($value, ['1', 'on', 'yes']); - break; - case 'date': - // 是否是一个有效日期 - $result = false !== strtotime($value); - break; - case 'activeUrl': - // 是否为有效的网址 - $result = checkdnsrr($value); - break; - case 'boolean': - case 'bool': - // 是否为布尔值 - $result = in_array($value, [true, false, 0, 1, '0', '1'], true); - break; - case 'number': - $result = ctype_digit((string) $value); - break; - case 'alphaNum': - $result = ctype_alnum($value); - break; - case 'array': - // 是否为数组 - $result = is_array($value); - break; - case 'file': - $result = $value instanceof File; - break; - case 'image': - $result = $value instanceof File && in_array($this->getImageType($value->getRealPath()), [1, 2, 3, 6]); - break; - case 'token': - $result = $this->token($value, '__token__', $data); - break; - default: - if (isset($this->type[$rule])) { - // 注册的验证规则 - $result = call_user_func_array($this->type[$rule], [$value]); - } elseif (function_exists('ctype_' . $rule)) { - // ctype验证规则 - $ctypeFun = 'ctype_' . $rule; - $result = $ctypeFun($value); - } elseif (isset($this->filter[$rule])) { - // Filter_var验证规则 - $result = $this->filter($value, $this->filter[$rule]); - } else { - // 正则验证 - $result = $this->regex($value, $rule); - } - } - - return $result; - } - - // 判断图像类型 - protected function getImageType($image) - { - if (function_exists('exif_imagetype')) { - return exif_imagetype($image); - } - - try { - $info = getimagesize($image); - return $info ? $info[2] : false; - } catch (\Exception $e) { - return false; - } - } - - /** - * 验证表单令牌 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function token($value, string $rule, array $data): bool - { - $rule = !empty($rule) ? $rule : '__token__'; - return $this->request->checkToken($rule, $data); - } - - /** - * 验证是否为合格的域名或者IP 支持A,MX,NS,SOA,PTR,CNAME,AAAA,A6, SRV,NAPTR,TXT 或者 ANY类型 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function activeUrl(string $value, string $rule = 'MX'): bool - { - if (!in_array($rule, ['A', 'MX', 'NS', 'SOA', 'PTR', 'CNAME', 'AAAA', 'A6', 'SRV', 'NAPTR', 'TXT', 'ANY'])) { - $rule = 'MX'; - } - - return checkdnsrr($value, $rule); - } - - /** - * 验证是否有效IP - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 ipv4 ipv6 - * @return bool - */ - public function ip($value, string $rule = 'ipv4'): bool - { - if (!in_array($rule, ['ipv4', 'ipv6'])) { - $rule = 'ipv4'; - } - - return $this->filter($value, [FILTER_VALIDATE_IP, 'ipv6' == $rule ? FILTER_FLAG_IPV6 : FILTER_FLAG_IPV4]); - } - - /** - * 检测上传文件后缀 - * @access public - * @param File $file - * @param array|string $ext 允许后缀 - * @return bool - */ - protected function checkExt(File $file, $ext): bool - { - if (is_string($ext)) { - $ext = explode(',', $ext); - } - - return in_array(strtolower($file->extension()), $ext); - } - - /** - * 检测上传文件大小 - * @access public - * @param File $file - * @param integer $size 最大大小 - * @return bool - */ - protected function checkSize(File $file, $size): bool - { - return $file->getSize() <= (int) $size; - } - - /** - * 检测上传文件类型 - * @access public - * @param File $file - * @param array|string $mime 允许类型 - * @return bool - */ - protected function checkMime(File $file, $mime): bool - { - if (is_string($mime)) { - $mime = explode(',', $mime); - } - - return in_array(strtolower($file->getMime()), $mime); - } - - /** - * 验证上传文件后缀 - * @access public - * @param mixed $file 上传文件 - * @param mixed $rule 验证规则 - * @return bool - */ - public function fileExt($file, $rule): bool - { - if (is_array($file)) { - foreach ($file as $item) { - if (!($item instanceof File) || !$this->checkExt($item, $rule)) { - return false; - } - } - return true; - } elseif ($file instanceof File) { - return $this->checkExt($file, $rule); - } - - return false; - } - - /** - * 验证上传文件类型 - * @access public - * @param mixed $file 上传文件 - * @param mixed $rule 验证规则 - * @return bool - */ - public function fileMime($file, $rule): bool - { - if (is_array($file)) { - foreach ($file as $item) { - if (!($item instanceof File) || !$this->checkMime($item, $rule)) { - return false; - } - } - return true; - } elseif ($file instanceof File) { - return $this->checkMime($file, $rule); - } - - return false; - } - - /** - * 验证上传文件大小 - * @access public - * @param mixed $file 上传文件 - * @param mixed $rule 验证规则 - * @return bool - */ - public function fileSize($file, $rule): bool - { - if (is_array($file)) { - foreach ($file as $item) { - if (!($item instanceof File) || !$this->checkSize($item, $rule)) { - return false; - } - } - return true; - } elseif ($file instanceof File) { - return $this->checkSize($file, $rule); - } - - return false; - } - - /** - * 验证图片的宽高及类型 - * @access public - * @param mixed $file 上传文件 - * @param mixed $rule 验证规则 - * @return bool - */ - public function image($file, $rule): bool - { - if (!($file instanceof File)) { - return false; - } - - if ($rule) { - $rule = explode(',', $rule); - - [$width, $height, $type] = getimagesize($file->getRealPath()); - - if (isset($rule[2])) { - $imageType = strtolower($rule[2]); - - if ('jpg' == $imageType) { - $imageType = 'jpeg'; - } - - if (image_type_to_extension($type, false) != $imageType) { - return false; - } - } - - [$w, $h] = $rule; - - return $w == $width && $h == $height; - } - - return in_array($this->getImageType($file->getRealPath()), [1, 2, 3, 6]); - } - - /** - * 验证时间和日期是否符合指定格式 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function dateFormat($value, $rule): bool - { - $info = date_parse_from_format($rule, $value); - return 0 == $info['warning_count'] && 0 == $info['error_count']; - } - - /** - * 验证是否唯一 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 格式:数据表,字段名,排除ID,主键名 - * @param array $data 数据 - * @param string $field 验证字段名 - * @return bool - */ - public function unique($value, $rule, array $data = [], string $field = ''): bool - { - if (is_string($rule)) { - $rule = explode(',', $rule); - } - - if (false !== strpos($rule[0], '\\')) { - // 指定模型类 - $db = new $rule[0]; - } else { - $db = $this->db->name($rule[0]); - } - - $key = $rule[1] ?? $field; - $map = []; - - if (strpos($key, '^')) { - // 支持多个字段验证 - $fields = explode('^', $key); - foreach ($fields as $key) { - if (isset($data[$key])) { - $map[] = [$key, '=', $data[$key]]; - } - } - } elseif (isset($data[$field])) { - $map[] = [$key, '=', $data[$field]]; - } else { - $map = []; - } - - $pk = !empty($rule[3]) ? $rule[3] : $db->getPk(); - - if (is_string($pk)) { - if (isset($rule[2])) { - $map[] = [$pk, '<>', $rule[2]]; - } elseif (isset($data[$pk])) { - $map[] = [$pk, '<>', $data[$pk]]; - } - } - - if ($db->where($map)->field($pk)->find()) { - return false; - } - - return true; - } - - /** - * 使用filter_var方式验证 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function filter($value, $rule): bool - { - if (is_string($rule) && strpos($rule, ',')) { - [$rule, $param] = explode(',', $rule); - } elseif (is_array($rule)) { - $param = $rule[1] ?? 0; - $rule = $rule[0]; - } else { - $param = 0; - } - - return false !== filter_var($value, is_int($rule) ? $rule : filter_id($rule), $param); - } - - /** - * 验证某个字段等于某个值的时候必须 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function requireIf($value, $rule, array $data = []): bool - { - [$field, $val] = explode(',', $rule); - - if ($this->getDataValue($data, $field) == $val) { - return !empty($value) || '0' == $value; - } - - return true; - } - - /** - * 通过回调方法验证某个字段是否必须 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function requireCallback($value, $rule, array $data = []): bool - { - $result = call_user_func_array([$this, $rule], [$value, $data]); - - if ($result) { - return !empty($value) || '0' == $value; - } - - return true; - } - - /** - * 验证某个字段有值的情况下必须 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function requireWith($value, $rule, array $data = []): bool - { - $val = $this->getDataValue($data, $rule); - - if (!empty($val)) { - return !empty($value) || '0' == $value; - } - - return true; - } - - /** - * 验证某个字段没有值的情况下必须 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function requireWithout($value, $rule, array $data = []): bool - { - $val = $this->getDataValue($data, $rule); - - if (empty($val)) { - return !empty($value) || '0' == $value; - } - - return true; - } - - /** - * 验证是否在范围内 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function in($value, $rule): bool - { - return in_array($value, is_array($rule) ? $rule : explode(',', $rule)); - } - - /** - * 验证是否不在某个范围 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function notIn($value, $rule): bool - { - return !in_array($value, is_array($rule) ? $rule : explode(',', $rule)); - } - - /** - * between验证数据 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function between($value, $rule): bool - { - if (is_string($rule)) { - $rule = explode(',', $rule); - } - [$min, $max] = $rule; - - return $value >= $min && $value <= $max; - } - - /** - * 使用notbetween验证数据 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function notBetween($value, $rule): bool - { - if (is_string($rule)) { - $rule = explode(',', $rule); - } - [$min, $max] = $rule; - - return $value < $min || $value > $max; - } - - /** - * 验证数据长度 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function length($value, $rule): bool - { - if (is_array($value)) { - $length = count($value); - } elseif ($value instanceof File) { - $length = $value->getSize(); - } else { - $length = mb_strlen((string) $value); - } - - if (is_string($rule) && strpos($rule, ',')) { - // 长度区间 - [$min, $max] = explode(',', $rule); - return $length >= $min && $length <= $max; - } - - // 指定长度 - return $length == $rule; - } - - /** - * 验证数据最大长度 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function max($value, $rule): bool - { - if (is_array($value)) { - $length = count($value); - } elseif ($value instanceof File) { - $length = $value->getSize(); - } else { - $length = mb_strlen((string) $value); - } - - return $length <= $rule; - } - - /** - * 验证数据最小长度 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function min($value, $rule): bool - { - if (is_array($value)) { - $length = count($value); - } elseif ($value instanceof File) { - $length = $value->getSize(); - } else { - $length = mb_strlen((string) $value); - } - - return $length >= $rule; - } - - /** - * 验证日期 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function after($value, $rule, array $data = []): bool - { - return strtotime($value) >= strtotime($rule); - } - - /** - * 验证日期 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function before($value, $rule, array $data = []): bool - { - return strtotime($value) <= strtotime($rule); - } - - /** - * 验证日期 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function afterWith($value, $rule, array $data = []): bool - { - $rule = $this->getDataValue($data, $rule); - return !is_null($rule) && strtotime($value) >= strtotime($rule); - } - - /** - * 验证日期 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @param array $data 数据 - * @return bool - */ - public function beforeWith($value, $rule, array $data = []): bool - { - $rule = $this->getDataValue($data, $rule); - return !is_null($rule) && strtotime($value) <= strtotime($rule); - } - - /** - * 验证有效期 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function expire($value, $rule): bool - { - if (is_string($rule)) { - $rule = explode(',', $rule); - } - - [$start, $end] = $rule; - - if (!is_numeric($start)) { - $start = strtotime($start); - } - - if (!is_numeric($end)) { - $end = strtotime($end); - } - - return time() >= $start && time() <= $end; - } - - /** - * 验证IP许可 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function allowIp($value, $rule): bool - { - return in_array($value, is_array($rule) ? $rule : explode(',', $rule)); - } - - /** - * 验证IP禁用 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 - * @return bool - */ - public function denyIp($value, $rule): bool - { - return !in_array($value, is_array($rule) ? $rule : explode(',', $rule)); - } - - /** - * 使用正则验证数据 - * @access public - * @param mixed $value 字段值 - * @param mixed $rule 验证规则 正则规则或者预定义正则名 - * @return bool - */ - public function regex($value, $rule): bool - { - if (isset($this->regex[$rule])) { - $rule = $this->regex[$rule]; - } elseif (isset($this->defaultRegex[$rule])) { - $rule = $this->defaultRegex[$rule]; - } - - if (is_string($rule) && 0 !== strpos($rule, '/') && !preg_match('/\/[imsU]{0,4}$/', $rule)) { - // 不是正则表达式则两端补上/ - $rule = '/^' . $rule . '$/'; - } - - return is_scalar($value) && 1 === preg_match($rule, (string) $value); - } - - /** - * 获取错误信息 - * @return array|string - */ - public function getError() - { - return $this->error; - } - - /** - * 获取数据值 - * @access protected - * @param array $data 数据 - * @param string $key 数据标识 支持二维 - * @return mixed - */ - protected function getDataValue(array $data, $key) - { - if (is_numeric($key)) { - $value = $key; - } elseif (is_string($key) && strpos($key, '.')) { - // 支持多维数组验证 - foreach (explode('.', $key) as $key) { - if (!isset($data[$key])) { - $value = null; - break; - } - $value = $data = $data[$key]; - } - } else { - $value = $data[$key] ?? null; - } - - return $value; - } - - /** - * 获取验证规则的错误提示信息 - * @access protected - * @param string $attribute 字段英文名 - * @param string $title 字段描述名 - * @param string $type 验证规则名称 - * @param mixed $rule 验证规则数据 - * @return string|array - */ - protected function getRuleMsg(string $attribute, string $title, string $type, $rule) - { - if (isset($this->message[$attribute . '.' . $type])) { - $msg = $this->message[$attribute . '.' . $type]; - } elseif (isset($this->message[$attribute][$type])) { - $msg = $this->message[$attribute][$type]; - } elseif (isset($this->message[$attribute])) { - $msg = $this->message[$attribute]; - } elseif (isset($this->typeMsg[$type])) { - $msg = $this->typeMsg[$type]; - } elseif (0 === strpos($type, 'require')) { - $msg = $this->typeMsg['require']; - } else { - $msg = $title . $this->lang->get('not conform to the rules'); - } - - if (is_array($msg)) { - return $this->errorMsgIsArray($msg, $rule, $title); - } - - return $this->parseErrorMsg($msg, $rule, $title); - } - - /** - * 获取验证规则的错误提示信息 - * @access protected - * @param string $msg 错误信息 - * @param mixed $rule 验证规则数据 - * @param string $title 字段描述名 - * @return string|array - */ - protected function parseErrorMsg(string $msg, $rule, string $title) - { - if (0 === strpos($msg, '{%')) { - $msg = $this->lang->get(substr($msg, 2, -1)); - } elseif ($this->lang->has($msg)) { - $msg = $this->lang->get($msg); - } - - if (is_array($msg)) { - return $this->errorMsgIsArray($msg, $rule, $title); - } - - // rule若是数组则转为字符串 - if (is_array($rule)) { - $rule = implode(',', $rule); - } - - if (is_scalar($rule) && false !== strpos($msg, ':')) { - // 变量替换 - if (is_string($rule) && strpos($rule, ',')) { - $array = array_pad(explode(',', $rule), 3, ''); - } else { - $array = array_pad([], 3, ''); - } - - $msg = str_replace( - [':attribute', ':1', ':2', ':3'], - [$title, $array[0], $array[1], $array[2]], - $msg - ); - - if (strpos($msg, ':rule')) { - $msg = str_replace(':rule', (string) $rule, $msg); - } - } - - return $msg; - } - - /** - * 错误信息数组处理 - * @access protected - * @param array $msg 错误信息 - * @param mixed $rule 验证规则数据 - * @param string $title 字段描述名 - * @return array - */ - protected function errorMsgIsArray(array $msg, $rule, string $title) - { - foreach ($msg as $key => $val) { - if (is_string($val)) { - $msg[$key] = $this->parseErrorMsg($val, $rule, $title); - } - } - return $msg; - } - - /** - * 获取数据验证的场景 - * @access protected - * @param string $scene 验证场景 - * @return void - */ - protected function getScene(string $scene): void - { - $this->only = $this->append = $this->remove = []; - - if (method_exists($this, 'scene' . $scene)) { - call_user_func([$this, 'scene' . $scene]); - } elseif (isset($this->scene[$scene])) { - // 如果设置了验证适用场景 - $this->only = $this->scene[$scene]; - } - } - - /** - * 动态方法 直接调用is方法进行验证 - * @access public - * @param string $method 方法名 - * @param array $args 调用参数 - * @return bool - */ - public function __call($method, $args) - { - if ('is' == strtolower(substr($method, 0, 2))) { - $method = substr($method, 2); - } - - array_push($args, lcfirst($method)); - - return call_user_func_array([$this, 'is'], $args); - } -} diff --git a/vendor/topthink/framework/src/think/View.php b/vendor/topthink/framework/src/think/View.php deleted file mode 100644 index 2e710884..00000000 --- a/vendor/topthink/framework/src/think/View.php +++ /dev/null @@ -1,191 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use think\helper\Arr; - -/** - * 视图类 - * @package think - */ -class View extends Manager -{ - - protected $namespace = '\\think\\view\\driver\\'; - - /** - * 模板变量 - * @var array - */ - protected $data = []; - - /** - * 内容过滤 - * @var mixed - */ - protected $filter; - - /** - * 获取模板引擎 - * @access public - * @param string $type 模板引擎类型 - * @return $this - */ - public function engine(string $type = null) - { - return $this->driver($type); - } - - /** - * 模板变量赋值 - * @access public - * @param string|array $name 模板变量 - * @param mixed $value 变量值 - * @return $this - */ - public function assign($name, $value = null) - { - if (is_array($name)) { - $this->data = array_merge($this->data, $name); - } else { - $this->data[$name] = $value; - } - - return $this; - } - - /** - * 视图过滤 - * @access public - * @param Callable $filter 过滤方法或闭包 - * @return $this - */ - public function filter(callable $filter = null) - { - $this->filter = $filter; - return $this; - } - - /** - * 解析和获取模板内容 用于输出 - * @access public - * @param string $template 模板文件名或者内容 - * @param array $vars 模板变量 - * @return string - * @throws \Exception - */ - public function fetch(string $template = '', array $vars = []): string - { - return $this->getContent(function () use ($vars, $template) { - $this->engine()->fetch($template, array_merge($this->data, $vars)); - }); - } - - /** - * 渲染内容输出 - * @access public - * @param string $content 内容 - * @param array $vars 模板变量 - * @return string - */ - public function display(string $content, array $vars = []): string - { - return $this->getContent(function () use ($vars, $content) { - $this->engine()->display($content, array_merge($this->data, $vars)); - }); - } - - /** - * 获取模板引擎渲染内容 - * @param $callback - * @return string - * @throws \Exception - */ - protected function getContent($callback): string - { - // 页面缓存 - ob_start(); - if (PHP_VERSION > 8.0) { - ob_implicit_flush(false); - } else { - ob_implicit_flush(0); - } - - // 渲染输出 - try { - $callback(); - } catch (\Exception $e) { - ob_end_clean(); - throw $e; - } - - // 获取并清空缓存 - $content = ob_get_clean(); - - if ($this->filter) { - $content = call_user_func_array($this->filter, [$content]); - } - - return $content; - } - - /** - * 模板变量赋值 - * @access public - * @param string $name 变量名 - * @param mixed $value 变量值 - */ - public function __set($name, $value) - { - $this->data[$name] = $value; - } - - /** - * 取得模板显示变量的值 - * @access protected - * @param string $name 模板变量 - * @return mixed - */ - public function __get($name) - { - return $this->data[$name]; - } - - /** - * 检测模板变量是否设置 - * @access public - * @param string $name 模板变量名 - * @return bool - */ - public function __isset($name) - { - return isset($this->data[$name]); - } - - protected function resolveConfig(string $name) - { - $config = $this->app->config->get('view', []); - Arr::forget($config, 'type'); - return $config; - } - - /** - * 默认驱动 - * @return string|null - */ - public function getDefaultDriver() - { - return $this->app->config->get('view.type', 'php'); - } - -} diff --git a/vendor/topthink/framework/src/think/cache/Driver.php b/vendor/topthink/framework/src/think/cache/Driver.php deleted file mode 100644 index 5813c7b3..00000000 --- a/vendor/topthink/framework/src/think/cache/Driver.php +++ /dev/null @@ -1,357 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\cache; - -use Closure; -use DateInterval; -use DateTime; -use DateTimeInterface; -use Exception; -use Psr\SimpleCache\CacheInterface; -use think\Container; -use think\contract\CacheHandlerInterface; -use think\exception\InvalidArgumentException; -use throwable; - -/** - * 缓存基础类 - */ -abstract class Driver implements CacheInterface, CacheHandlerInterface -{ - /** - * 驱动句柄 - * @var object - */ - protected $handler = null; - - /** - * 缓存读取次数 - * @var integer - */ - protected $readTimes = 0; - - /** - * 缓存写入次数 - * @var integer - */ - protected $writeTimes = 0; - - /** - * 缓存参数 - * @var array - */ - protected $options = []; - - /** - * 缓存标签 - * @var array - */ - protected $tag = []; - - /** - * 获取有效期 - * @access protected - * @param integer|DateTimeInterface|DateInterval $expire 有效期 - * @return int - */ - protected function getExpireTime($expire): int - { - if ($expire instanceof DateTimeInterface) { - $expire = $expire->getTimestamp() - time(); - } elseif ($expire instanceof DateInterval) { - $expire = DateTime::createFromFormat('U', (string) time()) - ->add($expire) - ->format('U') - time(); - } - - return (int) $expire; - } - - /** - * 获取实际的缓存标识 - * @access public - * @param string $name 缓存名 - * @return string - */ - public function getCacheKey(string $name): string - { - return $this->options['prefix'] . $name; - } - - /** - * 读取缓存并删除 - * @access public - * @param string $name 缓存变量名 - * @return mixed - */ - public function pull(string $name) - { - $result = $this->get($name, false); - - if ($result) { - $this->delete($name); - return $result; - } - } - - /** - * 追加(数组)缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @return void - */ - public function push(string $name, $value): void - { - $item = $this->get($name, []); - - if (!is_array($item)) { - throw new InvalidArgumentException('only array cache can be push'); - } - - $item[] = $value; - - if (count($item) > 1000) { - array_shift($item); - } - - $item = array_unique($item); - - $this->set($name, $item); - } - - /** - * 追加TagSet数据 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @return void - */ - public function append(string $name, $value): void - { - $this->push($name, $value); - } - - /** - * 如果不存在则写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param int $expire 有效时间 0为永久 - * @return mixed - */ - public function remember(string $name, $value, $expire = null) - { - if ($this->has($name)) { - return $this->get($name); - } - - $time = time(); - - while ($time + 5 > time() && $this->has($name . '_lock')) { - // 存在锁定则等待 - usleep(200000); - } - - try { - // 锁定 - $this->set($name . '_lock', true); - - if ($value instanceof Closure) { - // 获取缓存数据 - $value = Container::getInstance()->invokeFunction($value); - } - - // 缓存数据 - $this->set($name, $value, $expire); - - // 解锁 - $this->delete($name . '_lock'); - } catch (Exception | throwable $e) { - $this->delete($name . '_lock'); - throw $e; - } - - return $value; - } - - /** - * 缓存标签 - * @access public - * @param string|array $name 标签名 - * @return TagSet - */ - public function tag($name): TagSet - { - $name = (array) $name; - $key = implode('-', $name); - - if (!isset($this->tag[$key])) { - $this->tag[$key] = new TagSet($name, $this); - } - - return $this->tag[$key]; - } - - /** - * 获取标签包含的缓存标识 - * @access public - * @param string $tag 标签标识 - * @return array - */ - public function getTagItems(string $tag): array - { - $name = $this->getTagKey($tag); - return $this->get($name, []); - } - - /** - * 获取实际标签名 - * @access public - * @param string $tag 标签名 - * @return string - */ - public function getTagKey(string $tag): string - { - return $this->options['tag_prefix'] . md5($tag); - } - - /** - * 序列化数据 - * @access protected - * @param mixed $data 缓存数据 - * @return string - */ - protected function serialize($data): string - { - if (is_numeric($data)) { - return (string) $data; - } - - $serialize = $this->options['serialize'][0] ?? "serialize"; - - return $serialize($data); - } - - /** - * 反序列化数据 - * @access protected - * @param string $data 缓存数据 - * @return mixed - */ - protected function unserialize(string $data) - { - if (is_numeric($data)) { - return $data; - } - - $unserialize = $this->options['serialize'][1] ?? "unserialize"; - - return $unserialize($data); - } - - /** - * 返回句柄对象,可执行其它高级方法 - * - * @access public - * @return object - */ - public function handler() - { - return $this->handler; - } - - /** - * 返回缓存读取次数 - * @access public - * @return int - */ - public function getReadTimes(): int - { - return $this->readTimes; - } - - /** - * 返回缓存写入次数 - * @access public - * @return int - */ - public function getWriteTimes(): int - { - return $this->writeTimes; - } - - /** - * 读取缓存 - * @access public - * @param iterable $keys 缓存变量名 - * @param mixed $default 默认值 - * @return iterable - * @throws InvalidArgumentException - */ - public function getMultiple($keys, $default = null): iterable - { - $result = []; - - foreach ($keys as $key) { - $result[$key] = $this->get($key, $default); - } - - return $result; - } - - /** - * 写入缓存 - * @access public - * @param iterable $values 缓存数据 - * @param null|int|\DateInterval $ttl 有效时间 0为永久 - * @return bool - */ - public function setMultiple($values, $ttl = null): bool - { - foreach ($values as $key => $val) { - $result = $this->set($key, $val, $ttl); - - if (false === $result) { - return false; - } - } - - return true; - } - - /** - * 删除缓存 - * @access public - * @param iterable $keys 缓存变量名 - * @return bool - * @throws InvalidArgumentException - */ - public function deleteMultiple($keys): bool - { - foreach ($keys as $key) { - $result = $this->delete($key); - - if (false === $result) { - return false; - } - } - - return true; - } - - public function __call($method, $args) - { - return call_user_func_array([$this->handler, $method], $args); - } -} diff --git a/vendor/topthink/framework/src/think/cache/TagSet.php b/vendor/topthink/framework/src/think/cache/TagSet.php deleted file mode 100644 index 5ba20769..00000000 --- a/vendor/topthink/framework/src/think/cache/TagSet.php +++ /dev/null @@ -1,132 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\cache; - -/** - * 标签集合 - */ -class TagSet -{ - /** - * 标签的缓存Key - * @var array - */ - protected $tag; - - /** - * 缓存句柄 - * @var Driver - */ - protected $handler; - - /** - * 架构函数 - * @access public - * @param array $tag 缓存标签 - * @param Driver $cache 缓存对象 - */ - public function __construct(array $tag, Driver $cache) - { - $this->tag = $tag; - $this->handler = $cache; - } - - /** - * 写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param integer|\DateTime $expire 有效时间(秒) - * @return bool - */ - public function set(string $name, $value, $expire = null): bool - { - $this->handler->set($name, $value, $expire); - - $this->append($name); - - return true; - } - - /** - * 追加缓存标识到标签 - * @access public - * @param string $name 缓存变量名 - * @return void - */ - public function append(string $name): void - { - $name = $this->handler->getCacheKey($name); - - foreach ($this->tag as $tag) { - $key = $this->handler->getTagKey($tag); - $this->handler->append($key, $name); - } - } - - /** - * 写入缓存 - * @access public - * @param iterable $values 缓存数据 - * @param null|int|\DateInterval $ttl 有效时间 0为永久 - * @return bool - */ - public function setMultiple($values, $ttl = null): bool - { - foreach ($values as $key => $val) { - $result = $this->set($key, $val, $ttl); - - if (false === $result) { - return false; - } - } - - return true; - } - - /** - * 如果不存在则写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param int $expire 有效时间 0为永久 - * @return mixed - */ - public function remember(string $name, $value, $expire = null) - { - $result = $this->handler->remember($name, $value, $expire); - - $this->append($name); - - return $result; - } - - /** - * 清除缓存 - * @access public - * @return bool - */ - public function clear(): bool - { - // 指定标签清除 - foreach ($this->tag as $tag) { - $names = $this->handler->getTagItems($tag); - $this->handler->clearTag($names); - - $key = $this->handler->getTagKey($tag); - $this->handler->delete($key); - } - - return true; - } -} diff --git a/vendor/topthink/framework/src/think/cache/driver/File.php b/vendor/topthink/framework/src/think/cache/driver/File.php deleted file mode 100644 index b36b0696..00000000 --- a/vendor/topthink/framework/src/think/cache/driver/File.php +++ /dev/null @@ -1,304 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\cache\driver; - -use FilesystemIterator; -use think\App; -use think\cache\Driver; - -/** - * 文件缓存类 - */ -class File extends Driver -{ - /** - * 配置参数 - * @var array - */ - protected $options = [ - 'expire' => 0, - 'cache_subdir' => true, - 'prefix' => '', - 'path' => '', - 'hash_type' => 'md5', - 'data_compress' => false, - 'tag_prefix' => 'tag:', - 'serialize' => [], - ]; - - /** - * 架构函数 - * @param App $app - * @param array $options 参数 - */ - public function __construct(App $app, array $options = []) - { - if (!empty($options)) { - $this->options = array_merge($this->options, $options); - } - - if (empty($this->options['path'])) { - $this->options['path'] = $app->getRuntimePath() . 'cache'; - } - - if (substr($this->options['path'], -1) != DIRECTORY_SEPARATOR) { - $this->options['path'] .= DIRECTORY_SEPARATOR; - } - } - - /** - * 取得变量的存储文件名 - * @access public - * @param string $name 缓存变量名 - * @return string - */ - public function getCacheKey(string $name): string - { - $name = hash($this->options['hash_type'], $name); - - if ($this->options['cache_subdir']) { - // 使用子目录 - $name = substr($name, 0, 2) . DIRECTORY_SEPARATOR . substr($name, 2); - } - - if ($this->options['prefix']) { - $name = $this->options['prefix'] . DIRECTORY_SEPARATOR . $name; - } - - return $this->options['path'] . $name . '.php'; - } - - /** - * 获取缓存数据 - * @param string $name 缓存标识名 - * @return array|null - */ - protected function getRaw(string $name) - { - $filename = $this->getCacheKey($name); - - if (!is_file($filename)) { - return; - } - - $content = @file_get_contents($filename); - - if (false !== $content) { - $expire = (int) substr($content, 8, 12); - if (0 != $expire && time() - $expire > filemtime($filename)) { - //缓存过期删除缓存文件 - $this->unlink($filename); - return; - } - - $content = substr($content, 32); - - if ($this->options['data_compress'] && function_exists('gzcompress')) { - //启用数据压缩 - $content = gzuncompress($content); - } - - return is_string($content) ? ['content' => $content, 'expire' => $expire] : null; - } - } - - /** - * 判断缓存是否存在 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function has($name): bool - { - return $this->getRaw($name) !== null; - } - - /** - * 读取缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function get($name, $default = null) - { - $this->readTimes++; - - $raw = $this->getRaw($name); - - return is_null($raw) ? $default : $this->unserialize($raw['content']); - } - - /** - * 写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param int|\DateTime $expire 有效时间 0为永久 - * @return bool - */ - public function set($name, $value, $expire = null): bool - { - $this->writeTimes++; - - if (is_null($expire)) { - $expire = $this->options['expire']; - } - - $expire = $this->getExpireTime($expire); - $filename = $this->getCacheKey($name); - - $dir = dirname($filename); - - if (!is_dir($dir)) { - try { - mkdir($dir, 0755, true); - } catch (\Exception $e) { - // 创建失败 - } - } - - $data = $this->serialize($value); - - if ($this->options['data_compress'] && function_exists('gzcompress')) { - //数据压缩 - $data = gzcompress($data, 3); - } - - $data = "\n" . $data; - $result = file_put_contents($filename, $data); - - if ($result) { - clearstatcache(); - return true; - } - - return false; - } - - /** - * 自增缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function inc(string $name, int $step = 1) - { - if ($raw = $this->getRaw($name)) { - $value = $this->unserialize($raw['content']) + $step; - $expire = $raw['expire']; - } else { - $value = $step; - $expire = 0; - } - - return $this->set($name, $value, $expire) ? $value : false; - } - - /** - * 自减缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function dec(string $name, int $step = 1) - { - return $this->inc($name, -$step); - } - - /** - * 删除缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function delete($name): bool - { - $this->writeTimes++; - - return $this->unlink($this->getCacheKey($name)); - } - - /** - * 清除缓存 - * @access public - * @return bool - */ - public function clear(): bool - { - $this->writeTimes++; - - $dirname = $this->options['path'] . $this->options['prefix']; - - $this->rmdir($dirname); - - return true; - } - - /** - * 删除缓存标签 - * @access public - * @param array $keys 缓存标识列表 - * @return void - */ - public function clearTag(array $keys): void - { - foreach ($keys as $key) { - $this->unlink($key); - } - } - - /** - * 判断文件是否存在后,删除 - * @access private - * @param string $path - * @return bool - */ - private function unlink(string $path): bool - { - try { - return is_file($path) && unlink($path); - } catch (\Exception $e) { - return false; - } - } - - /** - * 删除文件夹 - * @param $dirname - * @return bool - */ - private function rmdir($dirname) - { - if (!is_dir($dirname)) { - return false; - } - - $items = new FilesystemIterator($dirname); - - foreach ($items as $item) { - if ($item->isDir() && !$item->isLink()) { - $this->rmdir($item->getPathname()); - } else { - $this->unlink($item->getPathname()); - } - } - - @rmdir($dirname); - - return true; - } - -} diff --git a/vendor/topthink/framework/src/think/cache/driver/Memcache.php b/vendor/topthink/framework/src/think/cache/driver/Memcache.php deleted file mode 100644 index 2fbbb9c7..00000000 --- a/vendor/topthink/framework/src/think/cache/driver/Memcache.php +++ /dev/null @@ -1,209 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\cache\driver; - -use think\cache\Driver; - -/** - * Memcache缓存类 - */ -class Memcache extends Driver -{ - /** - * 配置参数 - * @var array - */ - protected $options = [ - 'host' => '127.0.0.1', - 'port' => 11211, - 'expire' => 0, - 'timeout' => 0, // 超时时间(单位:毫秒) - 'persistent' => true, - 'prefix' => '', - 'tag_prefix' => 'tag:', - 'serialize' => [], - ]; - - /** - * 架构函数 - * @access public - * @param array $options 缓存参数 - * @throws \BadFunctionCallException - */ - public function __construct(array $options = []) - { - if (!extension_loaded('memcache')) { - throw new \BadFunctionCallException('not support: memcache'); - } - - if (!empty($options)) { - $this->options = array_merge($this->options, $options); - } - - $this->handler = new \Memcache; - - // 支持集群 - $hosts = (array) $this->options['host']; - $ports = (array) $this->options['port']; - - if (empty($ports[0])) { - $ports[0] = 11211; - } - - // 建立连接 - foreach ($hosts as $i => $host) { - $port = $ports[$i] ?? $ports[0]; - $this->options['timeout'] > 0 ? - $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, (int) $this->options['timeout']) : - $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1); - } - } - - /** - * 判断缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function has($name): bool - { - $key = $this->getCacheKey($name); - - return false !== $this->handler->get($key); - } - - /** - * 读取缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function get($name, $default = null) - { - $this->readTimes++; - - $result = $this->handler->get($this->getCacheKey($name)); - - return false !== $result ? $this->unserialize($result) : $default; - } - - /** - * 写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param int|\DateTime $expire 有效时间(秒) - * @return bool - */ - public function set($name, $value, $expire = null): bool - { - $this->writeTimes++; - - if (is_null($expire)) { - $expire = $this->options['expire']; - } - - $key = $this->getCacheKey($name); - $expire = $this->getExpireTime($expire); - $value = $this->serialize($value); - - if ($this->handler->set($key, $value, 0, $expire)) { - return true; - } - - return false; - } - - /** - * 自增缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function inc(string $name, int $step = 1) - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - - if ($this->handler->get($key)) { - return $this->handler->increment($key, $step); - } - - return $this->handler->set($key, $step); - } - - /** - * 自减缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function dec(string $name, int $step = 1) - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - $value = $this->handler->get($key) - $step; - $res = $this->handler->set($key, $value); - - return !$res ? false : $value; - } - - /** - * 删除缓存 - * @access public - * @param string $name 缓存变量名 - * @param bool|false $ttl - * @return bool - */ - public function delete($name, $ttl = false): bool - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - - return false === $ttl ? - $this->handler->delete($key) : - $this->handler->delete($key, $ttl); - } - - /** - * 清除缓存 - * @access public - * @return bool - */ - public function clear(): bool - { - $this->writeTimes++; - - return $this->handler->flush(); - } - - /** - * 删除缓存标签 - * @access public - * @param array $keys 缓存标识列表 - * @return void - */ - public function clearTag(array $keys): void - { - foreach ($keys as $key) { - $this->handler->delete($key); - } - } - -} diff --git a/vendor/topthink/framework/src/think/cache/driver/Memcached.php b/vendor/topthink/framework/src/think/cache/driver/Memcached.php deleted file mode 100644 index 71edb058..00000000 --- a/vendor/topthink/framework/src/think/cache/driver/Memcached.php +++ /dev/null @@ -1,221 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\cache\driver; - -use think\cache\Driver; - -/** - * Memcached缓存类 - */ -class Memcached extends Driver -{ - /** - * 配置参数 - * @var array - */ - protected $options = [ - 'host' => '127.0.0.1', - 'port' => 11211, - 'expire' => 0, - 'timeout' => 0, // 超时时间(单位:毫秒) - 'prefix' => '', - 'username' => '', //账号 - 'password' => '', //密码 - 'option' => [], - 'tag_prefix' => 'tag:', - 'serialize' => [], - ]; - - /** - * 架构函数 - * @access public - * @param array $options 缓存参数 - */ - public function __construct(array $options = []) - { - if (!extension_loaded('memcached')) { - throw new \BadFunctionCallException('not support: memcached'); - } - - if (!empty($options)) { - $this->options = array_merge($this->options, $options); - } - - $this->handler = new \Memcached; - - if (!empty($this->options['option'])) { - $this->handler->setOptions($this->options['option']); - } - - // 设置连接超时时间(单位:毫秒) - if ($this->options['timeout'] > 0) { - $this->handler->setOption(\Memcached::OPT_CONNECT_TIMEOUT, $this->options['timeout']); - } - - // 支持集群 - $hosts = (array) $this->options['host']; - $ports = (array) $this->options['port']; - if (empty($ports[0])) { - $ports[0] = 11211; - } - - // 建立连接 - $servers = []; - foreach ($hosts as $i => $host) { - $servers[] = [$host, $ports[$i] ?? $ports[0], 1]; - } - - $this->handler->addServers($servers); - - if ('' != $this->options['username']) { - $this->handler->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); - $this->handler->setSaslAuthData($this->options['username'], $this->options['password']); - } - } - - /** - * 判断缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function has($name): bool - { - $key = $this->getCacheKey($name); - - return $this->handler->get($key) ? true : false; - } - - /** - * 读取缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function get($name, $default = null) - { - $this->readTimes++; - - $result = $this->handler->get($this->getCacheKey($name)); - - return false !== $result ? $this->unserialize($result) : $default; - } - - /** - * 写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param integer|\DateTime $expire 有效时间(秒) - * @return bool - */ - public function set($name, $value, $expire = null): bool - { - $this->writeTimes++; - - if (is_null($expire)) { - $expire = $this->options['expire']; - } - - $key = $this->getCacheKey($name); - $expire = $this->getExpireTime($expire); - $value = $this->serialize($value); - - if ($this->handler->set($key, $value, $expire)) { - return true; - } - - return false; - } - - /** - * 自增缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function inc(string $name, int $step = 1) - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - - if ($this->handler->get($key)) { - return $this->handler->increment($key, $step); - } - - return $this->handler->set($key, $step); - } - - /** - * 自减缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function dec(string $name, int $step = 1) - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - $value = $this->handler->get($key) - $step; - $res = $this->handler->set($key, $value); - - return !$res ? false : $value; - } - - /** - * 删除缓存 - * @access public - * @param string $name 缓存变量名 - * @param bool|false $ttl - * @return bool - */ - public function delete($name, $ttl = false): bool - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - - return false === $ttl ? - $this->handler->delete($key) : - $this->handler->delete($key, $ttl); - } - - /** - * 清除缓存 - * @access public - * @return bool - */ - public function clear(): bool - { - $this->writeTimes++; - - return $this->handler->flush(); - } - - /** - * 删除缓存标签 - * @access public - * @param array $keys 缓存标识列表 - * @return void - */ - public function clearTag(array $keys): void - { - $this->handler->deleteMulti($keys); - } - -} diff --git a/vendor/topthink/framework/src/think/cache/driver/Redis.php b/vendor/topthink/framework/src/think/cache/driver/Redis.php deleted file mode 100644 index 791b27b8..00000000 --- a/vendor/topthink/framework/src/think/cache/driver/Redis.php +++ /dev/null @@ -1,249 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\cache\driver; - -use think\cache\Driver; - -/** - * Redis缓存驱动,适合单机部署、有前端代理实现高可用的场景,性能最好 - * 有需要在业务层实现读写分离、或者使用RedisCluster的需求,请使用Redisd驱动 - * - * 要求安装phpredis扩展:https://github.com/nicolasff/phpredis - * @author 尘缘 <130775@qq.com> - */ -class Redis extends Driver -{ - /** @var \Predis\Client|\Redis */ - protected $handler; - - /** - * 配置参数 - * @var array - */ - protected $options = [ - 'host' => '127.0.0.1', - 'port' => 6379, - 'password' => '', - 'select' => 0, - 'timeout' => 0, - 'expire' => 0, - 'persistent' => false, - 'prefix' => '', - 'tag_prefix' => 'tag:', - 'serialize' => [], - ]; - - /** - * 架构函数 - * @access public - * @param array $options 缓存参数 - */ - public function __construct(array $options = []) - { - if (!empty($options)) { - $this->options = array_merge($this->options, $options); - } - - if (extension_loaded('redis')) { - $this->handler = new \Redis; - - if ($this->options['persistent']) { - $this->handler->pconnect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout'], 'persistent_id_' . $this->options['select']); - } else { - $this->handler->connect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout']); - } - - if ('' != $this->options['password']) { - $this->handler->auth($this->options['password']); - } - } elseif (class_exists('\Predis\Client')) { - $params = []; - foreach ($this->options as $key => $val) { - if (in_array($key, ['aggregate', 'cluster', 'connections', 'exceptions', 'prefix', 'profile', 'replication', 'parameters'])) { - $params[$key] = $val; - unset($this->options[$key]); - } - } - - if ('' == $this->options['password']) { - unset($this->options['password']); - } - - $this->handler = new \Predis\Client($this->options, $params); - - $this->options['prefix'] = ''; - } else { - throw new \BadFunctionCallException('not support: redis'); - } - - if (0 != $this->options['select']) { - $this->handler->select((int) $this->options['select']); - } - } - - /** - * 判断缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function has($name): bool - { - return $this->handler->exists($this->getCacheKey($name)) ? true : false; - } - - /** - * 读取缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function get($name, $default = null) - { - $this->readTimes++; - $key = $this->getCacheKey($name); - $value = $this->handler->get($key); - - if (false === $value || is_null($value)) { - return $default; - } - - return $this->unserialize($value); - } - - /** - * 写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param integer|\DateTime $expire 有效时间(秒) - * @return bool - */ - public function set($name, $value, $expire = null): bool - { - $this->writeTimes++; - - if (is_null($expire)) { - $expire = $this->options['expire']; - } - - $key = $this->getCacheKey($name); - $expire = $this->getExpireTime($expire); - $value = $this->serialize($value); - - if ($expire) { - $this->handler->setex($key, $expire, $value); - } else { - $this->handler->set($key, $value); - } - - return true; - } - - /** - * 自增缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function inc(string $name, int $step = 1) - { - $this->writeTimes++; - $key = $this->getCacheKey($name); - - return $this->handler->incrby($key, $step); - } - - /** - * 自减缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function dec(string $name, int $step = 1) - { - $this->writeTimes++; - $key = $this->getCacheKey($name); - - return $this->handler->decrby($key, $step); - } - - /** - * 删除缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function delete($name): bool - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - $result = $this->handler->del($key); - return $result > 0; - } - - /** - * 清除缓存 - * @access public - * @return bool - */ - public function clear(): bool - { - $this->writeTimes++; - $this->handler->flushDB(); - return true; - } - - /** - * 删除缓存标签 - * @access public - * @param array $keys 缓存标识列表 - * @return void - */ - public function clearTag(array $keys): void - { - // 指定标签清除 - $this->handler->del($keys); - } - - /** - * 追加TagSet数据 - * @access public - * @param string $name 缓存标识 - * @param mixed $value 数据 - * @return void - */ - public function append(string $name, $value): void - { - $key = $this->getCacheKey($name); - $this->handler->sAdd($key, $value); - } - - /** - * 获取标签包含的缓存标识 - * @access public - * @param string $tag 缓存标签 - * @return array - */ - public function getTagItems(string $tag): array - { - $name = $this->getTagKey($tag); - $key = $this->getCacheKey($name); - return $this->handler->sMembers($key); - } - -} diff --git a/vendor/topthink/framework/src/think/cache/driver/Wincache.php b/vendor/topthink/framework/src/think/cache/driver/Wincache.php deleted file mode 100644 index 8b3e8b86..00000000 --- a/vendor/topthink/framework/src/think/cache/driver/Wincache.php +++ /dev/null @@ -1,175 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\cache\driver; - -use think\cache\Driver; - -/** - * Wincache缓存驱动 - */ -class Wincache extends Driver -{ - /** - * 配置参数 - * @var array - */ - protected $options = [ - 'prefix' => '', - 'expire' => 0, - 'tag_prefix' => 'tag:', - 'serialize' => [], - ]; - - /** - * 架构函数 - * @access public - * @param array $options 缓存参数 - * @throws \BadFunctionCallException - */ - public function __construct(array $options = []) - { - if (!function_exists('wincache_ucache_info')) { - throw new \BadFunctionCallException('not support: WinCache'); - } - - if (!empty($options)) { - $this->options = array_merge($this->options, $options); - } - } - - /** - * 判断缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function has($name): bool - { - $this->readTimes++; - - $key = $this->getCacheKey($name); - - return wincache_ucache_exists($key); - } - - /** - * 读取缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function get($name, $default = null) - { - $this->readTimes++; - - $key = $this->getCacheKey($name); - - return wincache_ucache_exists($key) ? $this->unserialize(wincache_ucache_get($key)) : $default; - } - - /** - * 写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param integer|\DateTime $expire 有效时间(秒) - * @return bool - */ - public function set($name, $value, $expire = null): bool - { - $this->writeTimes++; - - if (is_null($expire)) { - $expire = $this->options['expire']; - } - - $key = $this->getCacheKey($name); - $expire = $this->getExpireTime($expire); - $value = $this->serialize($value); - - if (wincache_ucache_set($key, $value, $expire)) { - return true; - } - - return false; - } - - /** - * 自增缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function inc(string $name, int $step = 1) - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - - return wincache_ucache_inc($key, $step); - } - - /** - * 自减缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function dec(string $name, int $step = 1) - { - $this->writeTimes++; - - $key = $this->getCacheKey($name); - - return wincache_ucache_dec($key, $step); - } - - /** - * 删除缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function delete($name): bool - { - $this->writeTimes++; - - return wincache_ucache_delete($this->getCacheKey($name)); - } - - /** - * 清除缓存 - * @access public - * @return bool - */ - public function clear(): bool - { - $this->writeTimes++; - return wincache_ucache_clear(); - } - - /** - * 删除缓存标签 - * @access public - * @param array $keys 缓存标识列表 - * @return void - */ - public function clearTag(array $keys): void - { - wincache_ucache_delete($keys); - } - -} diff --git a/vendor/topthink/framework/src/think/console/Command.php b/vendor/topthink/framework/src/think/console/Command.php deleted file mode 100644 index bd3fb209..00000000 --- a/vendor/topthink/framework/src/think/console/Command.php +++ /dev/null @@ -1,504 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\console; - -use Exception; -use InvalidArgumentException; -use LogicException; -use think\App; -use think\Console; -use think\console\input\Argument; -use think\console\input\Definition; -use think\console\input\Option; - -abstract class Command -{ - - /** @var Console */ - private $console; - private $name; - private $processTitle; - private $aliases = []; - private $definition; - private $help; - private $description; - private $ignoreValidationErrors = false; - private $consoleDefinitionMerged = false; - private $consoleDefinitionMergedWithArgs = false; - private $synopsis = []; - private $usages = []; - - /** @var Input */ - protected $input; - - /** @var Output */ - protected $output; - - /** @var App */ - protected $app; - - /** - * 构造方法 - * @throws LogicException - * @api - */ - public function __construct() - { - $this->definition = new Definition(); - - $this->configure(); - - if (!$this->name) { - throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this))); - } - } - - /** - * 忽略验证错误 - */ - public function ignoreValidationErrors(): void - { - $this->ignoreValidationErrors = true; - } - - /** - * 设置控制台 - * @param Console $console - */ - public function setConsole(Console $console = null): void - { - $this->console = $console; - } - - /** - * 获取控制台 - * @return Console - * @api - */ - public function getConsole(): Console - { - return $this->console; - } - - /** - * 设置app - * @param App $app - */ - public function setApp(App $app) - { - $this->app = $app; - } - - /** - * 获取app - * @return App - */ - public function getApp() - { - return $this->app; - } - - /** - * 是否有效 - * @return bool - */ - public function isEnabled(): bool - { - return true; - } - - /** - * 配置指令 - */ - protected function configure() - { - } - - /** - * 执行指令 - * @param Input $input - * @param Output $output - * @return null|int - * @throws LogicException - * @see setCode() - */ - protected function execute(Input $input, Output $output) - { - return $this->app->invoke([$this, 'handle']); - } - - /** - * 用户验证 - * @param Input $input - * @param Output $output - */ - protected function interact(Input $input, Output $output) - { - } - - /** - * 初始化 - * @param Input $input An InputInterface instance - * @param Output $output An OutputInterface instance - */ - protected function initialize(Input $input, Output $output) - { - } - - /** - * 执行 - * @param Input $input - * @param Output $output - * @return int - * @throws Exception - * @see setCode() - * @see execute() - */ - public function run(Input $input, Output $output): int - { - $this->input = $input; - $this->output = $output; - - $this->getSynopsis(true); - $this->getSynopsis(false); - - $this->mergeConsoleDefinition(); - - try { - $input->bind($this->definition); - } catch (Exception $e) { - if (!$this->ignoreValidationErrors) { - throw $e; - } - } - - $this->initialize($input, $output); - - if (null !== $this->processTitle) { - if (function_exists('cli_set_process_title')) { - if (false === @cli_set_process_title($this->processTitle)) { - if ('Darwin' === PHP_OS) { - $output->writeln('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.'); - } else { - $error = error_get_last(); - trigger_error($error['message'], E_USER_WARNING); - } - } - } elseif (function_exists('setproctitle')) { - setproctitle($this->processTitle); - } elseif (Output::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) { - $output->writeln('Install the proctitle PECL to be able to change the process title.'); - } - } - - if ($input->isInteractive()) { - $this->interact($input, $output); - } - - $input->validate(); - - $statusCode = $this->execute($input, $output); - - return is_numeric($statusCode) ? (int) $statusCode : 0; - } - - /** - * 合并参数定义 - * @param bool $mergeArgs - */ - public function mergeConsoleDefinition(bool $mergeArgs = true) - { - if (null === $this->console - || (true === $this->consoleDefinitionMerged - && ($this->consoleDefinitionMergedWithArgs || !$mergeArgs)) - ) { - return; - } - - if ($mergeArgs) { - $currentArguments = $this->definition->getArguments(); - $this->definition->setArguments($this->console->getDefinition()->getArguments()); - $this->definition->addArguments($currentArguments); - } - - $this->definition->addOptions($this->console->getDefinition()->getOptions()); - - $this->consoleDefinitionMerged = true; - if ($mergeArgs) { - $this->consoleDefinitionMergedWithArgs = true; - } - } - - /** - * 设置参数定义 - * @param array|Definition $definition - * @return Command - * @api - */ - public function setDefinition($definition) - { - if ($definition instanceof Definition) { - $this->definition = $definition; - } else { - $this->definition->setDefinition($definition); - } - - $this->consoleDefinitionMerged = false; - - return $this; - } - - /** - * 获取参数定义 - * @return Definition - * @api - */ - public function getDefinition(): Definition - { - return $this->definition; - } - - /** - * 获取当前指令的参数定义 - * @return Definition - */ - public function getNativeDefinition(): Definition - { - return $this->getDefinition(); - } - - /** - * 添加参数 - * @param string $name 名称 - * @param int $mode 类型 - * @param string $description 描述 - * @param mixed $default 默认值 - * @return Command - */ - public function addArgument(string $name, int $mode = null, string $description = '', $default = null) - { - $this->definition->addArgument(new Argument($name, $mode, $description, $default)); - - return $this; - } - - /** - * 添加选项 - * @param string $name 选项名称 - * @param string $shortcut 别名 - * @param int $mode 类型 - * @param string $description 描述 - * @param mixed $default 默认值 - * @return Command - */ - public function addOption(string $name, string $shortcut = null, int $mode = null, string $description = '', $default = null) - { - $this->definition->addOption(new Option($name, $shortcut, $mode, $description, $default)); - - return $this; - } - - /** - * 设置指令名称 - * @param string $name - * @return Command - * @throws InvalidArgumentException - */ - public function setName(string $name) - { - $this->validateName($name); - - $this->name = $name; - - return $this; - } - - /** - * 设置进程名称 - * - * PHP 5.5+ or the proctitle PECL library is required - * - * @param string $title The process title - * - * @return $this - */ - public function setProcessTitle($title) - { - $this->processTitle = $title; - - return $this; - } - - /** - * 获取指令名称 - * @return string - */ - public function getName(): string - { - return $this->name ?: ''; - } - - /** - * 设置描述 - * @param string $description - * @return Command - */ - public function setDescription(string $description) - { - $this->description = $description; - - return $this; - } - - /** - * 获取描述 - * @return string - */ - public function getDescription(): string - { - return $this->description ?: ''; - } - - /** - * 设置帮助信息 - * @param string $help - * @return Command - */ - public function setHelp(string $help) - { - $this->help = $help; - - return $this; - } - - /** - * 获取帮助信息 - * @return string - */ - public function getHelp(): string - { - return $this->help ?: ''; - } - - /** - * 描述信息 - * @return string - */ - public function getProcessedHelp(): string - { - $name = $this->name; - - $placeholders = [ - '%command.name%', - '%command.full_name%', - ]; - $replacements = [ - $name, - $_SERVER['PHP_SELF'] . ' ' . $name, - ]; - - return str_replace($placeholders, $replacements, $this->getHelp()); - } - - /** - * 设置别名 - * @param string[] $aliases - * @return Command - * @throws InvalidArgumentException - */ - public function setAliases(iterable $aliases) - { - foreach ($aliases as $alias) { - $this->validateName($alias); - } - - $this->aliases = $aliases; - - return $this; - } - - /** - * 获取别名 - * @return array - */ - public function getAliases(): array - { - return $this->aliases; - } - - /** - * 获取简介 - * @param bool $short 是否简单的 - * @return string - */ - public function getSynopsis(bool $short = false): string - { - $key = $short ? 'short' : 'long'; - - if (!isset($this->synopsis[$key])) { - $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short))); - } - - return $this->synopsis[$key]; - } - - /** - * 添加用法介绍 - * @param string $usage - * @return $this - */ - public function addUsage(string $usage) - { - if (0 !== strpos($usage, $this->name)) { - $usage = sprintf('%s %s', $this->name, $usage); - } - - $this->usages[] = $usage; - - return $this; - } - - /** - * 获取用法介绍 - * @return array - */ - public function getUsages(): array - { - return $this->usages; - } - - /** - * 验证指令名称 - * @param string $name - * @throws InvalidArgumentException - */ - private function validateName(string $name) - { - if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) { - throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name)); - } - } - - /** - * 输出表格 - * @param Table $table - * @return string - */ - protected function table(Table $table): string - { - $content = $table->render(); - $this->output->writeln($content); - return $content; - } - -} diff --git a/vendor/topthink/framework/src/think/console/Input.php b/vendor/topthink/framework/src/think/console/Input.php deleted file mode 100644 index 9ae90775..00000000 --- a/vendor/topthink/framework/src/think/console/Input.php +++ /dev/null @@ -1,465 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\console; - -use think\console\input\Argument; -use think\console\input\Definition; -use think\console\input\Option; - -class Input -{ - - /** - * @var Definition - */ - protected $definition; - - /** - * @var Option[] - */ - protected $options = []; - - /** - * @var Argument[] - */ - protected $arguments = []; - - protected $interactive = true; - - private $tokens; - private $parsed; - - public function __construct($argv = null) - { - if (null === $argv) { - $argv = $_SERVER['argv']; - // 去除命令名 - array_shift($argv); - } - - $this->tokens = $argv; - - $this->definition = new Definition(); - } - - protected function setTokens(array $tokens) - { - $this->tokens = $tokens; - } - - /** - * 绑定实例 - * @param Definition $definition A InputDefinition instance - */ - public function bind(Definition $definition): void - { - $this->arguments = []; - $this->options = []; - $this->definition = $definition; - - $this->parse(); - } - - /** - * 解析参数 - */ - protected function parse(): void - { - $parseOptions = true; - $this->parsed = $this->tokens; - while (null !== $token = array_shift($this->parsed)) { - if ($parseOptions && '' == $token) { - $this->parseArgument($token); - } elseif ($parseOptions && '--' == $token) { - $parseOptions = false; - } elseif ($parseOptions && 0 === strpos($token, '--')) { - $this->parseLongOption($token); - } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) { - $this->parseShortOption($token); - } else { - $this->parseArgument($token); - } - } - } - - /** - * 解析短选项 - * @param string $token 当前的指令. - */ - private function parseShortOption(string $token): void - { - $name = substr($token, 1); - - if (strlen($name) > 1) { - if ($this->definition->hasShortcut($name[0]) - && $this->definition->getOptionForShortcut($name[0])->acceptValue() - ) { - $this->addShortOption($name[0], substr($name, 1)); - } else { - $this->parseShortOptionSet($name); - } - } else { - $this->addShortOption($name, null); - } - } - - /** - * 解析短选项 - * @param string $name 当前指令 - * @throws \RuntimeException - */ - private function parseShortOptionSet(string $name): void - { - $len = strlen($name); - for ($i = 0; $i < $len; ++$i) { - if (!$this->definition->hasShortcut($name[$i])) { - throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i])); - } - - $option = $this->definition->getOptionForShortcut($name[$i]); - if ($option->acceptValue()) { - $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1)); - - break; - } else { - $this->addLongOption($option->getName(), null); - } - } - } - - /** - * 解析完整选项 - * @param string $token 当前指令 - */ - private function parseLongOption(string $token): void - { - $name = substr($token, 2); - - if (false !== $pos = strpos($name, '=')) { - $this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1)); - } else { - $this->addLongOption($name, null); - } - } - - /** - * 解析参数 - * @param string $token 当前指令 - * @throws \RuntimeException - */ - private function parseArgument(string $token): void - { - $c = count($this->arguments); - - if ($this->definition->hasArgument($c)) { - $arg = $this->definition->getArgument($c); - - $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token; - - } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) { - $arg = $this->definition->getArgument($c - 1); - - $this->arguments[$arg->getName()][] = $token; - } else { - throw new \RuntimeException('Too many arguments.'); - } - } - - /** - * 添加一个短选项的值 - * @param string $shortcut 短名称 - * @param mixed $value 值 - * @throws \RuntimeException - */ - private function addShortOption(string $shortcut, $value): void - { - if (!$this->definition->hasShortcut($shortcut)) { - throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut)); - } - - $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value); - } - - /** - * 添加一个完整选项的值 - * @param string $name 选项名 - * @param mixed $value 值 - * @throws \RuntimeException - */ - private function addLongOption(string $name, $value): void - { - if (!$this->definition->hasOption($name)) { - throw new \RuntimeException(sprintf('The "--%s" option does not exist.', $name)); - } - - $option = $this->definition->getOption($name); - - if (false === $value) { - $value = null; - } - - if (null !== $value && !$option->acceptValue()) { - throw new \RuntimeException(sprintf('The "--%s" option does not accept a value.', $name, $value)); - } - - if (null === $value && $option->acceptValue() && count($this->parsed)) { - $next = array_shift($this->parsed); - if (isset($next[0]) && '-' !== $next[0]) { - $value = $next; - } elseif (empty($next)) { - $value = ''; - } else { - array_unshift($this->parsed, $next); - } - } - - if (null === $value) { - if ($option->isValueRequired()) { - throw new \RuntimeException(sprintf('The "--%s" option requires a value.', $name)); - } - - if (!$option->isArray()) { - $value = $option->isValueOptional() ? $option->getDefault() : true; - } - } - - if ($option->isArray()) { - $this->options[$name][] = $value; - } else { - $this->options[$name] = $value; - } - } - - /** - * 获取第一个参数 - * @return string|null - */ - public function getFirstArgument() - { - foreach ($this->tokens as $token) { - if ($token && '-' === $token[0]) { - continue; - } - - return $token; - } - return; - } - - /** - * 检查原始参数是否包含某个值 - * @param string|array $values 需要检查的值 - * @return bool - */ - public function hasParameterOption($values): bool - { - $values = (array) $values; - - foreach ($this->tokens as $token) { - foreach ($values as $value) { - if ($token === $value || 0 === strpos($token, $value . '=')) { - return true; - } - } - } - - return false; - } - - /** - * 获取原始选项的值 - * @param string|array $values 需要检查的值 - * @param mixed $default 默认值 - * @return mixed The option value - */ - public function getParameterOption($values, $default = false) - { - $values = (array) $values; - $tokens = $this->tokens; - - while (0 < count($tokens)) { - $token = array_shift($tokens); - - foreach ($values as $value) { - if ($token === $value || 0 === strpos($token, $value . '=')) { - if (false !== $pos = strpos($token, '=')) { - return substr($token, $pos + 1); - } - - return array_shift($tokens); - } - } - } - - return $default; - } - - /** - * 验证输入 - * @throws \RuntimeException - */ - public function validate() - { - if (count($this->arguments) < $this->definition->getArgumentRequiredCount()) { - throw new \RuntimeException('Not enough arguments.'); - } - } - - /** - * 检查输入是否是交互的 - * @return bool - */ - public function isInteractive(): bool - { - return $this->interactive; - } - - /** - * 设置输入的交互 - * @param bool - */ - public function setInteractive(bool $interactive): void - { - $this->interactive = $interactive; - } - - /** - * 获取所有的参数 - * @return Argument[] - */ - public function getArguments(): array - { - return array_merge($this->definition->getArgumentDefaults(), $this->arguments); - } - - /** - * 根据名称获取参数 - * @param string $name 参数名 - * @return mixed - * @throws \InvalidArgumentException - */ - public function getArgument(string $name) - { - if (!$this->definition->hasArgument($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); - } - - return $this->arguments[$name] ?? $this->definition->getArgument($name) - ->getDefault(); - } - - /** - * 设置参数的值 - * @param string $name 参数名 - * @param string $value 值 - * @throws \InvalidArgumentException - */ - public function setArgument(string $name, $value) - { - if (!$this->definition->hasArgument($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); - } - - $this->arguments[$name] = $value; - } - - /** - * 检查是否存在某个参数 - * @param string|int $name 参数名或位置 - * @return bool - */ - public function hasArgument($name): bool - { - return $this->definition->hasArgument($name); - } - - /** - * 获取所有的选项 - * @return Option[] - */ - public function getOptions(): array - { - return array_merge($this->definition->getOptionDefaults(), $this->options); - } - - /** - * 获取选项值 - * @param string $name 选项名称 - * @return mixed - * @throws \InvalidArgumentException - */ - public function getOption(string $name) - { - if (!$this->definition->hasOption($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); - } - - return $this->options[$name] ?? $this->definition->getOption($name)->getDefault(); - } - - /** - * 设置选项值 - * @param string $name 选项名 - * @param string|bool $value 值 - * @throws \InvalidArgumentException - */ - public function setOption(string $name, $value): void - { - if (!$this->definition->hasOption($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); - } - - $this->options[$name] = $value; - } - - /** - * 是否有某个选项 - * @param string $name 选项名 - * @return bool - */ - public function hasOption(string $name): bool - { - return $this->definition->hasOption($name) && isset($this->options[$name]); - } - - /** - * 转义指令 - * @param string $token - * @return string - */ - public function escapeToken(string $token): string - { - return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token); - } - - /** - * 返回传递给命令的参数的字符串 - * @return string - */ - public function __toString() - { - $tokens = array_map(function ($token) { - if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) { - return $match[1] . $this->escapeToken($match[2]); - } - - if ($token && '-' !== $token[0]) { - return $this->escapeToken($token); - } - - return $token; - }, $this->tokens); - - return implode(' ', $tokens); - } -} diff --git a/vendor/topthink/framework/src/think/console/LICENSE b/vendor/topthink/framework/src/think/console/LICENSE deleted file mode 100644 index 0abe056e..00000000 --- a/vendor/topthink/framework/src/think/console/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2016 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/vendor/topthink/framework/src/think/console/Output.php b/vendor/topthink/framework/src/think/console/Output.php deleted file mode 100644 index 294c4b80..00000000 --- a/vendor/topthink/framework/src/think/console/Output.php +++ /dev/null @@ -1,231 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\console; - -use Exception; -use think\console\output\Ask; -use think\console\output\Descriptor; -use think\console\output\driver\Buffer; -use think\console\output\driver\Console; -use think\console\output\driver\Nothing; -use think\console\output\Question; -use think\console\output\question\Choice; -use think\console\output\question\Confirmation; -use Throwable; - -/** - * Class Output - * @package think\console - * - * @see \think\console\output\driver\Console::setDecorated - * @method void setDecorated($decorated) - * - * @see \think\console\output\driver\Buffer::fetch - * @method string fetch() - * - * @method void info($message) - * @method void error($message) - * @method void comment($message) - * @method void warning($message) - * @method void highlight($message) - * @method void question($message) - */ -class Output -{ - // 不显示信息(静默) - const VERBOSITY_QUIET = 0; - // 正常信息 - const VERBOSITY_NORMAL = 1; - // 详细信息 - const VERBOSITY_VERBOSE = 2; - // 非常详细的信息 - const VERBOSITY_VERY_VERBOSE = 3; - // 调试信息 - const VERBOSITY_DEBUG = 4; - - const OUTPUT_NORMAL = 0; - const OUTPUT_RAW = 1; - const OUTPUT_PLAIN = 2; - - // 输出信息级别 - private $verbosity = self::VERBOSITY_NORMAL; - - /** @var Buffer|Console|Nothing */ - private $handle = null; - - protected $styles = [ - 'info', - 'error', - 'comment', - 'question', - 'highlight', - 'warning', - ]; - - public function __construct($driver = 'console') - { - $class = '\\think\\console\\output\\driver\\' . ucwords($driver); - - $this->handle = new $class($this); - } - - public function ask(Input $input, $question, $default = null, $validator = null) - { - $question = new Question($question, $default); - $question->setValidator($validator); - - return $this->askQuestion($input, $question); - } - - public function askHidden(Input $input, $question, $validator = null) - { - $question = new Question($question); - - $question->setHidden(true); - $question->setValidator($validator); - - return $this->askQuestion($input, $question); - } - - public function confirm(Input $input, $question, $default = true) - { - return $this->askQuestion($input, new Confirmation($question, $default)); - } - - /** - * {@inheritdoc} - */ - public function choice(Input $input, $question, array $choices, $default = null) - { - if (null !== $default) { - $values = array_flip($choices); - $default = $values[$default]; - } - - return $this->askQuestion($input, new Choice($question, $choices, $default)); - } - - protected function askQuestion(Input $input, Question $question) - { - $ask = new Ask($input, $this, $question); - $answer = $ask->run(); - - if ($input->isInteractive()) { - $this->newLine(); - } - - return $answer; - } - - protected function block(string $style, string $message): void - { - $this->writeln("<{$style}>{$message}"); - } - - /** - * 输出空行 - * @param int $count - */ - public function newLine(int $count = 1): void - { - $this->write(str_repeat(PHP_EOL, $count)); - } - - /** - * 输出信息并换行 - * @param string $messages - * @param int $type - */ - public function writeln(string $messages, int $type = 0): void - { - $this->write($messages, true, $type); - } - - /** - * 输出信息 - * @param string $messages - * @param bool $newline - * @param int $type - */ - public function write(string $messages, bool $newline = false, int $type = 0): void - { - $this->handle->write($messages, $newline, $type); - } - - public function renderException(Throwable $e): void - { - $this->handle->renderException($e); - } - - /** - * 设置输出信息级别 - * @param int $level 输出信息级别 - */ - public function setVerbosity(int $level) - { - $this->verbosity = $level; - } - - /** - * 获取输出信息级别 - * @return int - */ - public function getVerbosity(): int - { - return $this->verbosity; - } - - public function isQuiet(): bool - { - return self::VERBOSITY_QUIET === $this->verbosity; - } - - public function isVerbose(): bool - { - return self::VERBOSITY_VERBOSE <= $this->verbosity; - } - - public function isVeryVerbose(): bool - { - return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity; - } - - public function isDebug(): bool - { - return self::VERBOSITY_DEBUG <= $this->verbosity; - } - - public function describe($object, array $options = []): void - { - $descriptor = new Descriptor(); - $options = array_merge([ - 'raw_text' => false, - ], $options); - - $descriptor->describe($this, $object, $options); - } - - public function __call($method, $args) - { - if (in_array($method, $this->styles)) { - array_unshift($args, $method); - return call_user_func_array([$this, 'block'], $args); - } - - if ($this->handle && method_exists($this->handle, $method)) { - return call_user_func_array([$this->handle, $method], $args); - } else { - throw new Exception('method not exists:' . __CLASS__ . '->' . $method); - } - } -} diff --git a/vendor/topthink/framework/src/think/console/Table.php b/vendor/topthink/framework/src/think/console/Table.php deleted file mode 100644 index 5a861d7f..00000000 --- a/vendor/topthink/framework/src/think/console/Table.php +++ /dev/null @@ -1,300 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\console; - -class Table -{ - const ALIGN_LEFT = 1; - const ALIGN_RIGHT = 0; - const ALIGN_CENTER = 2; - - /** - * 头信息数据 - * @var array - */ - protected $header = []; - - /** - * 头部对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER - * @var int - */ - protected $headerAlign = 1; - - /** - * 表格数据(二维数组) - * @var array - */ - protected $rows = []; - - /** - * 单元格对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER - * @var int - */ - protected $cellAlign = 1; - - /** - * 单元格宽度信息 - * @var array - */ - protected $colWidth = []; - - /** - * 表格输出样式 - * @var string - */ - protected $style = 'default'; - - /** - * 表格样式定义 - * @var array - */ - protected $format = [ - 'compact' => [], - 'default' => [ - 'top' => ['+', '-', '+', '+'], - 'cell' => ['|', ' ', '|', '|'], - 'middle' => ['+', '-', '+', '+'], - 'bottom' => ['+', '-', '+', '+'], - 'cross-top' => ['+', '-', '-', '+'], - 'cross-bottom' => ['+', '-', '-', '+'], - ], - 'markdown' => [ - 'top' => [' ', ' ', ' ', ' '], - 'cell' => ['|', ' ', '|', '|'], - 'middle' => ['|', '-', '|', '|'], - 'bottom' => [' ', ' ', ' ', ' '], - 'cross-top' => ['|', ' ', ' ', '|'], - 'cross-bottom' => ['|', ' ', ' ', '|'], - ], - 'borderless' => [ - 'top' => ['=', '=', ' ', '='], - 'cell' => [' ', ' ', ' ', ' '], - 'middle' => ['=', '=', ' ', '='], - 'bottom' => ['=', '=', ' ', '='], - 'cross-top' => ['=', '=', ' ', '='], - 'cross-bottom' => ['=', '=', ' ', '='], - ], - 'box' => [ - 'top' => ['┌', '─', '┬', '┐'], - 'cell' => ['│', ' ', '│', '│'], - 'middle' => ['├', '─', '┼', '┤'], - 'bottom' => ['└', '─', '┴', '┘'], - 'cross-top' => ['├', '─', '┴', '┤'], - 'cross-bottom' => ['├', '─', '┬', '┤'], - ], - 'box-double' => [ - 'top' => ['╔', '═', '╤', '╗'], - 'cell' => ['║', ' ', '│', '║'], - 'middle' => ['╠', '─', '╪', '╣'], - 'bottom' => ['╚', '═', '╧', '╝'], - 'cross-top' => ['╠', '═', '╧', '╣'], - 'cross-bottom' => ['╠', '═', '╤', '╣'], - ], - ]; - - /** - * 设置表格头信息 以及对齐方式 - * @access public - * @param array $header 要输出的Header信息 - * @param int $align 对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER - * @return void - */ - public function setHeader(array $header, int $align = 1): void - { - $this->header = $header; - $this->headerAlign = $align; - - $this->checkColWidth($header); - } - - /** - * 设置输出表格数据 及对齐方式 - * @access public - * @param array $rows 要输出的表格数据(二维数组) - * @param int $align 对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER - * @return void - */ - public function setRows(array $rows, int $align = 1): void - { - $this->rows = $rows; - $this->cellAlign = $align; - - foreach ($rows as $row) { - $this->checkColWidth($row); - } - } - - /** - * 设置全局单元格对齐方式 - * @param int $align 对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER - * @return $this - */ - public function setCellAlign(int $align = 1) - { - $this->cellAlign = $align; - return $this; - } - - /** - * 检查列数据的显示宽度 - * @access public - * @param mixed $row 行数据 - * @return void - */ - protected function checkColWidth($row): void - { - if (is_array($row)) { - foreach ($row as $key => $cell) { - $width = mb_strwidth((string) $cell); - if (!isset($this->colWidth[$key]) || $width > $this->colWidth[$key]) { - $this->colWidth[$key] = $width; - } - } - } - } - - /** - * 增加一行表格数据 - * @access public - * @param mixed $row 行数据 - * @param bool $first 是否在开头插入 - * @return void - */ - public function addRow($row, bool $first = false): void - { - if ($first) { - array_unshift($this->rows, $row); - } else { - $this->rows[] = $row; - } - - $this->checkColWidth($row); - } - - /** - * 设置输出表格的样式 - * @access public - * @param string $style 样式名 - * @return void - */ - public function setStyle(string $style): void - { - $this->style = isset($this->format[$style]) ? $style : 'default'; - } - - /** - * 输出分隔行 - * @access public - * @param string $pos 位置 - * @return string - */ - protected function renderSeparator(string $pos): string - { - $style = $this->getStyle($pos); - $array = []; - - foreach ($this->colWidth as $width) { - $array[] = str_repeat($style[1], $width + 2); - } - - return $style[0] . implode($style[2], $array) . $style[3] . PHP_EOL; - } - - /** - * 输出表格头部 - * @access public - * @return string - */ - protected function renderHeader(): string - { - $style = $this->getStyle('cell'); - $content = $this->renderSeparator('top'); - - foreach ($this->header as $key => $header) { - $array[] = ' ' . str_pad($header, $this->colWidth[$key], $style[1], $this->headerAlign); - } - - if (!empty($array)) { - $content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL; - - if (!empty($this->rows)) { - $content .= $this->renderSeparator('middle'); - } - } - - return $content; - } - - protected function getStyle(string $style): array - { - if ($this->format[$this->style]) { - $style = $this->format[$this->style][$style]; - } else { - $style = [' ', ' ', ' ', ' ']; - } - - return $style; - } - - /** - * 输出表格 - * @access public - * @param array $dataList 表格数据 - * @return string - */ - public function render(array $dataList = []): string - { - if (!empty($dataList)) { - $this->setRows($dataList); - } - - // 输出头部 - $content = $this->renderHeader(); - $style = $this->getStyle('cell'); - - if (!empty($this->rows)) { - foreach ($this->rows as $row) { - if (is_string($row) && '-' === $row) { - $content .= $this->renderSeparator('middle'); - } elseif (is_scalar($row)) { - $content .= $this->renderSeparator('cross-top'); - $width = 3 * (count($this->colWidth) - 1) + array_reduce($this->colWidth, function ($a, $b) { - return $a + $b; - }); - $array = str_pad($row, $width); - - $content .= $style[0] . ' ' . $array . ' ' . $style[3] . PHP_EOL; - $content .= $this->renderSeparator('cross-bottom'); - } else { - $array = []; - - foreach ($row as $key => $val) { - $width = $this->colWidth[$key]; - // form https://github.com/symfony/console/blob/20c9821c8d1c2189f287dcee709b2f86353ea08f/Helper/Table.php#L467 - // str_pad won't work properly with multi-byte strings, we need to fix the padding - if (false !== $encoding = mb_detect_encoding((string) $val, null, true)) { - $width += strlen((string) $val) - mb_strwidth((string) $val, $encoding); - } - $array[] = ' ' . str_pad((string) $val, $width, ' ', $this->cellAlign); - } - - $content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL; - } - } - } - - $content .= $this->renderSeparator('bottom'); - - return $content; - } -} diff --git a/vendor/topthink/framework/src/think/console/bin/README.md b/vendor/topthink/framework/src/think/console/bin/README.md deleted file mode 100644 index 9acc52fb..00000000 --- a/vendor/topthink/framework/src/think/console/bin/README.md +++ /dev/null @@ -1 +0,0 @@ -console 工具使用 hiddeninput.exe 在 windows 上隐藏密码输入,该二进制文件由第三方提供,相关源码和其他细节可以在 [Hidden Input](https://github.com/Seldaek/hidden-input) 找到。 diff --git a/vendor/topthink/framework/src/think/console/bin/hiddeninput.exe b/vendor/topthink/framework/src/think/console/bin/hiddeninput.exe deleted file mode 100644 index c8cf65e8..00000000 Binary files a/vendor/topthink/framework/src/think/console/bin/hiddeninput.exe and /dev/null differ diff --git a/vendor/topthink/framework/src/think/console/command/Clear.php b/vendor/topthink/framework/src/think/console/command/Clear.php deleted file mode 100644 index da70b35d..00000000 --- a/vendor/topthink/framework/src/think/console/command/Clear.php +++ /dev/null @@ -1,85 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\console\command; - -use think\console\Command; -use think\console\Input; -use think\console\input\Option; -use think\console\Output; - -class Clear extends Command -{ - protected function configure() - { - // 指令配置 - $this->setName('clear') - ->addOption('path', 'd', Option::VALUE_OPTIONAL, 'path to clear', null) - ->addOption('cache', 'c', Option::VALUE_NONE, 'clear cache file') - ->addOption('log', 'l', Option::VALUE_NONE, 'clear log file') - ->addOption('dir', 'r', Option::VALUE_NONE, 'clear empty dir') - ->addOption('expire', 'e', Option::VALUE_NONE, 'clear cache file if cache has expired') - ->setDescription('Clear runtime file'); - } - - protected function execute(Input $input, Output $output) - { - $runtimePath = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR; - - if ($input->getOption('cache')) { - $path = $runtimePath . 'cache'; - } elseif ($input->getOption('log')) { - $path = $runtimePath . 'log'; - } else { - $path = $input->getOption('path') ?: $runtimePath; - } - - $rmdir = $input->getOption('dir') ? true : false; - // --expire 仅当 --cache 时生效 - $cache_expire = $input->getOption('expire') && $input->getOption('cache') ? true : false; - $this->clear(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, $rmdir, $cache_expire); - - $output->writeln("Clear Successed"); - } - - protected function clear(string $path, bool $rmdir, bool $cache_expire): void - { - $files = is_dir($path) ? scandir($path) : []; - - foreach ($files as $file) { - if ('.' != $file && '..' != $file && is_dir($path . $file)) { - $this->clear($path . $file . DIRECTORY_SEPARATOR, $rmdir, $cache_expire); - if ($rmdir) { - @rmdir($path . $file); - } - } elseif ('.gitignore' != $file && is_file($path . $file)) { - if ($cache_expire) { - if ($this->cacheHasExpired($path . $file)) { - unlink($path . $file); - } - } else { - unlink($path . $file); - } - } - } - } - - /** - * 缓存文件是否已过期 - * @param $filename string 文件路径 - * @return bool - */ - protected function cacheHasExpired($filename) { - $content = file_get_contents($filename); - $expire = (int) substr($content, 8, 12); - return 0 != $expire && time() - $expire > filemtime($filename); - } - -} diff --git a/vendor/topthink/framework/src/think/console/command/Help.php b/vendor/topthink/framework/src/think/console/command/Help.php deleted file mode 100644 index 2e4f2ca7..00000000 --- a/vendor/topthink/framework/src/think/console/command/Help.php +++ /dev/null @@ -1,70 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command; - -use think\console\Command; -use think\console\Input; -use think\console\input\Argument as InputArgument; -use think\console\input\Option as InputOption; -use think\console\Output; - -class Help extends Command -{ - - private $command; - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this->ignoreValidationErrors(); - - $this->setName('help')->setDefinition([ - new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), - new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), - ])->setDescription('Displays help for a command')->setHelp( - <<%command.name% command displays help for a given command: - - php %command.full_name% list - -To display the list of available commands, please use the list command. -EOF - ); - } - - /** - * Sets the command. - * @param Command $command The command to set - */ - public function setCommand(Command $command): void - { - $this->command = $command; - } - - /** - * {@inheritdoc} - */ - protected function execute(Input $input, Output $output) - { - if (null === $this->command) { - $this->command = $this->getConsole()->find($input->getArgument('command_name')); - } - - $output->describe($this->command, [ - 'raw_text' => $input->getOption('raw'), - ]); - - $this->command = null; - } -} diff --git a/vendor/topthink/framework/src/think/console/command/Lists.php b/vendor/topthink/framework/src/think/console/command/Lists.php deleted file mode 100644 index d20fc751..00000000 --- a/vendor/topthink/framework/src/think/console/command/Lists.php +++ /dev/null @@ -1,74 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command; - -use think\console\Command; -use think\console\Input; -use think\console\input\Argument as InputArgument; -use think\console\input\Definition as InputDefinition; -use think\console\input\Option as InputOption; -use think\console\Output; - -class Lists extends Command -{ - /** - * {@inheritdoc} - */ - protected function configure() - { - $this->setName('list')->setDefinition($this->createDefinition())->setDescription('Lists commands')->setHelp( - <<%command.name% command lists all commands: - - php %command.full_name% - -You can also display the commands for a specific namespace: - - php %command.full_name% test - -It's also possible to get raw list of commands (useful for embedding command runner): - - php %command.full_name% --raw -EOF - ); - } - - /** - * {@inheritdoc} - */ - public function getNativeDefinition(): InputDefinition - { - return $this->createDefinition(); - } - - /** - * {@inheritdoc} - */ - protected function execute(Input $input, Output $output) - { - $output->describe($this->getConsole(), [ - 'raw_text' => $input->getOption('raw'), - 'namespace' => $input->getArgument('namespace'), - ]); - } - - /** - * {@inheritdoc} - */ - private function createDefinition(): InputDefinition - { - return new InputDefinition([ - new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'), - new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), - ]); - } -} diff --git a/vendor/topthink/framework/src/think/console/command/Make.php b/vendor/topthink/framework/src/think/console/command/Make.php deleted file mode 100644 index 662b3372..00000000 --- a/vendor/topthink/framework/src/think/console/command/Make.php +++ /dev/null @@ -1,99 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command; - -use think\console\Command; -use think\console\Input; -use think\console\input\Argument; -use think\console\Output; - -abstract class Make extends Command -{ - protected $type; - - abstract protected function getStub(); - - protected function configure() - { - $this->addArgument('name', Argument::REQUIRED, "The name of the class"); - } - - protected function execute(Input $input, Output $output) - { - $name = trim($input->getArgument('name')); - - $classname = $this->getClassName($name); - - $pathname = $this->getPathName($classname); - - if (is_file($pathname)) { - $output->writeln('' . $this->type . ':' . $classname . ' already exists!'); - return false; - } - - if (!is_dir(dirname($pathname))) { - mkdir(dirname($pathname), 0755, true); - } - - file_put_contents($pathname, $this->buildClass($classname)); - - $output->writeln('' . $this->type . ':' . $classname . ' created successfully.'); - } - - protected function buildClass(string $name) - { - $stub = file_get_contents($this->getStub()); - - $namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); - - $class = str_replace($namespace . '\\', '', $name); - - return str_replace(['{%className%}', '{%actionSuffix%}', '{%namespace%}', '{%app_namespace%}'], [ - $class, - $this->app->config->get('route.action_suffix'), - $namespace, - $this->app->getNamespace(), - ], $stub); - } - - protected function getPathName(string $name): string - { - $name = str_replace('app\\', '', $name); - - return $this->app->getBasePath() . ltrim(str_replace('\\', '/', $name), '/') . '.php'; - } - - protected function getClassName(string $name): string - { - if (strpos($name, '\\') !== false) { - return $name; - } - - if (strpos($name, '@')) { - [$app, $name] = explode('@', $name); - } else { - $app = ''; - } - - if (strpos($name, '/') !== false) { - $name = str_replace('/', '\\', $name); - } - - return $this->getNamespace($app) . '\\' . $name; - } - - protected function getNamespace(string $app): string - { - return 'app' . ($app ? '\\' . $app : ''); - } - -} diff --git a/vendor/topthink/framework/src/think/console/command/RouteList.php b/vendor/topthink/framework/src/think/console/command/RouteList.php deleted file mode 100644 index ed579b85..00000000 --- a/vendor/topthink/framework/src/think/console/command/RouteList.php +++ /dev/null @@ -1,129 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\console\command; - -use think\console\Command; -use think\console\Input; -use think\console\input\Argument; -use think\console\input\Option; -use think\console\Output; -use think\console\Table; -use think\event\RouteLoaded; - -class RouteList extends Command -{ - protected $sortBy = [ - 'rule' => 0, - 'route' => 1, - 'method' => 2, - 'name' => 3, - 'domain' => 4, - ]; - - protected function configure() - { - $this->setName('route:list') - ->addArgument('dir', Argument::OPTIONAL, 'dir name .') - ->addArgument('style', Argument::OPTIONAL, "the style of the table.", 'default') - ->addOption('sort', 's', Option::VALUE_OPTIONAL, 'order by rule name.', 0) - ->addOption('more', 'm', Option::VALUE_NONE, 'show route options.') - ->setDescription('show route list.'); - } - - protected function execute(Input $input, Output $output) - { - $dir = $input->getArgument('dir') ?: ''; - - $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '') . 'route_list.php'; - - if (is_file($filename)) { - unlink($filename); - } elseif (!is_dir(dirname($filename))) { - mkdir(dirname($filename), 0755); - } - - $content = $this->getRouteList($dir); - file_put_contents($filename, 'Route List' . PHP_EOL . $content); - } - - protected function getRouteList(string $dir = null): string - { - $this->app->route->setTestMode(true); - $this->app->route->clear(); - - if ($dir) { - $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; - } else { - $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR; - } - - $files = is_dir($path) ? scandir($path) : []; - - foreach ($files as $file) { - if (strpos($file, '.php')) { - include $path . $file; - } - } - - //触发路由载入完成事件 - $this->app->event->trigger(RouteLoaded::class); - - $table = new Table(); - - if ($this->input->hasOption('more')) { - $header = ['Rule', 'Route', 'Method', 'Name', 'Domain', 'Option', 'Pattern']; - } else { - $header = ['Rule', 'Route', 'Method', 'Name']; - } - - $table->setHeader($header); - - $routeList = $this->app->route->getRuleList(); - $rows = []; - - foreach ($routeList as $item) { - $item['route'] = $item['route'] instanceof \Closure ? '' : $item['route']; - - if ($this->input->hasOption('more')) { - $item = [$item['rule'], $item['route'], $item['method'], $item['name'], $item['domain'], json_encode($item['option']), json_encode($item['pattern'])]; - } else { - $item = [$item['rule'], $item['route'], $item['method'], $item['name']]; - } - - $rows[] = $item; - } - - if ($this->input->getOption('sort')) { - $sort = strtolower($this->input->getOption('sort')); - - if (isset($this->sortBy[$sort])) { - $sort = $this->sortBy[$sort]; - } - - uasort($rows, function ($a, $b) use ($sort) { - $itemA = $a[$sort] ?? null; - $itemB = $b[$sort] ?? null; - - return strcasecmp($itemA, $itemB); - }); - } - - $table->setRows($rows); - - if ($this->input->getArgument('style')) { - $style = $this->input->getArgument('style'); - $table->setStyle($style); - } - - return $this->table($table); - } - -} diff --git a/vendor/topthink/framework/src/think/console/command/RunServer.php b/vendor/topthink/framework/src/think/console/command/RunServer.php deleted file mode 100644 index 20a24662..00000000 --- a/vendor/topthink/framework/src/think/console/command/RunServer.php +++ /dev/null @@ -1,72 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\console\command; - -use think\console\Command; -use think\console\Input; -use think\console\input\Option; -use think\console\Output; - -class RunServer extends Command -{ - public function configure() - { - $this->setName('run') - ->addOption( - 'host', - 'H', - Option::VALUE_OPTIONAL, - 'The host to server the application on', - '0.0.0.0' - ) - ->addOption( - 'port', - 'p', - Option::VALUE_OPTIONAL, - 'The port to server the application on', - 8000 - ) - ->addOption( - 'root', - 'r', - Option::VALUE_OPTIONAL, - 'The document root of the application', - '' - ) - ->setDescription('PHP Built-in Server for ThinkPHP'); - } - - public function execute(Input $input, Output $output) - { - $host = $input->getOption('host'); - $port = $input->getOption('port'); - $root = $input->getOption('root'); - if (empty($root)) { - $root = $this->app->getRootPath() . 'public'; - } - - $command = sprintf( - 'php -S %s:%d -t %s %s', - $host, - $port, - escapeshellarg($root), - escapeshellarg($root . DIRECTORY_SEPARATOR . 'router.php') - ); - - $output->writeln(sprintf('ThinkPHP Development server is started On ', '0.0.0.0' == $host ? '127.0.0.1' : $host, $port)); - $output->writeln(sprintf('You can exit with `CTRL-C`')); - $output->writeln(sprintf('Document root is: %s', $root)); - passthru($command); - } - -} diff --git a/vendor/topthink/framework/src/think/console/command/ServiceDiscover.php b/vendor/topthink/framework/src/think/console/command/ServiceDiscover.php deleted file mode 100644 index e90f4339..00000000 --- a/vendor/topthink/framework/src/think/console/command/ServiceDiscover.php +++ /dev/null @@ -1,52 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\console\command; - -use think\console\Command; -use think\console\Input; -use think\console\Output; - -class ServiceDiscover extends Command -{ - public function configure() - { - $this->setName('service:discover') - ->setDescription('Discover Services for ThinkPHP'); - } - - public function execute(Input $input, Output $output) - { - if (is_file($path = $this->app->getRootPath() . 'vendor/composer/installed.json')) { - $packages = json_decode(@file_get_contents($path), true); - // Compatibility with Composer 2.0 - if (isset($packages['packages'])) { - $packages = $packages['packages']; - } - - $services = []; - foreach ($packages as $package) { - if (!empty($package['extra']['think']['services'])) { - $services = array_merge($services, (array) $package['extra']['think']['services']); - } - } - - $header = '// This file is automatically generated at:' . date('Y-m-d H:i:s') . PHP_EOL . 'declare (strict_types = 1);' . PHP_EOL; - - $content = 'app->getRootPath() . 'vendor/services.php', $content); - - $output->writeln('Succeed!'); - } - } -} diff --git a/vendor/topthink/framework/src/think/console/command/VendorPublish.php b/vendor/topthink/framework/src/think/console/command/VendorPublish.php deleted file mode 100644 index 39987657..00000000 --- a/vendor/topthink/framework/src/think/console/command/VendorPublish.php +++ /dev/null @@ -1,69 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\console\command; - -use think\console\Command; -use think\console\input\Option; - -class VendorPublish extends Command -{ - public function configure() - { - $this->setName('vendor:publish') - ->addOption('force', 'f', Option::VALUE_NONE, 'Overwrite any existing files') - ->setDescription('Publish any publishable assets from vendor packages'); - } - - public function handle() - { - - $force = $this->input->getOption('force'); - - if (is_file($path = $this->app->getRootPath() . 'vendor/composer/installed.json')) { - $packages = json_decode(@file_get_contents($path), true); - // Compatibility with Composer 2.0 - if (isset($packages['packages'])) { - $packages = $packages['packages']; - } - foreach ($packages as $package) { - //配置 - $configDir = $this->app->getConfigPath(); - - if (!empty($package['extra']['think']['config'])) { - - $installPath = $this->app->getRootPath() . 'vendor/' . $package['name'] . DIRECTORY_SEPARATOR; - - foreach ((array) $package['extra']['think']['config'] as $name => $file) { - - $target = $configDir . $name . '.php'; - $source = $installPath . $file; - - if (is_file($target) && !$force) { - $this->output->info("File {$target} exist!"); - continue; - } - - if (!is_file($source)) { - $this->output->info("File {$source} not exist!"); - continue; - } - - copy($source, $target); - } - } - } - - $this->output->writeln('Succeed!'); - } - } -} diff --git a/vendor/topthink/framework/src/think/console/command/Version.php b/vendor/topthink/framework/src/think/console/command/Version.php deleted file mode 100644 index beb49d2c..00000000 --- a/vendor/topthink/framework/src/think/console/command/Version.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\console\command; - -use think\console\Command; -use think\console\Input; -use think\console\Output; - -class Version extends Command -{ - protected function configure() - { - // 指令配置 - $this->setName('version') - ->setDescription('show thinkphp framework version'); - } - - protected function execute(Input $input, Output $output) - { - $output->writeln('v' . $this->app->version()); - } - -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Command.php b/vendor/topthink/framework/src/think/console/command/make/Command.php deleted file mode 100644 index 9549a021..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Command.php +++ /dev/null @@ -1,55 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command\make; - -use think\console\command\Make; -use think\console\input\Argument; - -class Command extends Make -{ - protected $type = "Command"; - - protected function configure() - { - parent::configure(); - $this->setName('make:command') - ->addArgument('commandName', Argument::OPTIONAL, "The name of the command") - ->setDescription('Create a new command class'); - } - - protected function buildClass(string $name): string - { - $commandName = $this->input->getArgument('commandName') ?: strtolower(basename($name)); - $namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); - - $class = str_replace($namespace . '\\', '', $name); - $stub = file_get_contents($this->getStub()); - - return str_replace(['{%commandName%}', '{%className%}', '{%namespace%}', '{%app_namespace%}'], [ - $commandName, - $class, - $namespace, - $this->app->getNamespace(), - ], $stub); - } - - protected function getStub(): string - { - return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'command.stub'; - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\command'; - } - -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Controller.php b/vendor/topthink/framework/src/think/console/command/make/Controller.php deleted file mode 100644 index 4a8d226c..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Controller.php +++ /dev/null @@ -1,56 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command\make; - -use think\console\command\Make; -use think\console\input\Option; - -class Controller extends Make -{ - - protected $type = "Controller"; - - protected function configure() - { - parent::configure(); - $this->setName('make:controller') - ->addOption('api', null, Option::VALUE_NONE, 'Generate an api controller class.') - ->addOption('plain', null, Option::VALUE_NONE, 'Generate an empty controller class.') - ->setDescription('Create a new resource controller class'); - } - - protected function getStub(): string - { - $stubPath = __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR; - - if ($this->input->getOption('api')) { - return $stubPath . 'controller.api.stub'; - } - - if ($this->input->getOption('plain')) { - return $stubPath . 'controller.plain.stub'; - } - - return $stubPath . 'controller.stub'; - } - - protected function getClassName(string $name): string - { - return parent::getClassName($name) . ($this->app->config->get('route.controller_suffix') ? 'Controller' : ''); - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\controller'; - } - -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Event.php b/vendor/topthink/framework/src/think/console/command/make/Event.php deleted file mode 100644 index 6b166898..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Event.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\console\command\make; - -use think\console\command\Make; - -class Event extends Make -{ - protected $type = "Event"; - - protected function configure() - { - parent::configure(); - $this->setName('make:event') - ->setDescription('Create a new event class'); - } - - protected function getStub(): string - { - return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'event.stub'; - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\event'; - } -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Listener.php b/vendor/topthink/framework/src/think/console/command/make/Listener.php deleted file mode 100644 index 5c926736..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Listener.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\console\command\make; - -use think\console\command\Make; - -class Listener extends Make -{ - protected $type = "Listener"; - - protected function configure() - { - parent::configure(); - $this->setName('make:listener') - ->setDescription('Create a new listener class'); - } - - protected function getStub(): string - { - return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'listener.stub'; - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\listener'; - } -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Middleware.php b/vendor/topthink/framework/src/think/console/command/make/Middleware.php deleted file mode 100644 index 3b68b4a7..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Middleware.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command\make; - -use think\console\command\Make; - -class Middleware extends Make -{ - protected $type = "Middleware"; - - protected function configure() - { - parent::configure(); - $this->setName('make:middleware') - ->setDescription('Create a new middleware class'); - } - - protected function getStub(): string - { - return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'middleware.stub'; - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\middleware'; - } -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Model.php b/vendor/topthink/framework/src/think/console/command/make/Model.php deleted file mode 100644 index cb7a23c4..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Model.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command\make; - -use think\console\command\Make; - -class Model extends Make -{ - protected $type = "Model"; - - protected function configure() - { - parent::configure(); - $this->setName('make:model') - ->setDescription('Create a new model class'); - } - - protected function getStub(): string - { - return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'model.stub'; - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\model'; - } -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Service.php b/vendor/topthink/framework/src/think/console/command/make/Service.php deleted file mode 100644 index c4bbaa0e..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Service.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command\make; - -use think\console\command\Make; - -class Service extends Make -{ - protected $type = "Service"; - - protected function configure() - { - parent::configure(); - $this->setName('make:service') - ->setDescription('Create a new Service class'); - } - - protected function getStub(): string - { - return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'service.stub'; - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\service'; - } -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Subscribe.php b/vendor/topthink/framework/src/think/console/command/make/Subscribe.php deleted file mode 100644 index a1dc2a82..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Subscribe.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\console\command\make; - -use think\console\command\Make; - -class Subscribe extends Make -{ - protected $type = "Subscribe"; - - protected function configure() - { - parent::configure(); - $this->setName('make:subscribe') - ->setDescription('Create a new subscribe class'); - } - - protected function getStub(): string - { - return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'subscribe.stub'; - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\subscribe'; - } -} diff --git a/vendor/topthink/framework/src/think/console/command/make/Validate.php b/vendor/topthink/framework/src/think/console/command/make/Validate.php deleted file mode 100644 index 8d364316..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/Validate.php +++ /dev/null @@ -1,39 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\command\make; - -use think\console\command\Make; - -class Validate extends Make -{ - protected $type = "Validate"; - - protected function configure() - { - parent::configure(); - $this->setName('make:validate') - ->setDescription('Create a validate class'); - } - - protected function getStub(): string - { - $stubPath = __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR; - - return $stubPath . 'validate.stub'; - } - - protected function getNamespace(string $app): string - { - return parent::getNamespace($app) . '\\validate'; - } - -} diff --git a/vendor/topthink/framework/src/think/console/command/make/stubs/command.stub b/vendor/topthink/framework/src/think/console/command/make/stubs/command.stub deleted file mode 100644 index 3ee2b1cf..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/stubs/command.stub +++ /dev/null @@ -1,26 +0,0 @@ -setName('{%commandName%}') - ->setDescription('the {%commandName%} command'); - } - - protected function execute(Input $input, Output $output) - { - // 指令输出 - $output->writeln('{%commandName%}'); - } -} diff --git a/vendor/topthink/framework/src/think/console/command/make/stubs/controller.api.stub b/vendor/topthink/framework/src/think/console/command/make/stubs/controller.api.stub deleted file mode 100644 index 5d3383d2..00000000 --- a/vendor/topthink/framework/src/think/console/command/make/stubs/controller.api.stub +++ /dev/null @@ -1,64 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = []; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/vendor/topthink/framework/src/think/console/command/optimize/Route.php b/vendor/topthink/framework/src/think/console/command/optimize/Route.php deleted file mode 100644 index 56f7f5a9..00000000 --- a/vendor/topthink/framework/src/think/console/command/optimize/Route.php +++ /dev/null @@ -1,66 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\console\command\optimize; - -use think\console\Command; -use think\console\Input; -use think\console\input\Argument; -use think\console\Output; -use think\event\RouteLoaded; - -class Route extends Command -{ - protected function configure() - { - $this->setName('optimize:route') - ->addArgument('dir', Argument::OPTIONAL, 'dir name .') - ->setDescription('Build app route cache.'); - } - - protected function execute(Input $input, Output $output) - { - $dir = $input->getArgument('dir') ?: ''; - - $path = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : ''); - - $filename = $path . 'route.php'; - if (is_file($filename)) { - unlink($filename); - } - - file_put_contents($filename, $this->buildRouteCache($dir)); - $output->writeln('Succeed!'); - } - - protected function buildRouteCache(string $dir = null): string - { - $this->app->route->clear(); - $this->app->route->lazy(false); - - // 路由检测 - $path = $this->app->getRootPath() . ($dir ? 'app' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR : '') . 'route' . DIRECTORY_SEPARATOR; - - $files = is_dir($path) ? scandir($path) : []; - - foreach ($files as $file) { - if (strpos($file, '.php')) { - include $path . $file; - } - } - - //触发路由载入完成事件 - $this->app->event->trigger(RouteLoaded::class); - $rules = $this->app->route->getName(); - - return ' -// +---------------------------------------------------------------------- -namespace think\console\command\optimize; - -use Exception; -use think\console\Command; -use think\console\Input; -use think\console\input\Argument; -use think\console\input\Option; -use think\console\Output; -use think\db\PDOConnection; - -class Schema extends Command -{ - protected function configure() - { - $this->setName('optimize:schema') - ->addArgument('dir', Argument::OPTIONAL, 'dir name .') - ->addOption('connection', null, Option::VALUE_REQUIRED, 'connection name .') - ->addOption('table', null, Option::VALUE_REQUIRED, 'table name .') - ->setDescription('Build database schema cache.'); - } - - protected function execute(Input $input, Output $output) - { - $dir = $input->getArgument('dir') ?: ''; - - if ($input->hasOption('table')) { - $connection = $this->app->db->connect($input->getOption('connection')); - if (!$connection instanceof PDOConnection) { - $output->error("only PDO connection support schema cache!"); - return; - } - $table = $input->getOption('table'); - if (false === strpos($table, '.')) { - $dbName = $connection->getConfig('database'); - } else { - [$dbName, $table] = explode('.', $table); - } - - if ($table == '*') { - $table = $connection->getTables($dbName); - } - - $this->buildDataBaseSchema($connection, (array) $table, $dbName); - } else { - if ($dir) { - $appPath = $this->app->getBasePath() . $dir . DIRECTORY_SEPARATOR; - $namespace = 'app\\' . $dir; - } else { - $appPath = $this->app->getBasePath(); - $namespace = 'app'; - } - - $path = $appPath . 'model'; - $list = is_dir($path) ? scandir($path) : []; - - foreach ($list as $file) { - if (0 === strpos($file, '.')) { - continue; - } - $class = '\\' . $namespace . '\\model\\' . pathinfo($file, PATHINFO_FILENAME); - $this->buildModelSchema($class); - } - } - - $output->writeln('Succeed!'); - } - - protected function buildModelSchema(string $class): void - { - $reflect = new \ReflectionClass($class); - if (!$reflect->isAbstract() && $reflect->isSubclassOf('\think\Model')) { - try { - /** @var \think\Model $model */ - $model = new $class; - $connection = $model->db()->getConnection(); - if ($connection instanceof PDOConnection) { - $table = $model->getTable(); - //预读字段信息 - $connection->getSchemaInfo($table, true); - } - } catch (Exception $e) { - - } - } - } - - protected function buildDataBaseSchema(PDOConnection $connection, array $tables, string $dbName): void - { - foreach ($tables as $table) { - //预读字段信息 - $connection->getSchemaInfo("{$dbName}.{$table}", true); - } - } -} diff --git a/vendor/topthink/framework/src/think/console/input/Argument.php b/vendor/topthink/framework/src/think/console/input/Argument.php deleted file mode 100644 index 86cca36c..00000000 --- a/vendor/topthink/framework/src/think/console/input/Argument.php +++ /dev/null @@ -1,138 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\input; - -class Argument -{ - // 必传参数 - const REQUIRED = 1; - - // 可选参数 - const OPTIONAL = 2; - - // 数组参数 - const IS_ARRAY = 4; - - /** - * 参数名 - * @var string - */ - private $name; - - /** - * 参数类型 - * @var int - */ - private $mode; - - /** - * 参数默认值 - * @var mixed - */ - private $default; - - /** - * 参数描述 - * @var string - */ - private $description; - - /** - * 构造方法 - * @param string $name 参数名 - * @param int $mode 参数类型: self::REQUIRED 或者 self::OPTIONAL - * @param string $description 描述 - * @param mixed $default 默认值 (仅 self::OPTIONAL 类型有效) - * @throws \InvalidArgumentException - */ - public function __construct(string $name, int $mode = null, string $description = '', $default = null) - { - if (null === $mode) { - $mode = self::OPTIONAL; - } elseif (!is_int($mode) || $mode > 7 || $mode < 1) { - throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode)); - } - - $this->name = $name; - $this->mode = $mode; - $this->description = $description; - - $this->setDefault($default); - } - - /** - * 获取参数名 - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * 是否必须 - * @return bool - */ - public function isRequired(): bool - { - return self::REQUIRED === (self::REQUIRED & $this->mode); - } - - /** - * 该参数是否接受数组 - * @return bool - */ - public function isArray(): bool - { - return self::IS_ARRAY === (self::IS_ARRAY & $this->mode); - } - - /** - * 设置默认值 - * @param mixed $default 默认值 - * @throws \LogicException - */ - public function setDefault($default = null): void - { - if (self::REQUIRED === $this->mode && null !== $default) { - throw new \LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.'); - } - - if ($this->isArray()) { - if (null === $default) { - $default = []; - } elseif (!is_array($default)) { - throw new \LogicException('A default value for an array argument must be an array.'); - } - } - - $this->default = $default; - } - - /** - * 获取默认值 - * @return mixed - */ - public function getDefault() - { - return $this->default; - } - - /** - * 获取描述 - * @return string - */ - public function getDescription(): string - { - return $this->description; - } -} diff --git a/vendor/topthink/framework/src/think/console/input/Definition.php b/vendor/topthink/framework/src/think/console/input/Definition.php deleted file mode 100644 index ccf02a0c..00000000 --- a/vendor/topthink/framework/src/think/console/input/Definition.php +++ /dev/null @@ -1,375 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\input; - -class Definition -{ - - /** - * @var Argument[] - */ - private $arguments; - - private $requiredCount; - private $hasAnArrayArgument = false; - private $hasOptional; - - /** - * @var Option[] - */ - private $options; - private $shortcuts; - - /** - * 构造方法 - * @param array $definition - * @api - */ - public function __construct(array $definition = []) - { - $this->setDefinition($definition); - } - - /** - * 设置指令的定义 - * @param array $definition 定义的数组 - */ - public function setDefinition(array $definition): void - { - $arguments = []; - $options = []; - foreach ($definition as $item) { - if ($item instanceof Option) { - $options[] = $item; - } else { - $arguments[] = $item; - } - } - - $this->setArguments($arguments); - $this->setOptions($options); - } - - /** - * 设置参数 - * @param Argument[] $arguments 参数数组 - */ - public function setArguments(array $arguments = []): void - { - $this->arguments = []; - $this->requiredCount = 0; - $this->hasOptional = false; - $this->hasAnArrayArgument = false; - $this->addArguments($arguments); - } - - /** - * 添加参数 - * @param Argument[] $arguments 参数数组 - * @api - */ - public function addArguments(array $arguments = []): void - { - if (null !== $arguments) { - foreach ($arguments as $argument) { - $this->addArgument($argument); - } - } - } - - /** - * 添加一个参数 - * @param Argument $argument 参数 - * @throws \LogicException - */ - public function addArgument(Argument $argument): void - { - if (isset($this->arguments[$argument->getName()])) { - throw new \LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName())); - } - - if ($this->hasAnArrayArgument) { - throw new \LogicException('Cannot add an argument after an array argument.'); - } - - if ($argument->isRequired() && $this->hasOptional) { - throw new \LogicException('Cannot add a required argument after an optional one.'); - } - - if ($argument->isArray()) { - $this->hasAnArrayArgument = true; - } - - if ($argument->isRequired()) { - ++$this->requiredCount; - } else { - $this->hasOptional = true; - } - - $this->arguments[$argument->getName()] = $argument; - } - - /** - * 根据名称或者位置获取参数 - * @param string|int $name 参数名或者位置 - * @return Argument 参数 - * @throws \InvalidArgumentException - */ - public function getArgument($name): Argument - { - if (!$this->hasArgument($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); - } - - $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments; - - return $arguments[$name]; - } - - /** - * 根据名称或位置检查是否具有某个参数 - * @param string|int $name 参数名或者位置 - * @return bool - * @api - */ - public function hasArgument($name): bool - { - $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments; - - return isset($arguments[$name]); - } - - /** - * 获取所有的参数 - * @return Argument[] 参数数组 - */ - public function getArguments(): array - { - return $this->arguments; - } - - /** - * 获取参数数量 - * @return int - */ - public function getArgumentCount(): int - { - return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments); - } - - /** - * 获取必填的参数的数量 - * @return int - */ - public function getArgumentRequiredCount(): int - { - return $this->requiredCount; - } - - /** - * 获取参数默认值 - * @return array - */ - public function getArgumentDefaults(): array - { - $values = []; - foreach ($this->arguments as $argument) { - $values[$argument->getName()] = $argument->getDefault(); - } - - return $values; - } - - /** - * 设置选项 - * @param Option[] $options 选项数组 - */ - public function setOptions(array $options = []): void - { - $this->options = []; - $this->shortcuts = []; - $this->addOptions($options); - } - - /** - * 添加选项 - * @param Option[] $options 选项数组 - * @api - */ - public function addOptions(array $options = []): void - { - foreach ($options as $option) { - $this->addOption($option); - } - } - - /** - * 添加一个选项 - * @param Option $option 选项 - * @throws \LogicException - * @api - */ - public function addOption(Option $option): void - { - if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) { - throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName())); - } - - if ($option->getShortcut()) { - foreach (explode('|', $option->getShortcut()) as $shortcut) { - if (isset($this->shortcuts[$shortcut]) - && !$option->equals($this->options[$this->shortcuts[$shortcut]]) - ) { - throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut)); - } - } - } - - $this->options[$option->getName()] = $option; - if ($option->getShortcut()) { - foreach (explode('|', $option->getShortcut()) as $shortcut) { - $this->shortcuts[$shortcut] = $option->getName(); - } - } - } - - /** - * 根据名称获取选项 - * @param string $name 选项名 - * @return Option - * @throws \InvalidArgumentException - * @api - */ - public function getOption(string $name): Option - { - if (!$this->hasOption($name)) { - throw new \InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name)); - } - - return $this->options[$name]; - } - - /** - * 根据名称检查是否有这个选项 - * @param string $name 选项名 - * @return bool - * @api - */ - public function hasOption(string $name): bool - { - return isset($this->options[$name]); - } - - /** - * 获取所有选项 - * @return Option[] - * @api - */ - public function getOptions(): array - { - return $this->options; - } - - /** - * 根据名称检查某个选项是否有短名称 - * @param string $name 短名称 - * @return bool - */ - public function hasShortcut(string $name): bool - { - return isset($this->shortcuts[$name]); - } - - /** - * 根据短名称获取选项 - * @param string $shortcut 短名称 - * @return Option - */ - public function getOptionForShortcut(string $shortcut): Option - { - return $this->getOption($this->shortcutToName($shortcut)); - } - - /** - * 获取所有选项的默认值 - * @return array - */ - public function getOptionDefaults(): array - { - $values = []; - foreach ($this->options as $option) { - $values[$option->getName()] = $option->getDefault(); - } - - return $values; - } - - /** - * 根据短名称获取选项名 - * @param string $shortcut 短名称 - * @return string - * @throws \InvalidArgumentException - */ - private function shortcutToName(string $shortcut): string - { - if (!isset($this->shortcuts[$shortcut])) { - throw new \InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut)); - } - - return $this->shortcuts[$shortcut]; - } - - /** - * 获取该指令的介绍 - * @param bool $short 是否简洁介绍 - * @return string - */ - public function getSynopsis(bool $short = false): string - { - $elements = []; - - if ($short && $this->getOptions()) { - $elements[] = '[options]'; - } elseif (!$short) { - foreach ($this->getOptions() as $option) { - $value = ''; - if ($option->acceptValue()) { - $value = sprintf(' %s%s%s', $option->isValueOptional() ? '[' : '', strtoupper($option->getName()), $option->isValueOptional() ? ']' : ''); - } - - $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : ''; - $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value); - } - } - - if (count($elements) && $this->getArguments()) { - $elements[] = '[--]'; - } - - foreach ($this->getArguments() as $argument) { - $element = '<' . $argument->getName() . '>'; - if (!$argument->isRequired()) { - $element = '[' . $element . ']'; - } elseif ($argument->isArray()) { - $element .= ' (' . $element . ')'; - } - - if ($argument->isArray()) { - $element .= '...'; - } - - $elements[] = $element; - } - - return implode(' ', $elements); - } -} diff --git a/vendor/topthink/framework/src/think/console/input/Option.php b/vendor/topthink/framework/src/think/console/input/Option.php deleted file mode 100644 index 19c7e1e8..00000000 --- a/vendor/topthink/framework/src/think/console/input/Option.php +++ /dev/null @@ -1,221 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\input; - -/** - * 命令行选项 - * @package think\console\input - */ -class Option -{ - // 无需传值 - const VALUE_NONE = 1; - // 必须传值 - const VALUE_REQUIRED = 2; - // 可选传值 - const VALUE_OPTIONAL = 4; - // 传数组值 - const VALUE_IS_ARRAY = 8; - - /** - * 选项名 - * @var string - */ - private $name; - - /** - * 选项短名称 - * @var string - */ - private $shortcut; - - /** - * 选项类型 - * @var int - */ - private $mode; - - /** - * 选项默认值 - * @var mixed - */ - private $default; - - /** - * 选项描述 - * @var string - */ - private $description; - - /** - * 构造方法 - * @param string $name 选项名 - * @param string|array $shortcut 短名称,多个用|隔开或者使用数组 - * @param int $mode 选项类型(可选类型为 self::VALUE_*) - * @param string $description 描述 - * @param mixed $default 默认值 (类型为 self::VALUE_REQUIRED 或者 self::VALUE_NONE 的时候必须为null) - * @throws \InvalidArgumentException - */ - public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null) - { - if (0 === strpos($name, '--')) { - $name = substr($name, 2); - } - - if (empty($name)) { - throw new \InvalidArgumentException('An option name cannot be empty.'); - } - - if (empty($shortcut)) { - $shortcut = null; - } - - if (null !== $shortcut) { - if (is_array($shortcut)) { - $shortcut = implode('|', $shortcut); - } - $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-')); - $shortcuts = array_filter($shortcuts); - $shortcut = implode('|', $shortcuts); - - if (empty($shortcut)) { - throw new \InvalidArgumentException('An option shortcut cannot be empty.'); - } - } - - if (null === $mode) { - $mode = self::VALUE_NONE; - } elseif (!is_int($mode) || $mode > 15 || $mode < 1) { - throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode)); - } - - $this->name = $name; - $this->shortcut = $shortcut; - $this->mode = $mode; - $this->description = $description; - - if ($this->isArray() && !$this->acceptValue()) { - throw new \InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.'); - } - - $this->setDefault($default); - } - - /** - * 获取短名称 - * @return string - */ - public function getShortcut() - { - return $this->shortcut; - } - - /** - * 获取选项名 - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * 是否可以设置值 - * @return bool 类型不是 self::VALUE_NONE 的时候返回true,其他均返回false - */ - public function acceptValue() - { - return $this->isValueRequired() || $this->isValueOptional(); - } - - /** - * 是否必须 - * @return bool 类型是 self::VALUE_REQUIRED 的时候返回true,其他均返回false - */ - public function isValueRequired() - { - return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode); - } - - /** - * 是否可选 - * @return bool 类型是 self::VALUE_OPTIONAL 的时候返回true,其他均返回false - */ - public function isValueOptional() - { - return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode); - } - - /** - * 选项值是否接受数组 - * @return bool 类型是 self::VALUE_IS_ARRAY 的时候返回true,其他均返回false - */ - public function isArray() - { - return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode); - } - - /** - * 设置默认值 - * @param mixed $default 默认值 - * @throws \LogicException - */ - public function setDefault($default = null) - { - if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) { - throw new \LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.'); - } - - if ($this->isArray()) { - if (null === $default) { - $default = []; - } elseif (!is_array($default)) { - throw new \LogicException('A default value for an array option must be an array.'); - } - } - - $this->default = $this->acceptValue() ? $default : false; - } - - /** - * 获取默认值 - * @return mixed - */ - public function getDefault() - { - return $this->default; - } - - /** - * 获取描述文字 - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * 检查所给选项是否是当前这个 - * @param Option $option - * @return bool - */ - public function equals(Option $option) - { - return $option->getName() === $this->getName() - && $option->getShortcut() === $this->getShortcut() - && $option->getDefault() === $this->getDefault() - && $option->isArray() === $this->isArray() - && $option->isValueRequired() === $this->isValueRequired() - && $option->isValueOptional() === $this->isValueOptional(); - } -} diff --git a/vendor/topthink/framework/src/think/console/output/Ask.php b/vendor/topthink/framework/src/think/console/output/Ask.php deleted file mode 100644 index 56821c72..00000000 --- a/vendor/topthink/framework/src/think/console/output/Ask.php +++ /dev/null @@ -1,336 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output; - -use think\console\Input; -use think\console\Output; -use think\console\output\question\Choice; -use think\console\output\question\Confirmation; - -class Ask -{ - private static $stty; - - private static $shell; - - /** @var Input */ - protected $input; - - /** @var Output */ - protected $output; - - /** @var Question */ - protected $question; - - public function __construct(Input $input, Output $output, Question $question) - { - $this->input = $input; - $this->output = $output; - $this->question = $question; - } - - public function run() - { - if (!$this->input->isInteractive()) { - return $this->question->getDefault(); - } - - if (!$this->question->getValidator()) { - return $this->doAsk(); - } - - $that = $this; - - $interviewer = function () use ($that) { - return $that->doAsk(); - }; - - return $this->validateAttempts($interviewer); - } - - protected function doAsk() - { - $this->writePrompt(); - - $inputStream = STDIN; - $autocomplete = $this->question->getAutocompleterValues(); - - if (null === $autocomplete || !$this->hasSttyAvailable()) { - $ret = false; - if ($this->question->isHidden()) { - try { - $ret = trim($this->getHiddenResponse($inputStream)); - } catch (\RuntimeException $e) { - if (!$this->question->isHiddenFallback()) { - throw $e; - } - } - } - - if (false === $ret) { - $ret = fgets($inputStream, 4096); - if (false === $ret) { - throw new \RuntimeException('Aborted'); - } - $ret = trim($ret); - } - } else { - $ret = trim($this->autocomplete($inputStream)); - } - - $ret = strlen($ret) > 0 ? $ret : $this->question->getDefault(); - - if ($normalizer = $this->question->getNormalizer()) { - return $normalizer($ret); - } - - return $ret; - } - - private function autocomplete($inputStream) - { - $autocomplete = $this->question->getAutocompleterValues(); - $ret = ''; - - $i = 0; - $ofs = -1; - $matches = $autocomplete; - $numMatches = count($matches); - - $sttyMode = shell_exec('stty -g'); - - shell_exec('stty -icanon -echo'); - - while (!feof($inputStream)) { - $c = fread($inputStream, 1); - - if ("\177" === $c) { - if (0 === $numMatches && 0 !== $i) { - --$i; - $this->output->write("\033[1D"); - } - - if ($i === 0) { - $ofs = -1; - $matches = $autocomplete; - $numMatches = count($matches); - } else { - $numMatches = 0; - } - - $ret = substr($ret, 0, $i); - } elseif ("\033" === $c) { - $c .= fread($inputStream, 2); - - if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) { - if ('A' === $c[2] && -1 === $ofs) { - $ofs = 0; - } - - if (0 === $numMatches) { - continue; - } - - $ofs += ('A' === $c[2]) ? -1 : 1; - $ofs = ($numMatches + $ofs) % $numMatches; - } - } elseif (ord($c) < 32) { - if ("\t" === $c || "\n" === $c) { - if ($numMatches > 0 && -1 !== $ofs) { - $ret = $matches[$ofs]; - $this->output->write(substr($ret, $i)); - $i = strlen($ret); - } - - if ("\n" === $c) { - $this->output->write($c); - break; - } - - $numMatches = 0; - } - - continue; - } else { - $this->output->write($c); - $ret .= $c; - ++$i; - - $numMatches = 0; - $ofs = 0; - - foreach ($autocomplete as $value) { - if (0 === strpos($value, $ret) && $i !== strlen($value)) { - $matches[$numMatches++] = $value; - } - } - } - - $this->output->write("\033[K"); - - if ($numMatches > 0 && -1 !== $ofs) { - $this->output->write("\0337"); - $this->output->highlight(substr($matches[$ofs], $i)); - $this->output->write("\0338"); - } - } - - shell_exec(sprintf('stty %s', $sttyMode)); - - return $ret; - } - - protected function getHiddenResponse($inputStream) - { - if ('\\' === DIRECTORY_SEPARATOR) { - $exe = __DIR__ . '/../bin/hiddeninput.exe'; - - $value = rtrim(shell_exec($exe)); - $this->output->writeln(''); - - return $value; - } - - if ($this->hasSttyAvailable()) { - $sttyMode = shell_exec('stty -g'); - - shell_exec('stty -echo'); - $value = fgets($inputStream, 4096); - shell_exec(sprintf('stty %s', $sttyMode)); - - if (false === $value) { - throw new \RuntimeException('Aborted'); - } - - $value = trim($value); - $this->output->writeln(''); - - return $value; - } - - if (false !== $shell = $this->getShell()) { - $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword'; - $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd); - $value = rtrim(shell_exec($command)); - $this->output->writeln(''); - - return $value; - } - - throw new \RuntimeException('Unable to hide the response.'); - } - - protected function validateAttempts($interviewer) - { - /** @var \Exception $error */ - $error = null; - $attempts = $this->question->getMaxAttempts(); - while (null === $attempts || $attempts--) { - if (null !== $error) { - $this->output->error($error->getMessage()); - } - - try { - return call_user_func($this->question->getValidator(), $interviewer()); - } catch (\Exception $error) { - } - } - - throw $error; - } - - /** - * 显示问题的提示信息 - */ - protected function writePrompt() - { - $text = $this->question->getQuestion(); - $default = $this->question->getDefault(); - - switch (true) { - case null === $default: - $text = sprintf(' %s:', $text); - - break; - - case $this->question instanceof Confirmation: - $text = sprintf(' %s (yes/no) [%s]:', $text, $default ? 'yes' : 'no'); - - break; - - case $this->question instanceof Choice && $this->question->isMultiselect(): - $choices = $this->question->getChoices(); - $default = explode(',', $default); - - foreach ($default as $key => $value) { - $default[$key] = $choices[trim($value)]; - } - - $text = sprintf(' %s [%s]:', $text, implode(', ', $default)); - - break; - - case $this->question instanceof Choice: - $choices = $this->question->getChoices(); - $text = sprintf(' %s [%s]:', $text, $choices[$default]); - - break; - - default: - $text = sprintf(' %s [%s]:', $text, $default); - } - - $this->output->writeln($text); - - if ($this->question instanceof Choice) { - $width = max(array_map('strlen', array_keys($this->question->getChoices()))); - - foreach ($this->question->getChoices() as $key => $value) { - $this->output->writeln(sprintf(" [%-${width}s] %s", $key, $value)); - } - } - - $this->output->write(' > '); - } - - private function getShell() - { - if (null !== self::$shell) { - return self::$shell; - } - - self::$shell = false; - - if (file_exists('/usr/bin/env')) { - $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null"; - foreach (['bash', 'zsh', 'ksh', 'csh'] as $sh) { - if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) { - self::$shell = $sh; - break; - } - } - } - - return self::$shell; - } - - private function hasSttyAvailable() - { - if (null !== self::$stty) { - return self::$stty; - } - - exec('stty 2>&1', $output, $exitcode); - - return self::$stty = $exitcode === 0; - } -} diff --git a/vendor/topthink/framework/src/think/console/output/Descriptor.php b/vendor/topthink/framework/src/think/console/output/Descriptor.php deleted file mode 100644 index e4a9e61b..00000000 --- a/vendor/topthink/framework/src/think/console/output/Descriptor.php +++ /dev/null @@ -1,323 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output; - -use think\Console; -use think\console\Command; -use think\console\input\Argument as InputArgument; -use think\console\input\Definition as InputDefinition; -use think\console\input\Option as InputOption; -use think\console\Output; -use think\console\output\descriptor\Console as ConsoleDescription; - -class Descriptor -{ - - /** - * @var Output - */ - protected $output; - - /** - * {@inheritdoc} - */ - public function describe(Output $output, $object, array $options = []) - { - $this->output = $output; - - switch (true) { - case $object instanceof InputArgument: - $this->describeInputArgument($object, $options); - break; - case $object instanceof InputOption: - $this->describeInputOption($object, $options); - break; - case $object instanceof InputDefinition: - $this->describeInputDefinition($object, $options); - break; - case $object instanceof Command: - $this->describeCommand($object, $options); - break; - case $object instanceof Console: - $this->describeConsole($object, $options); - break; - default: - throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object))); - } - } - - /** - * 输出内容 - * @param string $content - * @param bool $decorated - */ - protected function write($content, $decorated = false) - { - $this->output->write($content, false, $decorated ? Output::OUTPUT_NORMAL : Output::OUTPUT_RAW); - } - - /** - * 描述参数 - * @param InputArgument $argument - * @param array $options - * @return string|mixed - */ - protected function describeInputArgument(InputArgument $argument, array $options = []) - { - if (null !== $argument->getDefault() - && (!is_array($argument->getDefault()) - || count($argument->getDefault())) - ) { - $default = sprintf(' [default: %s]', $this->formatDefaultValue($argument->getDefault())); - } else { - $default = ''; - } - - $totalWidth = $options['total_width'] ?? strlen($argument->getName()); - $spacingWidth = $totalWidth - strlen($argument->getName()) + 2; - - $this->writeText(sprintf(" %s%s%s%s", $argument->getName(), str_repeat(' ', $spacingWidth), // + 17 = 2 spaces + + + 2 spaces - preg_replace('/\s*\R\s*/', PHP_EOL . str_repeat(' ', $totalWidth + 17), $argument->getDescription()), $default), $options); - } - - /** - * 描述选项 - * @param InputOption $option - * @param array $options - * @return string|mixed - */ - protected function describeInputOption(InputOption $option, array $options = []) - { - if ($option->acceptValue() && null !== $option->getDefault() - && (!is_array($option->getDefault()) - || count($option->getDefault())) - ) { - $default = sprintf(' [default: %s]', $this->formatDefaultValue($option->getDefault())); - } else { - $default = ''; - } - - $value = ''; - if ($option->acceptValue()) { - $value = '=' . strtoupper($option->getName()); - - if ($option->isValueOptional()) { - $value = '[' . $value . ']'; - } - } - - $totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]); - $synopsis = sprintf('%s%s', $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ', sprintf('--%s%s', $option->getName(), $value)); - - $spacingWidth = $totalWidth - strlen($synopsis) + 2; - - $this->writeText(sprintf(" %s%s%s%s%s", $synopsis, str_repeat(' ', $spacingWidth), // + 17 = 2 spaces + + + 2 spaces - preg_replace('/\s*\R\s*/', "\n" . str_repeat(' ', $totalWidth + 17), $option->getDescription()), $default, $option->isArray() ? ' (multiple values allowed)' : ''), $options); - } - - /** - * 描述输入 - * @param InputDefinition $definition - * @param array $options - * @return string|mixed - */ - protected function describeInputDefinition(InputDefinition $definition, array $options = []) - { - $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions()); - foreach ($definition->getArguments() as $argument) { - $totalWidth = max($totalWidth, strlen($argument->getName())); - } - - if ($definition->getArguments()) { - $this->writeText('Arguments:', $options); - $this->writeText("\n"); - foreach ($definition->getArguments() as $argument) { - $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth])); - $this->writeText("\n"); - } - } - - if ($definition->getArguments() && $definition->getOptions()) { - $this->writeText("\n"); - } - - if ($definition->getOptions()) { - $laterOptions = []; - - $this->writeText('Options:', $options); - foreach ($definition->getOptions() as $option) { - if (strlen($option->getShortcut()) > 1) { - $laterOptions[] = $option; - continue; - } - $this->writeText("\n"); - $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth])); - } - foreach ($laterOptions as $option) { - $this->writeText("\n"); - $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth])); - } - } - } - - /** - * 描述指令 - * @param Command $command - * @param array $options - * @return string|mixed - */ - protected function describeCommand(Command $command, array $options = []) - { - $command->getSynopsis(true); - $command->getSynopsis(false); - $command->mergeConsoleDefinition(false); - - $this->writeText('Usage:', $options); - foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) { - $this->writeText("\n"); - $this->writeText(' ' . $usage, $options); - } - $this->writeText("\n"); - - $definition = $command->getNativeDefinition(); - if ($definition->getOptions() || $definition->getArguments()) { - $this->writeText("\n"); - $this->describeInputDefinition($definition, $options); - $this->writeText("\n"); - } - - if ($help = $command->getProcessedHelp()) { - $this->writeText("\n"); - $this->writeText('Help:', $options); - $this->writeText("\n"); - $this->writeText(' ' . str_replace("\n", "\n ", $help), $options); - $this->writeText("\n"); - } - } - - /** - * 描述控制台 - * @param Console $console - * @param array $options - * @return string|mixed - */ - protected function describeConsole(Console $console, array $options = []) - { - $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; - $description = new ConsoleDescription($console, $describedNamespace); - - if (isset($options['raw_text']) && $options['raw_text']) { - $width = $this->getColumnWidth($description->getNamespaces()); - - foreach ($description->getCommands() as $command) { - $this->writeText(sprintf("%-${width}s %s", $command->getName(), $command->getDescription()), $options); - $this->writeText("\n"); - } - } else { - if ('' != $help = $console->getHelp()) { - $this->writeText("$help\n\n", $options); - } - - $this->writeText("Usage:\n", $options); - $this->writeText(" command [options] [arguments]\n\n", $options); - - $this->describeInputDefinition(new InputDefinition($console->getDefinition()->getOptions()), $options); - - $this->writeText("\n"); - $this->writeText("\n"); - - $width = $this->getColumnWidth($description->getNamespaces()); - - if ($describedNamespace) { - $this->writeText(sprintf('Available commands for the "%s" namespace:', $describedNamespace), $options); - } else { - $this->writeText('Available commands:', $options); - } - - // add commands by namespace - foreach ($description->getNamespaces() as $namespace) { - if (!$describedNamespace && ConsoleDescription::GLOBAL_NAMESPACE !== $namespace['id']) { - $this->writeText("\n"); - $this->writeText(' ' . $namespace['id'] . '', $options); - } - - foreach ($namespace['commands'] as $name) { - $this->writeText("\n"); - $spacingWidth = $width - strlen($name); - $this->writeText(sprintf(" %s%s%s", $name, str_repeat(' ', $spacingWidth), $description->getCommand($name) - ->getDescription()), $options); - } - } - - $this->writeText("\n"); - } - } - - /** - * {@inheritdoc} - */ - private function writeText($content, array $options = []) - { - $this->write(isset($options['raw_text']) - && $options['raw_text'] ? strip_tags($content) : $content, isset($options['raw_output']) ? !$options['raw_output'] : true); - } - - /** - * 格式化 - * @param mixed $default - * @return string - */ - private function formatDefaultValue($default) - { - return json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - } - - /** - * @param Namespaces[] $namespaces - * @return int - */ - private function getColumnWidth(array $namespaces) - { - $width = 0; - foreach ($namespaces as $namespace) { - foreach ($namespace['commands'] as $name) { - if (strlen($name) > $width) { - $width = strlen($name); - } - } - } - - return $width + 2; - } - - /** - * @param InputOption[] $options - * @return int - */ - private function calculateTotalWidthForOptions($options) - { - $totalWidth = 0; - foreach ($options as $option) { - $nameLength = 4 + strlen($option->getName()) + 2; // - + shortcut + , + whitespace + name + -- - - if ($option->acceptValue()) { - $valueLength = 1 + strlen($option->getName()); // = + value - $valueLength += $option->isValueOptional() ? 2 : 0; // [ + ] - - $nameLength += $valueLength; - } - $totalWidth = max($totalWidth, $nameLength); - } - - return $totalWidth; - } -} diff --git a/vendor/topthink/framework/src/think/console/output/Formatter.php b/vendor/topthink/framework/src/think/console/output/Formatter.php deleted file mode 100644 index 1b97ca32..00000000 --- a/vendor/topthink/framework/src/think/console/output/Formatter.php +++ /dev/null @@ -1,198 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\console\output; - -use think\console\output\formatter\Stack as StyleStack; -use think\console\output\formatter\Style; - -class Formatter -{ - - private $decorated = false; - private $styles = []; - private $styleStack; - - /** - * 转义 - * @param string $text - * @return string - */ - public static function escape($text) - { - return preg_replace('/([^\\\\]?)setStyle('error', new Style('white', 'red')); - $this->setStyle('info', new Style('green')); - $this->setStyle('comment', new Style('yellow')); - $this->setStyle('question', new Style('black', 'cyan')); - $this->setStyle('highlight', new Style('red')); - $this->setStyle('warning', new Style('black', 'yellow')); - - $this->styleStack = new StyleStack(); - } - - /** - * 设置外观标识 - * @param bool $decorated 是否美化文字 - */ - public function setDecorated($decorated) - { - $this->decorated = (bool) $decorated; - } - - /** - * 获取外观标识 - * @return bool - */ - public function isDecorated() - { - return $this->decorated; - } - - /** - * 添加一个新样式 - * @param string $name 样式名 - * @param Style $style 样式实例 - */ - public function setStyle($name, Style $style) - { - $this->styles[strtolower($name)] = $style; - } - - /** - * 是否有这个样式 - * @param string $name - * @return bool - */ - public function hasStyle($name) - { - return isset($this->styles[strtolower($name)]); - } - - /** - * 获取样式 - * @param string $name - * @return Style - * @throws \InvalidArgumentException - */ - public function getStyle($name) - { - if (!$this->hasStyle($name)) { - throw new \InvalidArgumentException(sprintf('Undefined style: %s', $name)); - } - - return $this->styles[strtolower($name)]; - } - - /** - * 使用所给的样式格式化文字 - * @param string $message 文字 - * @return string - */ - public function format($message) - { - $offset = 0; - $output = ''; - $tagRegex = '[a-z][a-z0-9_=;-]*'; - preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#isx", $message, $matches, PREG_OFFSET_CAPTURE); - foreach ($matches[0] as $i => $match) { - $pos = $match[1]; - $text = $match[0]; - - if (0 != $pos && '\\' == $message[$pos - 1]) { - continue; - } - - $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset)); - $offset = $pos + strlen($text); - - if ($open = '/' != $text[1]) { - $tag = $matches[1][$i][0]; - } else { - $tag = $matches[3][$i][0] ?? ''; - } - - if (!$open && !$tag) { - // - $this->styleStack->pop(); - } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) { - $output .= $this->applyCurrentStyle($text); - } elseif ($open) { - $this->styleStack->push($style); - } else { - $this->styleStack->pop($style); - } - } - - $output .= $this->applyCurrentStyle(substr($message, $offset)); - - return str_replace('\\<', '<', $output); - } - - /** - * @return StyleStack - */ - public function getStyleStack() - { - return $this->styleStack; - } - - /** - * 根据字符串创建新的样式实例 - * @param string $string - * @return Style|bool - */ - private function createStyleFromString($string) - { - if (isset($this->styles[$string])) { - return $this->styles[$string]; - } - - if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) { - return false; - } - - $style = new Style(); - foreach ($matches as $match) { - array_shift($match); - - if ('fg' == $match[0]) { - $style->setForeground($match[1]); - } elseif ('bg' == $match[0]) { - $style->setBackground($match[1]); - } else { - try { - $style->setOption($match[1]); - } catch (\InvalidArgumentException $e) { - return false; - } - } - } - - return $style; - } - - /** - * 从堆栈应用样式到文字 - * @param string $text 文字 - * @return string - */ - private function applyCurrentStyle($text) - { - return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text; - } -} diff --git a/vendor/topthink/framework/src/think/console/output/Question.php b/vendor/topthink/framework/src/think/console/output/Question.php deleted file mode 100644 index 03975f27..00000000 --- a/vendor/topthink/framework/src/think/console/output/Question.php +++ /dev/null @@ -1,211 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output; - -class Question -{ - - private $question; - private $attempts; - private $hidden = false; - private $hiddenFallback = true; - private $autocompleterValues; - private $validator; - private $default; - private $normalizer; - - /** - * 构造方法 - * @param string $question 问题 - * @param mixed $default 默认答案 - */ - public function __construct($question, $default = null) - { - $this->question = $question; - $this->default = $default; - } - - /** - * 获取问题 - * @return string - */ - public function getQuestion() - { - return $this->question; - } - - /** - * 获取默认答案 - * @return mixed - */ - public function getDefault() - { - return $this->default; - } - - /** - * 是否隐藏答案 - * @return bool - */ - public function isHidden() - { - return $this->hidden; - } - - /** - * 隐藏答案 - * @param bool $hidden - * @return Question - */ - public function setHidden($hidden) - { - if ($this->autocompleterValues) { - throw new \LogicException('A hidden question cannot use the autocompleter.'); - } - - $this->hidden = (bool) $hidden; - - return $this; - } - - /** - * 不能被隐藏是否撤销 - * @return bool - */ - public function isHiddenFallback() - { - return $this->hiddenFallback; - } - - /** - * 设置不能被隐藏的时候的操作 - * @param bool $fallback - * @return Question - */ - public function setHiddenFallback($fallback) - { - $this->hiddenFallback = (bool) $fallback; - - return $this; - } - - /** - * 获取自动完成 - * @return null|array|\Traversable - */ - public function getAutocompleterValues() - { - return $this->autocompleterValues; - } - - /** - * 设置自动完成的值 - * @param null|array|\Traversable $values - * @return Question - * @throws \InvalidArgumentException - * @throws \LogicException - */ - public function setAutocompleterValues($values) - { - if (is_array($values) && $this->isAssoc($values)) { - $values = array_merge(array_keys($values), array_values($values)); - } - - if (null !== $values && !is_array($values)) { - if (!$values instanceof \Traversable || $values instanceof \Countable) { - throw new \InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.'); - } - } - - if ($this->hidden) { - throw new \LogicException('A hidden question cannot use the autocompleter.'); - } - - $this->autocompleterValues = $values; - - return $this; - } - - /** - * 设置答案的验证器 - * @param null|callable $validator - * @return Question The current instance - */ - public function setValidator($validator) - { - $this->validator = $validator; - - return $this; - } - - /** - * 获取验证器 - * @return null|callable - */ - public function getValidator() - { - return $this->validator; - } - - /** - * 设置最大重试次数 - * @param null|int $attempts - * @return Question - * @throws \InvalidArgumentException - */ - public function setMaxAttempts($attempts) - { - if (null !== $attempts && $attempts < 1) { - throw new \InvalidArgumentException('Maximum number of attempts must be a positive value.'); - } - - $this->attempts = $attempts; - - return $this; - } - - /** - * 获取最大重试次数 - * @return null|int - */ - public function getMaxAttempts() - { - return $this->attempts; - } - - /** - * 设置响应的回调 - * @param string|\Closure $normalizer - * @return Question - */ - public function setNormalizer($normalizer) - { - $this->normalizer = $normalizer; - - return $this; - } - - /** - * 获取响应回调 - * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. - * @return string|\Closure - */ - public function getNormalizer() - { - return $this->normalizer; - } - - protected function isAssoc($array) - { - return (bool) count(array_filter(array_keys($array), 'is_string')); - } -} diff --git a/vendor/topthink/framework/src/think/console/output/descriptor/Console.php b/vendor/topthink/framework/src/think/console/output/descriptor/Console.php deleted file mode 100644 index ff9f4641..00000000 --- a/vendor/topthink/framework/src/think/console/output/descriptor/Console.php +++ /dev/null @@ -1,153 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output\descriptor; - -use think\Console as ThinkConsole; -use think\console\Command; - -class Console -{ - - const GLOBAL_NAMESPACE = '_global'; - - /** - * @var ThinkConsole - */ - private $console; - - /** - * @var null|string - */ - private $namespace; - - /** - * @var array - */ - private $namespaces; - - /** - * @var Command[] - */ - private $commands; - - /** - * @var Command[] - */ - private $aliases; - - /** - * 构造方法 - * @param ThinkConsole $console - * @param string|null $namespace - */ - public function __construct(ThinkConsole $console, $namespace = null) - { - $this->console = $console; - $this->namespace = $namespace; - } - - /** - * @return array - */ - public function getNamespaces(): array - { - if (null === $this->namespaces) { - $this->inspectConsole(); - } - - return $this->namespaces; - } - - /** - * @return Command[] - */ - public function getCommands(): array - { - if (null === $this->commands) { - $this->inspectConsole(); - } - - return $this->commands; - } - - /** - * @param string $name - * @return Command - * @throws \InvalidArgumentException - */ - public function getCommand(string $name): Command - { - if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) { - throw new \InvalidArgumentException(sprintf('Command %s does not exist.', $name)); - } - - return $this->commands[$name] ?? $this->aliases[$name]; - } - - private function inspectConsole(): void - { - $this->commands = []; - $this->namespaces = []; - - $all = $this->console->all($this->namespace ? $this->console->findNamespace($this->namespace) : null); - foreach ($this->sortCommands($all) as $namespace => $commands) { - $names = []; - - /** @var Command $command */ - foreach ($commands as $name => $command) { - if (is_string($command)) { - $command = new $command(); - } - - if (!$command->getName()) { - continue; - } - - if ($command->getName() === $name) { - $this->commands[$name] = $command; - } else { - $this->aliases[$name] = $command; - } - - $names[] = $name; - } - - $this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names]; - } - } - - /** - * @param array $commands - * @return array - */ - private function sortCommands(array $commands): array - { - $namespacedCommands = []; - foreach ($commands as $name => $command) { - $key = $this->console->extractNamespace($name, 1); - if (!$key) { - $key = self::GLOBAL_NAMESPACE; - } - - $namespacedCommands[$key][$name] = $command; - } - ksort($namespacedCommands); - - foreach ($namespacedCommands as &$commandsSet) { - ksort($commandsSet); - } - // unset reference to keep scope clear - unset($commandsSet); - - return $namespacedCommands; - } -} diff --git a/vendor/topthink/framework/src/think/console/output/driver/Buffer.php b/vendor/topthink/framework/src/think/console/output/driver/Buffer.php deleted file mode 100644 index 576f31ac..00000000 --- a/vendor/topthink/framework/src/think/console/output/driver/Buffer.php +++ /dev/null @@ -1,52 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output\driver; - -use think\console\Output; - -class Buffer -{ - /** - * @var string - */ - private $buffer = ''; - - public function __construct(Output $output) - { - // do nothing - } - - public function fetch() - { - $content = $this->buffer; - $this->buffer = ''; - return $content; - } - - public function write($messages, bool $newline = false, int $options = 0) - { - $messages = (array) $messages; - - foreach ($messages as $message) { - $this->buffer .= $message; - } - if ($newline) { - $this->buffer .= "\n"; - } - } - - public function renderException(\Throwable $e) - { - // do nothing - } - -} diff --git a/vendor/topthink/framework/src/think/console/output/driver/Console.php b/vendor/topthink/framework/src/think/console/output/driver/Console.php deleted file mode 100644 index 31bdf1f5..00000000 --- a/vendor/topthink/framework/src/think/console/output/driver/Console.php +++ /dev/null @@ -1,368 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output\driver; - -use think\console\Output; -use think\console\output\Formatter; - -class Console -{ - - /** @var Resource */ - private $stdout; - - /** @var Formatter */ - private $formatter; - - private $terminalDimensions; - - /** @var Output */ - private $output; - - public function __construct(Output $output) - { - $this->output = $output; - $this->formatter = new Formatter(); - $this->stdout = $this->openOutputStream(); - $decorated = $this->hasColorSupport($this->stdout); - $this->formatter->setDecorated($decorated); - } - - public function setDecorated($decorated) - { - $this->formatter->setDecorated($decorated); - } - - public function write($messages, bool $newline = false, int $type = 0, $stream = null) - { - if (Output::VERBOSITY_QUIET === $this->output->getVerbosity()) { - return; - } - - $messages = (array) $messages; - - foreach ($messages as $message) { - switch ($type) { - case Output::OUTPUT_NORMAL: - $message = $this->formatter->format($message); - break; - case Output::OUTPUT_RAW: - break; - case Output::OUTPUT_PLAIN: - $message = strip_tags($this->formatter->format($message)); - break; - default: - throw new \InvalidArgumentException(sprintf('Unknown output type given (%s)', $type)); - } - - $this->doWrite($message, $newline, $stream); - } - } - - public function renderException(\Throwable $e) - { - $stderr = $this->openErrorStream(); - $decorated = $this->hasColorSupport($stderr); - $this->formatter->setDecorated($decorated); - - do { - $title = sprintf(' [%s] ', get_class($e)); - - $len = $this->stringWidth($title); - - $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX; - - if (defined('HHVM_VERSION') && $width > 1 << 31) { - $width = 1 << 31; - } - $lines = []; - foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) { - foreach ($this->splitStringByWidth($line, $width - 4) as $line) { - - $lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $line)) + 4; - $lines[] = [$line, $lineLength]; - - $len = max($lineLength, $len); - } - } - - $messages = ['', '']; - $messages[] = $emptyLine = sprintf('%s', str_repeat(' ', $len)); - $messages[] = sprintf('%s%s', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title)))); - foreach ($lines as $line) { - $messages[] = sprintf(' %s %s', $line[0], str_repeat(' ', $len - $line[1])); - } - $messages[] = $emptyLine; - $messages[] = ''; - $messages[] = ''; - - $this->write($messages, true, Output::OUTPUT_NORMAL, $stderr); - - if (Output::VERBOSITY_VERBOSE <= $this->output->getVerbosity()) { - $this->write('Exception trace:', true, Output::OUTPUT_NORMAL, $stderr); - - // exception related properties - $trace = $e->getTrace(); - array_unshift($trace, [ - 'function' => '', - 'file' => $e->getFile() !== null ? $e->getFile() : 'n/a', - 'line' => $e->getLine() !== null ? $e->getLine() : 'n/a', - 'args' => [], - ]); - - for ($i = 0, $count = count($trace); $i < $count; ++$i) { - $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; - $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : ''; - $function = $trace[$i]['function']; - $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a'; - $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a'; - - $this->write(sprintf(' %s%s%s() at %s:%s', $class, $type, $function, $file, $line), true, Output::OUTPUT_NORMAL, $stderr); - } - - $this->write('', true, Output::OUTPUT_NORMAL, $stderr); - $this->write('', true, Output::OUTPUT_NORMAL, $stderr); - } - } while ($e = $e->getPrevious()); - - } - - /** - * 获取终端宽度 - * @return int|null - */ - protected function getTerminalWidth() - { - $dimensions = $this->getTerminalDimensions(); - - return $dimensions[0]; - } - - /** - * 获取终端高度 - * @return int|null - */ - protected function getTerminalHeight() - { - $dimensions = $this->getTerminalDimensions(); - - return $dimensions[1]; - } - - /** - * 获取当前终端的尺寸 - * @return array - */ - public function getTerminalDimensions(): array - { - if ($this->terminalDimensions) { - return $this->terminalDimensions; - } - - if ('\\' === DIRECTORY_SEPARATOR) { - if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) { - return [(int) $matches[1], (int) $matches[2]]; - } - if (preg_match('/^(\d+)x(\d+)$/', $this->getMode(), $matches)) { - return [(int) $matches[1], (int) $matches[2]]; - } - } - - if ($sttyString = $this->getSttyColumns()) { - if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) { - return [(int) $matches[2], (int) $matches[1]]; - } - if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) { - return [(int) $matches[2], (int) $matches[1]]; - } - } - - return [null, null]; - } - - /** - * 获取stty列数 - * @return string - */ - private function getSttyColumns() - { - if (!function_exists('proc_open')) { - return; - } - - $descriptorspec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']]; - $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); - if (is_resource($process)) { - $info = stream_get_contents($pipes[1]); - fclose($pipes[1]); - fclose($pipes[2]); - proc_close($process); - - return $info; - } - return; - } - - /** - * 获取终端模式 - * @return string x 或 null - */ - private function getMode() - { - if (!function_exists('proc_open')) { - return; - } - - $descriptorspec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']]; - $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); - if (is_resource($process)) { - $info = stream_get_contents($pipes[1]); - fclose($pipes[1]); - fclose($pipes[2]); - proc_close($process); - - if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { - return $matches[2] . 'x' . $matches[1]; - } - } - return; - } - - private function stringWidth(string $string): int - { - if (!function_exists('mb_strwidth')) { - return strlen($string); - } - - if (false === $encoding = mb_detect_encoding($string)) { - return strlen($string); - } - - return mb_strwidth($string, $encoding); - } - - private function splitStringByWidth(string $string, int $width): array - { - if (!function_exists('mb_strwidth')) { - return str_split($string, $width); - } - - if (false === $encoding = mb_detect_encoding($string)) { - return str_split($string, $width); - } - - $utf8String = mb_convert_encoding($string, 'utf8', $encoding); - $lines = []; - $line = ''; - foreach (preg_split('//u', $utf8String) as $char) { - if (mb_strwidth($line . $char, 'utf8') <= $width) { - $line .= $char; - continue; - } - $lines[] = str_pad($line, $width); - $line = $char; - } - if (strlen($line)) { - $lines[] = count($lines) ? str_pad($line, $width) : $line; - } - - mb_convert_variables($encoding, 'utf8', $lines); - - return $lines; - } - - private function isRunningOS400(): bool - { - $checks = [ - function_exists('php_uname') ? php_uname('s') : '', - getenv('OSTYPE'), - PHP_OS, - ]; - return false !== stripos(implode(';', $checks), 'OS400'); - } - - /** - * 当前环境是否支持写入控制台输出到stdout. - * - * @return bool - */ - protected function hasStdoutSupport(): bool - { - return false === $this->isRunningOS400(); - } - - /** - * 当前环境是否支持写入控制台输出到stderr. - * - * @return bool - */ - protected function hasStderrSupport(): bool - { - return false === $this->isRunningOS400(); - } - - /** - * @return resource - */ - private function openOutputStream() - { - if (!$this->hasStdoutSupport()) { - return fopen('php://output', 'w'); - } - return @fopen('php://stdout', 'w') ?: fopen('php://output', 'w'); - } - - /** - * @return resource - */ - private function openErrorStream() - { - return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w'); - } - - /** - * 将消息写入到输出。 - * @param string $message 消息 - * @param bool $newline 是否另起一行 - * @param null $stream - */ - protected function doWrite($message, $newline, $stream = null) - { - if (null === $stream) { - $stream = $this->stdout; - } - if (false === @fwrite($stream, $message . ($newline ? PHP_EOL : ''))) { - throw new \RuntimeException('Unable to write output.'); - } - - fflush($stream); - } - - /** - * 是否支持着色 - * @param $stream - * @return bool - */ - protected function hasColorSupport($stream): bool - { - if (DIRECTORY_SEPARATOR === '\\') { - return - '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD - || false !== getenv('ANSICON') - || 'ON' === getenv('ConEmuANSI') - || 'xterm' === getenv('TERM'); - } - - return function_exists('posix_isatty') && @posix_isatty($stream); - } - -} diff --git a/vendor/topthink/framework/src/think/console/output/driver/Nothing.php b/vendor/topthink/framework/src/think/console/output/driver/Nothing.php deleted file mode 100644 index a7cc49e2..00000000 --- a/vendor/topthink/framework/src/think/console/output/driver/Nothing.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output\driver; - -use think\console\Output; - -class Nothing -{ - - public function __construct(Output $output) - { - // do nothing - } - - public function write($messages, bool $newline = false, int $options = 0) - { - // do nothing - } - - public function renderException(\Throwable $e) - { - // do nothing - } -} diff --git a/vendor/topthink/framework/src/think/console/output/formatter/Stack.php b/vendor/topthink/framework/src/think/console/output/formatter/Stack.php deleted file mode 100644 index 53662599..00000000 --- a/vendor/topthink/framework/src/think/console/output/formatter/Stack.php +++ /dev/null @@ -1,116 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output\formatter; - -class Stack -{ - - /** - * @var Style[] - */ - private $styles; - - /** - * @var Style - */ - private $emptyStyle; - - /** - * 构造方法 - * @param Style|null $emptyStyle - */ - public function __construct(Style $emptyStyle = null) - { - $this->emptyStyle = $emptyStyle ?: new Style(); - $this->reset(); - } - - /** - * 重置堆栈 - */ - public function reset(): void - { - $this->styles = []; - } - - /** - * 推一个样式进入堆栈 - * @param Style $style - */ - public function push(Style $style): void - { - $this->styles[] = $style; - } - - /** - * 从堆栈中弹出一个样式 - * @param Style|null $style - * @return Style - * @throws \InvalidArgumentException - */ - public function pop(Style $style = null): Style - { - if (empty($this->styles)) { - return $this->emptyStyle; - } - - if (null === $style) { - return array_pop($this->styles); - } - - /** - * @var int $index - * @var Style $stackedStyle - */ - foreach (array_reverse($this->styles, true) as $index => $stackedStyle) { - if ($style->apply('') === $stackedStyle->apply('')) { - $this->styles = array_slice($this->styles, 0, $index); - - return $stackedStyle; - } - } - - throw new \InvalidArgumentException('Incorrectly nested style tag found.'); - } - - /** - * 计算堆栈的当前样式。 - * @return Style - */ - public function getCurrent(): Style - { - if (empty($this->styles)) { - return $this->emptyStyle; - } - - return $this->styles[count($this->styles) - 1]; - } - - /** - * @param Style $emptyStyle - * @return Stack - */ - public function setEmptyStyle(Style $emptyStyle) - { - $this->emptyStyle = $emptyStyle; - - return $this; - } - - /** - * @return Style - */ - public function getEmptyStyle(): Style - { - return $this->emptyStyle; - } -} diff --git a/vendor/topthink/framework/src/think/console/output/formatter/Style.php b/vendor/topthink/framework/src/think/console/output/formatter/Style.php deleted file mode 100644 index 2aae7682..00000000 --- a/vendor/topthink/framework/src/think/console/output/formatter/Style.php +++ /dev/null @@ -1,190 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output\formatter; - -class Style -{ - protected static $availableForegroundColors = [ - 'black' => ['set' => 30, 'unset' => 39], - 'red' => ['set' => 31, 'unset' => 39], - 'green' => ['set' => 32, 'unset' => 39], - 'yellow' => ['set' => 33, 'unset' => 39], - 'blue' => ['set' => 34, 'unset' => 39], - 'magenta' => ['set' => 35, 'unset' => 39], - 'cyan' => ['set' => 36, 'unset' => 39], - 'white' => ['set' => 37, 'unset' => 39], - ]; - - protected static $availableBackgroundColors = [ - 'black' => ['set' => 40, 'unset' => 49], - 'red' => ['set' => 41, 'unset' => 49], - 'green' => ['set' => 42, 'unset' => 49], - 'yellow' => ['set' => 43, 'unset' => 49], - 'blue' => ['set' => 44, 'unset' => 49], - 'magenta' => ['set' => 45, 'unset' => 49], - 'cyan' => ['set' => 46, 'unset' => 49], - 'white' => ['set' => 47, 'unset' => 49], - ]; - - protected static $availableOptions = [ - 'bold' => ['set' => 1, 'unset' => 22], - 'underscore' => ['set' => 4, 'unset' => 24], - 'blink' => ['set' => 5, 'unset' => 25], - 'reverse' => ['set' => 7, 'unset' => 27], - 'conceal' => ['set' => 8, 'unset' => 28], - ]; - - private $foreground; - private $background; - private $options = []; - - /** - * 初始化输出的样式 - * @param string|null $foreground 字体颜色 - * @param string|null $background 背景色 - * @param array $options 格式 - * @api - */ - public function __construct($foreground = null, $background = null, array $options = []) - { - if (null !== $foreground) { - $this->setForeground($foreground); - } - if (null !== $background) { - $this->setBackground($background); - } - if (count($options)) { - $this->setOptions($options); - } - } - - /** - * 设置字体颜色 - * @param string|null $color 颜色名 - * @throws \InvalidArgumentException - * @api - */ - public function setForeground($color = null) - { - if (null === $color) { - $this->foreground = null; - - return; - } - - if (!isset(static::$availableForegroundColors[$color])) { - throw new \InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors)))); - } - - $this->foreground = static::$availableForegroundColors[$color]; - } - - /** - * 设置背景色 - * @param string|null $color 颜色名 - * @throws \InvalidArgumentException - * @api - */ - public function setBackground($color = null) - { - if (null === $color) { - $this->background = null; - - return; - } - - if (!isset(static::$availableBackgroundColors[$color])) { - throw new \InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors)))); - } - - $this->background = static::$availableBackgroundColors[$color]; - } - - /** - * 设置字体格式 - * @param string $option 格式名 - * @throws \InvalidArgumentException When the option name isn't defined - * @api - */ - public function setOption(string $option): void - { - if (!isset(static::$availableOptions[$option])) { - throw new \InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); - } - - if (!in_array(static::$availableOptions[$option], $this->options)) { - $this->options[] = static::$availableOptions[$option]; - } - } - - /** - * 重置字体格式 - * @param string $option 格式名 - * @throws \InvalidArgumentException - */ - public function unsetOption(string $option): void - { - if (!isset(static::$availableOptions[$option])) { - throw new \InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); - } - - $pos = array_search(static::$availableOptions[$option], $this->options); - if (false !== $pos) { - unset($this->options[$pos]); - } - } - - /** - * 批量设置字体格式 - * @param array $options - */ - public function setOptions(array $options) - { - $this->options = []; - - foreach ($options as $option) { - $this->setOption($option); - } - } - - /** - * 应用样式到文字 - * @param string $text 文字 - * @return string - */ - public function apply(string $text): string - { - $setCodes = []; - $unsetCodes = []; - - if (null !== $this->foreground) { - $setCodes[] = $this->foreground['set']; - $unsetCodes[] = $this->foreground['unset']; - } - if (null !== $this->background) { - $setCodes[] = $this->background['set']; - $unsetCodes[] = $this->background['unset']; - } - if (count($this->options)) { - foreach ($this->options as $option) { - $setCodes[] = $option['set']; - $unsetCodes[] = $option['unset']; - } - } - - if (0 === count($setCodes)) { - return $text; - } - - return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes)); - } -} diff --git a/vendor/topthink/framework/src/think/console/output/question/Choice.php b/vendor/topthink/framework/src/think/console/output/question/Choice.php deleted file mode 100644 index 1da1750c..00000000 --- a/vendor/topthink/framework/src/think/console/output/question/Choice.php +++ /dev/null @@ -1,163 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output\question; - -use think\console\output\Question; - -class Choice extends Question -{ - - private $choices; - private $multiselect = false; - private $prompt = ' > '; - private $errorMessage = 'Value "%s" is invalid'; - - /** - * 构造方法 - * @param string $question 问题 - * @param array $choices 选项 - * @param mixed $default 默认答案 - */ - public function __construct($question, array $choices, $default = null) - { - parent::__construct($question, $default); - - $this->choices = $choices; - $this->setValidator($this->getDefaultValidator()); - $this->setAutocompleterValues($choices); - } - - /** - * 可选项 - * @return array - */ - public function getChoices(): array - { - return $this->choices; - } - - /** - * 设置可否多选 - * @param bool $multiselect - * @return self - */ - public function setMultiselect(bool $multiselect) - { - $this->multiselect = $multiselect; - $this->setValidator($this->getDefaultValidator()); - - return $this; - } - - public function isMultiselect(): bool - { - return $this->multiselect; - } - - /** - * 获取提示 - * @return string - */ - public function getPrompt(): string - { - return $this->prompt; - } - - /** - * 设置提示 - * @param string $prompt - * @return self - */ - public function setPrompt(string $prompt) - { - $this->prompt = $prompt; - - return $this; - } - - /** - * 设置错误提示信息 - * @param string $errorMessage - * @return self - */ - public function setErrorMessage(string $errorMessage) - { - $this->errorMessage = $errorMessage; - $this->setValidator($this->getDefaultValidator()); - - return $this; - } - - /** - * 获取默认的验证方法 - * @return callable - */ - private function getDefaultValidator() - { - $choices = $this->choices; - $errorMessage = $this->errorMessage; - $multiselect = $this->multiselect; - $isAssoc = $this->isAssoc($choices); - - return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { - // Collapse all spaces. - $selectedChoices = str_replace(' ', '', $selected); - - if ($multiselect) { - // Check for a separated comma values - if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) { - throw new \InvalidArgumentException(sprintf($errorMessage, $selected)); - } - $selectedChoices = explode(',', $selectedChoices); - } else { - $selectedChoices = [$selected]; - } - - $multiselectChoices = []; - foreach ($selectedChoices as $value) { - $results = []; - foreach ($choices as $key => $choice) { - if ($choice === $value) { - $results[] = $key; - } - } - - if (count($results) > 1) { - throw new \InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results))); - } - - $result = array_search($value, $choices); - - if (!$isAssoc) { - if (!empty($result)) { - $result = $choices[$result]; - } elseif (isset($choices[$value])) { - $result = $choices[$value]; - } - } elseif (empty($result) && array_key_exists($value, $choices)) { - $result = $value; - } - - if (false === $result) { - throw new \InvalidArgumentException(sprintf($errorMessage, $value)); - } - array_push($multiselectChoices, $result); - } - - if ($multiselect) { - return $multiselectChoices; - } - - return current($multiselectChoices); - }; - } -} diff --git a/vendor/topthink/framework/src/think/console/output/question/Confirmation.php b/vendor/topthink/framework/src/think/console/output/question/Confirmation.php deleted file mode 100644 index bf71b5d6..00000000 --- a/vendor/topthink/framework/src/think/console/output/question/Confirmation.php +++ /dev/null @@ -1,57 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\console\output\question; - -use think\console\output\Question; - -class Confirmation extends Question -{ - - private $trueAnswerRegex; - - /** - * 构造方法 - * @param string $question 问题 - * @param bool $default 默认答案 - * @param string $trueAnswerRegex 验证正则 - */ - public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i') - { - parent::__construct($question, (bool) $default); - - $this->trueAnswerRegex = $trueAnswerRegex; - $this->setNormalizer($this->getDefaultNormalizer()); - } - - /** - * 获取默认的答案回调 - * @return callable - */ - private function getDefaultNormalizer() - { - $default = $this->getDefault(); - $regex = $this->trueAnswerRegex; - - return function ($answer) use ($default, $regex) { - if (is_bool($answer)) { - return $answer; - } - - $answerIsTrue = (bool) preg_match($regex, $answer); - if (false === $default) { - return $answer && $answerIsTrue; - } - - return !$answer || $answerIsTrue; - }; - } -} diff --git a/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php b/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php deleted file mode 100644 index da5e6963..00000000 --- a/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php +++ /dev/null @@ -1,88 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\contract; - -/** - * 缓存驱动接口 - */ -interface CacheHandlerInterface -{ - /** - * 判断缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function has($name); - - /** - * 读取缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $default 默认值 - * @return mixed - */ - public function get($name, $default = null); - - /** - * 写入缓存 - * @access public - * @param string $name 缓存变量名 - * @param mixed $value 存储数据 - * @param integer|\DateTime $expire 有效时间(秒) - * @return bool - */ - public function set($name, $value, $expire = null); - - /** - * 自增缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function inc(string $name, int $step = 1); - - /** - * 自减缓存(针对数值缓存) - * @access public - * @param string $name 缓存变量名 - * @param int $step 步长 - * @return false|int - */ - public function dec(string $name, int $step = 1); - - /** - * 删除缓存 - * @access public - * @param string $name 缓存变量名 - * @return bool - */ - public function delete($name); - - /** - * 清除缓存 - * @access public - * @return bool - */ - public function clear(); - - /** - * 删除缓存标签 - * @access public - * @param array $keys 缓存标识列表 - * @return void - */ - public function clearTag(array $keys); - -} diff --git a/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php b/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php deleted file mode 100644 index 896ac29d..00000000 --- a/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\contract; - -/** - * 日志驱动接口 - */ -interface LogHandlerInterface -{ - /** - * 日志写入接口 - * @access public - * @param array $log 日志信息 - * @return bool - */ - public function save(array $log): bool; - -} diff --git a/vendor/topthink/framework/src/think/contract/ModelRelationInterface.php b/vendor/topthink/framework/src/think/contract/ModelRelationInterface.php deleted file mode 100644 index 1f6f994e..00000000 --- a/vendor/topthink/framework/src/think/contract/ModelRelationInterface.php +++ /dev/null @@ -1,99 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\contract; - -use Closure; -use think\Collection; -use think\db\Query; -use think\Model; - -/** - * 模型关联接口 - */ -interface ModelRelationInterface -{ - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联 - * @param Closure $closure 闭包查询条件 - * @return Collection - */ - public function getRelation(array $subRelation = [], Closure $closure = null): Collection; - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包条件 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation, Closure $closure = null): void; - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包条件 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null): void; - - /** - * 关联统计 - * @access public - * @param Model $result 模型对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount(Model $result, Closure $closure, string $aggregate = 'count', string $field = '*', string &$name = null); - - /** - * 创建关联统计子查询 - * @access public - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return string - */ - public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): string; - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = 'INNER'): Query; - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function hasWhere($where = [], $fields = null, string $joinType = ''): Query; -} diff --git a/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php b/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php deleted file mode 100644 index 0b2e4142..00000000 --- a/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\contract; - -/** - * Session驱动接口 - */ -interface SessionHandlerInterface -{ - public function read(string $sessionId): string; - public function delete(string $sessionId): bool; - public function write(string $sessionId, string $data): bool; -} diff --git a/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php b/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php deleted file mode 100644 index 9be93d2e..00000000 --- a/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php +++ /dev/null @@ -1,61 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\contract; - -/** - * 视图驱动接口 - */ -interface TemplateHandlerInterface -{ - /** - * 检测是否存在模板文件 - * @access public - * @param string $template 模板文件或者模板规则 - * @return bool - */ - public function exists(string $template): bool; - - /** - * 渲染模板文件 - * @access public - * @param string $template 模板文件 - * @param array $data 模板变量 - * @return void - */ - public function fetch(string $template, array $data = []): void; - - /** - * 渲染模板内容 - * @access public - * @param string $content 模板内容 - * @param array $data 模板变量 - * @return void - */ - public function display(string $content, array $data = []): void; - - /** - * 配置模板引擎 - * @access private - * @param array $config 参数 - * @return void - */ - public function config(array $config): void; - - /** - * 获取模板引擎配置 - * @access public - * @param string $name 参数名 - * @return void - */ - public function getConfig(string $name); -} diff --git a/vendor/topthink/framework/src/think/event/AppInit.php b/vendor/topthink/framework/src/think/event/AppInit.php deleted file mode 100644 index dda820b5..00000000 --- a/vendor/topthink/framework/src/think/event/AppInit.php +++ /dev/null @@ -1,19 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\event; - -/** - * AppInit事件类 - */ -class AppInit -{} diff --git a/vendor/topthink/framework/src/think/event/HttpEnd.php b/vendor/topthink/framework/src/think/event/HttpEnd.php deleted file mode 100644 index c40da57d..00000000 --- a/vendor/topthink/framework/src/think/event/HttpEnd.php +++ /dev/null @@ -1,19 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\event; - -/** - * HttpEnd事件类 - */ -class HttpEnd -{} diff --git a/vendor/topthink/framework/src/think/event/HttpRun.php b/vendor/topthink/framework/src/think/event/HttpRun.php deleted file mode 100644 index ce67e93e..00000000 --- a/vendor/topthink/framework/src/think/event/HttpRun.php +++ /dev/null @@ -1,19 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\event; - -/** - * HttpRun事件类 - */ -class HttpRun -{} diff --git a/vendor/topthink/framework/src/think/event/LogRecord.php b/vendor/topthink/framework/src/think/event/LogRecord.php deleted file mode 100644 index 237468dd..00000000 --- a/vendor/topthink/framework/src/think/event/LogRecord.php +++ /dev/null @@ -1,29 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\event; - -/** - * LogRecord事件类 - */ -class LogRecord -{ - /** @var string */ - public $type; - - /** @var string */ - public $message; - - public function __construct($type, $message) - { - $this->type = $type; - $this->message = $message; - } -} diff --git a/vendor/topthink/framework/src/think/event/LogWrite.php b/vendor/topthink/framework/src/think/event/LogWrite.php deleted file mode 100644 index a7873018..00000000 --- a/vendor/topthink/framework/src/think/event/LogWrite.php +++ /dev/null @@ -1,31 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\event; - -/** - * LogWrite事件类 - */ -class LogWrite -{ - /** @var string */ - public $channel; - - /** @var array */ - public $log; - - public function __construct($channel, $log) - { - $this->channel = $channel; - $this->log = $log; - } -} diff --git a/vendor/topthink/framework/src/think/event/RouteLoaded.php b/vendor/topthink/framework/src/think/event/RouteLoaded.php deleted file mode 100644 index ace7992f..00000000 --- a/vendor/topthink/framework/src/think/event/RouteLoaded.php +++ /dev/null @@ -1,21 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\event; - -/** - * 路由加载完成事件 - */ -class RouteLoaded -{ - -} diff --git a/vendor/topthink/framework/src/think/exception/ClassNotFoundException.php b/vendor/topthink/framework/src/think/exception/ClassNotFoundException.php deleted file mode 100644 index c4cda77d..00000000 --- a/vendor/topthink/framework/src/think/exception/ClassNotFoundException.php +++ /dev/null @@ -1,39 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -use Psr\Container\NotFoundExceptionInterface; -use RuntimeException; -use Throwable; - -class ClassNotFoundException extends RuntimeException implements NotFoundExceptionInterface -{ - protected $class; - - public function __construct(string $message, string $class = '', Throwable $previous = null) - { - $this->message = $message; - $this->class = $class; - - parent::__construct($message, 0, $previous); - } - - /** - * 获取类名 - * @access public - * @return string - */ - public function getClass() - { - return $this->class; - } -} diff --git a/vendor/topthink/framework/src/think/exception/ErrorException.php b/vendor/topthink/framework/src/think/exception/ErrorException.php deleted file mode 100644 index d1a23780..00000000 --- a/vendor/topthink/framework/src/think/exception/ErrorException.php +++ /dev/null @@ -1,57 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\exception; - -use think\Exception; - -/** - * ThinkPHP错误异常 - * 主要用于封装 set_error_handler 和 register_shutdown_function 得到的错误 - * 除开从 think\Exception 继承的功能 - * 其他和PHP系统\ErrorException功能基本一样 - */ -class ErrorException extends Exception -{ - /** - * 用于保存错误级别 - * @var integer - */ - protected $severity; - - /** - * 错误异常构造函数 - * @access public - * @param integer $severity 错误级别 - * @param string $message 错误详细信息 - * @param string $file 出错文件路径 - * @param integer $line 出错行号 - */ - public function __construct(int $severity, string $message, string $file, int $line) - { - $this->severity = $severity; - $this->message = $message; - $this->file = $file; - $this->line = $line; - $this->code = 0; - } - - /** - * 获取错误级别 - * @access public - * @return integer 错误级别 - */ - final public function getSeverity() - { - return $this->severity; - } -} diff --git a/vendor/topthink/framework/src/think/exception/FileException.php b/vendor/topthink/framework/src/think/exception/FileException.php deleted file mode 100644 index 228a1898..00000000 --- a/vendor/topthink/framework/src/think/exception/FileException.php +++ /dev/null @@ -1,17 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\exception; - -class FileException extends \RuntimeException -{ -} diff --git a/vendor/topthink/framework/src/think/exception/FuncNotFoundException.php b/vendor/topthink/framework/src/think/exception/FuncNotFoundException.php deleted file mode 100644 index ee2bcad2..00000000 --- a/vendor/topthink/framework/src/think/exception/FuncNotFoundException.php +++ /dev/null @@ -1,30 +0,0 @@ -message = $message; - $this->func = $func; - - parent::__construct($message, 0, $previous); - } - - /** - * 获取方法名 - * @access public - * @return string - */ - public function getFunc() - { - return $this->func; - } -} diff --git a/vendor/topthink/framework/src/think/exception/Handle.php b/vendor/topthink/framework/src/think/exception/Handle.php deleted file mode 100644 index 1f783bc5..00000000 --- a/vendor/topthink/framework/src/think/exception/Handle.php +++ /dev/null @@ -1,332 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\exception; - -use Exception; -use think\App; -use think\console\Output; -use think\db\exception\DataNotFoundException; -use think\db\exception\ModelNotFoundException; -use think\Request; -use think\Response; -use Throwable; - -/** - * 系统异常处理类 - */ -class Handle -{ - /** @var App */ - protected $app; - - protected $ignoreReport = [ - HttpException::class, - HttpResponseException::class, - ModelNotFoundException::class, - DataNotFoundException::class, - ValidateException::class, - ]; - - protected $isJson = false; - - public function __construct(App $app) - { - $this->app = $app; - } - - /** - * Report or log an exception. - * - * @access public - * @param Throwable $exception - * @return void - */ - public function report(Throwable $exception): void - { - if (!$this->isIgnoreReport($exception)) { - // 收集异常数据 - if ($this->app->isDebug()) { - $data = [ - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'message' => $this->getMessage($exception), - 'code' => $this->getCode($exception), - ]; - $log = "[{$data['code']}]{$data['message']}[{$data['file']}:{$data['line']}]"; - } else { - $data = [ - 'code' => $this->getCode($exception), - 'message' => $this->getMessage($exception), - ]; - $log = "[{$data['code']}]{$data['message']}"; - } - - if ($this->app->config->get('log.record_trace')) { - $log .= PHP_EOL . $exception->getTraceAsString(); - } - - try { - $this->app->log->record($log, 'error'); - } catch (Exception $e) {} - } - } - - protected function isIgnoreReport(Throwable $exception): bool - { - foreach ($this->ignoreReport as $class) { - if ($exception instanceof $class) { - return true; - } - } - - return false; - } - - /** - * Render an exception into an HTTP response. - * - * @access public - * @param Request $request - * @param Throwable $e - * @return Response - */ - public function render($request, Throwable $e): Response - { - $this->isJson = $request->isJson(); - if ($e instanceof HttpResponseException) { - return $e->getResponse(); - } elseif ($e instanceof HttpException) { - return $this->renderHttpException($e); - } else { - return $this->convertExceptionToResponse($e); - } - } - - /** - * @access public - * @param Output $output - * @param Throwable $e - */ - public function renderForConsole(Output $output, Throwable $e): void - { - if ($this->app->isDebug()) { - $output->setVerbosity(Output::VERBOSITY_DEBUG); - } - - $output->renderException($e); - } - - /** - * @access protected - * @param HttpException $e - * @return Response - */ - protected function renderHttpException(HttpException $e): Response - { - $status = $e->getStatusCode(); - $template = $this->app->config->get('app.http_exception_template'); - - if (!$this->app->isDebug() && !empty($template[$status])) { - return Response::create($template[$status], 'view', $status)->assign(['e' => $e]); - } else { - return $this->convertExceptionToResponse($e); - } - } - - /** - * 收集异常数据 - * @param Throwable $exception - * @return array - */ - protected function convertExceptionToArray(Throwable $exception): array - { - if ($this->app->isDebug()) { - // 调试模式,获取详细的错误信息 - $traces = []; - $nextException = $exception; - do { - $traces[] = [ - 'name' => get_class($nextException), - 'file' => $nextException->getFile(), - 'line' => $nextException->getLine(), - 'code' => $this->getCode($nextException), - 'message' => $this->getMessage($nextException), - 'trace' => $nextException->getTrace(), - 'source' => $this->getSourceCode($nextException), - ]; - } while ($nextException = $nextException->getPrevious()); - $data = [ - 'code' => $this->getCode($exception), - 'message' => $this->getMessage($exception), - 'traces' => $traces, - 'datas' => $this->getExtendData($exception), - 'tables' => [ - 'GET Data' => $this->app->request->get(), - 'POST Data' => $this->app->request->post(), - 'Files' => $this->app->request->file(), - 'Cookies' => $this->app->request->cookie(), - 'Session' => $this->app->exists('session') ? $this->app->session->all() : [], - 'Server/Request Data' => $this->app->request->server(), - ], - ]; - } else { - // 部署模式仅显示 Code 和 Message - $data = [ - 'code' => $this->getCode($exception), - 'message' => $this->getMessage($exception), - ]; - - if (!$this->app->config->get('app.show_error_msg')) { - // 不显示详细错误信息 - $data['message'] = $this->app->config->get('app.error_message'); - } - } - - return $data; - } - - /** - * @access protected - * @param Throwable $exception - * @return Response - */ - protected function convertExceptionToResponse(Throwable $exception): Response - { - if (!$this->isJson) { - $response = Response::create($this->renderExceptionContent($exception)); - } else { - $response = Response::create($this->convertExceptionToArray($exception), 'json'); - } - - if ($exception instanceof HttpException) { - $statusCode = $exception->getStatusCode(); - $response->header($exception->getHeaders()); - } - - return $response->code($statusCode ?? 500); - } - - protected function renderExceptionContent(Throwable $exception): string - { - ob_start(); - $data = $this->convertExceptionToArray($exception); - extract($data); - include $this->app->config->get('app.exception_tmpl') ?: __DIR__ . '/../../tpl/think_exception.tpl'; - - return ob_get_clean(); - } - - /** - * 获取错误编码 - * ErrorException则使用错误级别作为错误编码 - * @access protected - * @param Throwable $exception - * @return integer 错误编码 - */ - protected function getCode(Throwable $exception) - { - $code = $exception->getCode(); - - if (!$code && $exception instanceof ErrorException) { - $code = $exception->getSeverity(); - } - - return $code; - } - - /** - * 获取错误信息 - * ErrorException则使用错误级别作为错误编码 - * @access protected - * @param Throwable $exception - * @return string 错误信息 - */ - protected function getMessage(Throwable $exception): string - { - $message = $exception->getMessage(); - - if ($this->app->runningInConsole()) { - return $message; - } - - $lang = $this->app->lang; - - if (strpos($message, ':')) { - $name = strstr($message, ':', true); - $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message; - } elseif (strpos($message, ',')) { - $name = strstr($message, ',', true); - $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message; - } elseif ($lang->has($message)) { - $message = $lang->get($message); - } - - return $message; - } - - /** - * 获取出错文件内容 - * 获取错误的前9行和后9行 - * @access protected - * @param Throwable $exception - * @return array 错误文件内容 - */ - protected function getSourceCode(Throwable $exception): array - { - // 读取前9行和后9行 - $line = $exception->getLine(); - $first = ($line - 9 > 0) ? $line - 9 : 1; - - try { - $contents = file($exception->getFile()) ?: []; - $source = [ - 'first' => $first, - 'source' => array_slice($contents, $first - 1, 19), - ]; - } catch (Exception $e) { - $source = []; - } - - return $source; - } - - /** - * 获取异常扩展信息 - * 用于非调试模式html返回类型显示 - * @access protected - * @param Throwable $exception - * @return array 异常类定义的扩展数据 - */ - protected function getExtendData(Throwable $exception): array - { - $data = []; - - if ($exception instanceof \think\Exception) { - $data = $exception->getData(); - } - - return $data; - } - - /** - * 获取常量列表 - * @access protected - * @return array 常量列表 - */ - protected function getConst(): array - { - $const = get_defined_constants(true); - - return $const['user'] ?? []; - } -} diff --git a/vendor/topthink/framework/src/think/exception/HttpException.php b/vendor/topthink/framework/src/think/exception/HttpException.php deleted file mode 100644 index 45302e58..00000000 --- a/vendor/topthink/framework/src/think/exception/HttpException.php +++ /dev/null @@ -1,42 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\exception; - -use Exception; - -/** - * HTTP异常 - */ -class HttpException extends \RuntimeException -{ - private $statusCode; - private $headers; - - public function __construct(int $statusCode, string $message = '', Exception $previous = null, array $headers = [], $code = 0) - { - $this->statusCode = $statusCode; - $this->headers = $headers; - - parent::__construct($message, $code, $previous); - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function getHeaders() - { - return $this->headers; - } -} diff --git a/vendor/topthink/framework/src/think/exception/HttpResponseException.php b/vendor/topthink/framework/src/think/exception/HttpResponseException.php deleted file mode 100644 index 607813d9..00000000 --- a/vendor/topthink/framework/src/think/exception/HttpResponseException.php +++ /dev/null @@ -1,37 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\exception; - -use think\Response; - -/** - * HTTP响应异常 - */ -class HttpResponseException extends \RuntimeException -{ - /** - * @var Response - */ - protected $response; - - public function __construct(Response $response) - { - $this->response = $response; - } - - public function getResponse() - { - return $this->response; - } - -} diff --git a/vendor/topthink/framework/src/think/exception/InvalidArgumentException.php b/vendor/topthink/framework/src/think/exception/InvalidArgumentException.php deleted file mode 100644 index 8ccd6f6a..00000000 --- a/vendor/topthink/framework/src/think/exception/InvalidArgumentException.php +++ /dev/null @@ -1,22 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); -namespace think\exception; - -use Psr\Cache\InvalidArgumentException as Psr6CacheInvalidArgumentInterface; -use Psr\SimpleCache\InvalidArgumentException as SimpleCacheInvalidArgumentInterface; - -/** - * 非法数据异常 - */ -class InvalidArgumentException extends \InvalidArgumentException implements Psr6CacheInvalidArgumentInterface, SimpleCacheInvalidArgumentInterface -{ -} diff --git a/vendor/topthink/framework/src/think/exception/RouteNotFoundException.php b/vendor/topthink/framework/src/think/exception/RouteNotFoundException.php deleted file mode 100644 index 7a2ee879..00000000 --- a/vendor/topthink/framework/src/think/exception/RouteNotFoundException.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\exception; - -/** - * 路由未定义异常 - */ -class RouteNotFoundException extends HttpException -{ - - public function __construct() - { - parent::__construct(404, 'Route Not Found'); - } - -} diff --git a/vendor/topthink/framework/src/think/exception/ValidateException.php b/vendor/topthink/framework/src/think/exception/ValidateException.php deleted file mode 100644 index 89b4e4d5..00000000 --- a/vendor/topthink/framework/src/think/exception/ValidateException.php +++ /dev/null @@ -1,37 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\exception; - -/** - * 数据验证异常 - */ -class ValidateException extends \RuntimeException -{ - protected $error; - - public function __construct($error) - { - $this->error = $error; - $this->message = is_array($error) ? implode(PHP_EOL, $error) : $error; - } - - /** - * 获取验证错误信息 - * @access public - * @return array|string - */ - public function getError() - { - return $this->error; - } -} diff --git a/vendor/topthink/framework/src/think/facade/App.php b/vendor/topthink/framework/src/think/facade/App.php deleted file mode 100644 index e9f81050..00000000 --- a/vendor/topthink/framework/src/think/facade/App.php +++ /dev/null @@ -1,59 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\App - * @package think\facade - * @mixin \think\App - * @method static \think\Service|null register(\think\Service|string $service, bool $force = false) 注册服务 - * @method static mixed bootService(\think\Service $service) 执行服务 - * @method static \think\Service|null getService(string|\think\Service $service) 获取服务 - * @method static \think\App debug(bool $debug = true) 开启应用调试模式 - * @method static bool isDebug() 是否为调试模式 - * @method static \think\App setNamespace(string $namespace) 设置应用命名空间 - * @method static string getNamespace() 获取应用类库命名空间 - * @method static string version() 获取框架版本 - * @method static string getRootPath() 获取应用根目录 - * @method static string getBasePath() 获取应用基础目录 - * @method static string getAppPath() 获取当前应用目录 - * @method static mixed setAppPath(string $path) 设置应用目录 - * @method static string getRuntimePath() 获取应用运行时目录 - * @method static void setRuntimePath(string $path) 设置runtime目录 - * @method static string getThinkPath() 获取核心框架目录 - * @method static string getConfigPath() 获取应用配置目录 - * @method static string getConfigExt() 获取配置后缀 - * @method static float getBeginTime() 获取应用开启时间 - * @method static integer getBeginMem() 获取应用初始内存占用 - * @method static \think\App initialize() 初始化应用 - * @method static bool initialized() 是否初始化过 - * @method static void loadLangPack(string $langset) 加载语言包 - * @method static void boot() 引导应用 - * @method static void loadEvent(array $event) 注册应用事件 - * @method static string parseClass(string $layer, string $name) 解析应用类的类名 - * @method static bool runningInConsole() 是否运行在命令行下 - */ -class App extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'app'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Cache.php b/vendor/topthink/framework/src/think/facade/Cache.php deleted file mode 100644 index aac105d4..00000000 --- a/vendor/topthink/framework/src/think/facade/Cache.php +++ /dev/null @@ -1,48 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\cache\Driver; -use think\cache\TagSet; -use think\Facade; - -/** - * @see \think\Cache - * @package think\facade - * @mixin \think\Cache - * @method static string|null getDefaultDriver() 默认驱动 - * @method static mixed getConfig(null|string $name = null, mixed $default = null) 获取缓存配置 - * @method static array getStoreConfig(string $store, string $name = null, null $default = null) 获取驱动配置 - * @method static Driver store(string $name = null) 连接或者切换缓存 - * @method static bool clear() 清空缓冲池 - * @method static mixed get(string $key, mixed $default = null) 读取缓存 - * @method static bool set(string $key, mixed $value, int|\DateTime $ttl = null) 写入缓存 - * @method static bool delete(string $key) 删除缓存 - * @method static iterable getMultiple(iterable $keys, mixed $default = null) 读取缓存 - * @method static bool setMultiple(iterable $values, null|int|\DateInterval $ttl = null) 写入缓存 - * @method static bool deleteMultiple(iterable $keys) 删除缓存 - * @method static bool has(string $key) 判断缓存是否存在 - * @method static TagSet tag(string|array $name) 缓存标签 - */ -class Cache extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'cache'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Config.php b/vendor/topthink/framework/src/think/facade/Config.php deleted file mode 100644 index 4ce73dd6..00000000 --- a/vendor/topthink/framework/src/think/facade/Config.php +++ /dev/null @@ -1,37 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Config - * @package think\facade - * @mixin \think\Config - * @method static array load(string $file, string $name = '') 加载配置文件(多种格式) - * @method static bool has(string $name) 检测配置是否存在 - * @method static mixed get(string $name = null, mixed $default = null) 获取配置参数 为空则获取所有配置 - * @method static array set(array $config, string $name = null) 设置配置参数 name为数组则为批量设置 - */ -class Config extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'config'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Console.php b/vendor/topthink/framework/src/think/facade/Console.php deleted file mode 100644 index 30dd935e..00000000 --- a/vendor/topthink/framework/src/think/facade/Console.php +++ /dev/null @@ -1,56 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\console\Command; -use think\console\Input; -use think\console\input\Definition as InputDefinition; -use think\console\Output; -use think\console\output\driver\Buffer; -use think\Facade; - -/** - * Class Console - * @package think\facade - * @mixin \think\Console - * @method static Output|Buffer call(string $command, array $parameters = [], string $driver = 'buffer') - * @method static int run() 执行当前的指令 - * @method static int doRun(Input $input, Output $output) 执行指令 - * @method static void setDefinition(InputDefinition $definition) 设置输入参数定义 - * @method static InputDefinition The InputDefinition instance getDefinition() 获取输入参数定义 - * @method static string A help message. getHelp() Gets the help message. - * @method static void setCatchExceptions(bool $boolean) 是否捕获异常 - * @method static void setAutoExit(bool $boolean) 是否自动退出 - * @method static string getLongVersion() 获取完整的版本号 - * @method static void addCommands(array $commands) 添加指令集 - * @method static Command|void addCommand(string|Command $command, string $name = '') 添加一个指令 - * @method static Command getCommand(string $name) 获取指令 - * @method static bool hasCommand(string $name) 某个指令是否存在 - * @method static array getNamespaces() 获取所有的命名空间 - * @method static string findNamespace(string $namespace) 查找注册命名空间中的名称或缩写。 - * @method static Command find(string $name) 查找指令 - * @method static Command[] all(string $namespace = null) 获取所有的指令 - * @method static string extractNamespace(string $name, int $limit = 0) 返回命名空间部分 - */ -class Console extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'console'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Cookie.php b/vendor/topthink/framework/src/think/facade/Cookie.php deleted file mode 100644 index 960f4a3d..00000000 --- a/vendor/topthink/framework/src/think/facade/Cookie.php +++ /dev/null @@ -1,40 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Cookie - * @package think\facade - * @mixin \think\Cookie - * @method static mixed get(mixed $name = '', string $default = null) 获取cookie - * @method static bool has(string $name) 是否存在Cookie参数 - * @method static void set(string $name, string $value, mixed $option = null) Cookie 设置 - * @method static void forever(string $name, string $value = '', mixed $option = null) 永久保存Cookie数据 - * @method static void delete(string $name) Cookie删除 - * @method static array getCookie() 获取cookie保存数据 - * @method static void save() 保存Cookie - */ -class Cookie extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'cookie'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Env.php b/vendor/topthink/framework/src/think/facade/Env.php deleted file mode 100644 index bed25380..00000000 --- a/vendor/topthink/framework/src/think/facade/Env.php +++ /dev/null @@ -1,44 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Env - * @package think\facade - * @mixin \think\Env - * @method static void load(string $file) 读取环境变量定义文件 - * @method static mixed get(string $name = null, mixed $default = null) 获取环境变量值 - * @method static void set(string|array $env, mixed $value = null) 设置环境变量值 - * @method static bool has(string $name) 检测是否存在环境变量 - * @method static void __set(string $name, mixed $value) 设置环境变量 - * @method static mixed __get(string $name) 获取环境变量 - * @method static bool __isset(string $name) 检测是否存在环境变量 - * @method static void offsetSet($name, $value) - * @method static bool offsetExists($name) - * @method static mixed offsetUnset($name) - * @method static mixed offsetGet($name) - */ -class Env extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'env'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Event.php b/vendor/topthink/framework/src/think/facade/Event.php deleted file mode 100644 index c09d8166..00000000 --- a/vendor/topthink/framework/src/think/facade/Event.php +++ /dev/null @@ -1,42 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Event - * @package think\facade - * @mixin \think\Event - * @method static \think\Event listenEvents(array $events) 批量注册事件监听 - * @method static \think\Event listen(string $event, mixed $listener, bool $first = false) 注册事件监听 - * @method static bool hasListener(string $event) 是否存在事件监听 - * @method static void remove(string $event) 移除事件监听 - * @method static \think\Event bind(array $events) 指定事件别名标识 便于调用 - * @method static \think\Event subscribe(mixed $subscriber) 注册事件订阅者 - * @method static \think\Event observe(string|object $observer, null|string $prefix = '') 自动注册事件观察者 - * @method static mixed trigger(string|object $event, mixed $params = null, bool $once = false) 触发事件 - * @method static mixed until($event, $params = null) 触发事件(只获取一个有效返回值) - */ -class Event extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'event'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Filesystem.php b/vendor/topthink/framework/src/think/facade/Filesystem.php deleted file mode 100644 index 53706a84..00000000 --- a/vendor/topthink/framework/src/think/facade/Filesystem.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; -use think\filesystem\Driver; - -/** - * Class Filesystem - * @package think\facade - * @mixin \think\Filesystem - * @method static Driver disk(string $name = null) ,null|string - * @method static mixed getConfig(null|string $name = null, mixed $default = null) 获取缓存配置 - * @method static array getDiskConfig(string $disk, null $name = null, null $default = null) 获取磁盘配置 - * @method static string|null getDefaultDriver() 默认驱动 - */ -class Filesystem extends Facade -{ - protected static function getFacadeClass() - { - return 'filesystem'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Lang.php b/vendor/topthink/framework/src/think/facade/Lang.php deleted file mode 100644 index b460fe2f..00000000 --- a/vendor/topthink/framework/src/think/facade/Lang.php +++ /dev/null @@ -1,41 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Lang - * @package think\facade - * @mixin \think\Lang - * @method static void setLangSet(string $lang) 设置当前语言 - * @method static string getLangSet() 获取当前语言 - * @method static string defaultLangSet() 获取默认语言 - * @method static array load(string|array $file, string $range = '') 加载语言定义(不区分大小写) - * @method static bool has(string|null $name, string $range = '') 判断是否存在语言定义(不区分大小写) - * @method static mixed get(string|null $name = null, array $vars = [], string $range = '') 获取语言定义(不区分大小写) - * @method static string detect(\think\Request $request) 自动侦测设置获取语言选择 - * @method static void saveToCookie(\think\Cookie $cookie) 保存当前语言到Cookie - */ -class Lang extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'lang'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Log.php b/vendor/topthink/framework/src/think/facade/Log.php deleted file mode 100644 index 7c43d37e..00000000 --- a/vendor/topthink/framework/src/think/facade/Log.php +++ /dev/null @@ -1,58 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; -use think\log\Channel; -use think\log\ChannelSet; - -/** - * @see \think\Log - * @package think\facade - * @mixin \think\Log - * @method static string|null getDefaultDriver() 默认驱动 - * @method static mixed getConfig(null|string $name = null, mixed $default = null) 获取日志配置 - * @method static array getChannelConfig(string $channel, null $name = null, null $default = null) 获取渠道配置 - * @method static Channel|ChannelSet channel(string|array $name = null) driver() 的别名 - * @method static mixed createDriver(string $name) - * @method static \think\Log clear(string|array $channel = '*') 清空日志信息 - * @method static \think\Log close(string|array $channel = '*') 关闭本次请求日志写入 - * @method static array getLog(string $channel = null) 获取日志信息 - * @method static bool save() 保存日志信息 - * @method static \think\Log record(mixed $msg, string $type = 'info', array $context = [], bool $lazy = true) 记录日志信息 - * @method static \think\Log write(mixed $msg, string $type = 'info', array $context = []) 实时写入日志信息 - * @method static Event listen($listener) 注册日志写入事件监听 - * @method static void log(string $level, mixed $message, array $context = []) 记录日志信息 - * @method static void emergency(mixed $message, array $context = []) 记录emergency信息 - * @method static void alert(mixed $message, array $context = []) 记录警报信息 - * @method static void critical(mixed $message, array $context = []) 记录紧急情况 - * @method static void error(mixed $message, array $context = []) 记录错误信息 - * @method static void warning(mixed $message, array $context = []) 记录warning信息 - * @method static void notice(mixed $message, array $context = []) 记录notice信息 - * @method static void info(mixed $message, array $context = []) 记录一般信息 - * @method static void debug(mixed $message, array $context = []) 记录调试信息 - * @method static void sql(mixed $message, array $context = []) 记录sql信息 - * @method static mixed __call($method, $parameters) - */ -class Log extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'log'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Middleware.php b/vendor/topthink/framework/src/think/facade/Middleware.php deleted file mode 100644 index 4203f821..00000000 --- a/vendor/topthink/framework/src/think/facade/Middleware.php +++ /dev/null @@ -1,42 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Middleware - * @package think\facade - * @mixin \think\Middleware - * @method static void import(array $middlewares = [], string $type = 'global') 导入中间件 - * @method static void add(mixed $middleware, string $type = 'global') 注册中间件 - * @method static void route(mixed $middleware) 注册路由中间件 - * @method static void controller(mixed $middleware) 注册控制器中间件 - * @method static mixed unshift(mixed $middleware, string $type = 'global') 注册中间件到开始位置 - * @method static array all(string $type = 'global') 获取注册的中间件 - * @method static Pipeline pipeline(string $type = 'global') 调度管道 - * @method static mixed end(\think\Response $response) 结束调度 - * @method static \think\Response handleException(\think\Request $passable, \Throwable $e) 异常处理 - */ -class Middleware extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'middleware'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Request.php b/vendor/topthink/framework/src/think/facade/Request.php deleted file mode 100644 index 6531f467..00000000 --- a/vendor/topthink/framework/src/think/facade/Request.php +++ /dev/null @@ -1,134 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; -use think\file\UploadedFile; -use think\route\Rule; - -/** - * @see \think\Request - * @package think\facade - * @mixin \think\Request - * @method static \think\Request setDomain(string $domain) 设置当前包含协议的域名 - * @method static string domain(bool $port = false) 获取当前包含协议的域名 - * @method static string rootDomain() 获取当前根域名 - * @method static \think\Request setSubDomain(string $domain) 设置当前泛域名的值 - * @method static string subDomain() 获取当前子域名 - * @method static \think\Request setPanDomain(string $domain) 设置当前泛域名的值 - * @method static string panDomain() 获取当前泛域名的值 - * @method static \think\Request setUrl(string $url) 设置当前完整URL 包括QUERY_STRING - * @method static string url(bool $complete = false) 获取当前完整URL 包括QUERY_STRING - * @method static \think\Request setBaseUrl(string $url) 设置当前URL 不含QUERY_STRING - * @method static string baseUrl(bool $complete = false) 获取当前URL 不含QUERY_STRING - * @method static string baseFile(bool $complete = false) 获取当前执行的文件 SCRIPT_NAME - * @method static \think\Request setRoot(string $url) 设置URL访问根地址 - * @method static string root(bool $complete = false) 获取URL访问根地址 - * @method static string rootUrl() 获取URL访问根目录 - * @method static \think\Request setPathinfo(string $pathinfo) 设置当前请求的pathinfo - * @method static string pathinfo() 获取当前请求URL的pathinfo信息(含URL后缀) - * @method static string ext() 当前URL的访问后缀 - * @method static integer|float time(bool $float = false) 获取当前请求的时间 - * @method static string type() 当前请求的资源类型 - * @method static void mimeType(string|array $type, string $val = '') 设置资源类型 - * @method static \think\Request setMethod(string $method) 设置请求类型 - * @method static string method(bool $origin = false) 当前的请求类型 - * @method static bool isGet() 是否为GET请求 - * @method static bool isPost() 是否为POST请求 - * @method static bool isPut() 是否为PUT请求 - * @method static bool isDelete() 是否为DELTE请求 - * @method static bool isHead() 是否为HEAD请求 - * @method static bool isPatch() 是否为PATCH请求 - * @method static bool isOptions() 是否为OPTIONS请求 - * @method static bool isCli() 是否为cli - * @method static bool isCgi() 是否为cgi - * @method static mixed param(string|array $name = '', mixed $default = null, string|array $filter = '') 获取当前请求的参数 - * @method static \think\Request setRule(Rule $rule) 设置路由变量 - * @method static Rule|null rule() 获取当前路由对象 - * @method static \think\Request setRoute(array $route) 设置路由变量 - * @method static mixed route(string|array $name = '', mixed $default = null, string|array $filter = '') 获取路由参数 - * @method static mixed get(string|array $name = '', mixed $default = null, string|array $filter = '') 获取GET参数 - * @method static mixed middleware(mixed $name, mixed $default = null) 获取中间件传递的参数 - * @method static mixed post(string|array $name = '', mixed $default = null, string|array $filter = '') 获取POST参数 - * @method static mixed put(string|array $name = '', mixed $default = null, string|array $filter = '') 获取PUT参数 - * @method static mixed delete(mixed $name = '', mixed $default = null, string|array $filter = '') 设置获取DELETE参数 - * @method static mixed patch(mixed $name = '', mixed $default = null, string|array $filter = '') 设置获取PATCH参数 - * @method static mixed request(string|array $name = '', mixed $default = null, string|array $filter = '') 获取request变量 - * @method static mixed env(string $name = '', string $default = null) 获取环境变量 - * @method static mixed session(string $name = '', string $default = null) 获取session数据 - * @method static mixed cookie(mixed $name = '', string $default = null, string|array $filter = '') 获取cookie参数 - * @method static mixed server(string $name = '', string $default = '') 获取server参数 - * @method static null|array|UploadedFile file(string $name = '') 获取上传的文件信息 - * @method static string|array header(string $name = '', string $default = null) 设置或者获取当前的Header - * @method static mixed input(array $data = [], string|false $name = '', mixed $default = null, string|array $filter = '') 获取变量 支持过滤和默认值 - * @method static mixed filter(mixed $filter = null) 设置或获取当前的过滤规则 - * @method static mixed filterValue(mixed &$value, mixed $key, array $filters) 递归过滤给定的值 - * @method static bool has(string $name, string $type = 'param', bool $checkEmpty = false) 是否存在某个请求参数 - * @method static array only(array $name, mixed $data = 'param', string|array $filter = '') 获取指定的参数 - * @method static mixed except(array $name, string $type = 'param') 排除指定参数获取 - * @method static bool isSsl() 当前是否ssl - * @method static bool isJson() 当前是否JSON请求 - * @method static bool isAjax(bool $ajax = false) 当前是否Ajax请求 - * @method static bool isPjax(bool $pjax = false) 当前是否Pjax请求 - * @method static string ip() 获取客户端IP地址 - * @method static boolean isValidIP(string $ip, string $type = '') 检测是否是合法的IP地址 - * @method static string ip2bin(string $ip) 将IP地址转换为二进制字符串 - * @method static bool isMobile() 检测是否使用手机访问 - * @method static string scheme() 当前URL地址中的scheme参数 - * @method static string query() 当前请求URL地址中的query参数 - * @method static \think\Request setHost(string $host) 设置当前请求的host(包含端口) - * @method static string host(bool $strict = false) 当前请求的host - * @method static int port() 当前请求URL地址中的port参数 - * @method static string protocol() 当前请求 SERVER_PROTOCOL - * @method static int remotePort() 当前请求 REMOTE_PORT - * @method static string contentType() 当前请求 HTTP_CONTENT_TYPE - * @method static string secureKey() 获取当前请求的安全Key - * @method static \think\Request setController(string $controller) 设置当前的控制器名 - * @method static \think\Request setAction(string $action) 设置当前的操作名 - * @method static string controller(bool $convert = false) 获取当前的控制器名 - * @method static string action(bool $convert = false) 获取当前的操作名 - * @method static string getContent() 设置或者获取当前请求的content - * @method static string getInput() 获取当前请求的php://input - * @method static string buildToken(string $name = '__token__', mixed $type = 'md5') 生成请求令牌 - * @method static bool checkToken(string $token = '__token__', array $data = []) 检查请求令牌 - * @method static \think\Request withMiddleware(array $middleware) 设置在中间件传递的数据 - * @method static \think\Request withGet(array $get) 设置GET数据 - * @method static \think\Request withPost(array $post) 设置POST数据 - * @method static \think\Request withCookie(array $cookie) 设置COOKIE数据 - * @method static \think\Request withSession(Session $session) 设置SESSION数据 - * @method static \think\Request withServer(array $server) 设置SERVER数据 - * @method static \think\Request withHeader(array $header) 设置HEADER数据 - * @method static \think\Request withEnv(Env $env) 设置ENV数据 - * @method static \think\Request withInput(string $input) 设置php://input数据 - * @method static \think\Request withFiles(array $files) 设置文件上传数据 - * @method static \think\Request withRoute(array $route) 设置ROUTE变量 - * @method static mixed __set(string $name, mixed $value) 设置中间传递数据 - * @method static mixed __get(string $name) 获取中间传递数据的值 - * @method static boolean __isset(string $name) 检测中间传递数据的值 - * @method static bool offsetExists($name) - * @method static mixed offsetGet($name) - * @method static mixed offsetSet($name, $value) - * @method static mixed offsetUnset($name) - */ -class Request extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'request'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Route.php b/vendor/topthink/framework/src/think/facade/Route.php deleted file mode 100644 index 46bd7469..00000000 --- a/vendor/topthink/framework/src/think/facade/Route.php +++ /dev/null @@ -1,83 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; -use think\route\Dispatch; -use think\route\Domain; -use think\route\Rule; -use think\route\RuleGroup; -use think\route\RuleItem; -use think\route\RuleName; -use think\route\Url as UrlBuild; - -/** - * @see \think\Route - * @package think\facade - * @mixin \think\Route - * @method static mixed config(string $name = null) - * @method static \think\Route lazy(bool $lazy = true) 设置路由域名及分组(包括资源路由)是否延迟解析 - * @method static void setTestMode(bool $test) 设置路由为测试模式 - * @method static bool isTest() 检查路由是否为测试模式 - * @method static \think\Route mergeRuleRegex(bool $merge = true) 设置路由域名及分组(包括资源路由)是否合并解析 - * @method static void setGroup(RuleGroup $group) 设置当前分组 - * @method static RuleGroup getGroup(string $name = null) 获取指定标识的路由分组 不指定则获取当前分组 - * @method static \think\Route pattern(array $pattern) 注册变量规则 - * @method static \think\Route option(array $option) 注册路由参数 - * @method static Domain domain(string|array $name, mixed $rule = null) 注册域名路由 - * @method static array getDomains() 获取域名 - * @method static RuleName getRuleName() 获取RuleName对象 - * @method static \think\Route bind(string $bind, string $domain = null) 设置路由绑定 - * @method static array getBind() 读取路由绑定信息 - * @method static string|null getDomainBind(string $domain = null) 读取路由绑定 - * @method static RuleItem[] getName(string $name = null, string $domain = null, string $method = '*') 读取路由标识 - * @method static void import(array $name) 批量导入路由标识 - * @method static void setName(string $name, RuleItem $ruleItem, bool $first = false) 注册路由标识 - * @method static void setRule(string $rule, RuleItem $ruleItem = null) 保存路由规则 - * @method static RuleItem[] getRule(string $rule) 读取路由 - * @method static array getRuleList() 读取路由列表 - * @method static void clear() 清空路由规则 - * @method static RuleItem rule(string $rule, mixed $route = null, string $method = '*') 注册路由规则 - * @method static \think\Route setCrossDomainRule(Rule $rule, string $method = '*') 设置跨域有效路由规则 - * @method static RuleGroup group(string|\Closure $name, mixed $route = null) 注册路由分组 - * @method static RuleItem any(string $rule, mixed $route) 注册路由 - * @method static RuleItem get(string $rule, mixed $route) 注册GET路由 - * @method static RuleItem post(string $rule, mixed $route) 注册POST路由 - * @method static RuleItem put(string $rule, mixed $route) 注册PUT路由 - * @method static RuleItem delete(string $rule, mixed $route) 注册DELETE路由 - * @method static RuleItem patch(string $rule, mixed $route) 注册PATCH路由 - * @method static RuleItem options(string $rule, mixed $route) 注册OPTIONS路由 - * @method static Resource resource(string $rule, string $route) 注册资源路由 - * @method static RuleItem view(string $rule, string $template = '', array $vars = []) 注册视图路由 - * @method static RuleItem redirect(string $rule, string $route = '', int $status = 301) 注册重定向路由 - * @method static \think\Route rest(string|array $name, array|bool $resource = []) rest方法定义和修改 - * @method static array|null getRest(string $name = null) 获取rest方法定义的参数 - * @method static RuleItem miss(string|Closure $route, string $method = '*') 注册未匹配路由规则后的处理 - * @method static Response dispatch(\think\Request $request, Closure|bool $withRoute = true) 路由调度 - * @method static Dispatch|false check() 检测URL路由 - * @method static Dispatch url(string $url) 默认URL解析 - * @method static UrlBuild buildUrl(string $url = '', array $vars = []) URL生成 支持路由反射 - * @method static RuleGroup __call(string $method, array $args) 设置全局的路由分组参数 - */ -class Route extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'route'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Session.php b/vendor/topthink/framework/src/think/facade/Session.php deleted file mode 100644 index 68bf9936..00000000 --- a/vendor/topthink/framework/src/think/facade/Session.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Session - * @package think\facade - * @mixin \think\Session - * @method static mixed getConfig(null|string $name = null, mixed $default = null) 获取Session配置 - * @method static string|null getDefaultDriver() 默认驱动 - */ -class Session extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'session'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/Validate.php b/vendor/topthink/framework/src/think/facade/Validate.php deleted file mode 100644 index 6db6d34a..00000000 --- a/vendor/topthink/framework/src/think/facade/Validate.php +++ /dev/null @@ -1,95 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Validate - * @package think\facade - * @mixin \think\Validate - * @method static void setLang(\think\Lang $lang) 设置Lang对象 - * @method static void setDb(\think\Db $db) 设置Db对象 - * @method static void setRequest(\think\Request $request) 设置Request对象 - * @method static \think\Validate rule(string|array $name, mixed $rule = '') 添加字段验证规则 - * @method static \think\Validate extend(string $type, callable $callback = null, string $message = null) 注册验证(类型)规则 - * @method static void setTypeMsg(string|array $type, string $msg = null) 设置验证规则的默认提示信息 - * @method static Validate message(array $message) 设置提示信息 - * @method static \think\Validate scene(string $name) 设置验证场景 - * @method static bool hasScene(string $name) 判断是否存在某个验证场景 - * @method static \think\Validate batch(bool $batch = true) 设置批量验证 - * @method static \think\Validate failException(bool $fail = true) 设置验证失败后是否抛出异常 - * @method static \think\Validate only(array $fields) 指定需要验证的字段列表 - * @method static \think\Validate remove(string|array $field, mixed $rule = null) 移除某个字段的验证规则 - * @method static \think\Validate append(string|array $field, mixed $rule = null) 追加某个字段的验证规则 - * @method static bool check(array $data, array $rules = []) 数据自动验证 - * @method static bool checkRule(mixed $value, mixed $rules) 根据验证规则验证数据 - * @method static bool confirm(mixed $value, mixed $rule, array $data = [], string $field = '') 验证是否和某个字段的值一致 - * @method static bool different(mixed $value, mixed $rule, array $data = []) 验证是否和某个字段的值是否不同 - * @method static bool egt(mixed $value, mixed $rule, array $data = []) 验证是否大于等于某个值 - * @method static bool gt(mixed $value, mixed $rule, array $data = []) 验证是否大于某个值 - * @method static bool elt(mixed $value, mixed $rule, array $data = []) 验证是否小于等于某个值 - * @method static bool lt(mixed $value, mixed $rule, array $data = []) 验证是否小于某个值 - * @method static bool eq(mixed $value, mixed $rule) 验证是否等于某个值 - * @method static bool must(mixed $value, mixed $rule = null) 必须验证 - * @method static bool is(mixed $value, string $rule, array $data = []) 验证字段值是否为有效格式 - * @method static bool token(mixed $value, mixed $rule, array $data) 验证表单令牌 - * @method static bool activeUrl(mixed $value, mixed $rule = 'MX') 验证是否为合格的域名或者IP 支持A,MX,NS,SOA,PTR,CNAME,AAAA,A6, SRV,NAPTR,TXT 或者 ANY类型 - * @method static bool ip(mixed $value, mixed $rule = 'ipv4') 验证是否有效IP - * @method static bool fileExt(mixed $file, mixed $rule) 验证上传文件后缀 - * @method static bool fileMime(mixed $file, mixed $rule) 验证上传文件类型 - * @method static bool fileSize(mixed $file, mixed $rule) 验证上传文件大小 - * @method static bool image(mixed $file, mixed $rule) 验证图片的宽高及类型 - * @method static bool dateFormat(mixed $value, mixed $rule) 验证时间和日期是否符合指定格式 - * @method static bool unique(mixed $value, mixed $rule, array $data = [], string $field = '') 验证是否唯一 - * @method static bool filter(mixed $value, mixed $rule) 使用filter_var方式验证 - * @method static bool requireIf(mixed $value, mixed $rule, array $data = []) 验证某个字段等于某个值的时候必须 - * @method static bool requireCallback(mixed $value, mixed $rule, array $data = []) 通过回调方法验证某个字段是否必须 - * @method static bool requireWith(mixed $value, mixed $rule, array $data = []) 验证某个字段有值的情况下必须 - * @method static bool requireWithout(mixed $value, mixed $rule, array $data = []) 验证某个字段没有值的情况下必须 - * @method static bool in(mixed $value, mixed $rule) 验证是否在范围内 - * @method static bool notIn(mixed $value, mixed $rule) 验证是否不在某个范围 - * @method static bool between(mixed $value, mixed $rule) between验证数据 - * @method static bool notBetween(mixed $value, mixed $rule) 使用notbetween验证数据 - * @method static bool length(mixed $value, mixed $rule) 验证数据长度 - * @method static bool max(mixed $value, mixed $rule) 验证数据最大长度 - * @method static bool min(mixed $value, mixed $rule) 验证数据最小长度 - * @method static bool after(mixed $value, mixed $rule, array $data = []) 验证日期 - * @method static bool before(mixed $value, mixed $rule, array $data = []) 验证日期 - * @method static bool afterWith(mixed $value, mixed $rule, array $data = []) 验证日期 - * @method static bool beforeWith(mixed $value, mixed $rule, array $data = []) 验证日期 - * @method static bool expire(mixed $value, mixed $rule) 验证有效期 - * @method static bool allowIp(mixed $value, mixed $rule) 验证IP许可 - * @method static bool denyIp(mixed $value, mixed $rule) 验证IP禁用 - * @method static bool regex(mixed $value, mixed $rule) 使用正则验证数据 - * @method static array|string getError() 获取错误信息 - * @method static bool __call(string $method, array $args) 动态方法 直接调用is方法进行验证 - */ -class Validate extends Facade -{ - /** - * 始终创建新的对象实例 - * @var bool - */ - protected static $alwaysNewInstance = true; - - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'validate'; - } -} diff --git a/vendor/topthink/framework/src/think/facade/View.php b/vendor/topthink/framework/src/think/facade/View.php deleted file mode 100644 index acde3b57..00000000 --- a/vendor/topthink/framework/src/think/facade/View.php +++ /dev/null @@ -1,42 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\View - * @package think\facade - * @mixin \think\View - * @method static \think\View engine(string $type = null) 获取模板引擎 - * @method static \think\View assign(string|array $name, mixed $value = null) 模板变量赋值 - * @method static \think\View filter(\think\Callable $filter = null) 视图过滤 - * @method static string fetch(string $template = '', array $vars = []) 解析和获取模板内容 用于输出 - * @method static string display(string $content, array $vars = []) 渲染内容输出 - * @method static mixed __set(string $name, mixed $value) 模板变量赋值 - * @method static mixed __get(string $name) 取得模板显示变量的值 - * @method static bool __isset(string $name) 检测模板变量是否设置 - * @method static string|null getDefaultDriver() 默认驱动 - */ -class View extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'view'; - } -} diff --git a/vendor/topthink/framework/src/think/file/UploadedFile.php b/vendor/topthink/framework/src/think/file/UploadedFile.php deleted file mode 100644 index 7dff766e..00000000 --- a/vendor/topthink/framework/src/think/file/UploadedFile.php +++ /dev/null @@ -1,143 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\file; - -use think\exception\FileException; -use think\File; - -class UploadedFile extends File -{ - - private $test = false; - private $originalName; - private $mimeType; - private $error; - - public function __construct(string $path, string $originalName, string $mimeType = null, int $error = null, bool $test = false) - { - $this->originalName = $originalName; - $this->mimeType = $mimeType ?: 'application/octet-stream'; - $this->test = $test; - $this->error = $error ?: UPLOAD_ERR_OK; - - parent::__construct($path, UPLOAD_ERR_OK === $this->error); - } - - public function isValid(): bool - { - $isOk = UPLOAD_ERR_OK === $this->error; - - return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname()); - } - - /** - * 上传文件 - * @access public - * @param string $directory 保存路径 - * @param string|null $name 保存的文件名 - * @return File - */ - public function move(string $directory, string $name = null): File - { - if ($this->isValid()) { - if ($this->test) { - return parent::move($directory, $name); - } - - $target = $this->getTargetFile($directory, $name); - - set_error_handler(function ($type, $msg) use (&$error) { - $error = $msg; - }); - - $moved = move_uploaded_file($this->getPathname(), (string) $target); - restore_error_handler(); - if (!$moved) { - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error))); - } - - @chmod((string) $target, 0666 & ~umask()); - - return $target; - } - - throw new FileException($this->getErrorMessage()); - } - - /** - * 获取错误信息 - * @access public - * @return string - */ - protected function getErrorMessage(): string - { - switch ($this->error) { - case 1: - case 2: - $message = 'upload File size exceeds the maximum value'; - break; - case 3: - $message = 'only the portion of file is uploaded'; - break; - case 4: - $message = 'no file to uploaded'; - break; - case 6: - $message = 'upload temp dir not found'; - break; - case 7: - $message = 'file write error'; - break; - default: - $message = 'unknown upload error'; - } - - return $message; - } - - /** - * 获取上传文件类型信息 - * @return string - */ - public function getOriginalMime(): string - { - return $this->mimeType; - } - - /** - * 上传文件名 - * @return string - */ - public function getOriginalName(): string - { - return $this->originalName; - } - - /** - * 获取上传文件扩展名 - * @return string - */ - public function getOriginalExtension(): string - { - return pathinfo($this->originalName, PATHINFO_EXTENSION); - } - - /** - * 获取文件扩展名 - * @return string - */ - public function extension(): string - { - return $this->getOriginalExtension(); - } -} diff --git a/vendor/topthink/framework/src/think/filesystem/CacheStore.php b/vendor/topthink/framework/src/think/filesystem/CacheStore.php deleted file mode 100644 index 0a62399e..00000000 --- a/vendor/topthink/framework/src/think/filesystem/CacheStore.php +++ /dev/null @@ -1,54 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\filesystem; - -use League\Flysystem\Cached\Storage\AbstractCache; -use Psr\SimpleCache\CacheInterface; - -class CacheStore extends AbstractCache -{ - protected $store; - - protected $key; - - protected $expire; - - public function __construct(CacheInterface $store, $key = 'flysystem', $expire = null) - { - $this->key = $key; - $this->store = $store; - $this->expire = $expire; - } - - /** - * Store the cache. - */ - public function save() - { - $contents = $this->getForStorage(); - - $this->store->set($this->key, $contents, $this->expire); - } - - /** - * Load the cache. - */ - public function load() - { - $contents = $this->store->get($this->key); - - if (!is_null($contents)) { - $this->setFromStorage($contents); - } - } -} diff --git a/vendor/topthink/framework/src/think/filesystem/Driver.php b/vendor/topthink/framework/src/think/filesystem/Driver.php deleted file mode 100644 index 67129592..00000000 --- a/vendor/topthink/framework/src/think/filesystem/Driver.php +++ /dev/null @@ -1,133 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\filesystem; - -use League\Flysystem\AdapterInterface; -use League\Flysystem\Adapter\AbstractAdapter; -use League\Flysystem\Cached\CachedAdapter; -use League\Flysystem\Cached\Storage\Memory as MemoryStore; -use League\Flysystem\Filesystem; -use think\Cache; -use think\File; - -/** - * Class Driver - * @package think\filesystem - * @mixin Filesystem - */ -abstract class Driver -{ - - /** @var Cache */ - protected $cache; - - /** @var Filesystem */ - protected $filesystem; - - /** - * 配置参数 - * @var array - */ - protected $config = []; - - public function __construct(Cache $cache, array $config) - { - $this->cache = $cache; - $this->config = array_merge($this->config, $config); - - $adapter = $this->createAdapter(); - $this->filesystem = $this->createFilesystem($adapter); - } - - protected function createCacheStore($config) - { - if (true === $config) { - return new MemoryStore; - } - - return new CacheStore( - $this->cache->store($config['store']), - $config['prefix'] ?? 'flysystem', - $config['expire'] ?? null - ); - } - - abstract protected function createAdapter(): AdapterInterface; - - protected function createFilesystem(AdapterInterface $adapter): Filesystem - { - if (!empty($this->config['cache'])) { - $adapter = new CachedAdapter($adapter, $this->createCacheStore($this->config['cache'])); - } - - $config = array_intersect_key($this->config, array_flip(['visibility', 'disable_asserts', 'url'])); - - return new Filesystem($adapter, count($config) > 0 ? $config : null); - } - - /** - * 获取文件完整路径 - * @param string $path - * @return string - */ - public function path(string $path): string - { - $adapter = $this->filesystem->getAdapter(); - - if ($adapter instanceof AbstractAdapter) { - return $adapter->applyPathPrefix($path); - } - - return $path; - } - - /** - * 保存文件 - * @param string $path 路径 - * @param File $file 文件 - * @param null|string|\Closure $rule 文件名规则 - * @param array $options 参数 - * @return bool|string - */ - public function putFile(string $path, File $file, $rule = null, array $options = []) - { - return $this->putFileAs($path, $file, $file->hashName($rule), $options); - } - - /** - * 指定文件名保存文件 - * @param string $path 路径 - * @param File $file 文件 - * @param string $name 文件名 - * @param array $options 参数 - * @return bool|string - */ - public function putFileAs(string $path, File $file, string $name, array $options = []) - { - $stream = fopen($file->getRealPath(), 'r'); - $path = trim($path . '/' . $name, '/'); - - $result = $this->putStream($path, $stream, $options); - - if (is_resource($stream)) { - fclose($stream); - } - - return $result ? $path : false; - } - - public function __call($method, $parameters) - { - return $this->filesystem->$method(...$parameters); - } -} diff --git a/vendor/topthink/framework/src/think/filesystem/driver/Local.php b/vendor/topthink/framework/src/think/filesystem/driver/Local.php deleted file mode 100644 index c10ccc3b..00000000 --- a/vendor/topthink/framework/src/think/filesystem/driver/Local.php +++ /dev/null @@ -1,44 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\filesystem\driver; - -use League\Flysystem\AdapterInterface; -use League\Flysystem\Adapter\Local as LocalAdapter; -use think\filesystem\Driver; - -class Local extends Driver -{ - /** - * 配置参数 - * @var array - */ - protected $config = [ - 'root' => '', - ]; - - protected function createAdapter(): AdapterInterface - { - $permissions = $this->config['permissions'] ?? []; - - $links = ($this->config['links'] ?? null) === 'skip' - ? LocalAdapter::SKIP_LINKS - : LocalAdapter::DISALLOW_LINKS; - - return new LocalAdapter( - $this->config['root'], - LOCK_EX, - $links, - $permissions - ); - } -} diff --git a/vendor/topthink/framework/src/think/initializer/BootService.php b/vendor/topthink/framework/src/think/initializer/BootService.php deleted file mode 100644 index bab6d390..00000000 --- a/vendor/topthink/framework/src/think/initializer/BootService.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\initializer; - -use think\App; - -/** - * 启动系统服务 - */ -class BootService -{ - public function init(App $app) - { - $app->boot(); - } -} diff --git a/vendor/topthink/framework/src/think/initializer/Error.php b/vendor/topthink/framework/src/think/initializer/Error.php deleted file mode 100644 index 201d9473..00000000 --- a/vendor/topthink/framework/src/think/initializer/Error.php +++ /dev/null @@ -1,117 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\initializer; - -use think\App; -use think\console\Output as ConsoleOutput; -use think\exception\ErrorException; -use think\exception\Handle; -use Throwable; - -/** - * 错误和异常处理 - */ -class Error -{ - /** @var App */ - protected $app; - - /** - * 注册异常处理 - * @access public - * @param App $app - * @return void - */ - public function init(App $app) - { - $this->app = $app; - error_reporting(E_ALL); - set_error_handler([$this, 'appError']); - set_exception_handler([$this, 'appException']); - register_shutdown_function([$this, 'appShutdown']); - } - - /** - * Exception Handler - * @access public - * @param \Throwable $e - */ - public function appException(Throwable $e): void - { - $handler = $this->getExceptionHandler(); - - $handler->report($e); - - if ($this->app->runningInConsole()) { - $handler->renderForConsole(new ConsoleOutput, $e); - } else { - $handler->render($this->app->request, $e)->send(); - } - } - - /** - * Error Handler - * @access public - * @param integer $errno 错误编号 - * @param string $errstr 详细错误信息 - * @param string $errfile 出错的文件 - * @param integer $errline 出错行号 - * @throws ErrorException - */ - public function appError(int $errno, string $errstr, string $errfile = '', int $errline = 0): void - { - $exception = new ErrorException($errno, $errstr, $errfile, $errline); - - if (error_reporting() & $errno) { - // 将错误信息托管至 think\exception\ErrorException - throw $exception; - } - } - - /** - * Shutdown Handler - * @access public - */ - public function appShutdown(): void - { - if (!is_null($error = error_get_last()) && $this->isFatal($error['type'])) { - // 将错误信息托管至think\ErrorException - $exception = new ErrorException($error['type'], $error['message'], $error['file'], $error['line']); - - $this->appException($exception); - } - } - - /** - * 确定错误类型是否致命 - * - * @access protected - * @param int $type - * @return bool - */ - protected function isFatal(int $type): bool - { - return in_array($type, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE]); - } - - /** - * Get an instance of the exception handler. - * - * @access protected - * @return Handle - */ - protected function getExceptionHandler() - { - return $this->app->make(Handle::class); - } -} diff --git a/vendor/topthink/framework/src/think/initializer/RegisterService.php b/vendor/topthink/framework/src/think/initializer/RegisterService.php deleted file mode 100644 index b682a0b0..00000000 --- a/vendor/topthink/framework/src/think/initializer/RegisterService.php +++ /dev/null @@ -1,48 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\initializer; - -use think\App; -use think\service\ModelService; -use think\service\PaginatorService; -use think\service\ValidateService; - -/** - * 注册系统服务 - */ -class RegisterService -{ - - protected $services = [ - PaginatorService::class, - ValidateService::class, - ModelService::class, - ]; - - public function init(App $app) - { - $file = $app->getRootPath() . 'vendor/services.php'; - - $services = $this->services; - - if (is_file($file)) { - $services = array_merge($services, include $file); - } - - foreach ($services as $service) { - if (class_exists($service)) { - $app->register($service); - } - } - } -} diff --git a/vendor/topthink/framework/src/think/log/Channel.php b/vendor/topthink/framework/src/think/log/Channel.php deleted file mode 100644 index 1de96f1a..00000000 --- a/vendor/topthink/framework/src/think/log/Channel.php +++ /dev/null @@ -1,286 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\log; - -use Psr\Log\LoggerInterface; -use think\contract\LogHandlerInterface; -use think\Event; -use think\event\LogRecord; -use think\event\LogWrite; - -class Channel implements LoggerInterface -{ - protected $name; - protected $logger; - protected $event; - - protected $lazy = true; - /** - * 日志信息 - * @var array - */ - protected $log = []; - - /** - * 关闭日志 - * @var array - */ - protected $close = false; - - /** - * 允许写入类型 - * @var array - */ - protected $allow = []; - - public function __construct(string $name, LogHandlerInterface $logger, array $allow, bool $lazy = true, Event $event = null) - { - $this->name = $name; - $this->logger = $logger; - $this->allow = $allow; - $this->lazy = $lazy; - $this->event = $event; - } - - /** - * 关闭通道 - */ - public function close() - { - $this->clear(); - $this->close = true; - } - - /** - * 清空日志 - */ - public function clear() - { - $this->log = []; - } - - /** - * 记录日志信息 - * @access public - * @param mixed $msg 日志信息 - * @param string $type 日志级别 - * @param array $context 替换内容 - * @param bool $lazy - * @return $this - */ - public function record($msg, string $type = 'info', array $context = [], bool $lazy = true) - { - if ($this->close || (!empty($this->allow) && !in_array($type, $this->allow))) { - return $this; - } - - if (is_string($msg) && !empty($context)) { - $replace = []; - foreach ($context as $key => $val) { - $replace['{' . $key . '}'] = $val; - } - - $msg = strtr($msg, $replace); - } - - if (!empty($msg) || 0 === $msg) { - $this->log[$type][] = $msg; - if ($this->event) { - $this->event->trigger(new LogRecord($type, $msg)); - } - } - - if (!$this->lazy || !$lazy) { - $this->save(); - } - - return $this; - } - - /** - * 实时写入日志信息 - * @access public - * @param mixed $msg 调试信息 - * @param string $type 日志级别 - * @param array $context 替换内容 - * @return $this - */ - public function write($msg, string $type = 'info', array $context = []) - { - return $this->record($msg, $type, $context, false); - } - - /** - * 获取日志信息 - * @return array - */ - public function getLog(): array - { - return $this->log; - } - - /** - * 保存日志 - * @return bool - */ - public function save(): bool - { - $log = $this->log; - if ($this->event) { - $event = new LogWrite($this->name, $log); - $this->event->trigger($event); - $log = $event->log; - } - - if ($this->logger->save($log)) { - $this->clear(); - return true; - } - - return false; - } - - /** - * System is unusable. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function emergency($message, array $context = []) - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function alert($message, array $context = []) - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function critical($message, array $context = []) - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function error($message, array $context = []) - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function warning($message, array $context = []) - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function notice($message, array $context = []) - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function info($message, array $context = []) - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function debug($message, array $context = []) - { - $this->log(__FUNCTION__, $message, $context); - } - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - */ - public function log($level, $message, array $context = []) - { - $this->record($message, $level, $context); - } - - public function __call($method, $parameters) - { - $this->log($method, ...$parameters); - } -} diff --git a/vendor/topthink/framework/src/think/log/ChannelSet.php b/vendor/topthink/framework/src/think/log/ChannelSet.php deleted file mode 100644 index 6dcb0bdb..00000000 --- a/vendor/topthink/framework/src/think/log/ChannelSet.php +++ /dev/null @@ -1,39 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\log; - -use think\Log; - -/** - * Class ChannelSet - * @package think\log - * @mixin Channel - */ -class ChannelSet -{ - protected $log; - protected $channels; - - public function __construct(Log $log, array $channels) - { - $this->log = $log; - $this->channels = $channels; - } - - public function __call($method, $arguments) - { - foreach ($this->channels as $channel) { - $this->log->channel($channel)->{$method}(...$arguments); - } - } -} diff --git a/vendor/topthink/framework/src/think/log/driver/File.php b/vendor/topthink/framework/src/think/log/driver/File.php deleted file mode 100644 index e5682fc0..00000000 --- a/vendor/topthink/framework/src/think/log/driver/File.php +++ /dev/null @@ -1,205 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\log\driver; - -use think\App; -use think\contract\LogHandlerInterface; - -/** - * 本地化调试输出到文件 - */ -class File implements LogHandlerInterface -{ - /** - * 配置参数 - * @var array - */ - protected $config = [ - 'time_format' => 'c', - 'single' => false, - 'file_size' => 2097152, - 'path' => '', - 'apart_level' => [], - 'max_files' => 0, - 'json' => false, - 'json_options' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES, - 'format' => '[%s][%s] %s', - ]; - - // 实例化并传入参数 - public function __construct(App $app, $config = []) - { - if (is_array($config)) { - $this->config = array_merge($this->config, $config); - } - - if (empty($this->config['format'])) { - $this->config['format'] = '[%s][%s] %s'; - } - - if (empty($this->config['path'])) { - $this->config['path'] = $app->getRuntimePath() . 'log'; - } - - if (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { - $this->config['path'] .= DIRECTORY_SEPARATOR; - } - } - - /** - * 日志写入接口 - * @access public - * @param array $log 日志信息 - * @return bool - */ - public function save(array $log): bool - { - $destination = $this->getMasterLogFile(); - - $path = dirname($destination); - !is_dir($path) && mkdir($path, 0755, true); - - $info = []; - - // 日志信息封装 - $time = \DateTime::createFromFormat('0.u00 U', microtime())->setTimezone(new \DateTimeZone(date_default_timezone_get()))->format($this->config['time_format']); - - foreach ($log as $type => $val) { - $message = []; - foreach ($val as $msg) { - if (!is_string($msg)) { - $msg = var_export($msg, true); - } - - $message[] = $this->config['json'] ? - json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) : - sprintf($this->config['format'], $time, $type, $msg); - } - - if (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level'])) { - // 独立记录的日志级别 - $filename = $this->getApartLevelFile($path, $type); - $this->write($message, $filename); - continue; - } - - $info[$type] = $message; - } - - if ($info) { - return $this->write($info, $destination); - } - - return true; - } - - /** - * 日志写入 - * @access protected - * @param array $message 日志信息 - * @param string $destination 日志文件 - * @return bool - */ - protected function write(array $message, string $destination): bool - { - // 检测日志文件大小,超过配置大小则备份日志文件重新生成 - $this->checkLogSize($destination); - - $info = []; - - foreach ($message as $type => $msg) { - $info[$type] = is_array($msg) ? implode(PHP_EOL, $msg) : $msg; - } - - $message = implode(PHP_EOL, $info) . PHP_EOL; - - return error_log($message, 3, $destination); - } - - /** - * 获取主日志文件名 - * @access public - * @return string - */ - protected function getMasterLogFile(): string - { - - if ($this->config['max_files']) { - $files = glob($this->config['path'] . '*.log'); - - try { - if (count($files) > $this->config['max_files']) { - unlink($files[0]); - } - } catch (\Exception $e) { - // - } - } - - if ($this->config['single']) { - $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; - $destination = $this->config['path'] . $name . '.log'; - } else { - - if ($this->config['max_files']) { - $filename = date('Ymd') . '.log'; - } else { - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . '.log'; - } - - $destination = $this->config['path'] . $filename; - } - - return $destination; - } - - /** - * 获取独立日志文件名 - * @access public - * @param string $path 日志目录 - * @param string $type 日志类型 - * @return string - */ - protected function getApartLevelFile(string $path, string $type): string - { - - if ($this->config['single']) { - $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; - - $name .= '_' . $type; - } elseif ($this->config['max_files']) { - $name = date('Ymd') . '_' . $type; - } else { - $name = date('d') . '_' . $type; - } - - return $path . DIRECTORY_SEPARATOR . $name . '.log'; - } - - /** - * 检查日志文件大小并自动生成备份文件 - * @access protected - * @param string $destination 日志文件 - * @return void - */ - protected function checkLogSize(string $destination): void - { - if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { - try { - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); - } catch (\Exception $e) { - // - } - } - } -} diff --git a/vendor/topthink/framework/src/think/log/driver/Socket.php b/vendor/topthink/framework/src/think/log/driver/Socket.php deleted file mode 100644 index 2cfb9433..00000000 --- a/vendor/topthink/framework/src/think/log/driver/Socket.php +++ /dev/null @@ -1,311 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\log\driver; - -use Psr\Container\NotFoundExceptionInterface; -use think\App; -use think\contract\LogHandlerInterface; - -/** - * github: https://github.com/luofei614/SocketLog - * @author luofei614 - */ -class Socket implements LogHandlerInterface -{ - protected $app; - - protected $config = [ - // socket服务器地址 - 'host' => 'localhost', - // socket服务器端口 - 'port' => 1116, - // 是否显示加载的文件列表 - 'show_included_files' => false, - // 日志强制记录到配置的client_id - 'force_client_ids' => [], - // 限制允许读取日志的client_id - 'allow_client_ids' => [], - // 调试开关 - 'debug' => false, - // 输出到浏览器时默认展开的日志级别 - 'expand_level' => ['debug'], - // 日志头渲染回调 - 'format_head' => null, - // curl opt - 'curl_opt' => [ - CURLOPT_CONNECTTIMEOUT => 1, - CURLOPT_TIMEOUT => 10, - ], - ]; - - protected $css = [ - 'sql' => 'color:#009bb4;', - 'sql_warn' => 'color:#009bb4;font-size:14px;', - 'error' => 'color:#f4006b;font-size:14px;', - 'page' => 'color:#40e2ff;background:#171717;', - 'big' => 'font-size:20px;color:red;', - ]; - - protected $allowForceClientIds = []; //配置强制推送且被授权的client_id - - protected $clientArg = []; - - /** - * 架构函数 - * @access public - * @param App $app - * @param array $config 缓存参数 - */ - public function __construct(App $app, array $config = []) - { - $this->app = $app; - - if (!empty($config)) { - $this->config = array_merge($this->config, $config); - } - - if (!isset($config['debug'])) { - $this->config['debug'] = $app->isDebug(); - } - } - - /** - * 调试输出接口 - * @access public - * @param array $log 日志信息 - * @return bool - */ - public function save(array $log = []): bool - { - if (!$this->check()) { - return false; - } - - $trace = []; - - if ($this->config['debug']) { - if ($this->app->exists('request')) { - $currentUri = $this->app->request->url(true); - } else { - $currentUri = 'cmd:' . implode(' ', $_SERVER['argv'] ?? []); - } - - if (!empty($this->config['format_head'])) { - try { - $currentUri = $this->app->invoke($this->config['format_head'], [$currentUri]); - } catch (NotFoundExceptionInterface $notFoundException) { - // Ignore exception - } - } - - // 基本信息 - $trace[] = [ - 'type' => 'group', - 'msg' => $currentUri, - 'css' => $this->css['page'], - ]; - } - - $expandLevel = array_flip($this->config['expand_level']); - - foreach ($log as $type => $val) { - $trace[] = [ - 'type' => isset($expandLevel[$type]) ? 'group' : 'groupCollapsed', - 'msg' => '[ ' . $type . ' ]', - 'css' => $this->css[$type] ?? '', - ]; - - foreach ($val as $msg) { - if (!is_string($msg)) { - $msg = var_export($msg, true); - } - $trace[] = [ - 'type' => 'log', - 'msg' => $msg, - 'css' => '', - ]; - } - - $trace[] = [ - 'type' => 'groupEnd', - 'msg' => '', - 'css' => '', - ]; - } - - if ($this->config['show_included_files']) { - $trace[] = [ - 'type' => 'groupCollapsed', - 'msg' => '[ file ]', - 'css' => '', - ]; - - $trace[] = [ - 'type' => 'log', - 'msg' => implode("\n", get_included_files()), - 'css' => '', - ]; - - $trace[] = [ - 'type' => 'groupEnd', - 'msg' => '', - 'css' => '', - ]; - } - - $trace[] = [ - 'type' => 'groupEnd', - 'msg' => '', - 'css' => '', - ]; - - $tabid = $this->getClientArg('tabid'); - - if (!$clientId = $this->getClientArg('client_id')) { - $clientId = ''; - } - - if (!empty($this->allowForceClientIds)) { - //强制推送到多个client_id - foreach ($this->allowForceClientIds as $forceClientId) { - $clientId = $forceClientId; - $this->sendToClient($tabid, $clientId, $trace, $forceClientId); - } - } else { - $this->sendToClient($tabid, $clientId, $trace, ''); - } - - return true; - } - - /** - * 发送给指定客户端 - * @access protected - * @author Zjmainstay - * @param $tabid - * @param $clientId - * @param $logs - * @param $forceClientId - */ - protected function sendToClient($tabid, $clientId, $logs, $forceClientId) - { - $logs = [ - 'tabid' => $tabid, - 'client_id' => $clientId, - 'logs' => $logs, - 'force_client_id' => $forceClientId, - ]; - - $msg = json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); - $address = '/' . $clientId; //将client_id作为地址, server端通过地址判断将日志发布给谁 - - $this->send($this->config['host'], $this->config['port'], $msg, $address); - } - - /** - * 检测客户授权 - * @access protected - * @return bool - */ - protected function check() - { - $tabid = $this->getClientArg('tabid'); - - //是否记录日志的检查 - if (!$tabid && !$this->config['force_client_ids']) { - return false; - } - - //用户认证 - $allowClientIds = $this->config['allow_client_ids']; - - if (!empty($allowClientIds)) { - //通过数组交集得出授权强制推送的client_id - $this->allowForceClientIds = array_intersect($allowClientIds, $this->config['force_client_ids']); - if (!$tabid && count($this->allowForceClientIds)) { - return true; - } - - $clientId = $this->getClientArg('client_id'); - if (!in_array($clientId, $allowClientIds)) { - return false; - } - } else { - $this->allowForceClientIds = $this->config['force_client_ids']; - } - - return true; - } - - /** - * 获取客户参数 - * @access protected - * @param string $name - * @return string - */ - protected function getClientArg(string $name) - { - if (!$this->app->exists('request')) { - return ''; - } - - if (empty($this->clientArg)) { - if (empty($socketLog = $this->app->request->header('socketlog'))) { - if (empty($socketLog = $this->app->request->header('User-Agent'))) { - return ''; - } - } - - if (!preg_match('/SocketLog\((.*?)\)/', $socketLog, $match)) { - $this->clientArg = ['tabid' => null, 'client_id' => null]; - return ''; - } - parse_str($match[1] ?? '', $this->clientArg); - } - - if (isset($this->clientArg[$name])) { - return $this->clientArg[$name]; - } - - return ''; - } - - /** - * @access protected - * @param string $host - $host of socket server - * @param int $port - $port of socket server - * @param string $message - 发送的消息 - * @param string $address - 地址 - * @return bool - */ - protected function send($host, $port, $message = '', $address = '/') - { - $url = 'http://' . $host . ':' . $port . $address; - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $message); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->config['curl_opt'][CURLOPT_CONNECTTIMEOUT] ?? 1); - curl_setopt($ch, CURLOPT_TIMEOUT, $this->config['curl_opt'][CURLOPT_TIMEOUT] ?? 10); - - $headers = [ - "Content-Type: application/json;charset=UTF-8", - ]; - - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //设置header - - return curl_exec($ch); - } -} diff --git a/vendor/topthink/framework/src/think/middleware/AllowCrossDomain.php b/vendor/topthink/framework/src/think/middleware/AllowCrossDomain.php deleted file mode 100644 index b7ab842c..00000000 --- a/vendor/topthink/framework/src/think/middleware/AllowCrossDomain.php +++ /dev/null @@ -1,63 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\middleware; - -use Closure; -use think\Config; -use think\Request; -use think\Response; - -/** - * 跨域请求支持 - */ -class AllowCrossDomain -{ - protected $cookieDomain; - - protected $header = [ - 'Access-Control-Allow-Credentials' => 'true', - 'Access-Control-Max-Age' => 1800, - 'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS', - 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With', - ]; - - public function __construct(Config $config) - { - $this->cookieDomain = $config->get('cookie.domain', ''); - } - - /** - * 允许跨域请求 - * @access public - * @param Request $request - * @param Closure $next - * @param array $header - * @return Response - */ - public function handle($request, Closure $next, ? array $header = []) - { - $header = !empty($header) ? array_merge($this->header, $header) : $this->header; - - if (!isset($header['Access-Control-Allow-Origin'])) { - $origin = $request->header('origin'); - - if ($origin && ('' == $this->cookieDomain || strpos($origin, $this->cookieDomain))) { - $header['Access-Control-Allow-Origin'] = $origin; - } else { - $header['Access-Control-Allow-Origin'] = '*'; - } - } - - return $next($request)->header($header); - } -} diff --git a/vendor/topthink/framework/src/think/middleware/CheckRequestCache.php b/vendor/topthink/framework/src/think/middleware/CheckRequestCache.php deleted file mode 100644 index b1143519..00000000 --- a/vendor/topthink/framework/src/think/middleware/CheckRequestCache.php +++ /dev/null @@ -1,183 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\middleware; - -use Closure; -use think\Cache; -use think\Config; -use think\Request; -use think\Response; - -/** - * 请求缓存处理 - */ -class CheckRequestCache -{ - /** - * 缓存对象 - * @var Cache - */ - protected $cache; - - /** - * 配置参数 - * @var array - */ - protected $config = [ - // 请求缓存规则 true为自动规则 - 'request_cache_key' => true, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], - // 请求缓存的Tag - 'request_cache_tag' => '', - ]; - - public function __construct(Cache $cache, Config $config) - { - $this->cache = $cache; - $this->config = array_merge($this->config, $config->get('route')); - } - - /** - * 设置当前地址的请求缓存 - * @access public - * @param Request $request - * @param Closure $next - * @param mixed $cache - * @return Response - */ - public function handle($request, Closure $next, $cache = null) - { - if ($request->isGet() && false !== $cache) { - if (false === $this->config['request_cache_key']) { - // 关闭当前缓存 - $cache = false; - } - - $cache = $cache ?? $this->getRequestCache($request); - - if ($cache) { - if (is_array($cache)) { - [$key, $expire, $tag] = array_pad($cache, 3, null); - } else { - $key = md5($request->url(true)); - $expire = $cache; - $tag = null; - } - - $key = $this->parseCacheKey($request, $key); - - if (strtotime($request->server('HTTP_IF_MODIFIED_SINCE', '')) + $expire > $request->server('REQUEST_TIME')) { - // 读取缓存 - return Response::create()->code(304); - } elseif (($hit = $this->cache->get($key)) !== null) { - [$content, $header, $when] = $hit; - if (null === $expire || $when + $expire > $request->server('REQUEST_TIME')) { - return Response::create($content)->header($header); - } - } - } - } - - $response = $next($request); - - if (isset($key) && 200 == $response->getCode() && $response->isAllowCache()) { - $header = $response->getHeader(); - $header['Cache-Control'] = 'max-age=' . $expire . ',must-revalidate'; - $header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT'; - $header['Expires'] = gmdate('D, d M Y H:i:s', time() + $expire) . ' GMT'; - - $this->cache->tag($tag)->set($key, [$response->getContent(), $header, time()], $expire); - } - - return $response; - } - - /** - * 读取当前地址的请求缓存信息 - * @access protected - * @param Request $request - * @return mixed - */ - protected function getRequestCache($request) - { - $key = $this->config['request_cache_key']; - $expire = $this->config['request_cache_expire']; - $except = $this->config['request_cache_except']; - $tag = $this->config['request_cache_tag']; - - foreach ($except as $rule) { - if (0 === stripos($request->url(), $rule)) { - return; - } - } - - return [$key, $expire, $tag]; - } - - /** - * 读取当前地址的请求缓存信息 - * @access protected - * @param Request $request - * @param mixed $key - * @return null|string - */ - protected function parseCacheKey($request, $key) - { - if ($key instanceof \Closure) { - $key = call_user_func($key, $request); - } - - if (false === $key) { - // 关闭当前缓存 - return; - } - - if (true === $key) { - // 自动缓存功能 - $key = '__URL__'; - } elseif (strpos($key, '|')) { - [$key, $fun] = explode('|', $key); - } - - // 特殊规则替换 - if (false !== strpos($key, '__')) { - $key = str_replace(['__CONTROLLER__', '__ACTION__', '__URL__'], [$request->controller(), $request->action(), md5($request->url(true))], $key); - } - - if (false !== strpos($key, ':')) { - $param = $request->param(); - - foreach ($param as $item => $val) { - if (is_string($val) && false !== strpos($key, ':' . $item)) { - $key = str_replace(':' . $item, (string) $val, $key); - } - } - } elseif (strpos($key, ']')) { - if ('[' . $request->ext() . ']' == $key) { - // 缓存某个后缀的请求 - $key = md5($request->url()); - } else { - return; - } - } - - if (isset($fun)) { - $key = $fun($key); - } - - return $key; - } -} diff --git a/vendor/topthink/framework/src/think/middleware/FormTokenCheck.php b/vendor/topthink/framework/src/think/middleware/FormTokenCheck.php deleted file mode 100644 index efbb77b1..00000000 --- a/vendor/topthink/framework/src/think/middleware/FormTokenCheck.php +++ /dev/null @@ -1,45 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\middleware; - -use Closure; -use think\exception\ValidateException; -use think\Request; -use think\Response; - -/** - * 表单令牌支持 - */ -class FormTokenCheck -{ - - /** - * 表单令牌检测 - * @access public - * @param Request $request - * @param Closure $next - * @param string $token 表单令牌Token名称 - * @return Response - */ - public function handle(Request $request, Closure $next, string $token = null) - { - $check = $request->checkToken($token ?: '__token__'); - - if (false === $check) { - throw new ValidateException('invalid token'); - } - - return $next($request); - } - -} diff --git a/vendor/topthink/framework/src/think/middleware/LoadLangPack.php b/vendor/topthink/framework/src/think/middleware/LoadLangPack.php deleted file mode 100644 index 478e29c9..00000000 --- a/vendor/topthink/framework/src/think/middleware/LoadLangPack.php +++ /dev/null @@ -1,61 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\middleware; - -use Closure; -use think\App; -use think\Lang; -use think\Request; -use think\Response; - -/** - * 多语言加载 - */ -class LoadLangPack -{ - protected $app; - - protected $lang; - - public function __construct(App $app, Lang $lang) - { - $this->app = $app; - $this->lang = $lang; - } - - /** - * 路由初始化(路由规则注册) - * @access public - * @param Request $request - * @param Closure $next - * @return Response - */ - public function handle($request, Closure $next) - { - // 自动侦测当前语言 - $langset = $this->lang->detect($request); - - if ($this->lang->defaultLangSet() != $langset) { - // 加载系统语言包 - $this->lang->load([ - $this->app->getThinkPath() . 'lang' . DIRECTORY_SEPARATOR . $langset . '.php', - ]); - - $this->app->LoadLangPack($langset); - } - - $this->lang->saveToCookie($this->app->cookie); - - return $next($request); - } -} diff --git a/vendor/topthink/framework/src/think/middleware/SessionInit.php b/vendor/topthink/framework/src/think/middleware/SessionInit.php deleted file mode 100644 index 3cb2fad9..00000000 --- a/vendor/topthink/framework/src/think/middleware/SessionInit.php +++ /dev/null @@ -1,80 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\middleware; - -use Closure; -use think\App; -use think\Request; -use think\Response; -use think\Session; - -/** - * Session初始化 - */ -class SessionInit -{ - - /** @var App */ - protected $app; - - /** @var Session */ - protected $session; - - public function __construct(App $app, Session $session) - { - $this->app = $app; - $this->session = $session; - } - - /** - * Session初始化 - * @access public - * @param Request $request - * @param Closure $next - * @return Response - */ - public function handle($request, Closure $next) - { - // Session初始化 - $varSessionId = $this->app->config->get('session.var_session_id'); - $cookieName = $this->session->getName(); - - if ($varSessionId && $request->request($varSessionId)) { - $sessionId = $request->request($varSessionId); - } else { - $sessionId = $request->cookie($cookieName); - } - - if ($sessionId) { - $this->session->setId($sessionId); - } - - $this->session->init(); - - $request->withSession($this->session); - - /** @var Response $response */ - $response = $next($request); - - $response->setSession($this->session); - - $this->app->cookie->set($cookieName, $this->session->getId()); - - return $response; - } - - public function end(Response $response) - { - $this->session->save(); - } -} diff --git a/vendor/topthink/framework/src/think/response/File.php b/vendor/topthink/framework/src/think/response/File.php deleted file mode 100644 index 1e45f2f4..00000000 --- a/vendor/topthink/framework/src/think/response/File.php +++ /dev/null @@ -1,160 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\response; - -use think\Exception; -use think\Response; - -/** - * File Response - */ -class File extends Response -{ - protected $expire = 360; - protected $name; - protected $mimeType; - protected $isContent = false; - protected $force = true; - - public function __construct($data = '', int $code = 200) - { - $this->init($data, $code); - } - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - * @throws \Exception - */ - protected function output($data) - { - if (!$this->isContent && !is_file($data)) { - throw new Exception('file not exists:' . $data); - } - - while (ob_get_level() > 0) { - ob_end_clean(); - } - - if (!empty($this->name)) { - $name = $this->name; - } else { - $name = !$this->isContent ? pathinfo($data, PATHINFO_BASENAME) : ''; - } - - if ($this->isContent) { - $mimeType = $this->mimeType; - $size = strlen($data); - } else { - $mimeType = $this->getMimeType($data); - $size = filesize($data); - } - - $this->header['Pragma'] = 'public'; - $this->header['Content-Type'] = $mimeType ?: 'application/octet-stream'; - $this->header['Cache-control'] = 'max-age=' . $this->expire; - $this->header['Content-Disposition'] = ($this->force ? 'attachment; ' : '') . 'filename="' . $name . '"'; - $this->header['Content-Length'] = $size; - $this->header['Content-Transfer-Encoding'] = 'binary'; - $this->header['Expires'] = gmdate("D, d M Y H:i:s", time() + $this->expire) . ' GMT'; - - $this->lastModified(gmdate('D, d M Y H:i:s', time()) . ' GMT'); - - return $this->isContent ? $data : file_get_contents($data); - } - - /** - * 设置是否为内容 必须配合mimeType方法使用 - * @access public - * @param bool $content - * @return $this - */ - public function isContent(bool $content = true) - { - $this->isContent = $content; - return $this; - } - - /** - * 设置有效期 - * @access public - * @param integer $expire 有效期 - * @return $this - */ - public function expire(int $expire) - { - $this->expire = $expire; - return $this; - } - - /** - * 设置文件类型 - * @access public - * @param string $filename 文件名 - * @return $this - */ - public function mimeType(string $mimeType) - { - $this->mimeType = $mimeType; - return $this; - } - - /** - * 设置文件强制下载 - * @access public - * @param bool $force 强制浏览器下载 - * @return $this - */ - public function force(bool $force) - { - $this->force = $force; - return $this; - } - - /** - * 获取文件类型信息 - * @access public - * @param string $filename 文件名 - * @return string - */ - protected function getMimeType(string $filename): string - { - if (!empty($this->mimeType)) { - return $this->mimeType; - } - - $finfo = finfo_open(FILEINFO_MIME_TYPE); - - return finfo_file($finfo, $filename); - } - - /** - * 设置下载文件的显示名称 - * @access public - * @param string $filename 文件名 - * @param bool $extension 后缀自动识别 - * @return $this - */ - public function name(string $filename, bool $extension = true) - { - $this->name = $filename; - - if ($extension && false === strpos($filename, '.')) { - $this->name .= '.' . pathinfo($this->data, PATHINFO_EXTENSION); - } - - return $this; - } -} diff --git a/vendor/topthink/framework/src/think/response/Html.php b/vendor/topthink/framework/src/think/response/Html.php deleted file mode 100644 index c158f781..00000000 --- a/vendor/topthink/framework/src/think/response/Html.php +++ /dev/null @@ -1,34 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\response; - -use think\Cookie; -use think\Response; - -/** - * Html Response - */ -class Html extends Response -{ - /** - * 输出type - * @var string - */ - protected $contentType = 'text/html'; - - public function __construct(Cookie $cookie, $data = '', int $code = 200) - { - $this->init($data, $code); - $this->cookie = $cookie; - } -} diff --git a/vendor/topthink/framework/src/think/response/Json.php b/vendor/topthink/framework/src/think/response/Json.php deleted file mode 100644 index a84501f5..00000000 --- a/vendor/topthink/framework/src/think/response/Json.php +++ /dev/null @@ -1,62 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\response; - -use think\Cookie; -use think\Response; - -/** - * Json Response - */ -class Json extends Response -{ - // 输出参数 - protected $options = [ - 'json_encode_param' => JSON_UNESCAPED_UNICODE, - ]; - - protected $contentType = 'application/json'; - - public function __construct(Cookie $cookie, $data = '', int $code = 200) - { - $this->init($data, $code); - $this->cookie = $cookie; - } - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return string - * @throws \Exception - */ - protected function output($data): string - { - try { - // 返回JSON数据格式到客户端 包含状态信息 - $data = json_encode($data, $this->options['json_encode_param']); - - if (false === $data) { - throw new \InvalidArgumentException(json_last_error_msg()); - } - - return $data; - } catch (\Exception $e) { - if ($e->getPrevious()) { - throw $e->getPrevious(); - } - throw $e; - } - } - -} diff --git a/vendor/topthink/framework/src/think/response/Jsonp.php b/vendor/topthink/framework/src/think/response/Jsonp.php deleted file mode 100644 index 81d3a06e..00000000 --- a/vendor/topthink/framework/src/think/response/Jsonp.php +++ /dev/null @@ -1,74 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\response; - -use think\Cookie; -use think\Request; -use think\Response; - -/** - * Jsonp Response - */ -class Jsonp extends Response -{ - // 输出参数 - protected $options = [ - 'var_jsonp_handler' => 'callback', - 'default_jsonp_handler' => 'jsonpReturn', - 'json_encode_param' => JSON_UNESCAPED_UNICODE, - ]; - - protected $contentType = 'application/javascript'; - - protected $request; - - public function __construct(Cookie $cookie, Request $request, $data = '', int $code = 200) - { - $this->init($data, $code); - - $this->cookie = $cookie; - $this->request = $request; - } - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return string - * @throws \Exception - */ - protected function output($data): string - { - try { - // 返回JSON数据格式到客户端 包含状态信息 [当url_common_param为false时是无法获取到$_GET的数据的,故使用Request来获取] - $varJsonpHandler = $this->request->param($this->options['var_jsonp_handler'], ""); - $handler = !empty($varJsonpHandler) ? $varJsonpHandler : $this->options['default_jsonp_handler']; - - $data = json_encode($data, $this->options['json_encode_param']); - - if (false === $data) { - throw new \InvalidArgumentException(json_last_error_msg()); - } - - $data = $handler . '(' . $data . ');'; - - return $data; - } catch (\Exception $e) { - if ($e->getPrevious()) { - throw $e->getPrevious(); - } - throw $e; - } - } - -} diff --git a/vendor/topthink/framework/src/think/response/Redirect.php b/vendor/topthink/framework/src/think/response/Redirect.php deleted file mode 100644 index 1f38764c..00000000 --- a/vendor/topthink/framework/src/think/response/Redirect.php +++ /dev/null @@ -1,98 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\response; - -use think\Cookie; -use think\Request; -use think\Response; -use think\Session; - -/** - * Redirect Response - */ -class Redirect extends Response -{ - - protected $request; - - public function __construct(Cookie $cookie, Request $request, Session $session, $data = '', int $code = 302) - { - $this->init((string) $data, $code); - - $this->cookie = $cookie; - $this->request = $request; - $this->session = $session; - - $this->cacheControl('no-cache,must-revalidate'); - } - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return string - */ - protected function output($data): string - { - $this->header['Location'] = $data; - - return ''; - } - - /** - * 重定向传值(通过Session) - * @access protected - * @param string|array $name 变量名或者数组 - * @param mixed $value 值 - * @return $this - */ - public function with($name, $value = null) - { - if (is_array($name)) { - foreach ($name as $key => $val) { - $this->session->flash($key, $val); - } - } else { - $this->session->flash($name, $value); - } - - return $this; - } - - /** - * 记住当前url后跳转 - * @access public - * @return $this - */ - public function remember() - { - $this->session->set('redirect_url', $this->request->url()); - - return $this; - } - - /** - * 跳转到上次记住的url - * @access public - * @return $this - */ - public function restore() - { - if ($this->session->has('redirect_url')) { - $this->data = $this->session->get('redirect_url'); - $this->session->delete('redirect_url'); - } - - return $this; - } -} diff --git a/vendor/topthink/framework/src/think/response/View.php b/vendor/topthink/framework/src/think/response/View.php deleted file mode 100644 index 2c116c77..00000000 --- a/vendor/topthink/framework/src/think/response/View.php +++ /dev/null @@ -1,151 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\response; - -use think\Cookie; -use think\Response; -use think\View as BaseView; - -/** - * View Response - */ -class View extends Response -{ - /** - * 输出参数 - * @var array - */ - protected $options = []; - - /** - * 输出变量 - * @var array - */ - protected $vars = []; - - /** - * 输出过滤 - * @var mixed - */ - protected $filter; - - /** - * 输出type - * @var string - */ - protected $contentType = 'text/html'; - - /** - * View对象 - * @var BaseView - */ - protected $view; - - /** - * 是否内容渲染 - * @var bool - */ - protected $isContent = false; - - public function __construct(Cookie $cookie, BaseView $view, $data = '', int $code = 200) - { - $this->init($data, $code); - - $this->cookie = $cookie; - $this->view = $view; - } - - /** - * 设置是否为内容渲染 - * @access public - * @param bool $content - * @return $this - */ - public function isContent(bool $content = true) - { - $this->isContent = $content; - return $this; - } - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return string - */ - protected function output($data): string - { - // 渲染模板输出 - $this->view->filter($this->filter); - return $this->isContent ? - $this->view->display($data, $this->vars) : - $this->view->fetch($data, $this->vars); - } - - /** - * 获取视图变量 - * @access public - * @param string $name 模板变量 - * @return mixed - */ - public function getVars(string $name = null) - { - if (is_null($name)) { - return $this->vars; - } else { - return $this->vars[$name] ?? null; - } - } - - /** - * 模板变量赋值 - * @access public - * @param string|array $name 模板变量 - * @param mixed $value 变量值 - * @return $this - */ - public function assign($name, $value = null) - { - if (is_array($name)) { - $this->vars = array_merge($this->vars, $name); - } else { - $this->vars[$name] = $value; - } - - return $this; - } - - /** - * 视图内容过滤 - * @access public - * @param callable $filter - * @return $this - */ - public function filter(callable $filter = null) - { - $this->filter = $filter; - return $this; - } - - /** - * 检查模板是否存在 - * @access public - * @param string $name 模板名 - * @return bool - */ - public function exists(string $name): bool - { - return $this->view->exists($name); - } - -} diff --git a/vendor/topthink/framework/src/think/response/Xml.php b/vendor/topthink/framework/src/think/response/Xml.php deleted file mode 100644 index bddbb48b..00000000 --- a/vendor/topthink/framework/src/think/response/Xml.php +++ /dev/null @@ -1,127 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\response; - -use think\Collection; -use think\Cookie; -use think\Model; -use think\Response; - -/** - * XML Response - */ -class Xml extends Response -{ - // 输出参数 - protected $options = [ - // 根节点名 - 'root_node' => 'think', - // 根节点属性 - 'root_attr' => '', - //数字索引的子节点名 - 'item_node' => 'item', - // 数字索引子节点key转换的属性名 - 'item_key' => 'id', - // 数据编码 - 'encoding' => 'utf-8', - ]; - - protected $contentType = 'text/xml'; - - public function __construct(Cookie $cookie, $data = '', int $code = 200) - { - $this->init($data, $code); - $this->cookie = $cookie; - } - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - */ - protected function output($data): string - { - if (is_string($data)) { - if (0 !== strpos($data, 'options['encoding']; - $xml = ""; - $data = $xml . $data; - } - return $data; - } - - // XML数据转换 - return $this->xmlEncode($data, $this->options['root_node'], $this->options['item_node'], $this->options['root_attr'], $this->options['item_key'], $this->options['encoding']); - } - - /** - * XML编码 - * @access protected - * @param mixed $data 数据 - * @param string $root 根节点名 - * @param string $item 数字索引的子节点名 - * @param mixed $attr 根节点属性 - * @param string $id 数字索引子节点key转换的属性名 - * @param string $encoding 数据编码 - * @return string - */ - protected function xmlEncode($data, string $root, string $item, $attr, string $id, string $encoding): string - { - if (is_array($attr)) { - $array = []; - foreach ($attr as $key => $value) { - $array[] = "{$key}=\"{$value}\""; - } - $attr = implode(' ', $array); - } - - $attr = trim($attr); - $attr = empty($attr) ? '' : " {$attr}"; - $xml = ""; - $xml .= "<{$root}{$attr}>"; - $xml .= $this->dataToXml($data, $item, $id); - $xml .= ""; - - return $xml; - } - - /** - * 数据XML编码 - * @access protected - * @param mixed $data 数据 - * @param string $item 数字索引时的节点名称 - * @param string $id 数字索引key转换为的属性名 - * @return string - */ - protected function dataToXml($data, string $item, string $id): string - { - $xml = $attr = ''; - - if ($data instanceof Collection || $data instanceof Model) { - $data = $data->toArray(); - } - - foreach ($data as $key => $val) { - if (is_numeric($key)) { - $id && $attr = " {$id}=\"{$key}\""; - $key = $item; - } - $xml .= "<{$key}{$attr}>"; - $xml .= (is_array($val) || is_object($val)) ? $this->dataToXml($val, $item, $id) : $val; - $xml .= ""; - } - - return $xml; - } -} diff --git a/vendor/topthink/framework/src/think/route/Dispatch.php b/vendor/topthink/framework/src/think/route/Dispatch.php deleted file mode 100644 index e77e299a..00000000 --- a/vendor/topthink/framework/src/think/route/Dispatch.php +++ /dev/null @@ -1,257 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route; - -use think\App; -use think\Container; -use think\Request; -use think\Response; -use think\Validate; - -/** - * 路由调度基础类 - */ -abstract class Dispatch -{ - /** - * 应用对象 - * @var \think\App - */ - protected $app; - - /** - * 请求对象 - * @var Request - */ - protected $request; - - /** - * 路由规则 - * @var Rule - */ - protected $rule; - - /** - * 调度信息 - * @var mixed - */ - protected $dispatch; - - /** - * 路由变量 - * @var array - */ - protected $param; - - public function __construct(Request $request, Rule $rule, $dispatch, array $param = []) - { - $this->request = $request; - $this->rule = $rule; - $this->dispatch = $dispatch; - $this->param = $param; - } - - public function init(App $app) - { - $this->app = $app; - - // 执行路由后置操作 - $this->doRouteAfter(); - } - - /** - * 执行路由调度 - * @access public - * @return mixed - */ - public function run(): Response - { - if ($this->rule instanceof RuleItem && $this->request->method() == 'OPTIONS' && $this->rule->isAutoOptions()) { - $rules = $this->rule->getRouter()->getRule($this->rule->getRule()); - $allow = []; - foreach ($rules as $item) { - $allow[] = strtoupper($item->getMethod()); - } - - return Response::create('', 'html', 204)->header(['Allow' => implode(', ', $allow)]); - } - - $data = $this->exec(); - return $this->autoResponse($data); - } - - protected function autoResponse($data): Response - { - if ($data instanceof Response) { - $response = $data; - } elseif (!is_null($data)) { - // 默认自动识别响应输出类型 - $type = $this->request->isJson() ? 'json' : 'html'; - $response = Response::create($data, $type); - } else { - $data = ob_get_clean(); - - $content = false === $data ? '' : $data; - $status = '' === $content && $this->request->isJson() ? 204 : 200; - $response = Response::create($content, 'html', $status); - } - - return $response; - } - - /** - * 检查路由后置操作 - * @access protected - * @return void - */ - protected function doRouteAfter(): void - { - $option = $this->rule->getOption(); - - // 添加中间件 - if (!empty($option['middleware'])) { - $this->app->middleware->import($option['middleware'], 'route'); - } - - if (!empty($option['append'])) { - $this->param = array_merge($this->param, $option['append']); - } - - // 绑定模型数据 - if (!empty($option['model'])) { - $this->createBindModel($option['model'], $this->param); - } - - // 记录当前请求的路由规则 - $this->request->setRule($this->rule); - - // 记录路由变量 - $this->request->setRoute($this->param); - - // 数据自动验证 - if (isset($option['validate'])) { - $this->autoValidate($option['validate']); - } - } - - /** - * 路由绑定模型实例 - * @access protected - * @param array $bindModel 绑定模型 - * @param array $matches 路由变量 - * @return void - */ - protected function createBindModel(array $bindModel, array $matches): void - { - foreach ($bindModel as $key => $val) { - if ($val instanceof \Closure) { - $result = $this->app->invokeFunction($val, $matches); - } else { - $fields = explode('&', $key); - - if (is_array($val)) { - [$model, $exception] = $val; - } else { - $model = $val; - $exception = true; - } - - $where = []; - $match = true; - - foreach ($fields as $field) { - if (!isset($matches[$field])) { - $match = false; - break; - } else { - $where[] = [$field, '=', $matches[$field]]; - } - } - - if ($match) { - $result = $model::where($where)->failException($exception)->find(); - } - } - - if (!empty($result)) { - // 注入容器 - $this->app->instance(get_class($result), $result); - } - } - } - - /** - * 验证数据 - * @access protected - * @param array $option - * @return void - * @throws \think\exception\ValidateException - */ - protected function autoValidate(array $option): void - { - [$validate, $scene, $message, $batch] = $option; - - if (is_array($validate)) { - // 指定验证规则 - $v = new Validate(); - $v->rule($validate); - } else { - // 调用验证器 - $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); - - $v = new $class(); - - if (!empty($scene)) { - $v->scene($scene); - } - } - - /** @var Validate $v */ - $v->message($message) - ->batch($batch) - ->failException(true) - ->check($this->request->param()); - } - - public function getDispatch() - { - return $this->dispatch; - } - - public function getParam(): array - { - return $this->param; - } - - abstract public function exec(); - - public function __sleep() - { - return ['rule', 'dispatch', 'param', 'controller', 'actionName']; - } - - public function __wakeup() - { - $this->app = Container::pull('app'); - $this->request = $this->app->request; - } - - public function __debugInfo() - { - return [ - 'dispatch' => $this->dispatch, - 'param' => $this->param, - 'rule' => $this->rule, - ]; - } -} diff --git a/vendor/topthink/framework/src/think/route/Domain.php b/vendor/topthink/framework/src/think/route/Domain.php deleted file mode 100644 index 84f1d463..00000000 --- a/vendor/topthink/framework/src/think/route/Domain.php +++ /dev/null @@ -1,183 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route; - -use think\helper\Str; -use think\Request; -use think\Route; -use think\route\dispatch\Callback as CallbackDispatch; -use think\route\dispatch\Controller as ControllerDispatch; - -/** - * 域名路由 - */ -class Domain extends RuleGroup -{ - /** - * 架构函数 - * @access public - * @param Route $router 路由对象 - * @param string $name 路由域名 - * @param mixed $rule 域名路由 - */ - public function __construct(Route $router, string $name = null, $rule = null) - { - $this->router = $router; - $this->domain = $name; - $this->rule = $rule; - } - - /** - * 检测域名路由 - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function check(Request $request, string $url, bool $completeMatch = false) - { - // 检测URL绑定 - $result = $this->checkUrlBind($request, $url); - - if (!empty($this->option['append'])) { - $request->setRoute($this->option['append']); - unset($this->option['append']); - } - - if (false !== $result) { - return $result; - } - - return parent::check($request, $url, $completeMatch); - } - - /** - * 设置路由绑定 - * @access public - * @param string $bind 绑定信息 - * @return $this - */ - public function bind(string $bind) - { - $this->router->bind($bind, $this->domain); - - return $this; - } - - /** - * 检测URL绑定 - * @access private - * @param Request $request - * @param string $url URL地址 - * @return Dispatch|false - */ - private function checkUrlBind(Request $request, string $url) - { - $bind = $this->router->getDomainBind($this->domain); - - if ($bind) { - $this->parseBindAppendParam($bind); - - // 如果有URL绑定 则进行绑定检测 - $type = substr($bind, 0, 1); - $bind = substr($bind, 1); - - $bindTo = [ - '\\' => 'bindToClass', - '@' => 'bindToController', - ':' => 'bindToNamespace', - ]; - - if (isset($bindTo[$type])) { - return $this->{$bindTo[$type]}($request, $url, $bind); - } - } - - return false; - } - - protected function parseBindAppendParam(string &$bind): void - { - if (false !== strpos($bind, '?')) { - [$bind, $query] = explode('?', $bind); - parse_str($query, $vars); - $this->append($vars); - } - } - - /** - * 绑定到类 - * @access protected - * @param Request $request - * @param string $url URL地址 - * @param string $class 类名(带命名空间) - * @return CallbackDispatch - */ - protected function bindToClass(Request $request, string $url, string $class): CallbackDispatch - { - $array = explode('|', $url, 2); - $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); - $param = []; - - if (!empty($array[1])) { - $this->parseUrlParams($array[1], $param); - } - - return new CallbackDispatch($request, $this, [$class, $action], $param); - } - - /** - * 绑定到命名空间 - * @access protected - * @param Request $request - * @param string $url URL地址 - * @param string $namespace 命名空间 - * @return CallbackDispatch - */ - protected function bindToNamespace(Request $request, string $url, string $namespace): CallbackDispatch - { - $array = explode('|', $url, 3); - $class = !empty($array[0]) ? $array[0] : $this->router->config('default_controller'); - $method = !empty($array[1]) ? $array[1] : $this->router->config('default_action'); - $param = []; - - if (!empty($array[2])) { - $this->parseUrlParams($array[2], $param); - } - - return new CallbackDispatch($request, $this, [$namespace . '\\' . Str::studly($class), $method], $param); - } - - /** - * 绑定到控制器 - * @access protected - * @param Request $request - * @param string $url URL地址 - * @param string $controller 控制器名 - * @return ControllerDispatch - */ - protected function bindToController(Request $request, string $url, string $controller): ControllerDispatch - { - $array = explode('|', $url, 2); - $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); - $param = []; - - if (!empty($array[1])) { - $this->parseUrlParams($array[1], $param); - } - - return new ControllerDispatch($request, $this, $controller . '/' . $action, $param); - } - -} diff --git a/vendor/topthink/framework/src/think/route/Resource.php b/vendor/topthink/framework/src/think/route/Resource.php deleted file mode 100644 index bb37cb6d..00000000 --- a/vendor/topthink/framework/src/think/route/Resource.php +++ /dev/null @@ -1,251 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route; - -use think\Route; - -/** - * 资源路由类 - */ -class Resource extends RuleGroup -{ - /** - * 资源路由名称 - * @var string - */ - protected $resource; - - /** - * 资源路由地址 - * @var string - */ - protected $route; - - /** - * REST方法定义 - * @var array - */ - protected $rest = []; - - /** - * 模型绑定 - * @var array - */ - protected $model = []; - - /** - * 数据验证 - * @var array - */ - protected $validate = []; - - /** - * 中间件 - * @var array - */ - protected $middleware = []; - - /** - * 架构函数 - * @access public - * @param Route $router 路由对象 - * @param RuleGroup $parent 上级对象 - * @param string $name 资源名称 - * @param string $route 路由地址 - * @param array $rest 资源定义 - */ - public function __construct(Route $router, RuleGroup $parent = null, string $name = '', string $route = '', array $rest = []) - { - $name = ltrim($name, '/'); - $this->router = $router; - $this->parent = $parent; - $this->resource = $name; - $this->route = $route; - $this->name = strpos($name, '.') ? strstr($name, '.', true) : $name; - - $this->setFullName(); - - // 资源路由默认为完整匹配 - $this->option['complete_match'] = true; - - $this->rest = $rest; - - if ($this->parent) { - $this->domain = $this->parent->getDomain(); - $this->parent->addRuleItem($this); - } - - if ($router->isTest()) { - $this->buildResourceRule(); - } - } - - /** - * 生成资源路由规则 - * @access protected - * @return void - */ - protected function buildResourceRule(): void - { - $rule = $this->resource; - $option = $this->option; - $origin = $this->router->getGroup(); - $this->router->setGroup($this); - - if (strpos($rule, '.')) { - // 注册嵌套资源路由 - $array = explode('.', $rule); - $last = array_pop($array); - $item = []; - - foreach ($array as $val) { - $item[] = $val . '/<' . ($option['var'][$val] ?? $val . '_id') . '>'; - } - - $rule = implode('/', $item) . '/' . $last; - } - - $prefix = substr($rule, strlen($this->name) + 1); - - // 注册资源路由 - foreach ($this->rest as $key => $val) { - if ((isset($option['only']) && !in_array($key, $option['only'])) - || (isset($option['except']) && in_array($key, $option['except']))) { - continue; - } - - if (isset($last) && strpos($val[1], '') && isset($option['var'][$last])) { - $val[1] = str_replace('', '<' . $option['var'][$last] . '>', $val[1]); - } elseif (strpos($val[1], '') && isset($option['var'][$rule])) { - $val[1] = str_replace('', '<' . $option['var'][$rule] . '>', $val[1]); - } - - $ruleItem = $this->addRule(trim($prefix . $val[1], '/'), $this->route . '/' . $val[2], $val[0]); - - foreach (['model', 'validate', 'middleware', 'pattern'] as $name) { - if (isset($this->$name[$key])) { - call_user_func_array([$ruleItem, $name], (array) $this->$name[$key]); - } - - } - } - - $this->router->setGroup($origin); - } - - /** - * 设置资源允许 - * @access public - * @param array $only 资源允许 - * @return $this - */ - public function only(array $only) - { - return $this->setOption('only', $only); - } - - /** - * 设置资源排除 - * @access public - * @param array $except 排除资源 - * @return $this - */ - public function except(array $except) - { - return $this->setOption('except', $except); - } - - /** - * 设置资源路由的变量 - * @access public - * @param array $vars 资源变量 - * @return $this - */ - public function vars(array $vars) - { - return $this->setOption('var', $vars); - } - - /** - * 绑定资源验证 - * @access public - * @param array|string $name 资源类型或者验证信息 - * @param array|string $validate 验证信息 - * @return $this - */ - public function withValidate($name, $validate = []) - { - if (is_array($name)) { - $this->validate = array_merge($this->validate, $name); - } else { - $this->validate[$name] = $validate; - } - - return $this; - } - - /** - * 绑定资源模型 - * @access public - * @param array|string $name 资源类型或者模型绑定 - * @param array|string $model 模型绑定 - * @return $this - */ - public function withModel($name, $model = []) - { - if (is_array($name)) { - $this->model = array_merge($this->model, $name); - } else { - $this->model[$name] = $model; - } - - return $this; - } - - /** - * 绑定资源模型 - * @access public - * @param array|string $name 资源类型或者中间件定义 - * @param array|string $middleware 中间件定义 - * @return $this - */ - public function withMiddleware($name, $middleware = []) - { - if (is_array($name)) { - $this->middleware = array_merge($this->middleware, $name); - } else { - $this->middleware[$name] = $middleware; - } - - return $this; - } - - /** - * rest方法定义和修改 - * @access public - * @param array|string $name 方法名称 - * @param array|bool $resource 资源 - * @return $this - */ - public function rest($name, $resource = []) - { - if (is_array($name)) { - $this->rest = $resource ? $name : array_merge($this->rest, $name); - } else { - $this->rest[$name] = $resource; - } - - return $this; - } - -} diff --git a/vendor/topthink/framework/src/think/route/Rule.php b/vendor/topthink/framework/src/think/route/Rule.php deleted file mode 100644 index 31b2e0e5..00000000 --- a/vendor/topthink/framework/src/think/route/Rule.php +++ /dev/null @@ -1,905 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route; - -use Closure; -use think\Container; -use think\middleware\AllowCrossDomain; -use think\middleware\CheckRequestCache; -use think\middleware\FormTokenCheck; -use think\Request; -use think\Route; -use think\route\dispatch\Callback as CallbackDispatch; -use think\route\dispatch\Controller as ControllerDispatch; - -/** - * 路由规则基础类 - */ -abstract class Rule -{ - /** - * 路由标识 - * @var string - */ - protected $name; - - /** - * 所在域名 - * @var string - */ - protected $domain; - - /** - * 路由对象 - * @var Route - */ - protected $router; - - /** - * 路由所属分组 - * @var RuleGroup - */ - protected $parent; - - /** - * 路由规则 - * @var mixed - */ - protected $rule; - - /** - * 路由地址 - * @var string|Closure - */ - protected $route; - - /** - * 请求类型 - * @var string - */ - protected $method; - - /** - * 路由变量 - * @var array - */ - protected $vars = []; - - /** - * 路由参数 - * @var array - */ - protected $option = []; - - /** - * 路由变量规则 - * @var array - */ - protected $pattern = []; - - /** - * 需要和分组合并的路由参数 - * @var array - */ - protected $mergeOptions = ['model', 'append', 'middleware']; - - abstract public function check(Request $request, string $url, bool $completeMatch = false); - - /** - * 设置路由参数 - * @access public - * @param array $option 参数 - * @return $this - */ - public function option(array $option) - { - $this->option = array_merge($this->option, $option); - - return $this; - } - - /** - * 设置单个路由参数 - * @access public - * @param string $name 参数名 - * @param mixed $value 值 - * @return $this - */ - public function setOption(string $name, $value) - { - $this->option[$name] = $value; - - return $this; - } - - /** - * 注册变量规则 - * @access public - * @param array $pattern 变量规则 - * @return $this - */ - public function pattern(array $pattern) - { - $this->pattern = array_merge($this->pattern, $pattern); - - return $this; - } - - /** - * 设置标识 - * @access public - * @param string $name 标识名 - * @return $this - */ - public function name(string $name) - { - $this->name = $name; - - return $this; - } - - /** - * 获取路由对象 - * @access public - * @return Route - */ - public function getRouter(): Route - { - return $this->router; - } - - /** - * 获取Name - * @access public - * @return string - */ - public function getName(): string - { - return $this->name ?: ''; - } - - /** - * 获取当前路由规则 - * @access public - * @return mixed - */ - public function getRule() - { - return $this->rule; - } - - /** - * 获取当前路由地址 - * @access public - * @return mixed - */ - public function getRoute() - { - return $this->route; - } - - /** - * 获取当前路由的变量 - * @access public - * @return array - */ - public function getVars(): array - { - return $this->vars; - } - - /** - * 获取Parent对象 - * @access public - * @return $this|null - */ - public function getParent() - { - return $this->parent; - } - - /** - * 获取路由所在域名 - * @access public - * @return string - */ - public function getDomain(): string - { - return $this->domain ?: $this->parent->getDomain(); - } - - /** - * 获取路由参数 - * @access public - * @param string $name 变量名 - * @return mixed - */ - public function config(string $name = '') - { - return $this->router->config($name); - } - - /** - * 获取变量规则定义 - * @access public - * @param string $name 变量名 - * @return mixed - */ - public function getPattern(string $name = '') - { - $pattern = $this->pattern; - - if ($this->parent) { - $pattern = array_merge($this->parent->getPattern(), $pattern); - } - - if ('' === $name) { - return $pattern; - } - - return $pattern[$name] ?? null; - } - - /** - * 获取路由参数定义 - * @access public - * @param string $name 参数名 - * @param mixed $default 默认值 - * @return mixed - */ - public function getOption(string $name = '', $default = null) - { - $option = $this->option; - - if ($this->parent) { - $parentOption = $this->parent->getOption(); - - // 合并分组参数 - foreach ($this->mergeOptions as $item) { - if (isset($parentOption[$item]) && isset($option[$item])) { - $option[$item] = array_merge($parentOption[$item], $option[$item]); - } - } - - $option = array_merge($parentOption, $option); - } - - if ('' === $name) { - return $option; - } - - return $option[$name] ?? $default; - } - - /** - * 获取当前路由的请求类型 - * @access public - * @return string - */ - public function getMethod(): string - { - return strtolower($this->method); - } - - /** - * 设置路由请求类型 - * @access public - * @param string $method 请求类型 - * @return $this - */ - public function method(string $method) - { - return $this->setOption('method', strtolower($method)); - } - - /** - * 检查后缀 - * @access public - * @param string $ext URL后缀 - * @return $this - */ - public function ext(string $ext = '') - { - return $this->setOption('ext', $ext); - } - - /** - * 检查禁止后缀 - * @access public - * @param string $ext URL后缀 - * @return $this - */ - public function denyExt(string $ext = '') - { - return $this->setOption('deny_ext', $ext); - } - - /** - * 检查域名 - * @access public - * @param string $domain 域名 - * @return $this - */ - public function domain(string $domain) - { - $this->domain = $domain; - return $this->setOption('domain', $domain); - } - - /** - * 设置参数过滤检查 - * @access public - * @param array $filter 参数过滤 - * @return $this - */ - public function filter(array $filter) - { - $this->option['filter'] = $filter; - - return $this; - } - - /** - * 绑定模型 - * @access public - * @param array|string|Closure $var 路由变量名 多个使用 & 分割 - * @param string|Closure $model 绑定模型类 - * @param bool $exception 是否抛出异常 - * @return $this - */ - public function model($var, $model = null, bool $exception = true) - { - if ($var instanceof Closure) { - $this->option['model'][] = $var; - } elseif (is_array($var)) { - $this->option['model'] = $var; - } elseif (is_null($model)) { - $this->option['model']['id'] = [$var, true]; - } else { - $this->option['model'][$var] = [$model, $exception]; - } - - return $this; - } - - /** - * 附加路由隐式参数 - * @access public - * @param array $append 追加参数 - * @return $this - */ - public function append(array $append = []) - { - $this->option['append'] = $append; - - return $this; - } - - /** - * 绑定验证 - * @access public - * @param mixed $validate 验证器类 - * @param string $scene 验证场景 - * @param array $message 验证提示 - * @param bool $batch 批量验证 - * @return $this - */ - public function validate($validate, string $scene = null, array $message = [], bool $batch = false) - { - $this->option['validate'] = [$validate, $scene, $message, $batch]; - - return $this; - } - - /** - * 指定路由中间件 - * @access public - * @param string|array|Closure $middleware 中间件 - * @param mixed $params 参数 - * @return $this - */ - public function middleware($middleware, ...$params) - { - if (empty($params) && is_array($middleware)) { - $this->option['middleware'] = $middleware; - } else { - foreach ((array) $middleware as $item) { - $this->option['middleware'][] = [$item, $params]; - } - } - - return $this; - } - - /** - * 允许跨域 - * @access public - * @param array $header 自定义Header - * @return $this - */ - public function allowCrossDomain(array $header = []) - { - return $this->middleware(AllowCrossDomain::class, $header); - } - - /** - * 表单令牌验证 - * @access public - * @param string $token 表单令牌token名称 - * @return $this - */ - public function token(string $token = '__token__') - { - return $this->middleware(FormTokenCheck::class, $token); - } - - /** - * 设置路由缓存 - * @access public - * @param array|string $cache 缓存 - * @return $this - */ - public function cache($cache) - { - return $this->middleware(CheckRequestCache::class, $cache); - } - - /** - * 检查URL分隔符 - * @access public - * @param string $depr URL分隔符 - * @return $this - */ - public function depr(string $depr) - { - return $this->setOption('param_depr', $depr); - } - - /** - * 设置需要合并的路由参数 - * @access public - * @param array $option 路由参数 - * @return $this - */ - public function mergeOptions(array $option = []) - { - $this->mergeOptions = array_merge($this->mergeOptions, $option); - return $this; - } - - /** - * 检查是否为HTTPS请求 - * @access public - * @param bool $https 是否为HTTPS - * @return $this - */ - public function https(bool $https = true) - { - return $this->setOption('https', $https); - } - - /** - * 检查是否为JSON请求 - * @access public - * @param bool $json 是否为JSON - * @return $this - */ - public function json(bool $json = true) - { - return $this->setOption('json', $json); - } - - /** - * 检查是否为AJAX请求 - * @access public - * @param bool $ajax 是否为AJAX - * @return $this - */ - public function ajax(bool $ajax = true) - { - return $this->setOption('ajax', $ajax); - } - - /** - * 检查是否为PJAX请求 - * @access public - * @param bool $pjax 是否为PJAX - * @return $this - */ - public function pjax(bool $pjax = true) - { - return $this->setOption('pjax', $pjax); - } - - /** - * 路由到一个模板地址 需要额外传入的模板变量 - * @access public - * @param array $view 视图 - * @return $this - */ - public function view(array $view = []) - { - return $this->setOption('view', $view); - } - - /** - * 设置路由完整匹配 - * @access public - * @param bool $match 是否完整匹配 - * @return $this - */ - public function completeMatch(bool $match = true) - { - return $this->setOption('complete_match', $match); - } - - /** - * 是否去除URL最后的斜线 - * @access public - * @param bool $remove 是否去除最后斜线 - * @return $this - */ - public function removeSlash(bool $remove = true) - { - return $this->setOption('remove_slash', $remove); - } - - /** - * 设置路由规则全局有效 - * @access public - * @return $this - */ - public function crossDomainRule() - { - if ($this instanceof RuleGroup) { - $method = '*'; - } else { - $method = $this->method; - } - - $this->router->setCrossDomainRule($this, $method); - - return $this; - } - - /** - * 解析匹配到的规则路由 - * @access public - * @param Request $request 请求对象 - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @param string $url URL地址 - * @param array $option 路由参数 - * @param array $matches 匹配的变量 - * @return Dispatch - */ - public function parseRule(Request $request, string $rule, $route, string $url, array $option = [], array $matches = []): Dispatch - { - if (is_string($route) && isset($option['prefix'])) { - // 路由地址前缀 - $route = $option['prefix'] . $route; - } - - // 替换路由地址中的变量 - $extraParams = true; - $search = $replace = []; - $depr = $this->router->config('pathinfo_depr'); - foreach ($matches as $key => $value) { - $search[] = '<' . $key . '>'; - $replace[] = $value; - - $search[] = ':' . $key; - $replace[] = $value; - - if (strpos($value, $depr)) { - $extraParams = false; - } - } - - if (is_string($route)) { - $route = str_replace($search, $replace, $route); - } - - // 解析额外参数 - if ($extraParams) { - $count = substr_count($rule, '/'); - $url = array_slice(explode('|', $url), $count + 1); - $this->parseUrlParams(implode('|', $url), $matches); - } - - $this->vars = $matches; - - // 发起路由调度 - return $this->dispatch($request, $route, $option); - } - - /** - * 发起路由调度 - * @access protected - * @param Request $request Request对象 - * @param mixed $route 路由地址 - * @param array $option 路由参数 - * @return Dispatch - */ - protected function dispatch(Request $request, $route, array $option): Dispatch - { - if (is_subclass_of($route, Dispatch::class)) { - $result = new $route($request, $this, $route, $this->vars); - } elseif ($route instanceof Closure) { - // 执行闭包 - $result = new CallbackDispatch($request, $this, $route, $this->vars); - } elseif (false !== strpos($route, '@') || false !== strpos($route, '::') || false !== strpos($route, '\\')) { - // 路由到类的方法 - $route = str_replace('::', '@', $route); - $result = $this->dispatchMethod($request, $route); - } else { - // 路由到控制器/操作 - $result = $this->dispatchController($request, $route); - } - - return $result; - } - - /** - * 解析URL地址为 模块/控制器/操作 - * @access protected - * @param Request $request Request对象 - * @param string $route 路由地址 - * @return CallbackDispatch - */ - protected function dispatchMethod(Request $request, string $route): CallbackDispatch - { - $path = $this->parseUrlPath($route); - - $route = str_replace('/', '@', implode('/', $path)); - $method = strpos($route, '@') ? explode('@', $route) : $route; - - return new CallbackDispatch($request, $this, $method, $this->vars); - } - - /** - * 解析URL地址为 模块/控制器/操作 - * @access protected - * @param Request $request Request对象 - * @param string $route 路由地址 - * @return ControllerDispatch - */ - protected function dispatchController(Request $request, string $route): ControllerDispatch - { - $path = $this->parseUrlPath($route); - - $action = array_pop($path); - $controller = !empty($path) ? array_pop($path) : null; - - // 路由到模块/控制器/操作 - return new ControllerDispatch($request, $this, [$controller, $action], $this->vars); - } - - /** - * 路由检查 - * @access protected - * @param array $option 路由参数 - * @param Request $request Request对象 - * @return bool - */ - protected function checkOption(array $option, Request $request): bool - { - // 请求类型检测 - if (!empty($option['method'])) { - if (is_string($option['method']) && false === stripos($option['method'], $request->method())) { - return false; - } - } - - // AJAX PJAX 请求检查 - foreach (['ajax', 'pjax', 'json'] as $item) { - if (isset($option[$item])) { - $call = 'is' . $item; - if ($option[$item] && !$request->$call() || !$option[$item] && $request->$call()) { - return false; - } - } - } - - // 伪静态后缀检测 - if ($request->url() != '/' && ((isset($option['ext']) && false === stripos('|' . $option['ext'] . '|', '|' . $request->ext() . '|')) - || (isset($option['deny_ext']) && false !== stripos('|' . $option['deny_ext'] . '|', '|' . $request->ext() . '|')))) { - return false; - } - - // 域名检查 - if ((isset($option['domain']) && !in_array($option['domain'], [$request->host(true), $request->subDomain()]))) { - return false; - } - - // HTTPS检查 - if ((isset($option['https']) && $option['https'] && !$request->isSsl()) - || (isset($option['https']) && !$option['https'] && $request->isSsl())) { - return false; - } - - // 请求参数检查 - if (isset($option['filter'])) { - foreach ($option['filter'] as $name => $value) { - if ($request->param($name, '', null) != $value) { - return false; - } - } - } - - return true; - } - - /** - * 解析URL地址中的参数Request对象 - * @access protected - * @param string $rule 路由规则 - * @param array $var 变量 - * @return void - */ - protected function parseUrlParams(string $url, array &$var = []): void - { - if ($url) { - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { - $var[$match[1]] = strip_tags($match[2]); - }, $url); - } - } - - /** - * 解析URL的pathinfo参数 - * @access public - * @param string $url URL地址 - * @return array - */ - public function parseUrlPath(string $url): array - { - // 分隔符替换 确保路由定义使用统一的分隔符 - $url = str_replace('|', '/', $url); - $url = trim($url, '/'); - - if (strpos($url, '/')) { - // [控制器/操作] - $path = explode('/', $url); - } else { - $path = [$url]; - } - - return $path; - } - - /** - * 生成路由的正则规则 - * @access protected - * @param string $rule 路由规则 - * @param array $match 匹配的变量 - * @param array $pattern 路由变量规则 - * @param array $option 路由参数 - * @param bool $completeMatch 路由是否完全匹配 - * @param string $suffix 路由正则变量后缀 - * @return string - */ - protected function buildRuleRegex(string $rule, array $match, array $pattern = [], array $option = [], bool $completeMatch = false, string $suffix = ''): string - { - foreach ($match as $name) { - $value = $this->buildNameRegex($name, $pattern, $suffix); - if ($value) { - $origin[] = $name; - $replace[] = $value; - } - } - - // 是否区分 / 地址访问 - if ('/' != $rule) { - if (!empty($option['remove_slash'])) { - $rule = rtrim($rule, '/'); - } elseif (substr($rule, -1) == '/') { - $rule = rtrim($rule, '/'); - $hasSlash = true; - } - } - - $regex = isset($replace) ? str_replace($origin, $replace, $rule) : $rule; - $regex = str_replace([')?/', ')?-'], [')/', ')-'], $regex); - - if (isset($hasSlash)) { - $regex .= '/'; - } - - return $regex . ($completeMatch ? '$' : ''); - } - - /** - * 生成路由变量的正则规则 - * @access protected - * @param string $name 路由变量 - * @param array $pattern 变量规则 - * @param string $suffix 路由正则变量后缀 - * @return string - */ - protected function buildNameRegex(string $name, array $pattern, string $suffix): string - { - $optional = ''; - $slash = substr($name, 0, 1); - - if (in_array($slash, ['/', '-'])) { - $prefix = $slash; - $name = substr($name, 1); - $slash = substr($name, 0, 1); - } else { - $prefix = ''; - } - - if ('<' != $slash) { - return ''; - } - - if (strpos($name, '?')) { - $name = substr($name, 1, -2); - $optional = '?'; - } elseif (strpos($name, '>')) { - $name = substr($name, 1, -1); - } - - if (isset($pattern[$name])) { - $nameRule = $pattern[$name]; - if (0 === strpos($nameRule, '/') && '/' == substr($nameRule, -1)) { - $nameRule = substr($nameRule, 1, -1); - } - } else { - $nameRule = $this->router->config('default_route_pattern'); - } - - return '(' . $prefix . '(?<' . $name . $suffix . '>' . $nameRule . '))' . $optional; - } - - /** - * 设置路由参数 - * @access public - * @param string $method 方法名 - * @param array $args 调用参数 - * @return $this - */ - public function __call($method, $args) - { - if (count($args) > 1) { - $args[0] = $args; - } - array_unshift($args, $method); - - return call_user_func_array([$this, 'setOption'], $args); - } - - public function __sleep() - { - return ['name', 'rule', 'route', 'method', 'vars', 'option', 'pattern']; - } - - public function __wakeup() - { - $this->router = Container::pull('route'); - } - - public function __debugInfo() - { - return [ - 'name' => $this->name, - 'rule' => $this->rule, - 'route' => $this->route, - 'method' => $this->method, - 'vars' => $this->vars, - 'option' => $this->option, - 'pattern' => $this->pattern, - ]; - } -} diff --git a/vendor/topthink/framework/src/think/route/RuleGroup.php b/vendor/topthink/framework/src/think/route/RuleGroup.php deleted file mode 100644 index cd9ddbd1..00000000 --- a/vendor/topthink/framework/src/think/route/RuleGroup.php +++ /dev/null @@ -1,523 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route; - -use Closure; -use think\Container; -use think\Exception; -use think\Request; -use think\Route; - -/** - * 路由分组类 - */ -class RuleGroup extends Rule -{ - /** - * 分组路由(包括子分组) - * @var array - */ - protected $rules = []; - - /** - * 分组路由规则 - * @var mixed - */ - protected $rule; - - /** - * MISS路由 - * @var RuleItem - */ - protected $miss; - - /** - * 完整名称 - * @var string - */ - protected $fullName; - - /** - * 分组别名 - * @var string - */ - protected $alias; - - /** - * 架构函数 - * @access public - * @param Route $router 路由对象 - * @param RuleGroup $parent 上级对象 - * @param string $name 分组名称 - * @param mixed $rule 分组路由 - */ - public function __construct(Route $router, RuleGroup $parent = null, string $name = '', $rule = null) - { - $this->router = $router; - $this->parent = $parent; - $this->rule = $rule; - $this->name = trim($name, '/'); - - $this->setFullName(); - - if ($this->parent) { - $this->domain = $this->parent->getDomain(); - $this->parent->addRuleItem($this); - } - - if ($router->isTest()) { - $this->lazy(false); - } - } - - /** - * 设置分组的路由规则 - * @access public - * @return void - */ - protected function setFullName(): void - { - if (false !== strpos($this->name, ':')) { - $this->name = preg_replace(['/\[\:(\w+)\]/', '/\:(\w+)/'], ['<\1?>', '<\1>'], $this->name); - } - - if ($this->parent && $this->parent->getFullName()) { - $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : ''); - } else { - $this->fullName = $this->name; - } - - if ($this->name) { - $this->router->getRuleName()->setGroup($this->name, $this); - } - } - - /** - * 获取所属域名 - * @access public - * @return string - */ - public function getDomain(): string - { - return $this->domain ?: '-'; - } - - /** - * 获取分组别名 - * @access public - * @return string - */ - public function getAlias(): string - { - return $this->alias ?: ''; - } - - /** - * 检测分组路由 - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function check(Request $request, string $url, bool $completeMatch = false) - { - // 检查分组有效性 - if (!$this->checkOption($this->option, $request) || !$this->checkUrl($url)) { - return false; - } - - // 解析分组路由 - if ($this instanceof Resource) { - $this->buildResourceRule(); - } else { - $this->parseGroupRule($this->rule); - } - - // 获取当前路由规则 - $method = strtolower($request->method()); - $rules = $this->getRules($method); - $option = $this->getOption(); - - if (isset($option['complete_match'])) { - $completeMatch = $option['complete_match']; - } - - if (!empty($option['merge_rule_regex'])) { - // 合并路由正则规则进行路由匹配检查 - $result = $this->checkMergeRuleRegex($request, $rules, $url, $completeMatch); - - if (false !== $result) { - return $result; - } - } - - // 检查分组路由 - foreach ($rules as $key => $item) { - $result = $item[1]->check($request, $url, $completeMatch); - - if (false !== $result) { - return $result; - } - } - - if (!empty($option['dispatcher'])) { - $result = $this->parseRule($request, '', $option['dispatcher'], $url, $option); - } elseif ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) { - // 未匹配所有路由的路由规则处理 - $result = $this->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->getOption()); - } else { - $result = false; - } - - return $result; - } - - /** - * 分组URL匹配检查 - * @access protected - * @param string $url URL - * @return bool - */ - protected function checkUrl(string $url): bool - { - if ($this->fullName) { - $pos = strpos($this->fullName, '<'); - - if (false !== $pos) { - $str = substr($this->fullName, 0, $pos); - } else { - $str = $this->fullName; - } - - if ($str && 0 !== stripos(str_replace('|', '/', $url), $str)) { - return false; - } - } - - return true; - } - - /** - * 设置路由分组别名 - * @access public - * @param string $alias 路由分组别名 - * @return $this - */ - public function alias(string $alias) - { - $this->alias = $alias; - $this->router->getRuleName()->setGroup($alias, $this); - - return $this; - } - - /** - * 延迟解析分组的路由规则 - * @access public - * @param bool $lazy 路由是否延迟解析 - * @return $this - */ - public function lazy(bool $lazy = true) - { - if (!$lazy) { - $this->parseGroupRule($this->rule); - $this->rule = null; - } - - return $this; - } - - /** - * 解析分组和域名的路由规则及绑定 - * @access public - * @param mixed $rule 路由规则 - * @return void - */ - public function parseGroupRule($rule): void - { - if (is_string($rule) && is_subclass_of($rule, Dispatch::class)) { - $this->dispatcher($rule); - return; - } - - $origin = $this->router->getGroup(); - $this->router->setGroup($this); - - if ($rule instanceof \Closure) { - Container::getInstance()->invokeFunction($rule); - } elseif (is_string($rule) && $rule) { - $this->router->bind($rule, $this->domain); - } - - $this->router->setGroup($origin); - } - - /** - * 检测分组路由 - * @access public - * @param Request $request 请求对象 - * @param array $rules 路由规则 - * @param string $url 访问地址 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - protected function checkMergeRuleRegex(Request $request, array &$rules, string $url, bool $completeMatch) - { - $depr = $this->router->config('pathinfo_depr'); - $url = $depr . str_replace('|', $depr, $url); - $regex = []; - $items = []; - - foreach ($rules as $key => $val) { - $item = $val[1]; - if ($item instanceof RuleItem) { - $rule = $depr . str_replace('/', $depr, $item->getRule()); - if ($depr == $rule && $depr != $url) { - unset($rules[$key]); - continue; - } - - $complete = $item->getOption('complete_match', $completeMatch); - - if (false === strpos($rule, '<')) { - if (0 === strcasecmp($rule, $url) || (!$complete && 0 === strncasecmp($rule, $url, strlen($rule)))) { - return $item->checkRule($request, $url, []); - } - - unset($rules[$key]); - continue; - } - - $slash = preg_quote('/-' . $depr, '/'); - - if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) { - if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { - unset($rules[$key]); - continue; - } - } - - if (preg_match_all('/[' . $slash . ']??/', $rule, $matches)) { - unset($rules[$key]); - $pattern = array_merge($this->getPattern(), $item->getPattern()); - $option = array_merge($this->getOption(), $item->getOption()); - - $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key); - $items[$key] = $item; - } - } - } - - if (empty($regex)) { - return false; - } - - try { - $result = preg_match('~^(?:' . implode('|', $regex) . ')~u', $url, $match); - } catch (\Exception $e) { - throw new Exception('route pattern error'); - } - - if ($result) { - $var = []; - foreach ($match as $key => $val) { - if (is_string($key) && '' !== $val) { - [$name, $pos] = explode('_THINK_', $key); - - $var[$name] = $val; - } - } - - if (!isset($pos)) { - foreach ($regex as $key => $item) { - if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) { - $pos = $key; - break; - } - } - } - - $rule = $items[$pos]->getRule(); - $array = $this->router->getRule($rule); - - foreach ($array as $item) { - if (in_array($item->getMethod(), ['*', strtolower($request->method())])) { - $result = $item->checkRule($request, $url, $var); - - if (false !== $result) { - return $result; - } - } - } - } - - return false; - } - - /** - * 获取分组的MISS路由 - * @access public - * @return RuleItem|null - */ - public function getMissRule(): ? RuleItem - { - return $this->miss; - } - - /** - * 注册MISS路由 - * @access public - * @param string|Closure $route 路由地址 - * @param string $method 请求类型 - * @return RuleItem - */ - public function miss($route, string $method = '*') : RuleItem - { - // 创建路由规则实例 - $ruleItem = new RuleItem($this->router, $this, null, '', $route, strtolower($method)); - - $ruleItem->setMiss(); - $this->miss = $ruleItem; - - return $ruleItem; - } - - /** - * 添加分组下的路由规则 - * @access public - * @param string $rule 路由规则 - * @param mixed $route 路由地址 - * @param string $method 请求类型 - * @return RuleItem - */ - public function addRule(string $rule, $route = null, string $method = '*'): RuleItem - { - // 读取路由标识 - if (is_string($route)) { - $name = $route; - } else { - $name = null; - } - - $method = strtolower($method); - - if ('' === $rule || '/' === $rule) { - $rule .= '$'; - } - - // 创建路由规则实例 - $ruleItem = new RuleItem($this->router, $this, $name, $rule, $route, $method); - - $this->addRuleItem($ruleItem, $method); - - return $ruleItem; - } - - /** - * 注册分组下的路由规则 - * @access public - * @param Rule $rule 路由规则 - * @param string $method 请求类型 - * @return $this - */ - public function addRuleItem(Rule $rule, string $method = '*') - { - if (strpos($method, '|')) { - $rule->method($method); - $method = '*'; - } - - $this->rules[] = [$method, $rule]; - - if ($rule instanceof RuleItem && 'options' != $method) { - $this->rules[] = ['options', $rule->setAutoOptions()]; - } - - return $this; - } - - /** - * 设置分组的路由前缀 - * @access public - * @param string $prefix 路由前缀 - * @return $this - */ - public function prefix(string $prefix) - { - if ($this->parent && $this->parent->getOption('prefix')) { - $prefix = $this->parent->getOption('prefix') . $prefix; - } - - return $this->setOption('prefix', $prefix); - } - - /** - * 合并分组的路由规则正则 - * @access public - * @param bool $merge 是否合并 - * @return $this - */ - public function mergeRuleRegex(bool $merge = true) - { - return $this->setOption('merge_rule_regex', $merge); - } - - /** - * 设置分组的Dispatch调度 - * @access public - * @param string $dispatch 调度类 - * @return $this - */ - public function dispatcher(string $dispatch) - { - return $this->setOption('dispatcher', $dispatch); - } - - /** - * 获取完整分组Name - * @access public - * @return string - */ - public function getFullName(): string - { - return $this->fullName ?: ''; - } - - /** - * 获取分组的路由规则 - * @access public - * @param string $method 请求类型 - * @return array - */ - public function getRules(string $method = ''): array - { - if ('' === $method) { - return $this->rules; - } - - return array_filter($this->rules, function ($item) use ($method) { - return $method == $item[0] || '*' == $item[0]; - }); - } - - /** - * 清空分组下的路由规则 - * @access public - * @return void - */ - public function clear(): void - { - $this->rules = []; - } -} diff --git a/vendor/topthink/framework/src/think/route/RuleItem.php b/vendor/topthink/framework/src/think/route/RuleItem.php deleted file mode 100644 index 1f9aa52a..00000000 --- a/vendor/topthink/framework/src/think/route/RuleItem.php +++ /dev/null @@ -1,330 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route; - -use think\Exception; -use think\Request; -use think\Route; - -/** - * 路由规则类 - */ -class RuleItem extends Rule -{ - /** - * 是否为MISS规则 - * @var bool - */ - protected $miss = false; - - /** - * 是否为额外自动注册的OPTIONS规则 - * @var bool - */ - protected $autoOption = false; - - /** - * 架构函数 - * @access public - * @param Route $router 路由实例 - * @param RuleGroup $parent 上级对象 - * @param string $name 路由标识 - * @param string $rule 路由规则 - * @param string|\Closure $route 路由地址 - * @param string $method 请求类型 - */ - public function __construct(Route $router, RuleGroup $parent, string $name = null, string $rule = '', $route = null, string $method = '*') - { - $this->router = $router; - $this->parent = $parent; - $this->name = $name; - $this->route = $route; - $this->method = $method; - - $this->setRule($rule); - - $this->router->setRule($this->rule, $this); - } - - /** - * 设置当前路由规则为MISS路由 - * @access public - * @return $this - */ - public function setMiss() - { - $this->miss = true; - return $this; - } - - /** - * 判断当前路由规则是否为MISS路由 - * @access public - * @return bool - */ - public function isMiss(): bool - { - return $this->miss; - } - - /** - * 设置当前路由为自动注册OPTIONS - * @access public - * @return $this - */ - public function setAutoOptions() - { - $this->autoOption = true; - return $this; - } - - /** - * 判断当前路由规则是否为自动注册的OPTIONS路由 - * @access public - * @return bool - */ - public function isAutoOptions(): bool - { - return $this->autoOption; - } - - /** - * 获取当前路由的URL后缀 - * @access public - * @return string|null - */ - public function getSuffix() - { - if (isset($this->option['ext'])) { - $suffix = $this->option['ext']; - } elseif ($this->parent->getOption('ext')) { - $suffix = $this->parent->getOption('ext'); - } else { - $suffix = null; - } - - return $suffix; - } - - /** - * 路由规则预处理 - * @access public - * @param string $rule 路由规则 - * @return void - */ - public function setRule(string $rule): void - { - if ('$' == substr($rule, -1, 1)) { - // 是否完整匹配 - $rule = substr($rule, 0, -1); - - $this->option['complete_match'] = true; - } - - $rule = '/' != $rule ? ltrim($rule, '/') : ''; - - if ($this->parent && $prefix = $this->parent->getFullName()) { - $rule = $prefix . ($rule ? '/' . ltrim($rule, '/') : ''); - } - - if (false !== strpos($rule, ':')) { - $this->rule = preg_replace(['/\[\:(\w+)\]/', '/\:(\w+)/'], ['<\1?>', '<\1>'], $rule); - } else { - $this->rule = $rule; - } - - // 生成路由标识的快捷访问 - $this->setRuleName(); - } - - /** - * 设置别名 - * @access public - * @param string $name - * @return $this - */ - public function name(string $name) - { - $this->name = $name; - $this->setRuleName(true); - - return $this; - } - - /** - * 设置路由标识 用于URL反解生成 - * @access protected - * @param bool $first 是否插入开头 - * @return void - */ - protected function setRuleName(bool $first = false): void - { - if ($this->name) { - $this->router->setName($this->name, $this, $first); - } - } - - /** - * 检测路由 - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param array $match 匹配路由变量 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function checkRule(Request $request, string $url, $match = null, bool $completeMatch = false) - { - // 检查参数有效性 - if (!$this->checkOption($this->option, $request)) { - return false; - } - - // 合并分组参数 - $option = $this->getOption(); - $pattern = $this->getPattern(); - $url = $this->urlSuffixCheck($request, $url, $option); - - if (is_null($match)) { - $match = $this->match($url, $option, $pattern, $completeMatch); - } - - if (false !== $match) { - return $this->parseRule($request, $this->rule, $this->route, $url, $option, $match); - } - - return false; - } - - /** - * 检测路由(含路由匹配) - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function check(Request $request, string $url, bool $completeMatch = false) - { - return $this->checkRule($request, $url, null, $completeMatch); - } - - /** - * URL后缀及Slash检查 - * @access protected - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param array $option 路由参数 - * @return string - */ - protected function urlSuffixCheck(Request $request, string $url, array $option = []): string - { - // 是否区分 / 地址访问 - if (!empty($option['remove_slash']) && '/' != $this->rule) { - $this->rule = rtrim($this->rule, '/'); - $url = rtrim($url, '|'); - } - - if (isset($option['ext'])) { - // 路由ext参数 优先于系统配置的URL伪静态后缀参数 - $url = preg_replace('/\.(' . $request->ext() . ')$/i', '', $url); - } - - return $url; - } - - /** - * 检测URL和规则路由是否匹配 - * @access private - * @param string $url URL地址 - * @param array $option 路由参数 - * @param array $pattern 变量规则 - * @param bool $completeMatch 是否完全匹配 - * @return array|false - */ - private function match(string $url, array $option, array $pattern, bool $completeMatch) - { - if (isset($option['complete_match'])) { - $completeMatch = $option['complete_match']; - } - - $depr = $this->router->config('pathinfo_depr'); - - // 检查完整规则定义 - if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^' . $pattern['__url__'] . ($completeMatch ? '$' : '') . '/', str_replace('|', $depr, $url))) { - return false; - } - - $var = []; - $url = $depr . str_replace('|', $depr, $url); - $rule = $depr . str_replace('/', $depr, $this->rule); - - if ($depr == $rule && $depr != $url) { - return false; - } - - if (false === strpos($rule, '<')) { - if (0 === strcasecmp($rule, $url) || (!$completeMatch && 0 === strncasecmp($rule . $depr, $url . $depr, strlen($rule . $depr)))) { - return $var; - } - return false; - } - - $slash = preg_quote('/-' . $depr, '/'); - - if ($matchRule = preg_split('/[' . $slash . ']?<\w+\??>/', $rule, 2)) { - if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { - return false; - } - } - - if (preg_match_all('/[' . $slash . ']??/', $rule, $matches)) { - $regex = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $completeMatch); - - try { - if (!preg_match('~^' . $regex . '~u', $url, $match)) { - return false; - } - } catch (\Exception $e) { - throw new Exception('route pattern error'); - } - - foreach ($match as $key => $val) { - if (is_string($key)) { - $var[$key] = $val; - } - } - } - - // 成功匹配后返回URL中的动态变量数组 - return $var; - } - - /** - * 设置路由所属分组(用于注解路由) - * @access public - * @param string $name 分组名称或者标识 - * @return $this - */ - public function group(string $name) - { - $group = $this->router->getRuleName()->getGroup($name); - - if ($group) { - $this->parent = $group; - $this->setRule($this->rule); - } - - return $this; - } -} diff --git a/vendor/topthink/framework/src/think/route/RuleName.php b/vendor/topthink/framework/src/think/route/RuleName.php deleted file mode 100644 index 0684367c..00000000 --- a/vendor/topthink/framework/src/think/route/RuleName.php +++ /dev/null @@ -1,211 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route; - -/** - * 路由标识管理类 - */ -class RuleName -{ - /** - * 路由标识 - * @var array - */ - protected $item = []; - - /** - * 路由规则 - * @var array - */ - protected $rule = []; - - /** - * 路由分组 - * @var array - */ - protected $group = []; - - /** - * 注册路由标识 - * @access public - * @param string $name 路由标识 - * @param RuleItem $ruleItem 路由规则 - * @param bool $first 是否优先 - * @return void - */ - public function setName(string $name, RuleItem $ruleItem, bool $first = false): void - { - $name = strtolower($name); - $item = $this->getRuleItemInfo($ruleItem); - if ($first && isset($this->item[$name])) { - array_unshift($this->item[$name], $item); - } else { - $this->item[$name][] = $item; - } - } - - /** - * 注册路由分组标识 - * @access public - * @param string $name 路由分组标识 - * @param RuleGroup $group 路由分组 - * @return void - */ - public function setGroup(string $name, RuleGroup $group): void - { - $this->group[strtolower($name)] = $group; - } - - /** - * 注册路由规则 - * @access public - * @param string $rule 路由规则 - * @param RuleItem $ruleItem 路由 - * @return void - */ - public function setRule(string $rule, RuleItem $ruleItem): void - { - $route = $ruleItem->getRoute(); - - if (is_string($route)) { - $this->rule[$rule][$route] = $ruleItem; - } else { - $this->rule[$rule][] = $ruleItem; - } - } - - /** - * 根据路由规则获取路由对象(列表) - * @access public - * @param string $rule 路由标识 - * @return RuleItem[] - */ - public function getRule(string $rule): array - { - return $this->rule[$rule] ?? []; - } - - /** - * 根据路由分组标识获取分组 - * @access public - * @param string $name 路由分组标识 - * @return RuleGroup|null - */ - public function getGroup(string $name) - { - return $this->group[strtolower($name)] ?? null; - } - - /** - * 清空路由规则 - * @access public - * @return void - */ - public function clear(): void - { - $this->item = []; - $this->rule = []; - } - - /** - * 获取全部路由列表 - * @access public - * @return array - */ - public function getRuleList(): array - { - $list = []; - - foreach ($this->rule as $rule => $rules) { - foreach ($rules as $item) { - $val = []; - - foreach (['method', 'rule', 'name', 'route', 'domain', 'pattern', 'option'] as $param) { - $call = 'get' . $param; - $val[$param] = $item->$call(); - } - - if ($item->isMiss()) { - $val['rule'] .= ''; - } - - $list[] = $val; - } - } - - return $list; - } - - /** - * 导入路由标识 - * @access public - * @param array $item 路由标识 - * @return void - */ - public function import(array $item): void - { - $this->item = $item; - } - - /** - * 根据路由标识获取路由信息(用于URL生成) - * @access public - * @param string $name 路由标识 - * @param string $domain 域名 - * @param string $method 请求类型 - * @return array - */ - public function getName(string $name = null, string $domain = null, string $method = '*'): array - { - if (is_null($name)) { - return $this->item; - } - - $name = strtolower($name); - $method = strtolower($method); - $result = []; - - if (isset($this->item[$name])) { - if (is_null($domain)) { - $result = $this->item[$name]; - } else { - foreach ($this->item[$name] as $item) { - $itemDomain = $item['domain']; - $itemMethod = $item['method']; - - if (($itemDomain == $domain || '-' == $itemDomain) && ('*' == $itemMethod || '*' == $method || $method == $itemMethod)) { - $result[] = $item; - } - } - } - } - - return $result; - } - - /** - * 获取路由信息 - * @access protected - * @param RuleItem $item 路由规则 - * @return array - */ - protected function getRuleItemInfo(RuleItem $item): array - { - return [ - 'rule' => $item->getRule(), - 'domain' => $item->getDomain(), - 'method' => $item->getMethod(), - 'suffix' => $item->getSuffix(), - ]; - } -} diff --git a/vendor/topthink/framework/src/think/route/Url.php b/vendor/topthink/framework/src/think/route/Url.php deleted file mode 100644 index 8dd410cb..00000000 --- a/vendor/topthink/framework/src/think/route/Url.php +++ /dev/null @@ -1,517 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route; - -use think\App; -use think\Route; - -/** - * 路由地址生成 - */ -class Url -{ - /** - * 应用对象 - * @var App - */ - protected $app; - - /** - * 路由对象 - * @var Route - */ - protected $route; - - /** - * URL变量 - * @var array - */ - protected $vars = []; - - /** - * 路由URL - * @var string - */ - protected $url; - - /** - * URL 根地址 - * @var string - */ - protected $root = ''; - - /** - * HTTPS - * @var bool - */ - protected $https; - - /** - * URL后缀 - * @var string|bool - */ - protected $suffix = true; - - /** - * URL域名 - * @var string|bool - */ - protected $domain = false; - - /** - * 架构函数 - * @access public - * @param string $url URL地址 - * @param array $vars 参数 - */ - public function __construct(Route $route, App $app, string $url = '', array $vars = []) - { - $this->route = $route; - $this->app = $app; - $this->url = $url; - $this->vars = $vars; - } - - /** - * 设置URL参数 - * @access public - * @param array $vars URL参数 - * @return $this - */ - public function vars(array $vars = []) - { - $this->vars = $vars; - return $this; - } - - /** - * 设置URL后缀 - * @access public - * @param string|bool $suffix URL后缀 - * @return $this - */ - public function suffix($suffix) - { - $this->suffix = $suffix; - return $this; - } - - /** - * 设置URL域名(或者子域名) - * @access public - * @param string|bool $domain URL域名 - * @return $this - */ - public function domain($domain) - { - $this->domain = $domain; - return $this; - } - - /** - * 设置URL 根地址 - * @access public - * @param string $root URL root - * @return $this - */ - public function root(string $root) - { - $this->root = $root; - return $this; - } - - /** - * 设置是否使用HTTPS - * @access public - * @param bool $https - * @return $this - */ - public function https(bool $https = true) - { - $this->https = $https; - return $this; - } - - /** - * 检测域名 - * @access protected - * @param string $url URL - * @param string|true $domain 域名 - * @return string - */ - protected function parseDomain(string &$url, $domain): string - { - if (!$domain) { - return ''; - } - - $request = $this->app->request; - $rootDomain = $request->rootDomain(); - - if (true === $domain) { - // 自动判断域名 - $domain = $request->host(); - $domains = $this->route->getDomains(); - - if (!empty($domains)) { - $routeDomain = array_keys($domains); - foreach ($routeDomain as $domainPrefix) { - if (0 === strpos($domainPrefix, '*.') && strpos($domain, ltrim($domainPrefix, '*.')) !== false) { - foreach ($domains as $key => $rule) { - $rule = is_array($rule) ? $rule[0] : $rule; - if (is_string($rule) && false === strpos($key, '*') && 0 === strpos($url, $rule)) { - $url = ltrim($url, $rule); - $domain = $key; - - // 生成对应子域名 - if (!empty($rootDomain)) { - $domain .= $rootDomain; - } - break; - } elseif (false !== strpos($key, '*')) { - if (!empty($rootDomain)) { - $domain .= $rootDomain; - } - - break; - } - } - } - } - } - } elseif (false === strpos($domain, '.') && 0 !== strpos($domain, $rootDomain)) { - $domain .= '.' . $rootDomain; - } - - if (false !== strpos($domain, '://')) { - $scheme = ''; - } else { - $scheme = $this->https || $request->isSsl() ? 'https://' : 'http://'; - } - - return $scheme . $domain; - } - - /** - * 解析URL后缀 - * @access protected - * @param string|bool $suffix 后缀 - * @return string - */ - protected function parseSuffix($suffix): string - { - if ($suffix) { - $suffix = true === $suffix ? $this->route->config('url_html_suffix') : $suffix; - - if (is_string($suffix) && $pos = strpos($suffix, '|')) { - $suffix = substr($suffix, 0, $pos); - } - } - - return (empty($suffix) || 0 === strpos($suffix, '.')) ? (string) $suffix : '.' . $suffix; - } - - /** - * 直接解析URL地址 - * @access protected - * @param string $url URL - * @param string|bool $domain Domain - * @return string - */ - protected function parseUrl(string $url, &$domain): string - { - $request = $this->app->request; - - if (0 === strpos($url, '/')) { - // 直接作为路由地址解析 - $url = substr($url, 1); - } elseif (false !== strpos($url, '\\')) { - // 解析到类 - $url = ltrim(str_replace('\\', '/', $url), '/'); - } elseif (0 === strpos($url, '@')) { - // 解析到控制器 - $url = substr($url, 1); - } elseif ('' === $url) { - $url = $request->controller() . '/' . $request->action(); - } else { - $controller = $request->controller(); - - $path = explode('/', $url); - $action = array_pop($path); - $controller = empty($path) ? $controller : array_pop($path); - - $url = $controller . '/' . $action; - } - - return $url; - } - - /** - * 分析路由规则中的变量 - * @access protected - * @param string $rule 路由规则 - * @return array - */ - protected function parseVar(string $rule): array - { - // 提取路由规则中的变量 - $var = []; - - if (preg_match_all('/<\w+\??>/', $rule, $matches)) { - foreach ($matches[0] as $name) { - $optional = false; - - if (strpos($name, '?')) { - $name = substr($name, 1, -2); - $optional = true; - } else { - $name = substr($name, 1, -1); - } - - $var[$name] = $optional ? 2 : 1; - } - } - - return $var; - } - - /** - * 匹配路由地址 - * @access protected - * @param array $rule 路由规则 - * @param array $vars 路由变量 - * @param mixed $allowDomain 允许域名 - * @return array - */ - protected function getRuleUrl(array $rule, array &$vars = [], $allowDomain = ''): array - { - $request = $this->app->request; - if (is_string($allowDomain) && false === strpos($allowDomain, '.')) { - $allowDomain .= '.' . $request->rootDomain(); - } - $port = $request->port(); - - foreach ($rule as $item) { - $url = $item['rule']; - $pattern = $this->parseVar($url); - $domain = $item['domain']; - $suffix = $item['suffix']; - - if ('-' == $domain) { - $domain = is_string($allowDomain) ? $allowDomain : $request->host(true); - } - - if (is_string($allowDomain) && $domain != $allowDomain) { - continue; - } - - if ($port && !in_array($port, [80, 443])) { - $domain .= ':' . $port; - } - - if (empty($pattern)) { - return [rtrim($url, '?/-'), $domain, $suffix]; - } - - $type = $this->route->config('url_common_param'); - $keys = []; - - foreach ($pattern as $key => $val) { - if (isset($vars[$key])) { - $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? (string) $vars[$key] : urlencode((string) $vars[$key]), $url); - $keys[] = $key; - $url = str_replace(['/?', '-?'], ['/', '-'], $url); - $result = [rtrim($url, '?/-'), $domain, $suffix]; - } elseif (2 == $val) { - $url = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url); - $url = str_replace(['/?', '-?'], ['/', '-'], $url); - $result = [rtrim($url, '?/-'), $domain, $suffix]; - } else { - $result = null; - $keys = []; - break; - } - } - - $vars = array_diff_key($vars, array_flip($keys)); - - if (isset($result)) { - return $result; - } - } - - return []; - } - - /** - * 生成URL地址 - * @access public - * @return string - */ - public function build() - { - // 解析URL - $url = $this->url; - $suffix = $this->suffix; - $domain = $this->domain; - $request = $this->app->request; - $vars = $this->vars; - - if (0 === strpos($url, '[') && $pos = strpos($url, ']')) { - // [name] 表示使用路由命名标识生成URL - $name = substr($url, 1, $pos - 1); - $url = 'name' . substr($url, $pos + 1); - } - - if (false === strpos($url, '://') && 0 !== strpos($url, '/')) { - $info = parse_url($url); - $url = !empty($info['path']) ? $info['path'] : ''; - - if (isset($info['fragment'])) { - // 解析锚点 - $anchor = $info['fragment']; - - if (false !== strpos($anchor, '?')) { - // 解析参数 - [$anchor, $info['query']] = explode('?', $anchor, 2); - } - - if (false !== strpos($anchor, '@')) { - // 解析域名 - [$anchor, $domain] = explode('@', $anchor, 2); - } - } elseif (strpos($url, '@') && false === strpos($url, '\\')) { - // 解析域名 - [$url, $domain] = explode('@', $url, 2); - } - } - - if ($url) { - $checkName = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : ''); - $checkDomain = $domain && is_string($domain) ? $domain : null; - - $rule = $this->route->getName($checkName, $checkDomain); - - if (empty($rule) && isset($info['query'])) { - $rule = $this->route->getName($url, $checkDomain); - // 解析地址里面参数 合并到vars - parse_str($info['query'], $params); - $vars = array_merge($params, $vars); - unset($info['query']); - } - } - - if (!empty($rule) && $match = $this->getRuleUrl($rule, $vars, $domain)) { - // 匹配路由命名标识 - $url = $match[0]; - - if ($domain && !empty($match[1])) { - $domain = $match[1]; - } - - if (!is_null($match[2])) { - $suffix = $match[2]; - } - } elseif (!empty($rule) && isset($name)) { - throw new \InvalidArgumentException('route name not exists:' . $name); - } else { - // 检测URL绑定 - $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null); - - if ($bind && 0 === strpos($url, $bind)) { - $url = substr($url, strlen($bind) + 1); - } else { - $binds = $this->route->getBind(); - - foreach ($binds as $key => $val) { - if (is_string($val) && 0 === strpos($url, $val) && substr_count($val, '/') > 1) { - $url = substr($url, strlen($val) + 1); - $domain = $key; - break; - } - } - } - - // 路由标识不存在 直接解析 - $url = $this->parseUrl($url, $domain); - - if (isset($info['query'])) { - // 解析地址里面参数 合并到vars - parse_str($info['query'], $params); - $vars = array_merge($params, $vars); - } - } - - // 还原URL分隔符 - $depr = $this->route->config('pathinfo_depr'); - $url = str_replace('/', $depr, $url); - - $file = $request->baseFile(); - if ($file && 0 !== strpos($request->url(), $file)) { - $file = str_replace('\\', '/', dirname($file)); - } - - $url = rtrim($file, '/') . '/' . $url; - - // URL后缀 - if ('/' == substr($url, -1) || '' == $url) { - $suffix = ''; - } else { - $suffix = $this->parseSuffix($suffix); - } - - // 锚点 - $anchor = !empty($anchor) ? '#' . $anchor : ''; - - // 参数组装 - if (!empty($vars)) { - // 添加参数 - if ($this->route->config('url_common_param')) { - $vars = http_build_query($vars); - $url .= $suffix . ($vars ? '?' . $vars : '') . $anchor; - } else { - foreach ($vars as $var => $val) { - $val = (string) $val; - if ('' !== $val) { - $url .= $depr . $var . $depr . urlencode($val); - } - } - - $url .= $suffix . $anchor; - } - } else { - $url .= $suffix . $anchor; - } - - // 检测域名 - $domain = $this->parseDomain($url, $domain); - - // URL组装 - return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/'); - } - - public function __toString() - { - return $this->build(); - } - - public function __debugInfo() - { - return [ - 'url' => $this->url, - 'vars' => $this->vars, - 'suffix' => $this->suffix, - 'domain' => $this->domain, - ]; - } -} diff --git a/vendor/topthink/framework/src/think/route/dispatch/Callback.php b/vendor/topthink/framework/src/think/route/dispatch/Callback.php deleted file mode 100644 index 2044ef8e..00000000 --- a/vendor/topthink/framework/src/think/route/dispatch/Callback.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route\dispatch; - -use think\route\Dispatch; - -/** - * Callback Dispatcher - */ -class Callback extends Dispatch -{ - public function exec() - { - // 执行回调方法 - $vars = array_merge($this->request->param(), $this->param); - - return $this->app->invoke($this->dispatch, $vars); - } - -} diff --git a/vendor/topthink/framework/src/think/route/dispatch/Controller.php b/vendor/topthink/framework/src/think/route/dispatch/Controller.php deleted file mode 100644 index 611101bd..00000000 --- a/vendor/topthink/framework/src/think/route/dispatch/Controller.php +++ /dev/null @@ -1,183 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route\dispatch; - -use ReflectionClass; -use ReflectionException; -use ReflectionMethod; -use think\App; -use think\exception\ClassNotFoundException; -use think\exception\HttpException; -use think\helper\Str; -use think\route\Dispatch; - -/** - * Controller Dispatcher - */ -class Controller extends Dispatch -{ - /** - * 控制器名 - * @var string - */ - protected $controller; - - /** - * 操作名 - * @var string - */ - protected $actionName; - - public function init(App $app) - { - parent::init($app); - - $result = $this->dispatch; - - if (is_string($result)) { - $result = explode('/', $result); - } - - // 获取控制器名 - $controller = strip_tags($result[0] ?: $this->rule->config('default_controller')); - - if (strpos($controller, '.')) { - $pos = strrpos($controller, '.'); - $this->controller = substr($controller, 0, $pos) . '.' . Str::studly(substr($controller, $pos + 1)); - } else { - $this->controller = Str::studly($controller); - } - - // 获取操作名 - $this->actionName = strip_tags($result[1] ?: $this->rule->config('default_action')); - - // 设置当前请求的控制器、操作 - $this->request - ->setController($this->controller) - ->setAction($this->actionName); - } - - public function exec() - { - try { - // 实例化控制器 - $instance = $this->controller($this->controller); - } catch (ClassNotFoundException $e) { - throw new HttpException(404, 'controller not exists:' . $e->getClass()); - } - - // 注册控制器中间件 - $this->registerControllerMiddleware($instance); - - return $this->app->middleware->pipeline('controller') - ->send($this->request) - ->then(function () use ($instance) { - // 获取当前操作名 - $suffix = $this->rule->config('action_suffix'); - $action = $this->actionName . $suffix; - - if (is_callable([$instance, $action])) { - $vars = $this->request->param(); - try { - $reflect = new ReflectionMethod($instance, $action); - // 严格获取当前操作方法名 - $actionName = $reflect->getName(); - if ($suffix) { - $actionName = substr($actionName, 0, -strlen($suffix)); - } - - $this->request->setAction($actionName); - } catch (ReflectionException $e) { - $reflect = new ReflectionMethod($instance, '__call'); - $vars = [$action, $vars]; - $this->request->setAction($action); - } - } else { - // 操作不存在 - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); - } - - $data = $this->app->invokeReflectMethod($instance, $reflect, $vars); - - return $this->autoResponse($data); - }); - } - - /** - * 使用反射机制注册控制器中间件 - * @access public - * @param object $controller 控制器实例 - * @return void - */ - protected function registerControllerMiddleware($controller): void - { - $class = new ReflectionClass($controller); - - if ($class->hasProperty('middleware')) { - $reflectionProperty = $class->getProperty('middleware'); - $reflectionProperty->setAccessible(true); - - $middlewares = $reflectionProperty->getValue($controller); - - foreach ($middlewares as $key => $val) { - if (!is_int($key)) { - if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { - return strtolower($item); - }, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) { - continue; - } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { - return strtolower($item); - }, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) { - continue; - } else { - $val = $key; - } - } - - if (is_string($val) && strpos($val, ':')) { - $val = explode(':', $val); - if (count($val) > 1) { - $val = [$val[0], array_slice($val, 1)]; - } - } - - $this->app->middleware->controller($val); - } - } - } - - /** - * 实例化访问控制器 - * @access public - * @param string $name 资源地址 - * @return object - * @throws ClassNotFoundException - */ - public function controller(string $name) - { - $suffix = $this->rule->config('controller_suffix') ? 'Controller' : ''; - - $controllerLayer = $this->rule->config('controller_layer') ?: 'controller'; - $emptyController = $this->rule->config('empty_controller') ?: 'Error'; - - $class = $this->app->parseClass($controllerLayer, $name . $suffix); - - if (class_exists($class)) { - return $this->app->make($class, [], true); - } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) { - return $this->app->make($emptyClass, [], true); - } - - throw new ClassNotFoundException('class not exists:' . $class, $class); - } -} diff --git a/vendor/topthink/framework/src/think/route/dispatch/Url.php b/vendor/topthink/framework/src/think/route/dispatch/Url.php deleted file mode 100644 index 147f5cb7..00000000 --- a/vendor/topthink/framework/src/think/route/dispatch/Url.php +++ /dev/null @@ -1,118 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\route\dispatch; - -use think\exception\HttpException; -use think\helper\Str; -use think\Request; -use think\route\Rule; - -/** - * Url Dispatcher - */ -class Url extends Controller -{ - - public function __construct(Request $request, Rule $rule, $dispatch) - { - $this->request = $request; - $this->rule = $rule; - // 解析默认的URL规则 - $dispatch = $this->parseUrl($dispatch); - - parent::__construct($request, $rule, $dispatch, $this->param); - } - - /** - * 解析URL地址 - * @access protected - * @param string $url URL - * @return array - */ - protected function parseUrl(string $url): array - { - $depr = $this->rule->config('pathinfo_depr'); - $bind = $this->rule->getRouter()->getDomainBind(); - - if ($bind && preg_match('/^[a-z]/is', $bind)) { - $bind = str_replace('/', $depr, $bind); - // 如果有域名绑定 - $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr); - } - - $path = $this->rule->parseUrlPath($url); - if (empty($path)) { - return [null, null]; - } - - // 解析控制器 - $controller = !empty($path) ? array_shift($path) : null; - - if ($controller && !preg_match('/^[A-Za-z0-9][\w|\.]*$/', $controller)) { - throw new HttpException(404, 'controller not exists:' . $controller); - } - - // 解析操作 - $action = !empty($path) ? array_shift($path) : null; - $var = []; - - // 解析额外参数 - if ($path) { - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { - $var[$match[1]] = strip_tags($match[2]); - }, implode('|', $path)); - } - - $panDomain = $this->request->panDomain(); - if ($panDomain && $key = array_search('*', $var)) { - // 泛域名赋值 - $var[$key] = $panDomain; - } - - // 设置当前请求的参数 - $this->param = $var; - - // 封装路由 - $route = [$controller, $action]; - - if ($this->hasDefinedRoute($route)) { - throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url)); - } - - return $route; - } - - /** - * 检查URL是否已经定义过路由 - * @access protected - * @param array $route 路由信息 - * @return bool - */ - protected function hasDefinedRoute(array $route): bool - { - [$controller, $action] = $route; - - // 检查地址是否被定义过路由 - $name = strtolower(Str::studly($controller) . '/' . $action); - - $host = $this->request->host(true); - $method = $this->request->method(); - - if ($this->rule->getRouter()->getName($name, $host, $method)) { - return true; - } - - return false; - } - -} diff --git a/vendor/topthink/framework/src/think/service/ModelService.php b/vendor/topthink/framework/src/think/service/ModelService.php deleted file mode 100644 index 87cfaf98..00000000 --- a/vendor/topthink/framework/src/think/service/ModelService.php +++ /dev/null @@ -1,47 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\service; - -use think\Model; -use think\Service; - -/** - * 模型服务类 - */ -class ModelService extends Service -{ - public function boot() - { - Model::setDb($this->app->db); - Model::setEvent($this->app->event); - Model::setInvoker([$this->app, 'invoke']); - Model::maker(function (Model $model) { - $config = $this->app->config; - - $isAutoWriteTimestamp = $model->getAutoWriteTimestamp(); - - if (is_null($isAutoWriteTimestamp)) { - // 自动写入时间戳 - $model->isAutoWriteTimestamp($config->get('database.auto_timestamp', 'timestamp')); - } - - $dateFormat = $model->getDateFormat(); - - if (is_null($dateFormat)) { - // 设置时间戳格式 - $model->setDateFormat($config->get('database.datetime_format', 'Y-m-d H:i:s')); - } - - }); - } -} diff --git a/vendor/topthink/framework/src/think/service/PaginatorService.php b/vendor/topthink/framework/src/think/service/PaginatorService.php deleted file mode 100644 index a01977d0..00000000 --- a/vendor/topthink/framework/src/think/service/PaginatorService.php +++ /dev/null @@ -1,52 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\service; - -use think\Paginator; -use think\paginator\driver\Bootstrap; -use think\Service; - -/** - * 分页服务类 - */ -class PaginatorService extends Service -{ - public function register() - { - if (!$this->app->bound(Paginator::class)) { - $this->app->bind(Paginator::class, Bootstrap::class); - } - } - - public function boot() - { - Paginator::maker(function (...$args) { - return $this->app->make(Paginator::class, $args, true); - }); - - Paginator::currentPathResolver(function () { - return $this->app->request->baseUrl(); - }); - - Paginator::currentPageResolver(function ($varPage = 'page') { - - $page = $this->app->request->param($varPage); - - if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { - return (int) $page; - } - - return 1; - }); - } -} diff --git a/vendor/topthink/framework/src/think/service/ValidateService.php b/vendor/topthink/framework/src/think/service/ValidateService.php deleted file mode 100644 index 94d7638a..00000000 --- a/vendor/topthink/framework/src/think/service/ValidateService.php +++ /dev/null @@ -1,31 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\service; - -use think\Service; -use think\Validate; - -/** - * 验证服务类 - */ -class ValidateService extends Service -{ - public function boot() - { - Validate::maker(function (Validate $validate) { - $validate->setLang($this->app->lang); - $validate->setDb($this->app->db); - $validate->setRequest($this->app->request); - }); - } -} diff --git a/vendor/topthink/framework/src/think/session/Store.php b/vendor/topthink/framework/src/think/session/Store.php deleted file mode 100644 index 49e1ba90..00000000 --- a/vendor/topthink/framework/src/think/session/Store.php +++ /dev/null @@ -1,340 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\session; - -use think\contract\SessionHandlerInterface; -use think\helper\Arr; - -class Store -{ - - /** - * Session数据 - * @var array - */ - protected $data = []; - - /** - * 是否初始化 - * @var bool - */ - protected $init = null; - - /** - * 记录Session name - * @var string - */ - protected $name = 'PHPSESSID'; - - /** - * 记录Session Id - * @var string - */ - protected $id; - - /** - * @var SessionHandlerInterface - */ - protected $handler; - - /** @var array */ - protected $serialize = []; - - public function __construct($name, SessionHandlerInterface $handler, array $serialize = null) - { - $this->name = $name; - $this->handler = $handler; - - if (!empty($serialize)) { - $this->serialize = $serialize; - } - - $this->setId(); - } - - /** - * 设置数据 - * @access public - * @param array $data - * @return void - */ - public function setData(array $data): void - { - $this->data = $data; - } - - /** - * session初始化 - * @access public - * @return void - */ - public function init(): void - { - // 读取缓存数据 - $data = $this->handler->read($this->getId()); - - if (!empty($data)) { - $this->data = array_merge($this->data, $this->unserialize($data)); - } - - $this->init = true; - } - - /** - * 设置SessionName - * @access public - * @param string $name session_name - * @return void - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * 获取sessionName - * @access public - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * session_id设置 - * @access public - * @param string $id session_id - * @return void - */ - public function setId($id = null): void - { - $this->id = is_string($id) && strlen($id) === 32 && ctype_alnum($id) ? $id : md5(microtime(true) . session_create_id()); - } - - /** - * 获取session_id - * @access public - * @return string - */ - public function getId(): string - { - return $this->id; - } - - /** - * 获取所有数据 - * @return array - */ - public function all(): array - { - return $this->data; - } - - /** - * session设置 - * @access public - * @param string $name session名称 - * @param mixed $value session值 - * @return void - */ - public function set(string $name, $value): void - { - Arr::set($this->data, $name, $value); - } - - /** - * session获取 - * @access public - * @param string $name session名称 - * @param mixed $default 默认值 - * @return mixed - */ - public function get(string $name, $default = null) - { - return Arr::get($this->data, $name, $default); - } - - /** - * session获取并删除 - * @access public - * @param string $name session名称 - * @return mixed - */ - public function pull(string $name) - { - return Arr::pull($this->data, $name); - } - - /** - * 添加数据到一个session数组 - * @access public - * @param string $key - * @param mixed $value - * @return void - */ - public function push(string $key, $value): void - { - $array = $this->get($key, []); - - $array[] = $value; - - $this->set($key, $array); - } - - /** - * 判断session数据 - * @access public - * @param string $name session名称 - * @return bool - */ - public function has(string $name): bool - { - return Arr::has($this->data, $name); - } - - /** - * 删除session数据 - * @access public - * @param string $name session名称 - * @return void - */ - public function delete(string $name): void - { - Arr::forget($this->data, $name); - } - - /** - * 清空session数据 - * @access public - * @return void - */ - public function clear(): void - { - $this->data = []; - } - - /** - * 销毁session - */ - public function destroy(): void - { - $this->clear(); - - $this->regenerate(true); - } - - /** - * 重新生成session id - * @param bool $destroy - */ - public function regenerate(bool $destroy = false): void - { - if ($destroy) { - $this->handler->delete($this->getId()); - } - - $this->setId(); - } - - /** - * 保存session数据 - * @access public - * @return void - */ - public function save(): void - { - $this->clearFlashData(); - - $sessionId = $this->getId(); - - if (!empty($this->data)) { - $data = $this->serialize($this->data); - - $this->handler->write($sessionId, $data); - } else { - $this->handler->delete($sessionId); - } - - $this->init = false; - } - - /** - * session设置 下一次请求有效 - * @access public - * @param string $name session名称 - * @param mixed $value session值 - * @return void - */ - public function flash(string $name, $value): void - { - $this->set($name, $value); - $this->push('__flash__.__next__', $name); - $this->set('__flash__.__current__', Arr::except($this->get('__flash__.__current__', []), $name)); - } - - /** - * 将本次闪存数据推迟到下次请求 - * - * @return void - */ - public function reflash(): void - { - $keys = $this->get('__flash__.__current__', []); - $values = array_unique(array_merge($this->get('__flash__.__next__', []), $keys)); - $this->set('__flash__.__next__', $values); - $this->set('__flash__.__current__', []); - } - - /** - * 清空当前请求的session数据 - * @access public - * @return void - */ - public function clearFlashData(): void - { - Arr::forget($this->data, $this->get('__flash__.__current__', [])); - if (!empty($next = $this->get('__flash__.__next__', []))) { - $this->set('__flash__.__current__', $next); - } else { - $this->delete('__flash__.__current__'); - } - $this->delete('__flash__.__next__'); - } - - /** - * 序列化数据 - * @access protected - * @param mixed $data - * @return string - */ - protected function serialize($data): string - { - $serialize = $this->serialize[0] ?? 'serialize'; - - return $serialize($data); - } - - /** - * 反序列化数据 - * @access protected - * @param string $data - * @return array - */ - protected function unserialize(string $data): array - { - $unserialize = $this->serialize[1] ?? 'unserialize'; - - return (array) $unserialize($data); - } - -} diff --git a/vendor/topthink/framework/src/think/session/driver/Cache.php b/vendor/topthink/framework/src/think/session/driver/Cache.php deleted file mode 100644 index 4fabc799..00000000 --- a/vendor/topthink/framework/src/think/session/driver/Cache.php +++ /dev/null @@ -1,50 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\session\driver; - -use Psr\SimpleCache\CacheInterface; -use think\contract\SessionHandlerInterface; -use think\helper\Arr; - -class Cache implements SessionHandlerInterface -{ - - /** @var CacheInterface */ - protected $handler; - - /** @var integer */ - protected $expire; - - /** @var string */ - protected $prefix; - - public function __construct(\think\Cache $cache, array $config = []) - { - $this->handler = $cache->store(Arr::get($config, 'store')); - $this->expire = Arr::get($config, 'expire', 1440); - $this->prefix = Arr::get($config, 'prefix', ''); - } - - public function read(string $sessionId): string - { - return (string) $this->handler->get($this->prefix . $sessionId); - } - - public function delete(string $sessionId): bool - { - return $this->handler->delete($this->prefix . $sessionId); - } - - public function write(string $sessionId, string $data): bool - { - return $this->handler->set($this->prefix . $sessionId, $data, $this->expire); - } -} diff --git a/vendor/topthink/framework/src/think/session/driver/File.php b/vendor/topthink/framework/src/think/session/driver/File.php deleted file mode 100644 index 788f3230..00000000 --- a/vendor/topthink/framework/src/think/session/driver/File.php +++ /dev/null @@ -1,249 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\session\driver; - -use Closure; -use Exception; -use FilesystemIterator; -use Generator; -use SplFileInfo; -use think\App; -use think\contract\SessionHandlerInterface; - -/** - * Session 文件驱动 - */ -class File implements SessionHandlerInterface -{ - protected $config = [ - 'path' => '', - 'expire' => 1440, - 'prefix' => '', - 'data_compress' => false, - 'gc_probability' => 1, - 'gc_divisor' => 100, - ]; - - public function __construct(App $app, array $config = []) - { - $this->config = array_merge($this->config, $config); - - if (empty($this->config['path'])) { - $this->config['path'] = $app->getRuntimePath() . 'session' . DIRECTORY_SEPARATOR; - } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { - $this->config['path'] .= DIRECTORY_SEPARATOR; - } - - $this->init(); - } - - /** - * 打开Session - * @access protected - * @throws Exception - */ - protected function init(): void - { - try { - !is_dir($this->config['path']) && mkdir($this->config['path'], 0755, true); - } catch (\Exception $e) { - // 写入失败 - } - - // 垃圾回收 - if (random_int(1, $this->config['gc_divisor']) <= $this->config['gc_probability']) { - $this->gc(); - } - } - - /** - * Session 垃圾回收 - * @access public - * @return void - */ - public function gc(): void - { - $lifetime = $this->config['expire']; - $now = time(); - - $files = $this->findFiles($this->config['path'], function (SplFileInfo $item) use ($lifetime, $now) { - return $now - $lifetime > $item->getMTime(); - }); - - foreach ($files as $file) { - $this->unlink($file->getPathname()); - } - } - - /** - * 查找文件 - * @param string $root - * @param Closure $filter - * @return Generator - */ - protected function findFiles(string $root, Closure $filter) - { - $items = new FilesystemIterator($root); - - /** @var SplFileInfo $item */ - foreach ($items as $item) { - if ($item->isDir() && !$item->isLink()) { - yield from $this->findFiles($item->getPathname(), $filter); - } else { - if ($filter($item)) { - yield $item; - } - } - } - } - - /** - * 取得变量的存储文件名 - * @access protected - * @param string $name 缓存变量名 - * @param bool $auto 是否自动创建目录 - * @return string - */ - protected function getFileName(string $name, bool $auto = false): string - { - if ($this->config['prefix']) { - // 使用子目录 - $name = $this->config['prefix'] . DIRECTORY_SEPARATOR . 'sess_' . $name; - } else { - $name = 'sess_' . $name; - } - - $filename = $this->config['path'] . $name; - $dir = dirname($filename); - - if ($auto && !is_dir($dir)) { - try { - mkdir($dir, 0755, true); - } catch (\Exception $e) { - // 创建失败 - } - } - - return $filename; - } - - /** - * 读取Session - * @access public - * @param string $sessID - * @return string - */ - public function read(string $sessID): string - { - $filename = $this->getFileName($sessID); - - if (is_file($filename) && filemtime($filename) >= time() - $this->config['expire']) { - $content = $this->readFile($filename); - - if ($this->config['data_compress'] && function_exists('gzcompress')) { - //启用数据压缩 - $content = (string) gzuncompress($content); - } - - return $content; - } - - return ''; - } - - /** - * 写文件(加锁) - * @param $path - * @param $content - * @return bool - */ - protected function writeFile($path, $content): bool - { - return (bool) file_put_contents($path, $content, LOCK_EX); - } - - /** - * 读取文件内容(加锁) - * @param $path - * @return string - */ - protected function readFile($path): string - { - $contents = ''; - - $handle = fopen($path, 'rb'); - - if ($handle) { - try { - if (flock($handle, LOCK_SH)) { - clearstatcache(true, $path); - - $contents = fread($handle, filesize($path) ?: 1); - - flock($handle, LOCK_UN); - } - } finally { - fclose($handle); - } - } - - return $contents; - } - - /** - * 写入Session - * @access public - * @param string $sessID - * @param string $sessData - * @return bool - */ - public function write(string $sessID, string $sessData): bool - { - $filename = $this->getFileName($sessID, true); - $data = $sessData; - - if ($this->config['data_compress'] && function_exists('gzcompress')) { - //数据压缩 - $data = gzcompress($data, 3); - } - - return $this->writeFile($filename, $data); - } - - /** - * 删除Session - * @access public - * @param string $sessID - * @return bool - */ - public function delete(string $sessID): bool - { - try { - return $this->unlink($this->getFileName($sessID)); - } catch (\Exception $e) { - return false; - } - } - - /** - * 判断文件是否存在后,删除 - * @access private - * @param string $file - * @return bool - */ - private function unlink(string $file): bool - { - return is_file($file) && unlink($file); - } - -} diff --git a/vendor/topthink/framework/src/think/validate/ValidateRule.php b/vendor/topthink/framework/src/think/validate/ValidateRule.php deleted file mode 100644 index b741f530..00000000 --- a/vendor/topthink/framework/src/think/validate/ValidateRule.php +++ /dev/null @@ -1,172 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\validate; - -/** - * Class ValidateRule - * @package think\validate - * @method ValidateRule confirm(mixed $rule, string $msg = '') static 验证是否和某个字段的值一致 - * @method ValidateRule different(mixed $rule, string $msg = '') static 验证是否和某个字段的值是否不同 - * @method ValidateRule egt(mixed $rule, string $msg = '') static 验证是否大于等于某个值 - * @method ValidateRule gt(mixed $rule, string $msg = '') static 验证是否大于某个值 - * @method ValidateRule elt(mixed $rule, string $msg = '') static 验证是否小于等于某个值 - * @method ValidateRule lt(mixed $rule, string $msg = '') static 验证是否小于某个值 - * @method ValidateRule eg(mixed $rule, string $msg = '') static 验证是否等于某个值 - * @method ValidateRule in(mixed $rule, string $msg = '') static 验证是否在范围内 - * @method ValidateRule notIn(mixed $rule, string $msg = '') static 验证是否不在某个范围 - * @method ValidateRule between(mixed $rule, string $msg = '') static 验证是否在某个区间 - * @method ValidateRule notBetween(mixed $rule, string $msg = '') static 验证是否不在某个区间 - * @method ValidateRule length(mixed $rule, string $msg = '') static 验证数据长度 - * @method ValidateRule max(mixed $rule, string $msg = '') static 验证数据最大长度 - * @method ValidateRule min(mixed $rule, string $msg = '') static 验证数据最小长度 - * @method ValidateRule after(mixed $rule, string $msg = '') static 验证日期 - * @method ValidateRule before(mixed $rule, string $msg = '') static 验证日期 - * @method ValidateRule expire(mixed $rule, string $msg = '') static 验证有效期 - * @method ValidateRule allowIp(mixed $rule, string $msg = '') static 验证IP许可 - * @method ValidateRule denyIp(mixed $rule, string $msg = '') static 验证IP禁用 - * @method ValidateRule regex(mixed $rule, string $msg = '') static 使用正则验证数据 - * @method ValidateRule token(mixed $rule='__token__', string $msg = '') static 验证表单令牌 - * @method ValidateRule is(mixed $rule, string $msg = '') static 验证字段值是否为有效格式 - * @method ValidateRule isRequire(mixed $rule = null, string $msg = '') static 验证字段必须 - * @method ValidateRule isNumber(mixed $rule = null, string $msg = '') static 验证字段值是否为数字 - * @method ValidateRule isArray(mixed $rule = null, string $msg = '') static 验证字段值是否为数组 - * @method ValidateRule isInteger(mixed $rule = null, string $msg = '') static 验证字段值是否为整形 - * @method ValidateRule isFloat(mixed $rule = null, string $msg = '') static 验证字段值是否为浮点数 - * @method ValidateRule isMobile(mixed $rule = null, string $msg = '') static 验证字段值是否为手机 - * @method ValidateRule isIdCard(mixed $rule = null, string $msg = '') static 验证字段值是否为身份证号码 - * @method ValidateRule isChs(mixed $rule = null, string $msg = '') static 验证字段值是否为中文 - * @method ValidateRule isChsDash(mixed $rule = null, string $msg = '') static 验证字段值是否为中文字母及下划线 - * @method ValidateRule isChsAlpha(mixed $rule = null, string $msg = '') static 验证字段值是否为中文和字母 - * @method ValidateRule isChsAlphaNum(mixed $rule = null, string $msg = '') static 验证字段值是否为中文字母和数字 - * @method ValidateRule isDate(mixed $rule = null, string $msg = '') static 验证字段值是否为有效格式 - * @method ValidateRule isBool(mixed $rule = null, string $msg = '') static 验证字段值是否为布尔值 - * @method ValidateRule isAlpha(mixed $rule = null, string $msg = '') static 验证字段值是否为字母 - * @method ValidateRule isAlphaDash(mixed $rule = null, string $msg = '') static 验证字段值是否为字母和下划线 - * @method ValidateRule isAlphaNum(mixed $rule = null, string $msg = '') static 验证字段值是否为字母和数字 - * @method ValidateRule isAccepted(mixed $rule = null, string $msg = '') static 验证字段值是否为yes, on, 或是 1 - * @method ValidateRule isEmail(mixed $rule = null, string $msg = '') static 验证字段值是否为有效邮箱格式 - * @method ValidateRule isUrl(mixed $rule = null, string $msg = '') static 验证字段值是否为有效URL地址 - * @method ValidateRule activeUrl(mixed $rule, string $msg = '') static 验证是否为合格的域名或者IP - * @method ValidateRule ip(mixed $rule, string $msg = '') static 验证是否有效IP - * @method ValidateRule fileExt(mixed $rule, string $msg = '') static 验证文件后缀 - * @method ValidateRule fileMime(mixed $rule, string $msg = '') static 验证文件类型 - * @method ValidateRule fileSize(mixed $rule, string $msg = '') static 验证文件大小 - * @method ValidateRule image(mixed $rule, string $msg = '') static 验证图像文件 - * @method ValidateRule method(mixed $rule, string $msg = '') static 验证请求类型 - * @method ValidateRule dateFormat(mixed $rule, string $msg = '') static 验证时间和日期是否符合指定格式 - * @method ValidateRule unique(mixed $rule, string $msg = '') static 验证是否唯一 - * @method ValidateRule behavior(mixed $rule, string $msg = '') static 使用行为类验证 - * @method ValidateRule filter(mixed $rule, string $msg = '') static 使用filter_var方式验证 - * @method ValidateRule requireIf(mixed $rule, string $msg = '') static 验证某个字段等于某个值的时候必须 - * @method ValidateRule requireCallback(mixed $rule, string $msg = '') static 通过回调方法验证某个字段是否必须 - * @method ValidateRule requireWith(mixed $rule, string $msg = '') static 验证某个字段有值的情况下必须 - * @method ValidateRule must(mixed $rule = null, string $msg = '') static 必须验证 - */ -class ValidateRule -{ - // 验证字段的名称 - protected $title; - - // 当前验证规则 - protected $rule = []; - - // 验证提示信息 - protected $message = []; - - /** - * 添加验证因子 - * @access protected - * @param string $name 验证名称 - * @param mixed $rule 验证规则 - * @param string $msg 提示信息 - * @return $this - */ - protected function addItem(string $name, $rule = null, string $msg = '') - { - if ($rule || 0 === $rule) { - $this->rule[$name] = $rule; - } else { - $this->rule[] = $name; - } - - $this->message[] = $msg; - - return $this; - } - - /** - * 获取验证规则 - * @access public - * @return array - */ - public function getRule(): array - { - return $this->rule; - } - - /** - * 获取验证字段名称 - * @access public - * @return string - */ - public function getTitle(): string - { - return $this->title ?: ''; - } - - /** - * 获取验证提示 - * @access public - * @return array - */ - public function getMsg(): array - { - return $this->message; - } - - /** - * 设置验证字段名称 - * @access public - * @return $this - */ - public function title(string $title) - { - $this->title = $title; - - return $this; - } - - public function __call($method, $args) - { - if ('is' == strtolower(substr($method, 0, 2))) { - $method = substr($method, 2); - } - - array_unshift($args, lcfirst($method)); - - return call_user_func_array([$this, 'addItem'], $args); - } - - public static function __callStatic($method, $args) - { - $rule = new static(); - - if ('is' == strtolower(substr($method, 0, 2))) { - $method = substr($method, 2); - } - - array_unshift($args, lcfirst($method)); - - return call_user_func_array([$rule, 'addItem'], $args); - } -} diff --git a/vendor/topthink/framework/src/think/view/driver/Php.php b/vendor/topthink/framework/src/think/view/driver/Php.php deleted file mode 100644 index 9e6e54aa..00000000 --- a/vendor/topthink/framework/src/think/view/driver/Php.php +++ /dev/null @@ -1,191 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\view\driver; - -use RuntimeException; -use think\App; -use think\contract\TemplateHandlerInterface; -use think\helper\Str; - -/** - * PHP原生模板驱动 - */ -class Php implements TemplateHandlerInterface -{ - protected $template; - protected $content; - protected $app; - - // 模板引擎参数 - protected $config = [ - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 视图目录名 - 'view_dir_name' => 'view', - // 应用模板路径 - 'view_path' => '', - // 模板文件后缀 - 'view_suffix' => 'php', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - ]; - - public function __construct(App $app, array $config = []) - { - $this->app = $app; - $this->config = array_merge($this->config, (array) $config); - } - - /** - * 检测是否存在模板文件 - * @access public - * @param string $template 模板文件或者模板规则 - * @return bool - */ - public function exists(string $template): bool - { - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - // 获取模板文件名 - $template = $this->parseTemplate($template); - } - - return is_file($template); - } - - /** - * 渲染模板文件 - * @access public - * @param string $template 模板文件 - * @param array $data 模板变量 - * @return void - */ - public function fetch(string $template, array $data = []): void - { - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - // 获取模板文件名 - $template = $this->parseTemplate($template); - } - - // 模板不存在 抛出异常 - if (!is_file($template)) { - throw new RuntimeException('template not exists:' . $template); - } - - $this->template = $template; - - extract($data, EXTR_OVERWRITE); - - include $this->template; - } - - /** - * 渲染模板内容 - * @access public - * @param string $content 模板内容 - * @param array $data 模板变量 - * @return void - */ - public function display(string $content, array $data = []): void - { - $this->content = $content; - - extract($data, EXTR_OVERWRITE); - eval('?>' . $this->content); - } - - /** - * 自动定位模板文件 - * @access private - * @param string $template 模板文件规则 - * @return string - */ - private function parseTemplate(string $template): string - { - $request = $this->app->request; - - // 获取视图根目录 - if (strpos($template, '@')) { - // 跨应用调用 - [$app, $template] = explode('@', $template); - } - - if ($this->config['view_path'] && !isset($app)) { - $path = $this->config['view_path']; - } else { - $appName = isset($app) ? $app : $this->app->http->getName(); - $view = $this->config['view_dir_name']; - - if (is_dir($this->app->getAppPath() . $view)) { - $path = isset($app) ? $this->app->getBasePath() . ($appName ? $appName . DIRECTORY_SEPARATOR : '') . $view . DIRECTORY_SEPARATOR : $this->app->getAppPath() . $view . DIRECTORY_SEPARATOR; - } else { - $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . ($appName ? $appName . DIRECTORY_SEPARATOR : ''); - } - } - - $depr = $this->config['view_depr']; - - if (0 !== strpos($template, '/')) { - $template = str_replace(['/', ':'], $depr, $template); - $controller = $request->controller(); - if (strpos($controller, '.')) { - $pos = strrpos($controller, '.'); - $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1)); - } else { - $controller = Str::snake($controller); - } - - if ($controller) { - if ('' == $template) { - // 如果模板文件名为空 按照默认规则定位 - if (2 == $this->config['auto_rule']) { - $template = $request->action(true); - } elseif (3 == $this->config['auto_rule']) { - $template = $request->action(); - } else { - $template = Str::snake($request->action()); - } - - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; - } elseif (false === strpos($template, $depr)) { - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; - } - } - } else { - $template = str_replace(['/', ':'], $depr, substr($template, 1)); - } - - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); - } - - /** - * 配置模板引擎 - * @access private - * @param array $config 参数 - * @return void - */ - public function config(array $config): void - { - $this->config = array_merge($this->config, $config); - } - - /** - * 获取模板引擎配置 - * @access public - * @param string $name 参数名 - * @return mixed - */ - public function getConfig(string $name) - { - return $this->config[$name] ?? null; - } -} diff --git a/vendor/topthink/framework/src/tpl/think_exception.tpl b/vendor/topthink/framework/src/tpl/think_exception.tpl deleted file mode 100644 index 7766caf5..00000000 --- a/vendor/topthink/framework/src/tpl/think_exception.tpl +++ /dev/null @@ -1,502 +0,0 @@ -'.end($names).''; - } -} - -if (!function_exists('parse_file')) { - function parse_file($file, $line) - { - return ''.basename($file)." line {$line}".''; - } -} - -if (!function_exists('parse_args')) { - function parse_args($args) - { - $result = []; - foreach ($args as $key => $item) { - switch (true) { - case is_object($item): - $value = sprintf('object(%s)', parse_class(get_class($item))); - break; - case is_array($item): - if (count($item) > 3) { - $value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3))); - } else { - $value = sprintf('[%s]', parse_args($item)); - } - break; - case is_string($item): - if (strlen($item) > 20) { - $value = sprintf( - '\'%s...\'', - htmlentities($item), - htmlentities(substr($item, 0, 20)) - ); - } else { - $value = sprintf("'%s'", htmlentities($item)); - } - break; - case is_int($item): - case is_float($item): - $value = $item; - break; - case is_null($item): - $value = 'null'; - break; - case is_bool($item): - $value = '' . ($item ? 'true' : 'false') . ''; - break; - case is_resource($item): - $value = 'resource'; - break; - default: - $value = htmlentities(str_replace("\n", '', var_export(strval($item), true))); - break; - } - - $result[] = is_int($key) ? $value : "'{$key}' => {$value}"; - } - - return implode(', ', $result); - } -} -if (!function_exists('echo_value')) { - function echo_value($val) - { - if (is_array($val) || is_object($val)) { - echo htmlentities(json_encode($val, JSON_PRETTY_PRINT)); - } elseif (is_bool($val)) { - echo $val ? 'true' : 'false'; - } elseif (is_scalar($val)) { - echo htmlentities($val); - } else { - echo 'Resource'; - } - } -} -?> - - - - - 系统发生错误 - - - - - - $trace) { ?> -
    -
    -
    -
    -

    -
    -

    -
    -
    - -
    -
      $value) { ?>
    1. ">
    -
    - -
    -

    Call Stack

    -
      -
    1. - -
    2. - -
    3. - -
    -
    -
    - - -
    -

    -
    - - - -
    -

    Exception Datas

    - $value) { ?> - - - - - - - $val) { ?> - - - - - - - -
    empty
    - -
    - - - -
    -

    Environment Variables

    - $value) { ?> - - - - - - - $val) { ?> - - - - - - - -
    empty
    - -
    - - - - - - - - diff --git a/vendor/topthink/framework/tests/AppTest.php b/vendor/topthink/framework/tests/AppTest.php deleted file mode 100644 index 6b860152..00000000 --- a/vendor/topthink/framework/tests/AppTest.php +++ /dev/null @@ -1,215 +0,0 @@ - 'class', - ]; - - public function register() - { - - } - - public function boot() - { - - } -} - -/** - * @property array initializers - */ -class AppTest extends TestCase -{ - /** @var App */ - protected $app; - - protected function setUp() - { - $this->app = new App(); - } - - protected function tearDown(): void - { - m::close(); - } - - public function testService() - { - $this->app->register(stdClass::class); - - $this->assertInstanceOf(stdClass::class, $this->app->getService(stdClass::class)); - - $service = m::mock(SomeService::class); - - $service->shouldReceive('register')->once(); - - $this->app->register($service); - - $this->assertEquals($service, $this->app->getService(SomeService::class)); - - $service2 = m::mock(SomeService::class); - - $service2->shouldReceive('register')->once(); - - $this->app->register($service2); - - $this->assertEquals($service, $this->app->getService(SomeService::class)); - - $this->app->register($service2, true); - - $this->assertEquals($service2, $this->app->getService(SomeService::class)); - - $service->shouldReceive('boot')->once(); - $service2->shouldReceive('boot')->once(); - - $this->app->boot(); - } - - public function testDebug() - { - $this->app->debug(false); - - $this->assertFalse($this->app->isDebug()); - - $this->app->debug(true); - - $this->assertTrue($this->app->isDebug()); - } - - public function testNamespace() - { - $namespace = 'test'; - - $this->app->setNamespace($namespace); - - $this->assertEquals($namespace, $this->app->getNamespace()); - } - - public function testVersion() - { - $this->assertEquals(App::VERSION, $this->app->version()); - } - - public function testPath() - { - $rootPath = __DIR__ . DIRECTORY_SEPARATOR; - - $app = new App($rootPath); - - $this->assertEquals($rootPath, $app->getRootPath()); - - $this->assertEquals(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $app->getThinkPath()); - - $this->assertEquals($rootPath . 'app' . DIRECTORY_SEPARATOR, $app->getAppPath()); - - $appPath = $rootPath . 'app' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR; - $app->setAppPath($appPath); - $this->assertEquals($appPath, $app->getAppPath()); - - $this->assertEquals($rootPath . 'app' . DIRECTORY_SEPARATOR, $app->getBasePath()); - - $this->assertEquals($rootPath . 'config' . DIRECTORY_SEPARATOR, $app->getConfigPath()); - - $this->assertEquals($rootPath . 'runtime' . DIRECTORY_SEPARATOR, $app->getRuntimePath()); - - $runtimePath = $rootPath . 'runtime' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR; - $app->setRuntimePath($runtimePath); - $this->assertEquals($runtimePath, $app->getRuntimePath()); - } - - /** - * @param vfsStreamDirectory $root - * @param bool $debug - * @return App - */ - protected function prepareAppForInitialize(vfsStreamDirectory $root, $debug = true) - { - $rootPath = $root->url() . DIRECTORY_SEPARATOR; - - $app = new App($rootPath); - - $initializer = m::mock(); - $initializer->shouldReceive('init')->once()->with($app); - - $app->instance($initializer->mockery_getName(), $initializer); - - (function () use ($initializer) { - $this->initializers = [$initializer->mockery_getName()]; - })->call($app); - - $env = m::mock(Env::class); - $env->shouldReceive('load')->once()->with($rootPath . '.env'); - $env->shouldReceive('get')->once()->with('config_ext', '.php')->andReturn('.php'); - $env->shouldReceive('get')->once()->with('app_debug')->andReturn($debug); - - $event = m::mock(Event::class); - $event->shouldReceive('trigger')->once()->with(AppInit::class); - $event->shouldReceive('bind')->once()->with([]); - $event->shouldReceive('listenEvents')->once()->with([]); - $event->shouldReceive('subscribe')->once()->with([]); - - $app->instance('env', $env); - $app->instance('event', $event); - - return $app; - } - - public function testInitialize() - { - $root = vfsStream::setup('rootDir', null, [ - '.env' => '', - 'app' => [ - 'common.php' => '', - 'event.php' => '[],"listen"=>[],"subscribe"=>[]];', - 'provider.php' => ' [ - 'app.php' => 'prepareAppForInitialize($root, true); - - $app->debug(false); - - $app->initialize(); - - $this->assertIsInt($app->getBeginMem()); - $this->assertIsFloat($app->getBeginTime()); - - $this->assertTrue($app->initialized()); - } - - public function testFactory() - { - $this->assertInstanceOf(stdClass::class, App::factory(stdClass::class)); - - $this->expectException(ClassNotFoundException::class); - - App::factory('SomeClass'); - } - - public function testParseClass() - { - $this->assertEquals('app\\controller\\SomeClass', $this->app->parseClass('controller', 'some_class')); - $this->app->setNamespace('app2'); - $this->assertEquals('app2\\controller\\SomeClass', $this->app->parseClass('controller', 'some_class')); - } - -} diff --git a/vendor/topthink/framework/tests/CacheTest.php b/vendor/topthink/framework/tests/CacheTest.php deleted file mode 100644 index 5b5a13cb..00000000 --- a/vendor/topthink/framework/tests/CacheTest.php +++ /dev/null @@ -1,149 +0,0 @@ -app = m::mock(App::class)->makePartial(); - - Container::setInstance($this->app); - $this->app->shouldReceive('make')->with(App::class)->andReturn($this->app); - $this->config = m::mock(Config::class)->makePartial(); - $this->app->shouldReceive('get')->with('config')->andReturn($this->config); - - $this->cache = new Cache($this->app); - } - - public function testGetConfig() - { - $config = [ - 'default' => 'file', - ]; - - $this->config->shouldReceive('get')->with('cache')->andReturn($config); - - $this->assertEquals($config, $this->cache->getConfig()); - - $this->expectException(InvalidArgumentException::class); - $this->cache->getStoreConfig('foo'); - } - - public function testCacheManagerInstances() - { - $this->config->shouldReceive('get')->with("cache.stores.single", null)->andReturn(['type' => 'file']); - - $channel1 = $this->cache->store('single'); - $channel2 = $this->cache->store('single'); - - $this->assertSame($channel1, $channel2); - } - - public function testFileCache() - { - $root = vfsStream::setup(); - - $this->config->shouldReceive('get')->with("cache.default", null)->andReturn('file'); - - $this->config->shouldReceive('get')->with("cache.stores.file", null)->andReturn(['type' => 'file', 'path' => $root->url()]); - - $this->cache->set('foo', 5); - $this->cache->inc('foo'); - $this->assertEquals(6, $this->cache->get('foo')); - $this->cache->dec('foo', 2); - $this->assertEquals(4, $this->cache->get('foo')); - - $this->cache->set('bar', true); - $this->assertTrue($this->cache->get('bar')); - - $this->cache->set('baz', null); - $this->assertNull($this->cache->get('baz')); - - $this->assertTrue($this->cache->has('baz')); - $this->cache->delete('baz'); - $this->assertFalse($this->cache->has('baz')); - $this->assertNull($this->cache->get('baz')); - $this->assertFalse($this->cache->get('baz', false)); - - $this->assertTrue($root->hasChildren()); - $this->cache->clear(); - $this->assertFalse($root->hasChildren()); - - //tags - $this->cache->tag('foo')->set('bar', 'foobar'); - $this->assertEquals('foobar', $this->cache->get('bar')); - $this->cache->tag('foo')->clear(); - $this->assertFalse($this->cache->has('bar')); - - //multiple - $this->cache->setMultiple(['foo' => ['foobar', 'bar'], 'foobar' => ['foo', 'bar']]); - $this->assertEquals(['foo' => ['foobar', 'bar'], 'foobar' => ['foo', 'bar']], $this->cache->getMultiple(['foo', 'foobar'])); - $this->assertTrue($this->cache->deleteMultiple(['foo', 'foobar'])); - } - - public function testRedisCache() - { - if (extension_loaded('redis')) { - return; - } - $this->config->shouldReceive('get')->with("cache.default", null)->andReturn('redis'); - $this->config->shouldReceive('get')->with("cache.stores.redis", null)->andReturn(['type' => 'redis']); - - $redis = m::mock('overload:\Predis\Client'); - - $redis->shouldReceive("set")->once()->with('foo', 5)->andReturnTrue(); - $redis->shouldReceive("incrby")->once()->with('foo', 1)->andReturnTrue(); - $redis->shouldReceive("decrby")->once()->with('foo', 2)->andReturnTrue(); - $redis->shouldReceive("get")->once()->with('foo')->andReturn('6'); - $redis->shouldReceive("get")->once()->with('foo')->andReturn('4'); - $redis->shouldReceive("set")->once()->with('bar', serialize(true))->andReturnTrue(); - $redis->shouldReceive("set")->once()->with('baz', serialize(null))->andReturnTrue(); - $redis->shouldReceive("del")->once()->with('baz')->andReturnTrue(); - $redis->shouldReceive("flushDB")->once()->andReturnTrue(); - $redis->shouldReceive("set")->once()->with('bar', serialize('foobar'))->andReturnTrue(); - $redis->shouldReceive("sAdd")->once()->with('tag:' . md5('foo'), 'bar')->andReturnTrue(); - $redis->shouldReceive("sMembers")->once()->with('tag:' . md5('foo'))->andReturn(['bar']); - $redis->shouldReceive("del")->once()->with(['bar'])->andReturnTrue(); - $redis->shouldReceive("del")->once()->with('tag:' . md5('foo'))->andReturnTrue(); - - $this->cache->set('foo', 5); - $this->cache->inc('foo'); - $this->assertEquals(6, $this->cache->get('foo')); - $this->cache->dec('foo', 2); - $this->assertEquals(4, $this->cache->get('foo')); - - $this->cache->set('bar', true); - $this->cache->set('baz', null); - $this->cache->delete('baz'); - $this->cache->clear(); - - //tags - $this->cache->tag('foo')->set('bar', 'foobar'); - $this->cache->tag('foo')->clear(); - } -} diff --git a/vendor/topthink/framework/tests/ConfigTest.php b/vendor/topthink/framework/tests/ConfigTest.php deleted file mode 100644 index 271a34fc..00000000 --- a/vendor/topthink/framework/tests/ConfigTest.php +++ /dev/null @@ -1,46 +0,0 @@ -setContent(" 'value1','key2'=>'value2'];"); - $root->addChild($file); - - $config = new Config(); - - $config->load($file->url(), 'test'); - - $this->assertEquals('value1', $config->get('test.key1')); - $this->assertEquals('value2', $config->get('test.key2')); - - $this->assertSame(['key1' => 'value1', 'key2' => 'value2'], $config->get('test')); - } - - public function testSetAndGet() - { - $config = new Config(); - - $config->set([ - 'key1' => 'value1', - 'key2' => [ - 'key3' => 'value3', - ], - ], 'test'); - - $this->assertTrue($config->has('test.key1')); - $this->assertEquals('value1', $config->get('test.key1')); - $this->assertEquals('value3', $config->get('test.key2.key3')); - - $this->assertEquals(['key3' => 'value3'], $config->get('test.key2')); - $this->assertFalse($config->has('test.key3')); - $this->assertEquals('none', $config->get('test.key3', 'none')); - } -} diff --git a/vendor/topthink/framework/tests/ContainerTest.php b/vendor/topthink/framework/tests/ContainerTest.php deleted file mode 100644 index e27deb08..00000000 --- a/vendor/topthink/framework/tests/ContainerTest.php +++ /dev/null @@ -1,314 +0,0 @@ -name = $name; - } - - public function some(Container $container) - { - } - - protected function protectionFun() - { - return true; - } - - public static function test(Container $container) - { - return $container; - } - - public static function __make() - { - return new self('Taylor'); - } -} - -class SomeClass -{ - public $container; - - public $count = 0; - - public function __construct(Container $container) - { - $this->container = $container; - } -} - -class ContainerTest extends TestCase -{ - protected function tearDown(): void - { - Container::setInstance(null); - } - - public function testClosureResolution() - { - $container = new Container; - - Container::setInstance($container); - - $container->bind('name', function () { - return 'Taylor'; - }); - - $this->assertEquals('Taylor', $container->make('name')); - - $this->assertEquals('Taylor', Container::pull('name')); - } - - public function testGet() - { - $container = new Container; - - $this->expectException(ClassNotFoundException::class); - $this->expectExceptionMessage('class not exists: name'); - $container->get('name'); - - $container->bind('name', function () { - return 'Taylor'; - }); - - $this->assertSame('Taylor', $container->get('name')); - } - - public function testExist() - { - $container = new Container; - - $container->bind('name', function () { - return 'Taylor'; - }); - - $this->assertFalse($container->exists("name")); - - $container->make('name'); - - $this->assertTrue($container->exists('name')); - } - - public function testInstance() - { - $container = new Container; - - $container->bind('name', function () { - return 'Taylor'; - }); - - $this->assertEquals('Taylor', $container->get('name')); - - $container->bind('name2', Taylor::class); - - $object = new stdClass(); - - $this->assertFalse($container->exists('name2')); - - $container->instance('name2', $object); - - $this->assertTrue($container->exists('name2')); - - $this->assertTrue($container->exists(Taylor::class)); - - $this->assertEquals($object, $container->make(Taylor::class)); - - unset($container->name1); - - $this->assertFalse($container->exists('name1')); - - $container->delete('name2'); - - $this->assertFalse($container->exists('name2')); - - foreach ($container as $class => $instance) { - - } - } - - public function testBind() - { - $container = new Container; - - $object = new stdClass(); - - $container->bind(['name' => Taylor::class]); - - $container->bind('name2', $object); - - $container->bind('name3', Taylor::class); - $container->bind('name3', Taylor::class); - - $container->name4 = $object; - - $container['name5'] = $object; - - $this->assertTrue(isset($container->name4)); - - $this->assertTrue(isset($container['name5'])); - - $this->assertInstanceOf(Taylor::class, $container->get('name')); - - $this->assertSame($object, $container->get('name2')); - - $this->assertSame($object, $container->name4); - - $this->assertSame($object, $container['name5']); - - $this->assertInstanceOf(Taylor::class, $container->get('name3')); - - unset($container['name']); - - $this->assertFalse(isset($container['name'])); - - unset($container->name3); - - $this->assertFalse(isset($container->name3)); - } - - public function testAutoConcreteResolution() - { - $container = new Container; - - $taylor = $container->make(Taylor::class); - - $this->assertInstanceOf(Taylor::class, $taylor); - $this->assertAttributeSame('Taylor', 'name', $taylor); - } - - public function testGetAndSetInstance() - { - $this->assertInstanceOf(Container::class, Container::getInstance()); - - $object = new stdClass(); - - Container::setInstance($object); - - $this->assertSame($object, Container::getInstance()); - - Container::setInstance(function () { - return $this; - }); - - $this->assertSame($this, Container::getInstance()); - } - - public function testResolving() - { - $container = new Container(); - $container->bind(Container::class, $container); - - $container->resolving(function (SomeClass $taylor, Container $container) { - $taylor->count++; - }); - $container->resolving(SomeClass::class, function (SomeClass $taylor, Container $container) { - $taylor->count++; - }); - - /** @var SomeClass $someClass */ - $someClass = $container->invokeClass(SomeClass::class); - $this->assertEquals(2, $someClass->count); - } - - public function testInvokeFunctionWithoutMethodThrowsException() - { - $this->expectException(FuncNotFoundException::class); - $this->expectExceptionMessage('function not exists: ContainerTestCallStub()'); - $container = new Container(); - $container->invokeFunction('ContainerTestCallStub', []); - } - - public function testInvokeProtectionMethod() - { - $container = new Container(); - $this->assertTrue($container->invokeMethod([Taylor::class, 'protectionFun'], [], true)); - } - - public function testInvoke() - { - $container = new Container(); - - Container::setInstance($container); - - $container->bind(Container::class, $container); - - $stub = $this->createMock(Taylor::class); - - $stub->expects($this->once())->method('some')->with($container)->will($this->returnSelf()); - - $container->invokeMethod([$stub, 'some']); - - $this->assertEquals('48', $container->invoke('ord', ['0'])); - - $this->assertSame($container, $container->invoke(Taylor::class . '::test', [])); - - $this->assertSame($container, $container->invokeMethod(Taylor::class . '::test')); - - $reflect = new ReflectionMethod($container, 'exists'); - - $this->assertTrue($container->invokeReflectMethod($container, $reflect, [Container::class])); - - $this->assertSame($container, $container->invoke(function (Container $container) { - return $container; - })); - - $this->assertSame($container, $container->invoke(Taylor::class . '::test')); - - $object = $container->invokeClass(SomeClass::class); - $this->assertInstanceOf(SomeClass::class, $object); - $this->assertSame($container, $object->container); - - $stdClass = new stdClass(); - - $container->invoke(function (Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) { - $this->assertEquals('value1', $key1); - $this->assertEquals('default', $key2); - $this->assertEquals('value2', $lowKey); - $this->assertSame($stdClass, $stdObject); - return $container; - }, ['some' => $stdClass, 'key1' => 'value1', 'low_key' => 'value2']); - } - - public function testInvokeMethodNotExists() - { - $container = $this->resolveContainer(); - $this->expectException(FuncNotFoundException::class); - - $container->invokeMethod([SomeClass::class, 'any']); - } - - public function testInvokeClassNotExists() - { - $container = new Container(); - - Container::setInstance($container); - - $container->bind(Container::class, $container); - - $this->expectExceptionObject(new ClassNotFoundException('class not exists: SomeClass')); - - $container->invokeClass('SomeClass'); - } - - protected function resolveContainer() - { - $container = new Container(); - - Container::setInstance($container); - return $container; - } - -} diff --git a/vendor/topthink/framework/tests/DbTest.php b/vendor/topthink/framework/tests/DbTest.php deleted file mode 100644 index 3bd0c1e9..00000000 --- a/vendor/topthink/framework/tests/DbTest.php +++ /dev/null @@ -1,49 +0,0 @@ -shouldReceive('get')->with('database.cache_store', null)->andReturn(null); - $cache->shouldReceive('store')->with(null)->andReturn($store); - - $db = Db::__make($event, $config, $log, $cache); - - $config->shouldReceive('get')->with('database.foo', null)->andReturn('foo'); - $this->assertEquals('foo', $db->getConfig('foo')); - - $config->shouldReceive('get')->with('database', [])->andReturn([]); - $this->assertEquals([], $db->getConfig()); - - $callback = function () { - }; - $event->shouldReceive('listen')->with('db.some', $callback); - $db->event('some', $callback); - - $event->shouldReceive('trigger')->with('db.some', null, false); - $db->trigger('some'); - } - -} diff --git a/vendor/topthink/framework/tests/EnvTest.php b/vendor/topthink/framework/tests/EnvTest.php deleted file mode 100644 index cf2e65f8..00000000 --- a/vendor/topthink/framework/tests/EnvTest.php +++ /dev/null @@ -1,82 +0,0 @@ -setContent("key1=value1\nkey2=value2"); - $root->addChild($envFile); - - $env = new Env(); - - $env->load($envFile->url()); - - $this->assertEquals('value1', $env->get('key1')); - $this->assertEquals('value2', $env->get('key2')); - - $this->assertSame(['KEY1' => 'value1', 'KEY2' => 'value2'], $env->get()); - } - - public function testServerEnv() - { - $env = new Env(); - - $this->assertEquals('value2', $env->get('key2', 'value2')); - - putenv('PHP_KEY7=value7'); - putenv('PHP_KEY8=false'); - putenv('PHP_KEY9=true'); - - $this->assertEquals('value7', $env->get('key7')); - $this->assertFalse($env->get('KEY8')); - $this->assertTrue($env->get('key9')); - } - - public function testSetEnv() - { - $env = new Env(); - - $env->set([ - 'key1' => 'value1', - 'key2' => [ - 'key1' => 'value1-2', - ], - ]); - - $env->set('key3', 'value3'); - - $env->key4 = 'value4'; - - $env['key5'] = 'value5'; - - $this->assertEquals('value1', $env->get('key1')); - $this->assertEquals('value1-2', $env->get('key2.key1')); - - $this->assertEquals('value3', $env->get('key3')); - - $this->assertEquals('value4', $env->key4); - - $this->assertEquals('value5', $env['key5']); - - $this->expectException(Exception::class); - - unset($env['key5']); - } - - public function testHasEnv() - { - $env = new Env(); - $env->set(['foo' => 'bar']); - $this->assertTrue($env->has('foo')); - $this->assertTrue(isset($env->foo)); - $this->assertTrue($env->offsetExists('foo')); - } -} diff --git a/vendor/topthink/framework/tests/EventTest.php b/vendor/topthink/framework/tests/EventTest.php deleted file mode 100644 index ded5a36d..00000000 --- a/vendor/topthink/framework/tests/EventTest.php +++ /dev/null @@ -1,134 +0,0 @@ -app = m::mock(App::class)->makePartial(); - - Container::setInstance($this->app); - $this->app->shouldReceive('make')->with(App::class)->andReturn($this->app); - $this->config = m::mock(Config::class)->makePartial(); - $this->app->shouldReceive('get')->with('config')->andReturn($this->config); - - $this->event = new Event($this->app); - } - - public function testBasic() - { - $this->event->bind(['foo' => 'baz']); - - $this->event->listen('foo', function ($bar) { - $this->assertEquals('bar', $bar); - }); - - $this->assertTrue($this->event->hasListener('foo')); - - $this->event->trigger('baz', 'bar'); - - $this->event->remove('foo'); - - $this->assertFalse($this->event->hasListener('foo')); - } - - public function testOnceEvent() - { - $this->event->listen('AppInit', function ($bar) { - $this->assertEquals('bar', $bar); - return 'foo'; - }); - - $this->assertEquals('foo', $this->event->trigger('AppInit', 'bar', true)); - $this->assertEquals(['foo'], $this->event->trigger('AppInit', 'bar')); - } - - public function testClassListener() - { - $listener = m::mock("overload:SomeListener", TestListener::class); - - $listener->shouldReceive('handle')->andReturnTrue(); - - $this->event->listen('some', "SomeListener"); - - $this->assertTrue($this->event->until('some')); - } - - public function testSubscribe() - { - $listener = m::mock("overload:SomeListener", TestListener::class); - - $listener->shouldReceive('subscribe')->andReturnUsing(function (Event $event) use ($listener) { - - $listener->shouldReceive('onBar')->once()->andReturnFalse(); - - $event->listenEvents(['SomeListener::onBar' => [[$listener, 'onBar']]]); - }); - - $this->event->subscribe('SomeListener'); - - $this->assertTrue($this->event->hasListener('SomeListener::onBar')); - - $this->event->trigger('SomeListener::onBar'); - } - - public function testAutoObserve() - { - $listener = m::mock("overload:SomeListener", TestListener::class); - - $listener->shouldReceive('onBar')->once(); - - $this->app->shouldReceive('make')->with('SomeListener')->andReturn($listener); - - $this->event->observe('SomeListener'); - - $this->event->trigger('bar'); - } - -} - -class TestListener -{ - public function handle() - { - - } - - public function onBar() - { - - } - - public function onFoo() - { - - } - - public function subscribe() - { - - } -} diff --git a/vendor/topthink/framework/tests/FilesystemTest.php b/vendor/topthink/framework/tests/FilesystemTest.php deleted file mode 100644 index df5ffe20..00000000 --- a/vendor/topthink/framework/tests/FilesystemTest.php +++ /dev/null @@ -1,131 +0,0 @@ -app = m::mock(App::class)->makePartial(); - Container::setInstance($this->app); - $this->app->shouldReceive('make')->with(App::class)->andReturn($this->app); - $this->config = m::mock(Config::class); - $this->config->shouldReceive('get')->with('filesystem.default', null)->andReturn('local'); - $this->app->shouldReceive('get')->with('config')->andReturn($this->config); - $this->filesystem = new Filesystem($this->app); - - $this->root = vfsStream::setup('rootDir'); - } - - protected function tearDown(): void - { - m::close(); - } - - public function testDisk() - { - $this->config->shouldReceive('get')->with('filesystem.disks.local', null)->andReturn([ - 'type' => 'local', - 'root' => $this->root->url(), - ]); - - $this->config->shouldReceive('get')->with('filesystem.disks.foo', null)->andReturn([ - 'type' => 'local', - 'root' => $this->root->url(), - ]); - - $this->assertInstanceOf(Local::class, $this->filesystem->disk()); - - $this->assertInstanceOf(Local::class, $this->filesystem->disk('foo')); - } - - public function testCache() - { - $this->config->shouldReceive('get')->with('filesystem.disks.local', null)->andReturn([ - 'type' => 'local', - 'root' => $this->root->url(), - 'cache' => true, - ]); - - $this->assertInstanceOf(Local::class, $this->filesystem->disk()); - - $this->config->shouldReceive('get')->with('filesystem.disks.cache', null)->andReturn([ - 'type' => NullDriver::class, - 'root' => $this->root->url(), - 'cache' => [ - 'store' => 'flysystem', - ], - ]); - - $cache = m::mock(Cache::class); - - $cacheDriver = m::mock(File::class); - - $cache->shouldReceive('store')->once()->with('flysystem')->andReturn($cacheDriver); - - $this->app->shouldReceive('make')->with(Cache::class)->andReturn($cache); - - $cacheDriver->shouldReceive('get')->with('flysystem')->once()->andReturn(null); - - $cacheDriver->shouldReceive('set')->withAnyArgs(); - - $this->filesystem->disk('cache')->put('test.txt', 'aa'); - } - - public function testPutFile() - { - $root = vfsStream::setup('rootDir', null, [ - 'foo.jpg' => 'hello', - ]); - - $this->config->shouldReceive('get')->with('filesystem.disks.local', null)->andReturn([ - 'type' => NullDriver::class, - 'root' => $root->url(), - 'cache' => true, - ]); - - $file = m::mock(\think\File::class); - - $file->shouldReceive('hashName')->with(null)->once()->andReturn('foo.jpg'); - - $file->shouldReceive('getRealPath')->once()->andReturn($root->getChild('foo.jpg')->url()); - - $this->filesystem->putFile('test', $file); - } -} - -class NullDriver extends Driver -{ - protected function createAdapter(): AdapterInterface - { - return new NullAdapter(); - } -} diff --git a/vendor/topthink/framework/tests/HttpTest.php b/vendor/topthink/framework/tests/HttpTest.php deleted file mode 100644 index c3e0abd3..00000000 --- a/vendor/topthink/framework/tests/HttpTest.php +++ /dev/null @@ -1,155 +0,0 @@ -app = m::mock(App::class)->makePartial(); - - $this->http = m::mock(Http::class, [$this->app])->shouldAllowMockingProtectedMethods()->makePartial(); - } - - protected function prepareApp($request, $response) - { - $this->app->shouldReceive('instance')->once()->with('request', $request); - $this->app->shouldReceive('initialized')->once()->andReturnFalse(); - $this->app->shouldReceive('initialize')->once(); - $this->app->shouldReceive('get')->with('request')->andReturn($request); - - $route = m::mock(Route::class); - - $route->shouldReceive('dispatch')->withArgs(function ($req, $withRoute) use ($request) { - if ($withRoute) { - $withRoute(); - } - return $req === $request; - })->andReturn($response); - - $route->shouldReceive('config')->with('route_annotation')->andReturn(true); - - $this->app->shouldReceive('get')->with('route')->andReturn($route); - - $console = m::mock(Console::class); - - $console->shouldReceive('call'); - - $this->app->shouldReceive('get')->with('console')->andReturn($console); - } - - public function testRun() - { - $root = vfsStream::setup('rootDir', null, [ - 'app' => [ - 'controller' => [], - 'middleware.php' => ' [ - 'route.php' => 'app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url() . DIRECTORY_SEPARATOR); - $this->app->shouldReceive('getRootPath')->andReturn($root->url() . DIRECTORY_SEPARATOR); - - $request = m::mock(Request::class)->makePartial(); - $response = m::mock(Response::class)->makePartial(); - - $this->prepareApp($request, $response); - - $this->assertEquals($response, $this->http->run($request)); - } - - public function multiAppRunProvider() - { - $request1 = m::mock(Request::class)->makePartial(); - $request1->shouldReceive('subDomain')->andReturn('www'); - $request1->shouldReceive('host')->andReturn('www.domain.com'); - - $request2 = m::mock(Request::class)->makePartial(); - $request2->shouldReceive('subDomain')->andReturn('app2'); - $request2->shouldReceive('host')->andReturn('app2.domain.com'); - - $request3 = m::mock(Request::class)->makePartial(); - $request3->shouldReceive('pathinfo')->andReturn('some1/a/b/c'); - - $request4 = m::mock(Request::class)->makePartial(); - $request4->shouldReceive('pathinfo')->andReturn('app3/a/b/c'); - - $request5 = m::mock(Request::class)->makePartial(); - $request5->shouldReceive('pathinfo')->andReturn('some2/a/b/c'); - - return [ - [$request1, true, 'app1'], - [$request2, true, 'app2'], - [$request3, true, 'app3'], - [$request4, true, null], - [$request5, true, 'some2', 'path'], - [$request1, false, 'some3'], - ]; - } - - public function testRunWithException() - { - $request = m::mock(Request::class); - $response = m::mock(Response::class); - - $this->app->shouldReceive('instance')->once()->with('request', $request); - $this->app->shouldReceive('initialize')->once(); - - $exception = new Exception(); - - $this->http->shouldReceive('runWithRequest')->once()->with($request)->andThrow($exception); - - $handle = m::mock(Handle::class); - - $handle->shouldReceive('report')->once()->with($exception); - $handle->shouldReceive('render')->once()->with($request, $exception)->andReturn($response); - - $this->app->shouldReceive('make')->with(Handle::class)->andReturn($handle); - - $this->assertEquals($response, $this->http->run($request)); - } - - public function testEnd() - { - $response = m::mock(Response::class); - $event = m::mock(Event::class); - $event->shouldReceive('trigger')->once()->with(HttpEnd::class, $response); - $this->app->shouldReceive('get')->once()->with('event')->andReturn($event); - $log = m::mock(Log::class); - $log->shouldReceive('save')->once(); - $this->app->shouldReceive('get')->once()->with('log')->andReturn($log); - - $this->http->end($response); - } - -} diff --git a/vendor/topthink/framework/tests/InteractsWithApp.php b/vendor/topthink/framework/tests/InteractsWithApp.php deleted file mode 100644 index f4fcf73f..00000000 --- a/vendor/topthink/framework/tests/InteractsWithApp.php +++ /dev/null @@ -1,30 +0,0 @@ -app = m::mock(App::class)->makePartial(); - Container::setInstance($this->app); - $this->app->shouldReceive('make')->with(App::class)->andReturn($this->app); - $this->app->shouldReceive('isDebug')->andReturnTrue(); - $this->config = m::mock(Config::class)->makePartial(); - $this->config->shouldReceive('get')->with('app.show_error_msg')->andReturnTrue(); - $this->app->shouldReceive('get')->with('config')->andReturn($this->config); - $this->app->shouldReceive('runningInConsole')->andReturn(false); - } -} diff --git a/vendor/topthink/framework/tests/LogTest.php b/vendor/topthink/framework/tests/LogTest.php deleted file mode 100644 index 981110f5..00000000 --- a/vendor/topthink/framework/tests/LogTest.php +++ /dev/null @@ -1,130 +0,0 @@ -prepareApp(); - - $this->log = new Log($this->app); - } - - public function testGetConfig() - { - $config = [ - 'default' => 'file', - ]; - - $this->config->shouldReceive('get')->with('log')->andReturn($config); - - $this->assertEquals($config, $this->log->getConfig()); - - $this->expectException(InvalidArgumentException::class); - $this->log->getChannelConfig('foo'); - } - - public function testChannel() - { - $this->assertInstanceOf(ChannelSet::class, $this->log->channel(['file', 'mail'])); - } - - public function testLogManagerInstances() - { - $this->config->shouldReceive('get')->with("log.channels.single", null)->andReturn(['type' => 'file']); - - $channel1 = $this->log->channel('single'); - $channel2 = $this->log->channel('single'); - - $this->assertSame($channel1, $channel2); - } - - public function testFileLog() - { - $root = vfsStream::setup(); - - $this->config->shouldReceive('get')->with("log.default", null)->andReturn('file'); - - $this->config->shouldReceive('get')->with("log.channels.file", null)->andReturn(['type' => 'file', 'path' => $root->url()]); - - $this->log->info('foo'); - - $this->assertEquals($this->log->getLog(), ['info' => ['foo']]); - - $this->log->clear(); - - $this->assertEmpty($this->log->getLog()); - - $this->log->error('foo'); - $this->assertArrayHasKey('error', $this->log->getLog()); - - $this->log->emergency('foo'); - $this->assertArrayHasKey('emergency', $this->log->getLog()); - - $this->log->alert('foo'); - $this->assertArrayHasKey('alert', $this->log->getLog()); - - $this->log->critical('foo'); - $this->assertArrayHasKey('critical', $this->log->getLog()); - - $this->log->warning('foo'); - $this->assertArrayHasKey('warning', $this->log->getLog()); - - $this->log->notice('foo'); - $this->assertArrayHasKey('notice', $this->log->getLog()); - - $this->log->debug('foo'); - $this->assertArrayHasKey('debug', $this->log->getLog()); - - $this->log->sql('foo'); - $this->assertArrayHasKey('sql', $this->log->getLog()); - - $this->log->custom('foo'); - $this->assertArrayHasKey('custom', $this->log->getLog()); - - $this->log->write('foo'); - $this->assertTrue($root->hasChildren()); - $this->assertEmpty($this->log->getLog()); - - $this->log->close(); - - $this->log->info('foo'); - - $this->assertEmpty($this->log->getLog()); - } - - public function testSave() - { - $root = vfsStream::setup(); - - $this->config->shouldReceive('get')->with("log.default", null)->andReturn('file'); - - $this->config->shouldReceive('get')->with("log.channels.file", null)->andReturn(['type' => 'file', 'path' => $root->url()]); - - $this->log->info('foo'); - - $this->log->save(); - - $this->assertTrue($root->hasChildren()); - } - -} diff --git a/vendor/topthink/framework/tests/MiddlewareTest.php b/vendor/topthink/framework/tests/MiddlewareTest.php deleted file mode 100644 index aa53059c..00000000 --- a/vendor/topthink/framework/tests/MiddlewareTest.php +++ /dev/null @@ -1,108 +0,0 @@ -prepareApp(); - - $this->middleware = new Middleware($this->app); - } - - public function testSetMiddleware() - { - $this->middleware->add('BarMiddleware', 'bar'); - - $this->assertEquals(1, count($this->middleware->all('bar'))); - - $this->middleware->controller('BarMiddleware'); - $this->assertEquals(1, count($this->middleware->all('controller'))); - - $this->middleware->import(['FooMiddleware']); - $this->assertEquals(1, count($this->middleware->all())); - - $this->middleware->unshift(['BazMiddleware', 'baz']); - $this->assertEquals(2, count($this->middleware->all())); - $this->assertEquals([['BazMiddleware', 'handle'], 'baz'], $this->middleware->all()[0]); - - $this->config->shouldReceive('get')->with('middleware.alias', [])->andReturn(['foo' => ['FooMiddleware', 'FarMiddleware']]); - - $this->middleware->add('foo'); - $this->assertEquals(3, count($this->middleware->all())); - $this->middleware->add(function () { - }); - $this->middleware->add(function () { - }); - $this->assertEquals(5, count($this->middleware->all())); - } - - public function testPipelineAndEnd() - { - $bar = m::mock("overload:BarMiddleware"); - $foo = m::mock("overload:FooMiddleware", Foo::class); - - $request = m::mock(Request::class); - $response = m::mock(Response::class); - - $e = new Exception(); - - $handle = m::mock(Handle::class); - $handle->shouldReceive('report')->with($e)->andReturnNull(); - $handle->shouldReceive('render')->with($request, $e)->andReturn($response); - - $foo->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) { - return $next($request); - }); - $bar->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) use ($e) { - $next($request); - throw $e; - }); - - $foo->shouldReceive('end')->once()->with($response)->andReturnNull(); - - $this->app->shouldReceive('make')->with(Handle::class)->andReturn($handle); - - $this->config->shouldReceive('get')->once()->with('middleware.priority', [])->andReturn(['FooMiddleware', 'BarMiddleware']); - - $this->middleware->import([function ($request, $next) { - return $next($request); - }, 'BarMiddleware', 'FooMiddleware']); - - $this->assertInstanceOf(Pipeline::class, $pipeline = $this->middleware->pipeline()); - - $pipeline->send($request)->then(function ($request) use ($e, $response) { - throw $e; - }); - - $this->middleware->end($response); - } -} - -class Foo -{ - public function end(Response $response) - { - } -} diff --git a/vendor/topthink/framework/tests/RouteTest.php b/vendor/topthink/framework/tests/RouteTest.php deleted file mode 100644 index e992d0fe..00000000 --- a/vendor/topthink/framework/tests/RouteTest.php +++ /dev/null @@ -1,286 +0,0 @@ -prepareApp(); - $this->route = new Route($this->app); - } - - /** - * @param $path - * @param string $method - * @param string $host - * @return m\Mock|Request - */ - protected function makeRequest($path, $method = 'GET', $host = 'localhost') - { - $request = m::mock(Request::class)->makePartial(); - $request->shouldReceive('host')->andReturn($host); - $request->shouldReceive('pathinfo')->andReturn($path); - $request->shouldReceive('url')->andReturn('/' . $path); - $request->shouldReceive('method')->andReturn(strtoupper($method)); - return $request; - } - - public function testSimpleRequest() - { - $this->route->get('foo', function () { - return 'get-foo'; - }); - - $this->route->put('foo', function () { - return 'put-foo'; - }); - - $this->route->group(function () { - $this->route->post('foo', function () { - return 'post-foo'; - }); - }); - - $request = $this->makeRequest('foo', 'post'); - $response = $this->route->dispatch($request); - $this->assertEquals(200, $response->getCode()); - $this->assertEquals('post-foo', $response->getContent()); - - $request = $this->makeRequest('foo', 'get'); - $response = $this->route->dispatch($request); - $this->assertEquals(200, $response->getCode()); - $this->assertEquals('get-foo', $response->getContent()); - } - - public function testOptionsRequest() - { - $this->route->get('foo', function () { - return 'get-foo'; - }); - - $this->route->put('foo', function () { - return 'put-foo'; - }); - - $this->route->group(function () { - $this->route->post('foo', function () { - return 'post-foo'; - }); - }); - $this->route->group('abc', function () { - $this->route->post('foo/:id', function () { - return 'post-abc-foo'; - }); - }); - - $this->route->post('foo/:id', function () { - return 'post-abc-foo'; - }); - - $this->route->resource('bar', 'SomeClass'); - - $request = $this->makeRequest('foo', 'options'); - $response = $this->route->dispatch($request); - $this->assertEquals(204, $response->getCode()); - $this->assertEquals('GET, PUT, POST', $response->getHeader('Allow')); - - $request = $this->makeRequest('bar', 'options'); - $response = $this->route->dispatch($request); - $this->assertEquals(204, $response->getCode()); - $this->assertEquals('GET, POST', $response->getHeader('Allow')); - - $request = $this->makeRequest('bar/1', 'options'); - $response = $this->route->dispatch($request); - $this->assertEquals(204, $response->getCode()); - $this->assertEquals('GET, PUT, DELETE', $response->getHeader('Allow')); - - $request = $this->makeRequest('xxxx', 'options'); - $response = $this->route->dispatch($request); - $this->assertEquals(204, $response->getCode()); - $this->assertEquals('GET, POST, PUT, DELETE', $response->getHeader('Allow')); - } - - public function testAllowCrossDomain() - { - $this->route->get('foo', function () { - return 'get-foo'; - })->allowCrossDomain(['some' => 'bar']); - - $request = $this->makeRequest('foo', 'get'); - $response = $this->route->dispatch($request); - - $this->assertEquals('bar', $response->getHeader('some')); - $this->assertArrayHasKey('Access-Control-Allow-Credentials', $response->getHeader()); - - $request = $this->makeRequest('foo2', 'options'); - $response = $this->route->dispatch($request); - - $this->assertEquals(204, $response->getCode()); - $this->assertArrayHasKey('Access-Control-Allow-Credentials', $response->getHeader()); - $this->assertEquals('GET, POST, PUT, DELETE', $response->getHeader('Allow')); - } - - public function testControllerDispatch() - { - $this->route->get('foo', 'foo/bar'); - - $controller = m::Mock(\stdClass::class); - - $this->app->shouldReceive('parseClass')->with('controller', 'Foo')->andReturn($controller->mockery_getName()); - $this->app->shouldReceive('make')->with($controller->mockery_getName(), [], true)->andReturn($controller); - - $controller->shouldReceive('bar')->andReturn('bar'); - - $request = $this->makeRequest('foo'); - $response = $this->route->dispatch($request); - $this->assertEquals('bar', $response->getContent()); - } - - public function testEmptyControllerDispatch() - { - $this->route->get('foo', 'foo/bar'); - - $controller = m::Mock(\stdClass::class); - - $this->app->shouldReceive('parseClass')->with('controller', 'Error')->andReturn($controller->mockery_getName()); - $this->app->shouldReceive('make')->with($controller->mockery_getName(), [], true)->andReturn($controller); - - $controller->shouldReceive('bar')->andReturn('bar'); - - $request = $this->makeRequest('foo'); - $response = $this->route->dispatch($request); - $this->assertEquals('bar', $response->getContent()); - } - - protected function createMiddleware($times = 1) - { - $middleware = m::mock(Str::random(5)); - $middleware->shouldReceive('handle')->times($times)->andReturnUsing(function ($request, Closure $next) { - return $next($request); - }); - $this->app->shouldReceive('make')->with($middleware->mockery_getName())->andReturn($middleware); - - return $middleware; - } - - public function testControllerWithMiddleware() - { - $this->route->get('foo', 'foo/bar'); - - $controller = m::mock(FooClass::class); - - $controller->middleware = [ - $this->createMiddleware()->mockery_getName() . ":params1:params2", - $this->createMiddleware(0)->mockery_getName() => ['except' => 'bar'], - $this->createMiddleware()->mockery_getName() => ['only' => 'bar'], - ]; - - $this->app->shouldReceive('parseClass')->with('controller', 'Foo')->andReturn($controller->mockery_getName()); - $this->app->shouldReceive('make')->with($controller->mockery_getName(), [], true)->andReturn($controller); - - $controller->shouldReceive('bar')->once()->andReturn('bar'); - - $request = $this->makeRequest('foo'); - $response = $this->route->dispatch($request); - $this->assertEquals('bar', $response->getContent()); - } - - public function testUrlDispatch() - { - $controller = m::mock(FooClass::class); - $controller->shouldReceive('index')->andReturn('bar'); - - $this->app->shouldReceive('parseClass')->once()->with('controller', 'Foo')->andReturn($controller->mockery_getName()); - $this->app->shouldReceive('make')->with($controller->mockery_getName(), [], true)->andReturn($controller); - - $request = $this->makeRequest('foo'); - $response = $this->route->dispatch($request); - $this->assertEquals('bar', $response->getContent()); - } - - public function testRedirectDispatch() - { - $this->route->redirect('foo', 'http://localhost', 302); - - $request = $this->makeRequest('foo'); - $this->app->shouldReceive('make')->with(Request::class)->andReturn($request); - $response = $this->route->dispatch($request); - - $this->assertInstanceOf(Redirect::class, $response); - $this->assertEquals(302, $response->getCode()); - $this->assertEquals('http://localhost', $response->getData()); - } - - public function testViewDispatch() - { - $this->route->view('foo', 'index/hello', ['city' => 'shanghai']); - - $request = $this->makeRequest('foo'); - $response = $this->route->dispatch($request); - - $this->assertInstanceOf(View::class, $response); - $this->assertEquals(['city' => 'shanghai'], $response->getVars()); - $this->assertEquals('index/hello', $response->getData()); - } - - public function testResponseDispatch() - { - $this->route->get('hello/:name', response() - ->data('Hello,ThinkPHP') - ->code(200) - ->contentType('text/plain')); - - $request = $this->makeRequest('hello/some'); - $response = $this->route->dispatch($request); - - $this->assertEquals('Hello,ThinkPHP', $response->getContent()); - $this->assertEquals(200, $response->getCode()); - } - - public function testDomainBindResponse() - { - $this->route->domain('test', function () { - $this->route->get('/', function () { - return 'Hello,ThinkPHP'; - }); - }); - - $request = $this->makeRequest('', 'get', 'test.domain.com'); - $response = $this->route->dispatch($request); - - $this->assertEquals('Hello,ThinkPHP', $response->getContent()); - $this->assertEquals(200, $response->getCode()); - } - -} - -class FooClass -{ - public $middleware = []; - - public function bar() - { - - } -} diff --git a/vendor/topthink/framework/tests/SessionTest.php b/vendor/topthink/framework/tests/SessionTest.php deleted file mode 100644 index b3b48a70..00000000 --- a/vendor/topthink/framework/tests/SessionTest.php +++ /dev/null @@ -1,225 +0,0 @@ -app = m::mock(App::class)->makePartial(); - Container::setInstance($this->app); - - $this->app->shouldReceive('make')->with(App::class)->andReturn($this->app); - $this->config = m::mock(Config::class)->makePartial(); - - $this->app->shouldReceive('get')->with('config')->andReturn($this->config); - $handlerClass = "\\think\\session\\driver\\Test" . Str::random(10); - $this->config->shouldReceive("get")->with("session.type", "file")->andReturn($handlerClass); - $this->session = new Session($this->app); - - $this->handler = m::mock('overload:' . $handlerClass, SessionHandlerInterface::class); - } - - public function testLoadData() - { - $data = [ - "bar" => 'foo', - ]; - - $id = md5(uniqid()); - - $this->handler->shouldReceive("read")->once()->with($id)->andReturn(serialize($data)); - - $this->session->setId($id); - $this->session->init(); - - $this->assertEquals('foo', $this->session->get('bar')); - $this->assertTrue($this->session->has('bar')); - $this->assertFalse($this->session->has('foo')); - - $this->session->set('foo', 'bar'); - $this->assertTrue($this->session->has('foo')); - - $this->assertEquals('bar', $this->session->pull('foo')); - $this->assertFalse($this->session->has('foo')); - } - - public function testSave() - { - - $id = md5(uniqid()); - - $this->handler->shouldReceive('read')->once()->with($id)->andReturn(""); - - $this->handler->shouldReceive('write')->once()->with($id, serialize([ - "bar" => 'foo', - ]))->andReturnTrue(); - - $this->session->setId($id); - $this->session->init(); - - $this->session->set('bar', 'foo'); - - $this->session->save(); - } - - public function testFlash() - { - $this->session->flash('foo', 'bar'); - $this->session->flash('bar', 0); - $this->session->flash('baz', true); - - $this->assertTrue($this->session->has('foo')); - $this->assertEquals('bar', $this->session->get('foo')); - $this->assertEquals(0, $this->session->get('bar')); - $this->assertTrue($this->session->get('baz')); - - $this->session->clearFlashData(); - - $this->assertTrue($this->session->has('foo')); - $this->assertEquals('bar', $this->session->get('foo')); - $this->assertEquals(0, $this->session->get('bar')); - - $this->session->clearFlashData(); - - $this->assertFalse($this->session->has('foo')); - $this->assertNull($this->session->get('foo')); - - $this->session->flash('foo', 'bar'); - $this->assertTrue($this->session->has('foo')); - $this->session->clearFlashData(); - $this->session->reflash(); - $this->session->clearFlashData(); - - $this->assertTrue($this->session->has('foo')); - } - - public function testClear() - { - $this->session->set('bar', 'foo'); - $this->assertEquals('foo', $this->session->get('bar')); - $this->session->clear(); - $this->assertFalse($this->session->has('foo')); - } - - public function testSetName() - { - $this->session->setName('foo'); - $this->assertEquals('foo', $this->session->getName()); - } - - public function testDestroy() - { - $id = md5(uniqid()); - - $this->handler->shouldReceive('read')->once()->with($id)->andReturn(""); - $this->handler->shouldReceive('delete')->once()->with($id)->andReturnTrue(); - - $this->session->setId($id); - $this->session->init(); - - $this->session->set('bar', 'foo'); - - $this->session->destroy(); - - $this->assertFalse($this->session->has('bar')); - - $this->assertNotEquals($id, $this->session->getId()); - } - - public function testFileHandler() - { - $root = vfsStream::setup(); - - vfsStream::newFile('bar') - ->at($root) - ->lastModified(time()); - - vfsStream::newFile('bar') - ->at(vfsStream::newDirectory("foo")->at($root)) - ->lastModified(100); - - $this->assertTrue($root->hasChild("bar")); - $this->assertTrue($root->hasChild("foo/bar")); - - $handler = new TestFileHandle($this->app, [ - 'path' => $root->url(), - 'gc_probability' => 1, - 'gc_divisor' => 1, - ]); - - $this->assertTrue($root->hasChild("bar")); - $this->assertFalse($root->hasChild("foo/bar")); - - $id = md5(uniqid()); - $handler->write($id, "bar"); - - $this->assertTrue($root->hasChild("sess_{$id}")); - - $this->assertEquals("bar", $handler->read($id)); - - $handler->delete($id); - - $this->assertFalse($root->hasChild("sess_{$id}")); - } - - public function testCacheHandler() - { - $id = md5(uniqid()); - - $cache = m::mock(\think\Cache::class); - - $store = m::mock(Driver::class); - - $cache->shouldReceive('store')->once()->with('redis')->andReturn($store); - - $handler = new Cache($cache, ['store' => 'redis']); - - $store->shouldReceive("set")->with($id, "bar", 1440)->once()->andReturnTrue(); - $handler->write($id, "bar"); - - $store->shouldReceive("get")->with($id)->once()->andReturn("bar"); - $this->assertEquals("bar", $handler->read($id)); - - $store->shouldReceive("delete")->with($id)->once()->andReturnTrue(); - $handler->delete($id); - } -} - -class TestFileHandle extends File -{ - protected function writeFile($path, $content): bool - { - return (bool) file_put_contents($path, $content); - } -} diff --git a/vendor/topthink/framework/tests/ViewTest.php b/vendor/topthink/framework/tests/ViewTest.php deleted file mode 100644 index e4135109..00000000 --- a/vendor/topthink/framework/tests/ViewTest.php +++ /dev/null @@ -1,127 +0,0 @@ -app = m::mock(App::class)->makePartial(); - Container::setInstance($this->app); - - $this->app->shouldReceive('make')->with(App::class)->andReturn($this->app); - $this->config = m::mock(Config::class)->makePartial(); - $this->app->shouldReceive('get')->with('config')->andReturn($this->config); - - $this->view = new View($this->app); - } - - public function testAssignData() - { - $this->view->assign('foo', 'bar'); - $this->view->assign(['baz' => 'boom']); - $this->view->qux = "corge"; - - $this->assertEquals('bar', $this->view->foo); - $this->assertEquals('boom', $this->view->baz); - $this->assertEquals('corge', $this->view->qux); - $this->assertTrue(isset($this->view->qux)); - } - - public function testRender() - { - $this->config->shouldReceive("get")->with("view.type", 'php')->andReturn(TestTemplate::class); - - $this->view->filter(function ($content) { - return $content; - }); - - $this->assertEquals("fetch", $this->view->fetch('foo')); - $this->assertEquals("display", $this->view->display('foo')); - } - -} - -class TestTemplate implements TemplateHandlerInterface -{ - - /** - * 检测是否存在模板文件 - * @access public - * @param string $template 模板文件或者模板规则 - * @return bool - */ - public function exists(string $template): bool - { - return true; - } - - /** - * 渲染模板文件 - * @access public - * @param string $template 模板文件 - * @param array $data 模板变量 - * @return void - */ - public function fetch(string $template, array $data = []): void - { - echo "fetch"; - } - - /** - * 渲染模板内容 - * @access public - * @param string $content 模板内容 - * @param array $data 模板变量 - * @return void - */ - public function display(string $content, array $data = []): void - { - echo "display"; - } - - /** - * 配置模板引擎 - * @access private - * @param array $config 参数 - * @return void - */ - public function config(array $config): void - { - // TODO: Implement config() method. - } - - /** - * 获取模板引擎配置 - * @access public - * @param string $name 参数名 - * @return void - */ - public function getConfig(string $name) - { - // TODO: Implement getConfig() method. - } -} diff --git a/vendor/topthink/framework/tests/bootstrap.php b/vendor/topthink/framework/tests/bootstrap.php deleted file mode 100644 index 34590612..00000000 --- a/vendor/topthink/framework/tests/bootstrap.php +++ /dev/null @@ -1,3 +0,0 @@ - composer require topthink/think-captcha - - - -## 使用 - -### 在控制器中输出验证码 - -在控制器的操作方法中使用 - -~~~ -public function captcha($id = '') -{ - return captcha($id); -} -~~~ -然后注册对应的路由来输出验证码 - - -### 模板里输出验证码 - -首先要在你应用的路由定义文件中,注册一个验证码路由规则。 - -~~~ -\think\facade\Route::get('captcha/[:id]', "\\think\\captcha\\CaptchaController@index"); -~~~ - -然后就可以在模板文件中使用 -~~~ -
    {:captcha_img()}
    -~~~ -或者 -~~~ -
    captcha
    -~~~ -> 上面两种的最终效果是一样的 - - -### 控制器里验证 - -使用TP的内置验证功能即可 -~~~ -$this->validate($data,[ - 'captcha|验证码'=>'require|captcha' -]); -~~~ -或者手动验证 -~~~ -if(!captcha_check($captcha)){ - //验证失败 -}; -~~~ \ No newline at end of file diff --git a/vendor/topthink/think-captcha/assets/bgs/1.jpg b/vendor/topthink/think-captcha/assets/bgs/1.jpg deleted file mode 100644 index d417136b..00000000 Binary files a/vendor/topthink/think-captcha/assets/bgs/1.jpg and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/bgs/2.jpg b/vendor/topthink/think-captcha/assets/bgs/2.jpg deleted file mode 100644 index 56640bde..00000000 Binary files a/vendor/topthink/think-captcha/assets/bgs/2.jpg and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/bgs/3.jpg b/vendor/topthink/think-captcha/assets/bgs/3.jpg deleted file mode 100644 index 83e5bd90..00000000 Binary files a/vendor/topthink/think-captcha/assets/bgs/3.jpg and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/bgs/4.jpg b/vendor/topthink/think-captcha/assets/bgs/4.jpg deleted file mode 100644 index 97a3721b..00000000 Binary files a/vendor/topthink/think-captcha/assets/bgs/4.jpg and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/bgs/5.jpg b/vendor/topthink/think-captcha/assets/bgs/5.jpg deleted file mode 100644 index 220a17a2..00000000 Binary files a/vendor/topthink/think-captcha/assets/bgs/5.jpg and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/bgs/6.jpg b/vendor/topthink/think-captcha/assets/bgs/6.jpg deleted file mode 100644 index be53ea0a..00000000 Binary files a/vendor/topthink/think-captcha/assets/bgs/6.jpg and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/bgs/7.jpg b/vendor/topthink/think-captcha/assets/bgs/7.jpg deleted file mode 100644 index fbf537fa..00000000 Binary files a/vendor/topthink/think-captcha/assets/bgs/7.jpg and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/bgs/8.jpg b/vendor/topthink/think-captcha/assets/bgs/8.jpg deleted file mode 100644 index e10cf281..00000000 Binary files a/vendor/topthink/think-captcha/assets/bgs/8.jpg and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/ttfs/1.ttf b/vendor/topthink/think-captcha/assets/ttfs/1.ttf deleted file mode 100644 index 9eae6f25..00000000 Binary files a/vendor/topthink/think-captcha/assets/ttfs/1.ttf and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/ttfs/2.ttf b/vendor/topthink/think-captcha/assets/ttfs/2.ttf deleted file mode 100644 index 6386c6bd..00000000 Binary files a/vendor/topthink/think-captcha/assets/ttfs/2.ttf and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/ttfs/3.ttf b/vendor/topthink/think-captcha/assets/ttfs/3.ttf deleted file mode 100644 index 678a4917..00000000 Binary files a/vendor/topthink/think-captcha/assets/ttfs/3.ttf and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/ttfs/4.ttf b/vendor/topthink/think-captcha/assets/ttfs/4.ttf deleted file mode 100644 index db433349..00000000 Binary files a/vendor/topthink/think-captcha/assets/ttfs/4.ttf and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/ttfs/5.ttf b/vendor/topthink/think-captcha/assets/ttfs/5.ttf deleted file mode 100644 index 8c082c8d..00000000 Binary files a/vendor/topthink/think-captcha/assets/ttfs/5.ttf and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/ttfs/6.ttf b/vendor/topthink/think-captcha/assets/ttfs/6.ttf deleted file mode 100644 index 45a038ba..00000000 Binary files a/vendor/topthink/think-captcha/assets/ttfs/6.ttf and /dev/null differ diff --git a/vendor/topthink/think-captcha/assets/zhttfs/1.ttf b/vendor/topthink/think-captcha/assets/zhttfs/1.ttf deleted file mode 100644 index 1c14f7fa..00000000 Binary files a/vendor/topthink/think-captcha/assets/zhttfs/1.ttf and /dev/null differ diff --git a/vendor/topthink/think-captcha/composer.json b/vendor/topthink/think-captcha/composer.json deleted file mode 100644 index 56883059..00000000 --- a/vendor/topthink/think-captcha/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "topthink/think-captcha", - "description": "captcha package for thinkphp", - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "license": "Apache-2.0", - "require": { - "topthink/framework": "^6.0.0" - }, - "autoload": { - "psr-4": { - "think\\captcha\\": "src/" - }, - "files": [ - "src/helper.php" - ] - }, - "extra": { - "think": { - "services": [ - "think\\captcha\\CaptchaService" - ], - "config":{ - "captcha": "src/config.php" - } - } - }, - "minimum-stability": "dev" -} diff --git a/vendor/topthink/think-captcha/src/Captcha.php b/vendor/topthink/think-captcha/src/Captcha.php deleted file mode 100644 index 07890874..00000000 --- a/vendor/topthink/think-captcha/src/Captcha.php +++ /dev/null @@ -1,340 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\captcha; - -use Exception; -use think\Config; -use think\Response; -use think\Session; - -class Captcha -{ - private $im = null; // 验证码图片实例 - private $color = null; // 验证码字体颜色 - - /** - * @var Config|null - */ - private $config = null; - - /** - * @var Session|null - */ - private $session = null; - - // 验证码字符集合 - protected $codeSet = '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY'; - // 验证码过期时间(s) - protected $expire = 1800; - // 使用中文验证码 - protected $useZh = false; - // 中文验证码字符串 - protected $zhSet = '们以我到他会作时要动国产的一是工就年阶义发成部民可出能方进在了不和有大这主中人上为来分生对于学下级地个用同行面说种过命度革而多子后自社加小机也经力线本电高量长党得实家定深法表着水理化争现所二起政三好十战无农使性前等反体合斗路图把结第里正新开论之物从当两些还天资事队批点育重其思与间内去因件日利相由压员气业代全组数果期导平各基或月毛然如应形想制心样干都向变关问比展那它最及外没看治提五解系林者米群头意只明四道马认次文通但条较克又公孔领军流入接席位情运器并飞原油放立题质指建区验活众很教决特此常石强极土少已根共直团统式转别造切九你取西持总料连任志观调七么山程百报更见必真保热委手改管处己将修支识病象几先老光专什六型具示复安带每东增则完风回南广劳轮科北打积车计给节做务被整联步类集号列温装即毫知轴研单色坚据速防史拉世设达尔场织历花受求传口断况采精金界品判参层止边清至万确究书术状厂须离再目海交权且儿青才证低越际八试规斯近注办布门铁需走议县兵固除般引齿千胜细影济白格效置推空配刀叶率述今选养德话查差半敌始片施响收华觉备名红续均药标记难存测士身紧液派准斤角降维板许破述技消底床田势端感往神便贺村构照容非搞亚磨族火段算适讲按值美态黄易彪服早班麦削信排台声该击素张密害侯草何树肥继右属市严径螺检左页抗苏显苦英快称坏移约巴材省黑武培著河帝仅针怎植京助升王眼她抓含苗副杂普谈围食射源例致酸旧却充足短划剂宣环落首尺波承粉践府鱼随考刻靠够满夫失包住促枝局菌杆周护岩师举曲春元超负砂封换太模贫减阳扬江析亩木言球朝医校古呢稻宋听唯输滑站另卫字鼓刚写刘微略范供阿块某功套友限项余倒卷创律雨让骨远帮初皮播优占死毒圈伟季训控激找叫云互跟裂粮粒母练塞钢顶策双留误础吸阻故寸盾晚丝女散焊功株亲院冷彻弹错散商视艺灭版烈零室轻血倍缺厘泵察绝富城冲喷壤简否柱李望盘磁雄似困巩益洲脱投送奴侧润盖挥距触星松送获兴独官混纪依未突架宽冬章湿偏纹吃执阀矿寨责熟稳夺硬价努翻奇甲预职评读背协损棉侵灰虽矛厚罗泥辟告卵箱掌氧恩爱停曾溶营终纲孟钱待尽俄缩沙退陈讨奋械载胞幼哪剥迫旋征槽倒握担仍呀鲜吧卡粗介钻逐弱脚怕盐末阴丰雾冠丙街莱贝辐肠付吉渗瑞惊顿挤秒悬姆烂森糖圣凹陶词迟蚕亿矩康遵牧遭幅园腔订香肉弟屋敏恢忘编印蜂急拿扩伤飞露核缘游振操央伍域甚迅辉异序免纸夜乡久隶缸夹念兰映沟乙吗儒杀汽磷艰晶插埃燃欢铁补咱芽永瓦倾阵碳演威附牙芽永瓦斜灌欧献顺猪洋腐请透司危括脉宜笑若尾束壮暴企菜穗楚汉愈绿拖牛份染既秋遍锻玉夏疗尖殖井费州访吹荣铜沿替滚客召旱悟刺脑措贯藏敢令隙炉壳硫煤迎铸粘探临薄旬善福纵择礼愿伏残雷延烟句纯渐耕跑泽慢栽鲁赤繁境潮横掉锥希池败船假亮谓托伙哲怀割摆贡呈劲财仪沉炼麻罪祖息车穿货销齐鼠抽画饲龙库守筑房歌寒喜哥洗蚀废纳腹乎录镜妇恶脂庄擦险赞钟摇典柄辩竹谷卖乱虚桥奥伯赶垂途额壁网截野遗静谋弄挂课镇妄盛耐援扎虑键归符庆聚绕摩忙舞遇索顾胶羊湖钉仁音迹碎伸灯避泛亡答勇频皇柳哈揭甘诺概宪浓岛袭谁洪谢炮浇斑讯懂灵蛋闭孩释乳巨徒私银伊景坦累匀霉杜乐勒隔弯绩招绍胡呼痛峰零柴簧午跳居尚丁秦稍追梁折耗碱殊岗挖氏刃剧堆赫荷胸衡勤膜篇登驻案刊秧缓凸役剪川雪链渔啦脸户洛孢勃盟买杨宗焦赛旗滤硅炭股坐蒸凝竟陷枪黎救冒暗洞犯筒您宋弧爆谬涂味津臂障褐陆啊健尊豆拔莫抵桑坡缝警挑污冰柬嘴啥饭塑寄赵喊垫丹渡耳刨虎笔稀昆浪萨茶滴浅拥穴覆伦娘吨浸袖珠雌妈紫戏塔锤震岁貌洁剖牢锋疑霸闪埔猛诉刷狠忽灾闹乔唐漏闻沈熔氯荒茎男凡抢像浆旁玻亦忠唱蒙予纷捕锁尤乘乌智淡允叛畜俘摸锈扫毕璃宝芯爷鉴秘净蒋钙肩腾枯抛轨堂拌爸循诱祝励肯酒绳穷塘燥泡袋朗喂铝软渠颗惯贸粪综墙趋彼届墨碍启逆卸航衣孙龄岭骗休借'; - // 使用背景图片 - protected $useImgBg = false; - // 验证码字体大小(px) - protected $fontSize = 25; - // 是否画混淆曲线 - protected $useCurve = true; - // 是否添加杂点 - protected $useNoise = true; - // 验证码图片高度 - protected $imageH = 0; - // 验证码图片宽度 - protected $imageW = 0; - // 验证码位数 - protected $length = 5; - // 验证码字体,不设置随机获取 - protected $fontttf = ''; - // 背景颜色 - protected $bg = [243, 251, 254]; - //算术验证码 - protected $math = false; - - /** - * 架构方法 设置参数 - * @access public - * @param Config $config - * @param Session $session - */ - public function __construct(Config $config, Session $session) - { - $this->config = $config; - $this->session = $session; - } - - /** - * 配置验证码 - * @param string|null $config - */ - protected function configure(string $config = null): void - { - if (is_null($config)) { - $config = $this->config->get('captcha', []); - } else { - $config = $this->config->get('captcha.' . $config, []); - } - - foreach ($config as $key => $val) { - if (property_exists($this, $key)) { - $this->{$key} = $val; - } - } - } - - /** - * 创建验证码 - * @return array - * @throws Exception - */ - protected function generate(): array - { - $bag = ''; - - if ($this->math) { - $this->useZh = false; - $this->length = 5; - - $x = random_int(10, 30); - $y = random_int(1, 9); - $bag = "{$x} + {$y} = "; - $key = $x + $y; - $key .= ''; - } else { - if ($this->useZh) { - $characters = preg_split('/(?zhSet); - } else { - $characters = str_split($this->codeSet); - } - - for ($i = 0; $i < $this->length; $i++) { - $bag .= $characters[rand(0, count($characters) - 1)]; - } - - $key = mb_strtolower($bag, 'UTF-8'); - } - - $hash = password_hash($key, PASSWORD_BCRYPT, ['cost' => 10]); - - $this->session->set('captcha', [ - 'key' => $hash, - ]); - - return [ - 'value' => $bag, - 'key' => $hash, - ]; - } - - /** - * 验证验证码是否正确 - * @access public - * @param string $code 用户验证码 - * @return bool 用户验证码是否正确 - */ - public function check(string $code): bool - { - if (!$this->session->has('captcha')) { - return false; - } - - $key = $this->session->get('captcha.key'); - - $code = mb_strtolower($code, 'UTF-8'); - - $res = password_verify($code, $key); - - if ($res) { - $this->session->delete('captcha'); - } - - return $res; - } - - /** - * 输出验证码并把验证码的值保存的session中 - * @access public - * @param null|string $config - * @param bool $api - * @return Response - */ - public function create(string $config = null, bool $api = false): Response - { - $this->configure($config); - - $generator = $this->generate(); - - // 图片宽(px) - $this->imageW || $this->imageW = $this->length * $this->fontSize * 1.5 + $this->length * $this->fontSize / 2; - // 图片高(px) - $this->imageH || $this->imageH = $this->fontSize * 2.5; - // 建立一幅 $this->imageW x $this->imageH 的图像 - $this->im = imagecreate($this->imageW, $this->imageH); - // 设置背景 - imagecolorallocate($this->im, $this->bg[0], $this->bg[1], $this->bg[2]); - - // 验证码字体随机颜色 - $this->color = imagecolorallocate($this->im, mt_rand(1, 150), mt_rand(1, 150), mt_rand(1, 150)); - - // 验证码使用随机字体 - $ttfPath = __DIR__ . '/../assets/' . ($this->useZh ? 'zhttfs' : 'ttfs') . '/'; - - if (empty($this->fontttf)) { - $dir = dir($ttfPath); - $ttfs = []; - while (false !== ($file = $dir->read())) { - if ('.' != $file[0] && substr($file, -4) == '.ttf') { - $ttfs[] = $file; - } - } - $dir->close(); - $this->fontttf = $ttfs[array_rand($ttfs)]; - } - - $fontttf = $ttfPath . $this->fontttf; - - if ($this->useImgBg) { - $this->background(); - } - - if ($this->useNoise) { - // 绘杂点 - $this->writeNoise(); - } - if ($this->useCurve) { - // 绘干扰线 - $this->writeCurve(); - } - - // 绘验证码 - $text = $this->useZh ? preg_split('/(? $char) { - - $x = $this->fontSize * ($index + 1) * mt_rand(1.2, 1.6) * ($this->math ? 1 : 1.5); - $y = $this->fontSize + mt_rand(10, 20); - $angle = $this->math ? 0 : mt_rand(-40, 40); - - imagettftext($this->im, $this->fontSize, $angle, $x, $y, $this->color, $fontttf, $char); - } - - ob_start(); - // 输出图像 - imagepng($this->im); - $content = ob_get_clean(); - imagedestroy($this->im); - - return response($content, 200, ['Content-Length' => strlen($content)])->contentType('image/png'); - } - - /** - * 画一条由两条连在一起构成的随机正弦函数曲线作干扰线(你可以改成更帅的曲线函数) - * - * 高中的数学公式咋都忘了涅,写出来 - * 正弦型函数解析式:y=Asin(ωx+φ)+b - * 各常数值对函数图像的影响: - * A:决定峰值(即纵向拉伸压缩的倍数) - * b:表示波形在Y轴的位置关系或纵向移动距离(上加下减) - * φ:决定波形与X轴位置关系或横向移动距离(左加右减) - * ω:决定周期(最小正周期T=2π/∣ω∣) - * - */ - protected function writeCurve(): void - { - $px = $py = 0; - - // 曲线前部分 - $A = mt_rand(1, $this->imageH / 2); // 振幅 - $b = mt_rand(-$this->imageH / 4, $this->imageH / 4); // Y轴方向偏移量 - $f = mt_rand(-$this->imageH / 4, $this->imageH / 4); // X轴方向偏移量 - $T = mt_rand($this->imageH, $this->imageW * 2); // 周期 - $w = (2 * M_PI) / $T; - - $px1 = 0; // 曲线横坐标起始位置 - $px2 = mt_rand($this->imageW / 2, $this->imageW * 0.8); // 曲线横坐标结束位置 - - for ($px = $px1; $px <= $px2; $px = $px + 1) { - if (0 != $w) { - $py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b - $i = (int) ($this->fontSize / 5); - while ($i > 0) { - imagesetpixel($this->im, $px + $i, $py + $i, $this->color); // 这里(while)循环画像素点比imagettftext和imagestring用字体大小一次画出(不用这while循环)性能要好很多 - $i--; - } - } - } - - // 曲线后部分 - $A = mt_rand(1, $this->imageH / 2); // 振幅 - $f = mt_rand(-$this->imageH / 4, $this->imageH / 4); // X轴方向偏移量 - $T = mt_rand($this->imageH, $this->imageW * 2); // 周期 - $w = (2 * M_PI) / $T; - $b = $py - $A * sin($w * $px + $f) - $this->imageH / 2; - $px1 = $px2; - $px2 = $this->imageW; - - for ($px = $px1; $px <= $px2; $px = $px + 1) { - if (0 != $w) { - $py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b - $i = (int) ($this->fontSize / 5); - while ($i > 0) { - imagesetpixel($this->im, $px + $i, $py + $i, $this->color); - $i--; - } - } - } - } - - /** - * 画杂点 - * 往图片上写不同颜色的字母或数字 - */ - protected function writeNoise(): void - { - $codeSet = '2345678abcdefhijkmnpqrstuvwxyz'; - for ($i = 0; $i < 10; $i++) { - //杂点颜色 - $noiseColor = imagecolorallocate($this->im, mt_rand(150, 225), mt_rand(150, 225), mt_rand(150, 225)); - for ($j = 0; $j < 5; $j++) { - // 绘杂点 - imagestring($this->im, 5, mt_rand(-10, $this->imageW), mt_rand(-10, $this->imageH), $codeSet[mt_rand(0, 29)], $noiseColor); - } - } - } - - /** - * 绘制背景图片 - * 注:如果验证码输出图片比较大,将占用比较多的系统资源 - */ - protected function background(): void - { - $path = __DIR__ . '/../assets/bgs/'; - $dir = dir($path); - - $bgs = []; - while (false !== ($file = $dir->read())) { - if ('.' != $file[0] && substr($file, -4) == '.jpg') { - $bgs[] = $path . $file; - } - } - $dir->close(); - - $gb = $bgs[array_rand($bgs)]; - - list($width, $height) = @getimagesize($gb); - // Resample - $bgImage = @imagecreatefromjpeg($gb); - @imagecopyresampled($this->im, $bgImage, 0, 0, 0, 0, $this->imageW, $this->imageH, $width, $height); - @imagedestroy($bgImage); - } - -} diff --git a/vendor/topthink/think-captcha/src/CaptchaController.php b/vendor/topthink/think-captcha/src/CaptchaController.php deleted file mode 100644 index 2c3cf598..00000000 --- a/vendor/topthink/think-captcha/src/CaptchaController.php +++ /dev/null @@ -1,20 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\captcha; - -class CaptchaController -{ - public function index(Captcha $captcha, $config = null) - { - return $captcha->create($config); - } -} diff --git a/vendor/topthink/think-captcha/src/CaptchaService.php b/vendor/topthink/think-captcha/src/CaptchaService.php deleted file mode 100644 index 27f0ff08..00000000 --- a/vendor/topthink/think-captcha/src/CaptchaService.php +++ /dev/null @@ -1,21 +0,0 @@ -get('captcha/[:config]', "\\think\\captcha\\CaptchaController@index"); - - Validate::maker(function ($validate) { - $validate->extend('captcha', function ($value) { - return captcha_check($value); - }, ':attribute错误!'); - }); - } -} diff --git a/vendor/topthink/think-captcha/src/config.php b/vendor/topthink/think-captcha/src/config.php deleted file mode 100644 index 9bbf5291..00000000 --- a/vendor/topthink/think-captcha/src/config.php +++ /dev/null @@ -1,39 +0,0 @@ - 5, - // 验证码字符集合 - 'codeSet' => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY', - // 验证码过期时间 - 'expire' => 1800, - // 是否使用中文验证码 - 'useZh' => false, - // 是否使用算术验证码 - 'math' => false, - // 是否使用背景图 - 'useImgBg' => false, - //验证码字符大小 - 'fontSize' => 25, - // 是否使用混淆曲线 - 'useCurve' => true, - //是否添加杂点 - 'useNoise' => true, - // 验证码字体 不设置则随机 - 'fontttf' => '', - //背景颜色 - 'bg' => [243, 251, 254], - // 验证码图片高度 - 'imageH' => 0, - // 验证码图片宽度 - 'imageW' => 0, - - // 添加额外的验证码设置 - // verify => [ - // 'length'=>4, - // ... - //], -]; diff --git a/vendor/topthink/think-captcha/src/facade/Captcha.php b/vendor/topthink/think-captcha/src/facade/Captcha.php deleted file mode 100644 index cd9f793e..00000000 --- a/vendor/topthink/think-captcha/src/facade/Captcha.php +++ /dev/null @@ -1,18 +0,0 @@ - -// +---------------------------------------------------------------------- - -use think\captcha\facade\Captcha; -use think\facade\Route; -use think\Response; - -/** - * @param string $config - * @return \think\Response - */ -function captcha($config = null): Response -{ - return Captcha::create($config); -} - -/** - * @param $config - * @return string - */ -function captcha_src($config = null): string -{ - return Route::buildUrl('/captcha' . ($config ? "/{$config}" : '')); -} - -/** - * @param $id - * @return string - */ -function captcha_img($id = ''): string -{ - $src = captcha_src($id); - - return "captcha"; -} - -/** - * @param string $value - * @return bool - */ -function captcha_check($value) -{ - return Captcha::check($value); -} diff --git a/vendor/topthink/think-helper/.gitignore b/vendor/topthink/think-helper/.gitignore deleted file mode 100644 index d851bdbf..00000000 --- a/vendor/topthink/think-helper/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/vendor/ -/.idea/ -composer.lock \ No newline at end of file diff --git a/vendor/topthink/think-helper/LICENSE b/vendor/topthink/think-helper/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/vendor/topthink/think-helper/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/topthink/think-helper/README.md b/vendor/topthink/think-helper/README.md deleted file mode 100644 index 7baf8f7b..00000000 --- a/vendor/topthink/think-helper/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# thinkphp6 常用的一些扩展类库 - -基于PHP7.1+ - -> 以下类库都在`\\think\\helper`命名空间下 - -## Str - -> 字符串操作 - -``` -// 检查字符串中是否包含某些字符串 -Str::contains($haystack, $needles) - -// 检查字符串是否以某些字符串结尾 -Str::endsWith($haystack, $needles) - -// 获取指定长度的随机字母数字组合的字符串 -Str::random($length = 16) - -// 字符串转小写 -Str::lower($value) - -// 字符串转大写 -Str::upper($value) - -// 获取字符串的长度 -Str::length($value) - -// 截取字符串 -Str::substr($string, $start, $length = null) - -``` \ No newline at end of file diff --git a/vendor/topthink/think-helper/composer.json b/vendor/topthink/think-helper/composer.json deleted file mode 100644 index b68c43b5..00000000 --- a/vendor/topthink/think-helper/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "topthink/think-helper", - "description": "The ThinkPHP6 Helper Package", - "license": "Apache-2.0", - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "require": { - "php": ">=7.1.0" - }, - "autoload": { - "psr-4": { - "think\\": "src" - }, - "files": [ - "src/helper.php" - ] - } -} diff --git a/vendor/topthink/think-helper/src/Collection.php b/vendor/topthink/think-helper/src/Collection.php deleted file mode 100644 index 905f3f86..00000000 --- a/vendor/topthink/think-helper/src/Collection.php +++ /dev/null @@ -1,651 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use ArrayAccess; -use ArrayIterator; -use Countable; -use IteratorAggregate; -use JsonSerializable; -use think\contract\Arrayable; -use think\contract\Jsonable; -use think\helper\Arr; - -/** - * 数据集管理类 - */ -class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable, Arrayable, Jsonable -{ - /** - * 数据集数据 - * @var array - */ - protected $items = []; - - public function __construct($items = []) - { - $this->items = $this->convertToArray($items); - } - - public static function make($items = []) - { - return new static($items); - } - - /** - * 是否为空 - * @access public - * @return bool - */ - public function isEmpty(): bool - { - return empty($this->items); - } - - public function toArray(): array - { - return array_map(function ($value) { - return $value instanceof Arrayable ? $value->toArray() : $value; - }, $this->items); - } - - public function all(): array - { - return $this->items; - } - - /** - * 合并数组 - * - * @access public - * @param mixed $items 数据 - * @return static - */ - public function merge($items) - { - return new static(array_merge($this->items, $this->convertToArray($items))); - } - - /** - * 按指定键整理数据 - * - * @access public - * @param mixed $items 数据 - * @param string $indexKey 键名 - * @return array - */ - public function dictionary($items = null, string &$indexKey = null) - { - if ($items instanceof self) { - $items = $items->all(); - } - - $items = is_null($items) ? $this->items : $items; - - if ($items && empty($indexKey)) { - $indexKey = is_array($items[0]) ? 'id' : $items[0]->getPk(); - } - - if (isset($indexKey) && is_string($indexKey)) { - return array_column($items, null, $indexKey); - } - - return $items; - } - - /** - * 比较数组,返回差集 - * - * @access public - * @param mixed $items 数据 - * @param string $indexKey 指定比较的键名 - * @return static - */ - public function diff($items, string $indexKey = null) - { - if ($this->isEmpty() || is_scalar($this->items[0])) { - return new static(array_diff($this->items, $this->convertToArray($items))); - } - - $diff = []; - $dictionary = $this->dictionary($items, $indexKey); - - if (is_string($indexKey)) { - foreach ($this->items as $item) { - if (!isset($dictionary[$item[$indexKey]])) { - $diff[] = $item; - } - } - } - - return new static($diff); - } - - /** - * 比较数组,返回交集 - * - * @access public - * @param mixed $items 数据 - * @param string $indexKey 指定比较的键名 - * @return static - */ - public function intersect($items, string $indexKey = null) - { - if ($this->isEmpty() || is_scalar($this->items[0])) { - return new static(array_diff($this->items, $this->convertToArray($items))); - } - - $intersect = []; - $dictionary = $this->dictionary($items, $indexKey); - - if (is_string($indexKey)) { - foreach ($this->items as $item) { - if (isset($dictionary[$item[$indexKey]])) { - $intersect[] = $item; - } - } - } - - return new static($intersect); - } - - /** - * 交换数组中的键和值 - * - * @access public - * @return static - */ - public function flip() - { - return new static(array_flip($this->items)); - } - - /** - * 返回数组中所有的键名 - * - * @access public - * @return static - */ - public function keys() - { - return new static(array_keys($this->items)); - } - - /** - * 返回数组中所有的值组成的新 Collection 实例 - * @access public - * @return static - */ - public function values() - { - return new static(array_values($this->items)); - } - - /** - * 删除数组的最后一个元素(出栈) - * - * @access public - * @return mixed - */ - public function pop() - { - return array_pop($this->items); - } - - /** - * 通过使用用户自定义函数,以字符串返回数组 - * - * @access public - * @param callable $callback 调用方法 - * @param mixed $initial - * @return mixed - */ - public function reduce(callable $callback, $initial = null) - { - return array_reduce($this->items, $callback, $initial); - } - - /** - * 以相反的顺序返回数组。 - * - * @access public - * @return static - */ - public function reverse() - { - return new static(array_reverse($this->items)); - } - - /** - * 删除数组中首个元素,并返回被删除元素的值 - * - * @access public - * @return mixed - */ - public function shift() - { - return array_shift($this->items); - } - - /** - * 在数组结尾插入一个元素 - * @access public - * @param mixed $value 元素 - * @param string $key KEY - * @return void - */ - public function push($value, string $key = null): void - { - if (is_null($key)) { - $this->items[] = $value; - } else { - $this->items[$key] = $value; - } - } - - /** - * 把一个数组分割为新的数组块. - * - * @access public - * @param int $size 块大小 - * @param bool $preserveKeys - * @return static - */ - public function chunk(int $size, bool $preserveKeys = false) - { - $chunks = []; - - foreach (array_chunk($this->items, $size, $preserveKeys) as $chunk) { - $chunks[] = new static($chunk); - } - - return new static($chunks); - } - - /** - * 在数组开头插入一个元素 - * @access public - * @param mixed $value 元素 - * @param string $key KEY - * @return void - */ - public function unshift($value, string $key = null): void - { - if (is_null($key)) { - array_unshift($this->items, $value); - } else { - $this->items = [$key => $value] + $this->items; - } - } - - /** - * 给每个元素执行个回调 - * - * @access public - * @param callable $callback 回调 - * @return $this - */ - public function each(callable $callback) - { - foreach ($this->items as $key => $item) { - $result = $callback($item, $key); - - if (false === $result) { - break; - } elseif (!is_object($item)) { - $this->items[$key] = $result; - } - } - - return $this; - } - - /** - * 用回调函数处理数组中的元素 - * @access public - * @param callable|null $callback 回调 - * @return static - */ - public function map(callable $callback) - { - return new static(array_map($callback, $this->items)); - } - - /** - * 用回调函数过滤数组中的元素 - * @access public - * @param callable|null $callback 回调 - * @return static - */ - public function filter(callable $callback = null) - { - if ($callback) { - return new static(array_filter($this->items, $callback)); - } - - return new static(array_filter($this->items)); - } - - /** - * 根据字段条件过滤数组中的元素 - * @access public - * @param string $field 字段名 - * @param mixed $operator 操作符 - * @param mixed $value 数据 - * @return static - */ - public function where(string $field, $operator, $value = null) - { - if (is_null($value)) { - $value = $operator; - $operator = '='; - } - - return $this->filter(function ($data) use ($field, $operator, $value) { - if (strpos($field, '.')) { - [$field, $relation] = explode('.', $field); - - $result = $data[$field][$relation] ?? null; - } else { - $result = $data[$field] ?? null; - } - - switch (strtolower($operator)) { - case '===': - return $result === $value; - case '!==': - return $result !== $value; - case '!=': - case '<>': - return $result != $value; - case '>': - return $result > $value; - case '>=': - return $result >= $value; - case '<': - return $result < $value; - case '<=': - return $result <= $value; - case 'like': - return is_string($result) && false !== strpos($result, $value); - case 'not like': - return is_string($result) && false === strpos($result, $value); - case 'in': - return is_scalar($result) && in_array($result, $value, true); - case 'not in': - return is_scalar($result) && !in_array($result, $value, true); - case 'between': - [$min, $max] = is_string($value) ? explode(',', $value) : $value; - return is_scalar($result) && $result >= $min && $result <= $max; - case 'not between': - [$min, $max] = is_string($value) ? explode(',', $value) : $value; - return is_scalar($result) && $result > $max || $result < $min; - case '==': - case '=': - default: - return $result == $value; - } - }); - } - - /** - * LIKE过滤 - * @access public - * @param string $field 字段名 - * @param string $value 数据 - * @return static - */ - public function whereLike(string $field, string $value) - { - return $this->where($field, 'like', $value); - } - - /** - * NOT LIKE过滤 - * @access public - * @param string $field 字段名 - * @param string $value 数据 - * @return static - */ - public function whereNotLike(string $field, string $value) - { - return $this->where($field, 'not like', $value); - } - - /** - * IN过滤 - * @access public - * @param string $field 字段名 - * @param array $value 数据 - * @return static - */ - public function whereIn(string $field, array $value) - { - return $this->where($field, 'in', $value); - } - - /** - * NOT IN过滤 - * @access public - * @param string $field 字段名 - * @param array $value 数据 - * @return static - */ - public function whereNotIn(string $field, array $value) - { - return $this->where($field, 'not in', $value); - } - - /** - * BETWEEN 过滤 - * @access public - * @param string $field 字段名 - * @param mixed $value 数据 - * @return static - */ - public function whereBetween(string $field, $value) - { - return $this->where($field, 'between', $value); - } - - /** - * NOT BETWEEN 过滤 - * @access public - * @param string $field 字段名 - * @param mixed $value 数据 - * @return static - */ - public function whereNotBetween(string $field, $value) - { - return $this->where($field, 'not between', $value); - } - - /** - * 返回数据中指定的一列 - * @access public - * @param string|null $columnKey 键名 - * @param string|null $indexKey 作为索引值的列 - * @return array - */ - public function column(?string $columnKey, string $indexKey = null) - { - return array_column($this->items, $columnKey, $indexKey); - } - - /** - * 对数组排序 - * - * @access public - * @param callable|null $callback 回调 - * @return static - */ - public function sort(callable $callback = null) - { - $items = $this->items; - - $callback = $callback ?: function ($a, $b) { - return $a == $b ? 0 : (($a < $b) ? -1 : 1); - }; - - uasort($items, $callback); - - return new static($items); - } - - /** - * 指定字段排序 - * @access public - * @param string $field 排序字段 - * @param string $order 排序 - * @return $this - */ - public function order(string $field, string $order = 'asc') - { - return $this->sort(function ($a, $b) use ($field, $order) { - $fieldA = $a[$field] ?? null; - $fieldB = $b[$field] ?? null; - - return 'desc' == strtolower($order) ? $fieldB > $fieldA : $fieldA > $fieldB; - }); - } - - /** - * 将数组打乱 - * - * @access public - * @return static - */ - public function shuffle() - { - $items = $this->items; - - shuffle($items); - - return new static($items); - } - - /** - * 获取最第一个单元数据 - * - * @access public - * @param callable|null $callback - * @param null $default - * @return mixed - */ - public function first(callable $callback = null, $default = null) - { - return Arr::first($this->items, $callback, $default); - } - - /** - * 获取最后一个单元数据 - * - * @access public - * @param callable|null $callback - * @param null $default - * @return mixed - */ - public function last(callable $callback = null, $default = null) - { - return Arr::last($this->items, $callback, $default); - } - - /** - * 截取数组 - * - * @access public - * @param int $offset 起始位置 - * @param int $length 截取长度 - * @param bool $preserveKeys preserveKeys - * @return static - */ - public function slice(int $offset, int $length = null, bool $preserveKeys = false) - { - return new static(array_slice($this->items, $offset, $length, $preserveKeys)); - } - - // ArrayAccess - public function offsetExists($offset) - { - return array_key_exists($offset, $this->items); - } - - public function offsetGet($offset) - { - return $this->items[$offset]; - } - - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->items[] = $value; - } else { - $this->items[$offset] = $value; - } - } - - public function offsetUnset($offset) - { - unset($this->items[$offset]); - } - - //Countable - public function count() - { - return count($this->items); - } - - //IteratorAggregate - public function getIterator() - { - return new ArrayIterator($this->items); - } - - //JsonSerializable - public function jsonSerialize() - { - return $this->toArray(); - } - - /** - * 转换当前数据集为JSON字符串 - * @access public - * @param integer $options json参数 - * @return string - */ - public function toJson(int $options = JSON_UNESCAPED_UNICODE): string - { - return json_encode($this->toArray(), $options); - } - - public function __toString() - { - return $this->toJson(); - } - - /** - * 转换成数组 - * - * @access public - * @param mixed $items 数据 - * @return array - */ - protected function convertToArray($items): array - { - if ($items instanceof self) { - return $items->all(); - } - - return (array) $items; - } -} diff --git a/vendor/topthink/think-helper/src/contract/Arrayable.php b/vendor/topthink/think-helper/src/contract/Arrayable.php deleted file mode 100644 index 7c6b992b..00000000 --- a/vendor/topthink/think-helper/src/contract/Arrayable.php +++ /dev/null @@ -1,8 +0,0 @@ - -// +---------------------------------------------------------------------- - -use think\Collection; -use think\helper\Arr; - -if (!function_exists('throw_if')) { - /** - * 按条件抛异常 - * - * @param mixed $condition - * @param Throwable|string $exception - * @param array ...$parameters - * @return mixed - * - * @throws Throwable - */ - function throw_if($condition, $exception, ...$parameters) - { - if ($condition) { - throw (is_string($exception) ? new $exception(...$parameters) : $exception); - } - - return $condition; - } -} - -if (!function_exists('throw_unless')) { - /** - * 按条件抛异常 - * - * @param mixed $condition - * @param Throwable|string $exception - * @param array ...$parameters - * @return mixed - * @throws Throwable - */ - function throw_unless($condition, $exception, ...$parameters) - { - if (!$condition) { - throw (is_string($exception) ? new $exception(...$parameters) : $exception); - } - - return $condition; - } -} - -if (!function_exists('tap')) { - /** - * 对一个值调用给定的闭包,然后返回该值 - * - * @param mixed $value - * @param callable|null $callback - * @return mixed - */ - function tap($value, $callback = null) - { - if (is_null($callback)) { - return $value; - } - - $callback($value); - - return $value; - } -} - -if (!function_exists('value')) { - /** - * Return the default value of the given value. - * - * @param mixed $value - * @return mixed - */ - function value($value) - { - return $value instanceof Closure ? $value() : $value; - } -} - -if (!function_exists('collect')) { - /** - * Create a collection from the given value. - * - * @param mixed $value - * @return Collection - */ - function collect($value = null) - { - return new Collection($value); - } -} - -if (!function_exists('data_fill')) { - /** - * Fill in data where it's missing. - * - * @param mixed $target - * @param string|array $key - * @param mixed $value - * @return mixed - */ - function data_fill(&$target, $key, $value) - { - return data_set($target, $key, $value, false); - } -} - -if (!function_exists('data_get')) { - /** - * Get an item from an array or object using "dot" notation. - * - * @param mixed $target - * @param string|array|int $key - * @param mixed $default - * @return mixed - */ - function data_get($target, $key, $default = null) - { - if (is_null($key)) { - return $target; - } - - $key = is_array($key) ? $key : explode('.', $key); - - while (!is_null($segment = array_shift($key))) { - if ('*' === $segment) { - if ($target instanceof Collection) { - $target = $target->all(); - } elseif (!is_array($target)) { - return value($default); - } - - $result = []; - - foreach ($target as $item) { - $result[] = data_get($item, $key); - } - - return in_array('*', $key) ? Arr::collapse($result) : $result; - } - - if (Arr::accessible($target) && Arr::exists($target, $segment)) { - $target = $target[$segment]; - } elseif (is_object($target) && isset($target->{$segment})) { - $target = $target->{$segment}; - } else { - return value($default); - } - } - - return $target; - } -} - -if (!function_exists('data_set')) { - /** - * Set an item on an array or object using dot notation. - * - * @param mixed $target - * @param string|array $key - * @param mixed $value - * @param bool $overwrite - * @return mixed - */ - function data_set(&$target, $key, $value, $overwrite = true) - { - $segments = is_array($key) ? $key : explode('.', $key); - - if (($segment = array_shift($segments)) === '*') { - if (!Arr::accessible($target)) { - $target = []; - } - - if ($segments) { - foreach ($target as &$inner) { - data_set($inner, $segments, $value, $overwrite); - } - } elseif ($overwrite) { - foreach ($target as &$inner) { - $inner = $value; - } - } - } elseif (Arr::accessible($target)) { - if ($segments) { - if (!Arr::exists($target, $segment)) { - $target[$segment] = []; - } - - data_set($target[$segment], $segments, $value, $overwrite); - } elseif ($overwrite || !Arr::exists($target, $segment)) { - $target[$segment] = $value; - } - } elseif (is_object($target)) { - if ($segments) { - if (!isset($target->{$segment})) { - $target->{$segment} = []; - } - - data_set($target->{$segment}, $segments, $value, $overwrite); - } elseif ($overwrite || !isset($target->{$segment})) { - $target->{$segment} = $value; - } - } else { - $target = []; - - if ($segments) { - data_set($target[$segment], $segments, $value, $overwrite); - } elseif ($overwrite) { - $target[$segment] = $value; - } - } - - return $target; - } -} - -if (!function_exists('trait_uses_recursive')) { - /** - * 获取一个trait里所有引用到的trait - * - * @param string $trait Trait - * @return array - */ - function trait_uses_recursive(string $trait): array - { - $traits = class_uses($trait); - foreach ($traits as $trait) { - $traits += trait_uses_recursive($trait); - } - - return $traits; - } -} - -if (!function_exists('class_basename')) { - /** - * 获取类名(不包含命名空间) - * - * @param mixed $class 类名 - * @return string - */ - function class_basename($class): string - { - $class = is_object($class) ? get_class($class) : $class; - return basename(str_replace('\\', '/', $class)); - } -} - -if (!function_exists('class_uses_recursive')) { - /** - *获取一个类里所有用到的trait,包括父类的 - * - * @param mixed $class 类名 - * @return array - */ - function class_uses_recursive($class): array - { - if (is_object($class)) { - $class = get_class($class); - } - - $results = []; - $classes = array_merge([$class => $class], class_parents($class)); - foreach ($classes as $class) { - $results += trait_uses_recursive($class); - } - - return array_unique($results); - } -} diff --git a/vendor/topthink/think-helper/src/helper/Arr.php b/vendor/topthink/think-helper/src/helper/Arr.php deleted file mode 100644 index ed4d6a9e..00000000 --- a/vendor/topthink/think-helper/src/helper/Arr.php +++ /dev/null @@ -1,634 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\helper; - -use ArrayAccess; -use InvalidArgumentException; -use think\Collection; - -class Arr -{ - - /** - * Determine whether the given value is array accessible. - * - * @param mixed $value - * @return bool - */ - public static function accessible($value) - { - return is_array($value) || $value instanceof ArrayAccess; - } - - /** - * Add an element to an array using "dot" notation if it doesn't exist. - * - * @param array $array - * @param string $key - * @param mixed $value - * @return array - */ - public static function add($array, $key, $value) - { - if (is_null(static::get($array, $key))) { - static::set($array, $key, $value); - } - - return $array; - } - - /** - * Collapse an array of arrays into a single array. - * - * @param array $array - * @return array - */ - public static function collapse($array) - { - $results = []; - - foreach ($array as $values) { - if ($values instanceof Collection) { - $values = $values->all(); - } elseif (!is_array($values)) { - continue; - } - - $results = array_merge($results, $values); - } - - return $results; - } - - /** - * Cross join the given arrays, returning all possible permutations. - * - * @param array ...$arrays - * @return array - */ - public static function crossJoin(...$arrays) - { - $results = [[]]; - - foreach ($arrays as $index => $array) { - $append = []; - - foreach ($results as $product) { - foreach ($array as $item) { - $product[$index] = $item; - - $append[] = $product; - } - } - - $results = $append; - } - - return $results; - } - - /** - * Divide an array into two arrays. One with keys and the other with values. - * - * @param array $array - * @return array - */ - public static function divide($array) - { - return [array_keys($array), array_values($array)]; - } - - /** - * Flatten a multi-dimensional associative array with dots. - * - * @param array $array - * @param string $prepend - * @return array - */ - public static function dot($array, $prepend = '') - { - $results = []; - - foreach ($array as $key => $value) { - if (is_array($value) && !empty($value)) { - $results = array_merge($results, static::dot($value, $prepend . $key . '.')); - } else { - $results[$prepend . $key] = $value; - } - } - - return $results; - } - - /** - * Get all of the given array except for a specified array of keys. - * - * @param array $array - * @param array|string $keys - * @return array - */ - public static function except($array, $keys) - { - static::forget($array, $keys); - - return $array; - } - - /** - * Determine if the given key exists in the provided array. - * - * @param \ArrayAccess|array $array - * @param string|int $key - * @return bool - */ - public static function exists($array, $key) - { - if ($array instanceof ArrayAccess) { - return $array->offsetExists($key); - } - - return array_key_exists($key, $array); - } - - /** - * Return the first element in an array passing a given truth test. - * - * @param array $array - * @param callable|null $callback - * @param mixed $default - * @return mixed - */ - public static function first($array, callable $callback = null, $default = null) - { - if (is_null($callback)) { - if (empty($array)) { - return value($default); - } - - foreach ($array as $item) { - return $item; - } - } - - foreach ($array as $key => $value) { - if (call_user_func($callback, $value, $key)) { - return $value; - } - } - - return value($default); - } - - /** - * Return the last element in an array passing a given truth test. - * - * @param array $array - * @param callable|null $callback - * @param mixed $default - * @return mixed - */ - public static function last($array, callable $callback = null, $default = null) - { - if (is_null($callback)) { - return empty($array) ? value($default) : end($array); - } - - return static::first(array_reverse($array, true), $callback, $default); - } - - /** - * Flatten a multi-dimensional array into a single level. - * - * @param array $array - * @param int $depth - * @return array - */ - public static function flatten($array, $depth = INF) - { - $result = []; - - foreach ($array as $item) { - $item = $item instanceof Collection ? $item->all() : $item; - - if (!is_array($item)) { - $result[] = $item; - } elseif ($depth === 1) { - $result = array_merge($result, array_values($item)); - } else { - $result = array_merge($result, static::flatten($item, $depth - 1)); - } - } - - return $result; - } - - /** - * Remove one or many array items from a given array using "dot" notation. - * - * @param array $array - * @param array|string $keys - * @return void - */ - public static function forget(&$array, $keys) - { - $original = &$array; - - $keys = (array) $keys; - - if (count($keys) === 0) { - return; - } - - foreach ($keys as $key) { - // if the exact key exists in the top-level, remove it - if (static::exists($array, $key)) { - unset($array[$key]); - - continue; - } - - $parts = explode('.', $key); - - // clean up before each pass - $array = &$original; - - while (count($parts) > 1) { - $part = array_shift($parts); - - if (isset($array[$part]) && is_array($array[$part])) { - $array = &$array[$part]; - } else { - continue 2; - } - } - - unset($array[array_shift($parts)]); - } - } - - /** - * Get an item from an array using "dot" notation. - * - * @param \ArrayAccess|array $array - * @param string $key - * @param mixed $default - * @return mixed - */ - public static function get($array, $key, $default = null) - { - if (!static::accessible($array)) { - return value($default); - } - - if (is_null($key)) { - return $array; - } - - if (static::exists($array, $key)) { - return $array[$key]; - } - - if (strpos($key, '.') === false) { - return $array[$key] ?? value($default); - } - - foreach (explode('.', $key) as $segment) { - if (static::accessible($array) && static::exists($array, $segment)) { - $array = $array[$segment]; - } else { - return value($default); - } - } - - return $array; - } - - /** - * Check if an item or items exist in an array using "dot" notation. - * - * @param \ArrayAccess|array $array - * @param string|array $keys - * @return bool - */ - public static function has($array, $keys) - { - $keys = (array) $keys; - - if (!$array || $keys === []) { - return false; - } - - foreach ($keys as $key) { - $subKeyArray = $array; - - if (static::exists($array, $key)) { - continue; - } - - foreach (explode('.', $key) as $segment) { - if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) { - $subKeyArray = $subKeyArray[$segment]; - } else { - return false; - } - } - } - - return true; - } - - /** - * Determines if an array is associative. - * - * An array is "associative" if it doesn't have sequential numerical keys beginning with zero. - * - * @param array $array - * @return bool - */ - public static function isAssoc(array $array) - { - $keys = array_keys($array); - - return array_keys($keys) !== $keys; - } - - /** - * Get a subset of the items from the given array. - * - * @param array $array - * @param array|string $keys - * @return array - */ - public static function only($array, $keys) - { - return array_intersect_key($array, array_flip((array) $keys)); - } - - /** - * Pluck an array of values from an array. - * - * @param array $array - * @param string|array $value - * @param string|array|null $key - * @return array - */ - public static function pluck($array, $value, $key = null) - { - $results = []; - - [$value, $key] = static::explodePluckParameters($value, $key); - - foreach ($array as $item) { - $itemValue = data_get($item, $value); - - // If the key is "null", we will just append the value to the array and keep - // looping. Otherwise we will key the array using the value of the key we - // received from the developer. Then we'll return the final array form. - if (is_null($key)) { - $results[] = $itemValue; - } else { - $itemKey = data_get($item, $key); - - if (is_object($itemKey) && method_exists($itemKey, '__toString')) { - $itemKey = (string) $itemKey; - } - - $results[$itemKey] = $itemValue; - } - } - - return $results; - } - - /** - * Explode the "value" and "key" arguments passed to "pluck". - * - * @param string|array $value - * @param string|array|null $key - * @return array - */ - protected static function explodePluckParameters($value, $key) - { - $value = is_string($value) ? explode('.', $value) : $value; - - $key = is_null($key) || is_array($key) ? $key : explode('.', $key); - - return [$value, $key]; - } - - /** - * Push an item onto the beginning of an array. - * - * @param array $array - * @param mixed $value - * @param mixed $key - * @return array - */ - public static function prepend($array, $value, $key = null) - { - if (is_null($key)) { - array_unshift($array, $value); - } else { - $array = [$key => $value] + $array; - } - - return $array; - } - - /** - * Get a value from the array, and remove it. - * - * @param array $array - * @param string $key - * @param mixed $default - * @return mixed - */ - public static function pull(&$array, $key, $default = null) - { - $value = static::get($array, $key, $default); - - static::forget($array, $key); - - return $value; - } - - /** - * Get one or a specified number of random values from an array. - * - * @param array $array - * @param int|null $number - * @return mixed - * - * @throws \InvalidArgumentException - */ - public static function random($array, $number = null) - { - $requested = is_null($number) ? 1 : $number; - - $count = count($array); - - if ($requested > $count) { - throw new InvalidArgumentException( - "You requested {$requested} items, but there are only {$count} items available." - ); - } - - if (is_null($number)) { - return $array[array_rand($array)]; - } - - if ((int) $number === 0) { - return []; - } - - $keys = array_rand($array, $number); - - $results = []; - - foreach ((array) $keys as $key) { - $results[] = $array[$key]; - } - - return $results; - } - - /** - * Set an array item to a given value using "dot" notation. - * - * If no key is given to the method, the entire array will be replaced. - * - * @param array $array - * @param string $key - * @param mixed $value - * @return array - */ - public static function set(&$array, $key, $value) - { - if (is_null($key)) { - return $array = $value; - } - - $keys = explode('.', $key); - - while (count($keys) > 1) { - $key = array_shift($keys); - - // If the key doesn't exist at this depth, we will just create an empty array - // to hold the next value, allowing us to create the arrays to hold final - // values at the correct depth. Then we'll keep digging into the array. - if (!isset($array[$key]) || !is_array($array[$key])) { - $array[$key] = []; - } - - $array = &$array[$key]; - } - - $array[array_shift($keys)] = $value; - - return $array; - } - - /** - * Shuffle the given array and return the result. - * - * @param array $array - * @param int|null $seed - * @return array - */ - public static function shuffle($array, $seed = null) - { - if (is_null($seed)) { - shuffle($array); - } else { - srand($seed); - - usort($array, function () { - return rand(-1, 1); - }); - } - - return $array; - } - - /** - * Sort the array using the given callback or "dot" notation. - * - * @param array $array - * @param callable|string|null $callback - * @return array - */ - public static function sort($array, $callback = null) - { - return Collection::make($array)->sort($callback)->all(); - } - - /** - * Recursively sort an array by keys and values. - * - * @param array $array - * @return array - */ - public static function sortRecursive($array) - { - foreach ($array as &$value) { - if (is_array($value)) { - $value = static::sortRecursive($value); - } - } - - if (static::isAssoc($array)) { - ksort($array); - } else { - sort($array); - } - - return $array; - } - - /** - * Convert the array into a query string. - * - * @param array $array - * @return string - */ - public static function query($array) - { - return http_build_query($array, null, '&', PHP_QUERY_RFC3986); - } - - /** - * Filter the array using the given callback. - * - * @param array $array - * @param callable $callback - * @return array - */ - public static function where($array, callable $callback) - { - return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH); - } - - /** - * If the given value is not an array and not null, wrap it in one. - * - * @param mixed $value - * @return array - */ - public static function wrap($value) - { - if (is_null($value)) { - return []; - } - - return is_array($value) ? $value : [$value]; - } -} \ No newline at end of file diff --git a/vendor/topthink/think-helper/src/helper/Str.php b/vendor/topthink/think-helper/src/helper/Str.php deleted file mode 100644 index 7391fbd3..00000000 --- a/vendor/topthink/think-helper/src/helper/Str.php +++ /dev/null @@ -1,234 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\helper; - -class Str -{ - - protected static $snakeCache = []; - - protected static $camelCache = []; - - protected static $studlyCache = []; - - /** - * 检查字符串中是否包含某些字符串 - * @param string $haystack - * @param string|array $needles - * @return bool - */ - public static function contains(string $haystack, $needles): bool - { - foreach ((array) $needles as $needle) { - if ('' != $needle && mb_strpos($haystack, $needle) !== false) { - return true; - } - } - - return false; - } - - /** - * 检查字符串是否以某些字符串结尾 - * - * @param string $haystack - * @param string|array $needles - * @return bool - */ - public static function endsWith(string $haystack, $needles): bool - { - foreach ((array) $needles as $needle) { - if ((string) $needle === static::substr($haystack, -static::length($needle))) { - return true; - } - } - - return false; - } - - /** - * 检查字符串是否以某些字符串开头 - * - * @param string $haystack - * @param string|array $needles - * @return bool - */ - public static function startsWith(string $haystack, $needles): bool - { - foreach ((array) $needles as $needle) { - if ('' != $needle && mb_strpos($haystack, $needle) === 0) { - return true; - } - } - - return false; - } - - /** - * 获取指定长度的随机字母数字组合的字符串 - * - * @param int $length - * @param int $type - * @param string $addChars - * @return string - */ - public static function random(int $length = 6, int $type = null, string $addChars = ''): string - { - $str = ''; - switch ($type) { - case 0: - $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' . $addChars; - break; - case 1: - $chars = str_repeat('0123456789', 3); - break; - case 2: - $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . $addChars; - break; - case 3: - $chars = 'abcdefghijklmnopqrstuvwxyz' . $addChars; - break; - case 4: - $chars = "们以我到他会作时要动国产的一是工就年阶义发成部民可出能方进在了不和有大这主中人上为来分生对于学下级地个用同行面说种过命度革而多子后自社加小机也经力线本电高量长党得实家定深法表着水理化争现所二起政三好十战无农使性前等反体合斗路图把结第里正新开论之物从当两些还天资事队批点育重其思与间内去因件日利相由压员气业代全组数果期导平各基或月毛然如应形想制心样干都向变关问比展那它最及外没看治提五解系林者米群头意只明四道马认次文通但条较克又公孔领军流入接席位情运器并飞原油放立题质指建区验活众很教决特此常石强极土少已根共直团统式转别造切九你取西持总料连任志观调七么山程百报更见必真保热委手改管处己将修支识病象几先老光专什六型具示复安带每东增则完风回南广劳轮科北打积车计给节做务被整联步类集号列温装即毫知轴研单色坚据速防史拉世设达尔场织历花受求传口断况采精金界品判参层止边清至万确究书" . $addChars; - break; - default: - $chars = 'ABCDEFGHIJKMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789' . $addChars; - break; - } - if ($length > 10) { - $chars = $type == 1 ? str_repeat($chars, $length) : str_repeat($chars, 5); - } - if ($type != 4) { - $chars = str_shuffle($chars); - $str = substr($chars, 0, $length); - } else { - for ($i = 0; $i < $length; $i++) { - $str .= mb_substr($chars, floor(mt_rand(0, mb_strlen($chars, 'utf-8') - 1)), 1); - } - } - return $str; - } - - /** - * 字符串转小写 - * - * @param string $value - * @return string - */ - public static function lower(string $value): string - { - return mb_strtolower($value, 'UTF-8'); - } - - /** - * 字符串转大写 - * - * @param string $value - * @return string - */ - public static function upper(string $value): string - { - return mb_strtoupper($value, 'UTF-8'); - } - - /** - * 获取字符串的长度 - * - * @param string $value - * @return int - */ - public static function length(string $value): int - { - return mb_strlen($value); - } - - /** - * 截取字符串 - * - * @param string $string - * @param int $start - * @param int|null $length - * @return string - */ - public static function substr(string $string, int $start, int $length = null): string - { - return mb_substr($string, $start, $length, 'UTF-8'); - } - - /** - * 驼峰转下划线 - * - * @param string $value - * @param string $delimiter - * @return string - */ - public static function snake(string $value, string $delimiter = '_'): string - { - $key = $value; - - if (isset(static::$snakeCache[$key][$delimiter])) { - return static::$snakeCache[$key][$delimiter]; - } - - if (!ctype_lower($value)) { - $value = preg_replace('/\s+/u', '', $value); - - $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1' . $delimiter, $value)); - } - - return static::$snakeCache[$key][$delimiter] = $value; - } - - /** - * 下划线转驼峰(首字母小写) - * - * @param string $value - * @return string - */ - public static function camel(string $value): string - { - if (isset(static::$camelCache[$value])) { - return static::$camelCache[$value]; - } - - return static::$camelCache[$value] = lcfirst(static::studly($value)); - } - - /** - * 下划线转驼峰(首字母大写) - * - * @param string $value - * @return string - */ - public static function studly(string $value): string - { - $key = $value; - - if (isset(static::$studlyCache[$key])) { - return static::$studlyCache[$key]; - } - - $value = ucwords(str_replace(['-', '_'], ' ', $value)); - - return static::$studlyCache[$key] = str_replace(' ', '', $value); - } - - /** - * 转为首字母大写的标题格式 - * - * @param string $value - * @return string - */ - public static function title(string $value): string - { - return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8'); - } -} diff --git a/vendor/topthink/think-multi-app/LICENSE b/vendor/topthink/think-multi-app/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/vendor/topthink/think-multi-app/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/topthink/think-multi-app/README.md b/vendor/topthink/think-multi-app/README.md deleted file mode 100644 index a746fa7a..00000000 --- a/vendor/topthink/think-multi-app/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# think-multi-app - -用于ThinkPHP6+的多应用支持 - -## 安装 - -~~~ -composer require topthink/think-multi-app -~~~ - -## 使用 - -用法参考ThinkPHP6完全开发手册[多应用模式](https://www.kancloud.cn/manual/thinkphp6_0/1297876)章节。 - diff --git a/vendor/topthink/think-multi-app/composer.json b/vendor/topthink/think-multi-app/composer.json deleted file mode 100644 index 92d620eb..00000000 --- a/vendor/topthink/think-multi-app/composer.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "topthink/think-multi-app", - "description": "thinkphp6 multi app support", - "license": "Apache-2.0", - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "require": { - "php": ">=7.1.0", - "topthink/framework": "^6.0.0" - }, - "autoload": { - "psr-4": { - "think\\app\\": "src" - } - }, - "extra": { - "think":{ - "services":[ - "think\\app\\Service" - ] - } - }, - "minimum-stability": "dev" -} diff --git a/vendor/topthink/think-multi-app/src/MultiApp.php b/vendor/topthink/think-multi-app/src/MultiApp.php deleted file mode 100644 index f069aeb2..00000000 --- a/vendor/topthink/think-multi-app/src/MultiApp.php +++ /dev/null @@ -1,255 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\app; - -use Closure; -use think\App; -use think\exception\HttpException; -use think\Request; -use think\Response; - -/** - * 多应用模式支持 - */ -class MultiApp -{ - - /** @var App */ - protected $app; - - /** - * 应用名称 - * @var string - */ - protected $name; - - /** - * 应用名称 - * @var string - */ - protected $appName; - - /** - * 应用路径 - * @var string - */ - protected $path; - - public function __construct(App $app) - { - $this->app = $app; - $this->name = $this->app->http->getName(); - $this->path = $this->app->http->getPath(); - } - - /** - * 多应用解析 - * @access public - * @param Request $request - * @param Closure $next - * @return Response - */ - public function handle($request, Closure $next) - { - if (!$this->parseMultiApp()) { - return $next($request); - } - - return $this->app->middleware->pipeline('app') - ->send($request) - ->then(function ($request) use ($next) { - return $next($request); - }); - } - - /** - * 获取路由目录 - * @access protected - * @return string - */ - protected function getRoutePath(): string - { - if (is_dir($this->app->getAppPath() . 'route')) { - return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR; - } - - return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $this->appName . DIRECTORY_SEPARATOR; - } - - /** - * 解析多应用 - * @return bool - */ - protected function parseMultiApp(): bool - { - $scriptName = $this->getScriptName(); - $defaultApp = $this->app->config->get('app.default_app') ?: 'index'; - - if ($this->name || ($scriptName && !in_array($scriptName, ['index', 'router', 'think']))) { - $appName = $this->name ?: $scriptName; - $this->app->http->setBind(); - } else { - // 自动多应用识别 - $this->app->http->setBind(false); - $appName = null; - $this->appName = ''; - - $bind = $this->app->config->get('app.domain_bind', []); - - if (!empty($bind)) { - // 获取当前子域名 - $subDomain = $this->app->request->subDomain(); - $domain = $this->app->request->host(true); - - if (isset($bind[$domain])) { - $appName = $bind[$domain]; - $this->app->http->setBind(); - } elseif (isset($bind[$subDomain])) { - $appName = $bind[$subDomain]; - $this->app->http->setBind(); - } elseif (isset($bind['*'])) { - $appName = $bind['*']; - $this->app->http->setBind(); - } - } - - if (!$this->app->http->isBind()) { - $path = $this->app->request->pathinfo(); - $map = $this->app->config->get('app.app_map', []); - $deny = $this->app->config->get('app.deny_app_list', []); - $name = current(explode('/', $path)); - - if (strpos($name, '.')) { - $name = strstr($name, '.', true); - } - - if (isset($map[$name])) { - if ($map[$name] instanceof Closure) { - $result = call_user_func_array($map[$name], [$this->app]); - $appName = $result ?: $name; - } else { - $appName = $map[$name]; - } - } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) { - throw new HttpException(404, 'app not exists:' . $name); - } elseif ($name && isset($map['*'])) { - $appName = $map['*']; - } else { - $appName = $name ?: $defaultApp; - $appPath = $this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR; - - if (!is_dir($appPath)) { - $express = $this->app->config->get('app.app_express', false); - if ($express) { - $this->setApp($defaultApp); - return true; - } else { - return false; - } - } - } - - if ($name) { - $this->app->request->setRoot('/' . $name); - $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : ''); - } - } - } - - $this->setApp($appName ?: $defaultApp); - return true; - } - - /** - * 获取当前运行入口名称 - * @access protected - * @codeCoverageIgnore - * @return string - */ - protected function getScriptName(): string - { - if (isset($_SERVER['SCRIPT_FILENAME'])) { - $file = $_SERVER['SCRIPT_FILENAME']; - } elseif (isset($_SERVER['argv'][0])) { - $file = realpath($_SERVER['argv'][0]); - } - - return isset($file) ? pathinfo($file, PATHINFO_FILENAME) : ''; - } - - /** - * 设置应用 - * @param string $appName - */ - protected function setApp(string $appName): void - { - $this->appName = $appName; - $this->app->http->name($appName); - - $appPath = $this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR; - - $this->app->setAppPath($appPath); - // 设置应用命名空间 - $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName); - - if (is_dir($appPath)) { - $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR); - $this->app->http->setRoutePath($this->getRoutePath()); - - //加载应用 - $this->loadApp($appName, $appPath); - } - } - - /** - * 加载应用文件 - * @param string $appName 应用名 - * @return void - */ - protected function loadApp(string $appName, string $appPath): void - { - if (is_file($appPath . 'common.php')) { - include_once $appPath . 'common.php'; - } - - $configPath = $this->app->getConfigPath(); - - $files = []; - - if (is_dir($appPath . 'config')) { - $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt())); - } elseif (is_dir($configPath . $appName)) { - $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt())); - } - - foreach ($files as $file) { - $this->app->config->load($file, pathinfo($file, PATHINFO_FILENAME)); - } - - if (is_file($appPath . 'event.php')) { - $this->app->loadEvent(include $appPath . 'event.php'); - } - - if (is_file($appPath . 'middleware.php')) { - $this->app->middleware->import(include $appPath . 'middleware.php', 'app'); - } - - if (is_file($appPath . 'provider.php')) { - $this->app->bind(include $appPath . 'provider.php'); - } - - // 加载应用默认语言包 - $this->app->loadLangPack($this->app->lang->defaultLangSet()); - } - -} diff --git a/vendor/topthink/think-multi-app/src/Service.php b/vendor/topthink/think-multi-app/src/Service.php deleted file mode 100644 index ad576c39..00000000 --- a/vendor/topthink/think-multi-app/src/Service.php +++ /dev/null @@ -1,29 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\app; - -use think\Service as BaseService; - -class Service extends BaseService -{ - public function register() - { - $this->app->middleware->unshift(MultiApp::class); - - $this->commands([ - 'build' => command\Build::class, - ]); - - $this->app->bind([ - 'think\route\Url' => Url::class, - ]); - } -} diff --git a/vendor/topthink/think-multi-app/src/Url.php b/vendor/topthink/think-multi-app/src/Url.php deleted file mode 100644 index 78a88040..00000000 --- a/vendor/topthink/think-multi-app/src/Url.php +++ /dev/null @@ -1,224 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\app; - -use think\App; -use think\Route; -use think\route\Url as UrlBuild; - -/** - * 路由地址生成 - */ -class Url extends UrlBuild -{ - - /** - * 直接解析URL地址 - * @access protected - * @param string $url URL - * @param string|bool $domain Domain - * @return string - */ - protected function parseUrl(string $url, &$domain): string - { - $request = $this->app->request; - - if (0 === strpos($url, '/')) { - // 直接作为路由地址解析 - $url = substr($url, 1); - } elseif (false !== strpos($url, '\\')) { - // 解析到类 - $url = ltrim(str_replace('\\', '/', $url), '/'); - } elseif (0 === strpos($url, '@')) { - // 解析到控制器 - $url = substr($url, 1); - } elseif ('' === $url) { - $url = $this->app->http->getName() . '/' . $request->controller() . '/' . $request->action(); - } else { - // 解析到 应用/控制器/操作 - $controller = $request->controller(); - $app = $this->app->http->getName(); - - $path = explode('/', $url); - $action = array_pop($path); - $controller = empty($path) ? $controller : array_pop($path); - $app = empty($path) ? $app : array_pop($path); - - $url = $controller . '/' . $action; - - $bind = $this->app->config->get('app.domain_bind', []); - - if ($key = array_search($app, $bind)) { - $domain = is_bool($domain) ? $key : $domain; - } else { - $map = $this->app->config->get('app.app_map', []); - - if ($key = array_search($app, $map)) { - $url = $key . '/' . $url; - } else { - $url = $app . '/' . $url; - } - } - - } - - return $url; - } - - public function build() - { - // 解析URL - $url = $this->url; - $suffix = $this->suffix; - $domain = $this->domain; - $request = $this->app->request; - $vars = $this->vars; - - if (0 === strpos($url, '[') && $pos = strpos($url, ']')) { - // [name] 表示使用路由命名标识生成URL - $name = substr($url, 1, $pos - 1); - $url = 'name' . substr($url, $pos + 1); - } - - if (false === strpos($url, '://') && 0 !== strpos($url, '/')) { - $info = parse_url($url); - $url = !empty($info['path']) ? $info['path'] : ''; - - if (isset($info['fragment'])) { - // 解析锚点 - $anchor = $info['fragment']; - - if (false !== strpos($anchor, '?')) { - // 解析参数 - list($anchor, $info['query']) = explode('?', $anchor, 2); - } - - if (false !== strpos($anchor, '@')) { - // 解析域名 - list($anchor, $domain) = explode('@', $anchor, 2); - } - } elseif (strpos($url, '@') && false === strpos($url, '\\')) { - // 解析域名 - list($url, $domain) = explode('@', $url, 2); - } - } - - if ($url) { - $checkName = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : ''); - $checkDomain = $domain && is_string($domain) ? $domain : null; - - $rule = $this->route->getName($checkName, $checkDomain); - - if (empty($rule) && isset($info['query'])) { - $rule = $this->route->getName($url, $checkDomain); - // 解析地址里面参数 合并到vars - parse_str($info['query'], $params); - $vars = array_merge($params, $vars); - unset($info['query']); - } - } - - if (!empty($rule) && $match = $this->getRuleUrl($rule, $vars, $domain)) { - // 匹配路由命名标识 - $url = $match[0]; - - if ($domain && !empty($match[1])) { - $domain = $match[1]; - } - - if (!is_null($match[2])) { - $suffix = $match[2]; - } - - if (!$this->app->http->isBind()) { - $url = $this->app->http->getName() . '/' . $url; - } - } elseif (!empty($rule) && isset($name)) { - throw new \InvalidArgumentException('route name not exists:' . $name); - } else { - // 检测URL绑定 - $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null); - - if ($bind && 0 === strpos($url, $bind)) { - $url = substr($url, strlen($bind) + 1); - } else { - $binds = $this->route->getBind(); - - foreach ($binds as $key => $val) { - if (is_string($val) && 0 === strpos($url, $val) && substr_count($val, '/') > 1) { - $url = substr($url, strlen($val) + 1); - $domain = $key; - break; - } - } - } - - // 路由标识不存在 直接解析 - $url = $this->parseUrl($url, $domain); - - if (isset($info['query'])) { - // 解析地址里面参数 合并到vars - parse_str($info['query'], $params); - $vars = array_merge($params, $vars); - } - } - - // 还原URL分隔符 - $depr = $this->route->config('pathinfo_depr'); - $url = str_replace('/', $depr, $url); - - $file = $request->baseFile(); - if ($file && 0 !== strpos($request->url(), $file)) { - $file = str_replace('\\', '/', dirname($file)); - } - - $url = rtrim($file, '/') . '/' . ltrim($url, '/'); - - // URL后缀 - if ('/' == substr($url, -1) || '' == $url) { - $suffix = ''; - } else { - $suffix = $this->parseSuffix($suffix); - } - - // 锚点 - $anchor = !empty($anchor) ? '#' . $anchor : ''; - - // 参数组装 - if (!empty($vars)) { - // 添加参数 - if ($this->route->config('url_common_param')) { - $vars = http_build_query($vars); - $url .= $suffix . '?' . $vars . $anchor; - } else { - foreach ($vars as $var => $val) { - $val = (string) $val; - if ('' !== $val) { - $url .= $depr . $var . $depr . urlencode($val); - } - } - - $url .= $suffix . $anchor; - } - } else { - $url .= $suffix . $anchor; - } - - // 检测域名 - $domain = $this->parseDomain($url, $domain); - - // URL组装 - return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/'); - } - -} diff --git a/vendor/topthink/think-multi-app/src/command/Build.php b/vendor/topthink/think-multi-app/src/command/Build.php deleted file mode 100644 index e192167e..00000000 --- a/vendor/topthink/think-multi-app/src/command/Build.php +++ /dev/null @@ -1,180 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\app\command; - -use think\console\Command; -use think\console\Input; -use think\console\input\Argument; -use think\console\Output; - -class Build extends Command -{ - /** - * 应用基础目录 - * @var string - */ - protected $basePath; - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this->setName('build') - ->addArgument('app', Argument::OPTIONAL, 'app name .') - ->setDescription('Build App Dirs'); - } - - protected function execute(Input $input, Output $output) - { - $this->basePath = $this->app->getBasePath(); - $app = $input->getArgument('app') ?: ''; - - if (is_file($this->basePath . 'build.php')) { - $list = include $this->basePath . 'build.php'; - } else { - $list = [ - '__dir__' => ['controller', 'model', 'view'], - ]; - } - - $this->buildApp($app, $list); - $output->writeln("Successed"); - - } - - /** - * 创建应用 - * @access protected - * @param string $app 应用名 - * @param array $list 目录结构 - * @return void - */ - protected function buildApp(string $app, array $list = []): void - { - if (!is_dir($this->basePath . $app)) { - // 创建应用目录 - mkdir($this->basePath . $app); - } - - $appPath = $this->basePath . ($app ? $app . DIRECTORY_SEPARATOR : ''); - $namespace = 'app' . ($app ? '\\' . $app : ''); - - // 创建配置文件和公共文件 - $this->buildCommon($app); - // 创建模块的默认页面 - $this->buildHello($app, $namespace); - - foreach ($list as $path => $file) { - if ('__dir__' == $path) { - // 生成子目录 - foreach ($file as $dir) { - $this->checkDirBuild($appPath . $dir); - } - } elseif ('__file__' == $path) { - // 生成(空白)文件 - foreach ($file as $name) { - if (!is_file($appPath . $name)) { - file_put_contents($appPath . $name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? 'app->config->get('route.controller_suffix')) { - $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . 'Controller.php'; - $class = $val . 'Controller'; - } - $content = "checkDirBuild(dirname($filename)); - $content = ''; - break; - default: - // 其他文件 - $content = "app->config->get('route.controller_suffix') ? 'Controller' : ''; - $filename = $this->basePath . ($app ? $app . DIRECTORY_SEPARATOR : '') . 'controller' . DIRECTORY_SEPARATOR . 'Index' . $suffix . '.php'; - - if (!is_file($filename)) { - $content = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'controller.stub'); - $content = str_replace(['{%name%}', '{%app%}', '{%layer%}', '{%suffix%}'], [$app, $namespace, 'controller', $suffix], $content); - $this->checkDirBuild(dirname($filename)); - - file_put_contents($filename, $content); - } - } - - /** - * 创建应用的公共文件 - * @access protected - * @param string $app 目录 - * @return void - */ - protected function buildCommon(string $app): void - { - $appPath = $this->basePath . ($app ? $app . DIRECTORY_SEPARATOR : ''); - - if (!is_file($appPath . 'common.php')) { - file_put_contents($appPath . 'common.php', "=7.1.0", - "ext-json": "*", - "psr/simple-cache": "^1.0", - "psr/log": "~1.0", - "topthink/think-helper":"^3.1" - }, - "autoload": { - "psr-4": { - "think\\": "src" - }, - "files": [] - } -} diff --git a/vendor/topthink/think-orm/src/DbManager.php b/vendor/topthink/think-orm/src/DbManager.php deleted file mode 100644 index ceb508f1..00000000 --- a/vendor/topthink/think-orm/src/DbManager.php +++ /dev/null @@ -1,406 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use InvalidArgumentException; -use Psr\Log\LoggerInterface; -use Psr\SimpleCache\CacheInterface; -use think\db\BaseQuery; -use think\db\ConnectionInterface; -use think\db\Query; -use think\db\Raw; - -/** - * Class DbManager - * @package think - * @mixin BaseQuery - * @mixin Query - */ -class DbManager -{ - /** - * 数据库连接实例 - * @var array - */ - protected $instance = []; - - /** - * 数据库配置 - * @var array - */ - protected $config = []; - - /** - * Event对象或者数组 - * @var array|object - */ - protected $event; - - /** - * SQL监听 - * @var array - */ - protected $listen = []; - - /** - * SQL日志 - * @var array - */ - protected $dbLog = []; - - /** - * 查询次数 - * @var int - */ - protected $queryTimes = 0; - - /** - * 查询缓存对象 - * @var CacheInterface - */ - protected $cache; - - /** - * 查询日志对象 - * @var LoggerInterface - */ - protected $log; - - /** - * 架构函数 - * @access public - */ - public function __construct() - { - $this->modelMaker(); - } - - /** - * 注入模型对象 - * @access public - * @return void - */ - protected function modelMaker() - { - $this->triggerSql(); - - Model::setDb($this); - - if (is_object($this->event)) { - Model::setEvent($this->event); - } - - Model::maker(function (Model $model) { - $isAutoWriteTimestamp = $model->getAutoWriteTimestamp(); - - if (is_null($isAutoWriteTimestamp)) { - // 自动写入时间戳 - $model->isAutoWriteTimestamp($this->getConfig('auto_timestamp', true)); - } - - $dateFormat = $model->getDateFormat(); - - if (is_null($dateFormat)) { - // 设置时间戳格式 - $model->setDateFormat($this->getConfig('datetime_format', 'Y-m-d H:i:s')); - } - }); - } - - /** - * 监听SQL - * @access protected - * @return void - */ - protected function triggerSql(): void - { - // 监听SQL - $this->listen(function ($sql, $time, $master) { - if (0 === strpos($sql, 'CONNECT:')) { - $this->log($sql); - return; - } - - // 记录SQL - if (is_bool($master)) { - // 分布式记录当前操作的主从 - $master = $master ? 'master|' : 'slave|'; - } else { - $master = ''; - } - - $this->log($sql . ' [ ' . $master . 'RunTime:' . $time . 's ]'); - }); - } - - /** - * 初始化配置参数 - * @access public - * @param array $config 连接配置 - * @return void - */ - public function setConfig($config): void - { - $this->config = $config; - } - - /** - * 设置缓存对象 - * @access public - * @param CacheInterface $cache 缓存对象 - * @return void - */ - public function setCache(CacheInterface $cache): void - { - $this->cache = $cache; - } - - /** - * 设置日志对象 - * @access public - * @param LoggerInterface $log 日志对象 - * @return void - */ - public function setLog(LoggerInterface $log): void - { - $this->log = $log; - } - - /** - * 记录SQL日志 - * @access protected - * @param string $log SQL日志信息 - * @param string $type 日志类型 - * @return void - */ - public function log(string $log, string $type = 'sql') - { - if ($this->log) { - $this->log->log($type, $log); - } else { - $this->dbLog[$type][] = $log; - } - } - - /** - * 获得查询日志(没有设置日志对象使用) - * @access public - * @param bool $clear 是否清空 - * @return array - */ - public function getDbLog(bool $clear = false): array - { - $logs = $this->dbLog; - if ($clear) { - $this->dbLog = []; - } - - return $logs; - } - - /** - * 获取配置参数 - * @access public - * @param string $name 配置参数 - * @param mixed $default 默认值 - * @return mixed - */ - public function getConfig(string $name = '', $default = null) - { - if ('' === $name) { - return $this->config; - } - - return $this->config[$name] ?? $default; - } - - /** - * 创建/切换数据库连接查询 - * @access public - * @param string|null $name 连接配置标识 - * @param bool $force 强制重新连接 - * @return BaseQuery - */ - public function connect(string $name = null, bool $force = false): BaseQuery - { - $connection = $this->instance($name, $force); - - $class = $connection->getQueryClass(); - $query = new $class($connection); - - $timeRule = $this->getConfig('time_query_rule'); - if (!empty($timeRule)) { - $query->timeRule($timeRule); - } - - return $query; - } - - /** - * 创建数据库连接实例 - * @access protected - * @param string|null $name 连接标识 - * @param bool $force 强制重新连接 - * @return ConnectionInterface - */ - protected function instance(string $name = null, bool $force = false): ConnectionInterface - { - if (empty($name)) { - $name = $this->getConfig('default', 'mysql'); - } - - if ($force || !isset($this->instance[$name])) { - $this->instance[$name] = $this->createConnection($name); - } - - return $this->instance[$name]; - } - - /** - * 获取连接配置 - * @param string $name - * @return array - */ - protected function getConnectionConfig(string $name): array - { - $connections = $this->getConfig('connections'); - if (!isset($connections[$name])) { - throw new InvalidArgumentException('Undefined db config:' . $name); - } - - return $connections[$name]; - } - - /** - * 创建连接 - * @param $name - * @return ConnectionInterface - */ - protected function createConnection(string $name): ConnectionInterface - { - $config = $this->getConnectionConfig($name); - - $type = !empty($config['type']) ? $config['type'] : 'mysql'; - - if (false !== strpos($type, '\\')) { - $class = $type; - } else { - $class = '\\think\\db\\connector\\' . ucfirst($type); - } - - /** @var ConnectionInterface $connection */ - $connection = new $class($config); - $connection->setDb($this); - - if ($this->cache) { - $connection->setCache($this->cache); - } - - return $connection; - } - - /** - * 使用表达式设置数据 - * @access public - * @param string $value 表达式 - * @return Raw - */ - public function raw(string $value): Raw - { - return new Raw($value); - } - - /** - * 更新查询次数 - * @access public - * @return void - */ - public function updateQueryTimes(): void - { - $this->queryTimes++; - } - - /** - * 重置查询次数 - * @access public - * @return void - */ - public function clearQueryTimes(): void - { - $this->queryTimes = 0; - } - - /** - * 获得查询次数 - * @access public - * @return integer - */ - public function getQueryTimes(): int - { - return $this->queryTimes; - } - - /** - * 监听SQL执行 - * @access public - * @param callable $callback 回调方法 - * @return void - */ - public function listen(callable $callback): void - { - $this->listen[] = $callback; - } - - /** - * 获取监听SQL执行 - * @access public - * @return array - */ - public function getListen(): array - { - return $this->listen; - } - - /** - * 注册回调方法 - * @access public - * @param string $event 事件名 - * @param callable $callback 回调方法 - * @return void - */ - public function event(string $event, callable $callback): void - { - $this->event[$event][] = $callback; - } - - /** - * 触发事件 - * @access public - * @param string $event 事件名 - * @param mixed $params 传入参数 - * @return mixed - */ - public function trigger(string $event, $params = null) - { - if (isset($this->event[$event])) { - foreach ($this->event[$event] as $callback) { - call_user_func_array($callback, [$this]); - } - } - } - - public function __call($method, $args) - { - return call_user_func_array([$this->connect(), $method], $args); - } -} diff --git a/vendor/topthink/think-orm/src/Model.php b/vendor/topthink/think-orm/src/Model.php deleted file mode 100644 index d1a97104..00000000 --- a/vendor/topthink/think-orm/src/Model.php +++ /dev/null @@ -1,981 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use ArrayAccess; -use Closure; -use JsonSerializable; -use think\contract\Arrayable; -use think\contract\Jsonable; -use think\db\BaseQuery as Query; - -/** - * Class Model - * @package think - * @mixin Query - * @method void onAfterRead(Model $model) static after_read事件定义 - * @method mixed onBeforeInsert(Model $model) static before_insert事件定义 - * @method void onAfterInsert(Model $model) static after_insert事件定义 - * @method mixed onBeforeUpdate(Model $model) static before_update事件定义 - * @method void onAfterUpdate(Model $model) static after_update事件定义 - * @method mixed onBeforeWrite(Model $model) static before_write事件定义 - * @method void onAfterWrite(Model $model) static after_write事件定义 - * @method mixed onBeforeDelete(Model $model) static before_write事件定义 - * @method void onAfterDelete(Model $model) static after_delete事件定义 - * @method void onBeforeRestore(Model $model) static before_restore事件定义 - * @method void onAfterRestore(Model $model) static after_restore事件定义 - */ -abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonable -{ - use model\concern\Attribute; - use model\concern\RelationShip; - use model\concern\ModelEvent; - use model\concern\TimeStamp; - use model\concern\Conversion; - - /** - * 数据是否存在 - * @var bool - */ - private $exists = false; - - /** - * 是否强制更新所有数据 - * @var bool - */ - private $force = false; - - /** - * 是否Replace - * @var bool - */ - private $replace = false; - - /** - * 数据表后缀 - * @var string - */ - protected $suffix; - - /** - * 更新条件 - * @var array - */ - private $updateWhere; - - /** - * 数据库配置 - * @var string - */ - protected $connection; - - /** - * 模型名称 - * @var string - */ - protected $name; - - /** - * 数据表名称 - * @var string - */ - protected $table; - - /** - * 初始化过的模型. - * @var array - */ - protected static $initialized = []; - - /** - * 软删除字段默认值 - * @var mixed - */ - protected $defaultSoftDelete; - - /** - * 全局查询范围 - * @var array - */ - protected $globalScope = []; - - /** - * 延迟保存信息 - * @var bool - */ - private $lazySave = false; - - /** - * Db对象 - * @var DbManager - */ - protected static $db; - - /** - * 容器对象的依赖注入方法 - * @var callable - */ - protected static $invoker; - - /** - * 服务注入 - * @var Closure[] - */ - protected static $maker = []; - - /** - * 设置服务注入 - * @access public - * @param Closure $maker - * @return void - */ - public static function maker(Closure $maker) - { - static::$maker[] = $maker; - } - - /** - * 设置Db对象 - * @access public - * @param DbManager $db Db对象 - * @return void - */ - public static function setDb(DbManager $db) - { - self::$db = $db; - } - - /** - * 设置容器对象的依赖注入方法 - * @access public - * @param callable $callable 依赖注入方法 - * @return void - */ - public static function setInvoker(callable $callable): void - { - self::$invoker = $callable; - } - - /** - * 调用反射执行模型方法 支持参数绑定 - * @access public - * @param mixed $method - * @param array $vars 参数 - * @return mixed - */ - public function invoke($method, array $vars = []) - { - if (self::$invoker) { - $call = self::$invoker; - return $call($method instanceof Closure ? $method : Closure::fromCallable([$this, $method]), $vars); - } - - return call_user_func_array($method instanceof Closure ? $method : [$this, $method], $vars); - } - - /** - * 架构函数 - * @access public - * @param array $data 数据 - */ - public function __construct(array $data = []) - { - $this->data = $data; - - if (!empty($this->data)) { - // 废弃字段 - foreach ((array) $this->disuse as $key) { - if (array_key_exists($key, $this->data)) { - unset($this->data[$key]); - } - } - } - - // 记录原始数据 - $this->origin = $this->data; - - if (empty($this->name)) { - // 当前模型名 - $name = str_replace('\\', '/', static::class); - $this->name = basename($name); - } - - if (!empty(static::$maker)) { - foreach (static::$maker as $maker) { - call_user_func($maker, $this); - } - } - - // 执行初始化操作 - $this->initialize(); - } - - /** - * 获取当前模型名称 - * @access public - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * 创建新的模型实例 - * @access public - * @param array $data 数据 - * @param mixed $where 更新条件 - * @return Model - */ - public function newInstance(array $data = [], $where = null): Model - { - if (empty($data)) { - return new static(); - } - - $model = (new static($data))->exists(true); - $model->setUpdateWhere($where); - - $model->trigger('AfterRead'); - - return $model; - } - - /** - * 设置模型的更新条件 - * @access protected - * @param mixed $where 更新条件 - * @return void - */ - protected function setUpdateWhere($where): void - { - $this->updateWhere = $where; - } - - /** - * 设置当前模型数据表的后缀 - * @access public - * @param string $suffix 数据表后缀 - * @return $this - */ - public function setSuffix(string $suffix) - { - $this->suffix = $suffix; - return $this; - } - - /** - * 获取当前模型的数据表后缀 - * @access public - * @return string - */ - public function getSuffix(): string - { - return $this->suffix ?: ''; - } - - /** - * 获取当前模型的数据库查询对象 - * @access public - * @param array $scope 设置不使用的全局查询范围 - * @return Query - */ - public function db($scope = []): Query - { - /** @var Query $query */ - $query = self::$db->connect($this->connection) - ->name($this->name . $this->suffix) - ->pk($this->pk); - - if (!empty($this->table)) { - $query->table($this->table . $this->suffix); - } - - $query->model($this) - ->json($this->json, $this->jsonAssoc) - ->setFieldType(array_merge($this->schema, $this->jsonType)); - - // 软删除 - if (property_exists($this, 'withTrashed') && !$this->withTrashed) { - $this->withNoTrashed($query); - } - - // 全局作用域 - if (is_array($scope)) { - $globalScope = array_diff($this->globalScope, $scope); - $query->scope($globalScope); - } - - // 返回当前模型的数据库查询对象 - return $query; - } - - /** - * 初始化模型 - * @access private - * @return void - */ - private function initialize(): void - { - if (!isset(static::$initialized[static::class])) { - static::$initialized[static::class] = true; - static::init(); - } - } - - /** - * 初始化处理 - * @access protected - * @return void - */ - protected static function init() - { - } - - protected function checkData(): void - { - } - - protected function checkResult($result): void - { - } - - /** - * 更新是否强制写入数据 而不做比较(亦可用于软删除的强制删除) - * @access public - * @param bool $force - * @return $this - */ - public function force(bool $force = true) - { - $this->force = $force; - return $this; - } - - /** - * 判断force - * @access public - * @return bool - */ - public function isForce(): bool - { - return $this->force; - } - - /** - * 新增数据是否使用Replace - * @access public - * @param bool $replace - * @return $this - */ - public function replace(bool $replace = true) - { - $this->replace = $replace; - return $this; - } - - /** - * 刷新模型数据 - * @access public - * @param bool $relation 是否刷新关联数据 - * @return $this - */ - public function refresh(bool $relation = false) - { - if ($this->exists) { - $this->data = $this->db()->find($this->getKey())->getData(); - $this->origin = $this->data; - - if ($relation) { - $this->relation = []; - } - } - - return $this; - } - - /** - * 设置数据是否存在 - * @access public - * @param bool $exists - * @return $this - */ - public function exists(bool $exists = true) - { - $this->exists = $exists; - return $this; - } - - /** - * 判断数据是否存在数据库 - * @access public - * @return bool - */ - public function isExists(): bool - { - return $this->exists; - } - - /** - * 判断模型是否为空 - * @access public - * @return bool - */ - public function isEmpty(): bool - { - return empty($this->data); - } - - /** - * 延迟保存当前数据对象 - * @access public - * @param array|bool $data 数据 - * @return void - */ - public function lazySave($data = []): void - { - if (false === $data) { - $this->lazySave = false; - } else { - if (is_array($data)) { - $this->setAttrs($data); - } - - $this->lazySave = true; - } - } - - /** - * 保存当前数据对象 - * @access public - * @param array $data 数据 - * @param string $sequence 自增序列名 - * @return bool - */ - public function save(array $data = [], string $sequence = null): bool - { - // 数据对象赋值 - $this->setAttrs($data); - - if ($this->isEmpty() || false === $this->trigger('BeforeWrite')) { - return false; - } - - $result = $this->exists ? $this->updateData() : $this->insertData($sequence); - - if (false === $result) { - return false; - } - - // 写入回调 - $this->trigger('AfterWrite'); - - // 重新记录原始数据 - $this->origin = $this->data; - $this->set = []; - $this->lazySave = false; - - return true; - } - - /** - * 检查数据是否允许写入 - * @access protected - * @return array - */ - protected function checkAllowFields(): array - { - // 检测字段 - if (empty($this->field)) { - if (!empty($this->schema)) { - $this->field = array_keys(array_merge($this->schema, $this->jsonType)); - } else { - $query = $this->db(); - $table = $this->table ? $this->table . $this->suffix : $query->getTable(); - - $this->field = $query->getConnection()->getTableFields($table); - } - - return $this->field; - } - - $field = $this->field; - - if ($this->autoWriteTimestamp) { - array_push($field, $this->createTime, $this->updateTime); - } - - if (!empty($this->disuse)) { - // 废弃字段 - $field = array_diff($field, $this->disuse); - } - - return $field; - } - - /** - * 保存写入数据 - * @access protected - * @return bool - */ - protected function updateData(): bool - { - // 事件回调 - if (false === $this->trigger('BeforeUpdate')) { - return false; - } - - $this->checkData(); - - // 获取有更新的数据 - $data = $this->getChangedData(); - - if (empty($data)) { - // 关联更新 - if (!empty($this->relationWrite)) { - $this->autoRelationUpdate(); - } - - return true; - } - - if ($this->autoWriteTimestamp && $this->updateTime && !isset($data[$this->updateTime])) { - // 自动写入更新时间 - $data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); - $this->data[$this->updateTime] = $data[$this->updateTime]; - } - - // 检查允许字段 - $allowFields = $this->checkAllowFields(); - - foreach ($this->relationWrite as $name => $val) { - if (!is_array($val)) { - continue; - } - - foreach ($val as $key) { - if (isset($data[$key])) { - unset($data[$key]); - } - } - } - - // 模型更新 - $db = $this->db(); - $db->startTrans(); - - try { - $where = $this->getWhere(); - $result = $db->where($where) - ->strict(false) - ->field($allowFields) - ->update($data); - - $this->checkResult($result); - - // 关联更新 - if (!empty($this->relationWrite)) { - $this->autoRelationUpdate(); - } - - $db->commit(); - - // 更新回调 - $this->trigger('AfterUpdate'); - - return true; - } catch (\Exception $e) { - $db->rollback(); - throw $e; - } - } - - /** - * 新增写入数据 - * @access protected - * @param string $sequence 自增名 - * @return bool - */ - protected function insertData(string $sequence = null): bool - { - // 时间戳自动写入 - if ($this->autoWriteTimestamp) { - if ($this->createTime && !isset($this->data[$this->createTime])) { - $this->data[$this->createTime] = $this->autoWriteTimestamp($this->createTime); - } - - if ($this->updateTime && !isset($this->data[$this->updateTime])) { - $this->data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); - } - } - - if (false === $this->trigger('BeforeInsert')) { - return false; - } - - $this->checkData(); - - // 检查允许字段 - $allowFields = $this->checkAllowFields(); - - $db = $this->db(); - $db->startTrans(); - - try { - $result = $db->strict(false) - ->field($allowFields) - ->replace($this->replace) - ->insert($this->data, false, $sequence); - - // 获取自动增长主键 - if ($result && $insertId = $db->getLastInsID($sequence)) { - $pk = $this->getPk(); - - if (is_string($pk) && (!isset($this->data[$pk]) || '' == $this->data[$pk])) { - $this->data[$pk] = $insertId; - } - } - - // 关联写入 - if (!empty($this->relationWrite)) { - $this->autoRelationInsert(); - } - - $db->commit(); - - // 标记数据已经存在 - $this->exists = true; - - // 新增回调 - $this->trigger('AfterInsert'); - - return true; - } catch (\Exception $e) { - $db->rollback(); - throw $e; - } - } - - /** - * 获取当前的更新条件 - * @access public - * @return mixed - */ - public function getWhere() - { - $pk = $this->getPk(); - - if (is_string($pk) && isset($this->data[$pk])) { - $where = [[$pk, '=', $this->data[$pk]]]; - } elseif (is_array($pk)) { - foreach ($pk as $field) { - if (isset($this->data[$field])) { - $where[] = [$field, '=', $this->data[$field]]; - } - } - } - - if (empty($where)) { - $where = empty($this->updateWhere) ? null : $this->updateWhere; - } - - return $where; - } - - /** - * 保存多个数据到当前数据对象 - * @access public - * @param iterable $dataSet 数据 - * @param boolean $replace 是否自动识别更新和写入 - * @return Collection - * @throws \Exception - */ - public function saveAll(iterable $dataSet, bool $replace = true): Collection - { - $db = $this->db(); - $db->startTrans(); - - try { - $pk = $this->getPk(); - - if (is_string($pk) && $replace) { - $auto = true; - } - - $result = []; - - foreach ($dataSet as $key => $data) { - if ($this->exists || (!empty($auto) && isset($data[$pk]))) { - $result[$key] = self::update($data); - } else { - $result[$key] = self::create($data, $this->field, $this->replace); - } - } - - $db->commit(); - - return $this->toCollection($result); - } catch (\Exception $e) { - $db->rollback(); - throw $e; - } - } - - /** - * 删除当前的记录 - * @access public - * @return bool - */ - public function delete(): bool - { - if (!$this->exists || $this->isEmpty() || false === $this->trigger('BeforeDelete')) { - return false; - } - - // 读取更新条件 - $where = $this->getWhere(); - - $db = $this->db(); - $db->startTrans(); - - try { - // 删除当前模型数据 - $db->where($where)->delete(); - - // 关联删除 - if (!empty($this->relationWrite)) { - $this->autoRelationDelete(); - } - - $db->commit(); - - $this->trigger('AfterDelete'); - - $this->exists = false; - $this->lazySave = false; - - return true; - } catch (\Exception $e) { - $db->rollback(); - throw $e; - } - } - - /** - * 写入数据 - * @access public - * @param array $data 数据数组 - * @param array $allowField 允许字段 - * @param bool $replace 使用Replace - * @return static - */ - public static function create(array $data, array $allowField = [], bool $replace = false): Model - { - $model = new static(); - - if (!empty($allowField)) { - $model->allowField($allowField); - } - - $model->replace($replace)->save($data); - - return $model; - } - - /** - * 更新数据 - * @access public - * @param array $data 数据数组 - * @param mixed $where 更新条件 - * @param array $allowField 允许字段 - * @return static - */ - public static function update(array $data, $where = [], array $allowField = []) - { - $model = new static(); - - if (!empty($allowField)) { - $model->allowField($allowField); - } - - if (!empty($where)) { - $model->setUpdateWhere($where); - } - - $model->exists(true)->save($data); - - return $model; - } - - /** - * 删除记录 - * @access public - * @param mixed $data 主键列表 支持闭包查询条件 - * @param bool $force 是否强制删除 - * @return bool - */ - public static function destroy($data, bool $force = false): bool - { - if (empty($data) && 0 !== $data) { - return false; - } - - $model = new static(); - - $query = $model->db(); - - if (is_array($data) && key($data) !== 0) { - $query->where($data); - $data = null; - } elseif ($data instanceof \Closure) { - $data($query); - $data = null; - } - - $resultSet = $query->select($data); - - foreach ($resultSet as $result) { - $result->force($force)->delete(); - } - - return true; - } - - /** - * 解序列化后处理 - */ - public function __wakeup() - { - $this->initialize(); - } - - /** - * 修改器 设置数据对象的值 - * @access public - * @param string $name 名称 - * @param mixed $value 值 - * @return void - */ - public function __set(string $name, $value): void - { - $this->setAttr($name, $value); - } - - /** - * 获取器 获取数据对象的值 - * @access public - * @param string $name 名称 - * @return mixed - */ - public function __get(string $name) - { - return $this->getAttr($name); - } - - /** - * 检测数据对象的值 - * @access public - * @param string $name 名称 - * @return bool - */ - public function __isset(string $name): bool - { - return !is_null($this->getAttr($name)); - } - - /** - * 销毁数据对象的值 - * @access public - * @param string $name 名称 - * @return void - */ - public function __unset(string $name): void - { - unset($this->data[$name], $this->relation[$name]); - } - - // ArrayAccess - public function offsetSet($name, $value) - { - $this->setAttr($name, $value); - } - - public function offsetExists($name): bool - { - return $this->__isset($name); - } - - public function offsetUnset($name) - { - $this->__unset($name); - } - - public function offsetGet($name) - { - return $this->getAttr($name); - } - - /** - * 设置不使用的全局查询范围 - * @access public - * @param array $scope 不启用的全局查询范围 - * @return Query - */ - public static function withoutGlobalScope(array $scope = null) - { - $model = new static(); - - return $model->db($scope); - } - - /** - * 切换后缀进行查询 - * @access public - * @param string $suffix 切换的表后缀 - * @return Model - */ - public static function suffix(string $suffix) - { - $model = new static(); - $model->setSuffix($suffix); - - return $model; - } - - public function __call($method, $args) - { - if ('withattr' == strtolower($method)) { - return call_user_func_array([$this, 'withAttribute'], $args); - } - - return call_user_func_array([$this->db(), $method], $args); - } - - public static function __callStatic($method, $args) - { - $model = new static(); - - return call_user_func_array([$model->db(), $method], $args); - } - - /** - * 析构方法 - * @access public - */ - public function __destruct() - { - if ($this->lazySave) { - $this->save(); - } - } -} diff --git a/vendor/topthink/think-orm/src/Paginator.php b/vendor/topthink/think-orm/src/Paginator.php deleted file mode 100644 index 06999a1e..00000000 --- a/vendor/topthink/think-orm/src/Paginator.php +++ /dev/null @@ -1,497 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use ArrayAccess; -use ArrayIterator; -use Closure; -use Countable; -use DomainException; -use IteratorAggregate; -use JsonSerializable; -use think\paginator\driver\Bootstrap; -use Traversable; - -/** - * 分页基础类 - * @mixin Collection - */ -abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable -{ - /** - * 是否简洁模式 - * @var bool - */ - protected $simple = false; - - /** - * 数据集 - * @var Collection - */ - protected $items; - - /** - * 当前页 - * @var int - */ - protected $currentPage; - - /** - * 最后一页 - * @var int - */ - protected $lastPage; - - /** - * 数据总数 - * @var integer|null - */ - protected $total; - - /** - * 每页数量 - * @var int - */ - protected $listRows; - - /** - * 是否有下一页 - * @var bool - */ - protected $hasMore; - - /** - * 分页配置 - * @var array - */ - protected $options = [ - 'var_page' => 'page', - 'path' => '/', - 'query' => [], - 'fragment' => '', - ]; - - /** - * 获取当前页码 - * @var Closure - */ - protected static $currentPageResolver; - - /** - * 获取当前路径 - * @var Closure - */ - protected static $currentPathResolver; - - /** - * @var Closure - */ - protected static $maker; - - public function __construct($items, int $listRows, int $currentPage = 1, int $total = null, bool $simple = false, array $options = []) - { - $this->options = array_merge($this->options, $options); - - $this->options['path'] = '/' != $this->options['path'] ? rtrim($this->options['path'], '/') : $this->options['path']; - - $this->simple = $simple; - $this->listRows = $listRows; - - if (!$items instanceof Collection) { - $items = Collection::make($items); - } - - if ($simple) { - $this->currentPage = $this->setCurrentPage($currentPage); - $this->hasMore = count($items) > ($this->listRows); - $items = $items->slice(0, $this->listRows); - } else { - $this->total = $total; - $this->lastPage = (int) ceil($total / $listRows); - $this->currentPage = $this->setCurrentPage($currentPage); - $this->hasMore = $this->currentPage < $this->lastPage; - } - $this->items = $items; - } - - /** - * @access public - * @param mixed $items - * @param int $listRows - * @param int $currentPage - * @param int $total - * @param bool $simple - * @param array $options - * @return Paginator - */ - public static function make($items, int $listRows, int $currentPage = 1, int $total = null, bool $simple = false, array $options = []) - { - if (isset(static::$maker)) { - return call_user_func(static::$maker, $items, $listRows, $currentPage, $total, $simple, $options); - } - - return new Bootstrap($items, $listRows, $currentPage, $total, $simple, $options); - } - - public static function maker(Closure $resolver) - { - static::$maker = $resolver; - } - - protected function setCurrentPage(int $currentPage): int - { - if (!$this->simple && $currentPage > $this->lastPage) { - return $this->lastPage > 0 ? $this->lastPage : 1; - } - - return $currentPage; - } - - /** - * 获取页码对应的链接 - * - * @access protected - * @param int $page - * @return string - */ - protected function url(int $page): string - { - if ($page <= 0) { - $page = 1; - } - - if (strpos($this->options['path'], '[PAGE]') === false) { - $parameters = [$this->options['var_page'] => $page]; - $path = $this->options['path']; - } else { - $parameters = []; - $path = str_replace('[PAGE]', $page, $this->options['path']); - } - - if (count($this->options['query']) > 0) { - $parameters = array_merge($this->options['query'], $parameters); - } - - $url = $path; - if (!empty($parameters)) { - $url .= '?' . http_build_query($parameters, '', '&'); - } - - return $url . $this->buildFragment(); - } - - /** - * 自动获取当前页码 - * @access public - * @param string $varPage - * @param int $default - * @return int - */ - public static function getCurrentPage(string $varPage = 'page', int $default = 1): int - { - if (isset(static::$currentPageResolver)) { - return call_user_func(static::$currentPageResolver, $varPage); - } - - return $default; - } - - /** - * 设置获取当前页码闭包 - * @param Closure $resolver - */ - public static function currentPageResolver(Closure $resolver) - { - static::$currentPageResolver = $resolver; - } - - /** - * 自动获取当前的path - * @access public - * @param string $default - * @return string - */ - public static function getCurrentPath($default = '/'): string - { - if (isset(static::$currentPathResolver)) { - return call_user_func(static::$currentPathResolver); - } - - return $default; - } - - /** - * 设置获取当前路径闭包 - * @param Closure $resolver - */ - public static function currentPathResolver(Closure $resolver) - { - static::$currentPathResolver = $resolver; - } - - public function total(): int - { - if ($this->simple) { - throw new DomainException('not support total'); - } - - return $this->total; - } - - public function listRows(): int - { - return $this->listRows; - } - - public function currentPage(): int - { - return $this->currentPage; - } - - public function lastPage(): int - { - if ($this->simple) { - throw new DomainException('not support last'); - } - - return $this->lastPage; - } - - /** - * 数据是否足够分页 - * @access public - * @return bool - */ - public function hasPages(): bool - { - return !(1 == $this->currentPage && !$this->hasMore); - } - - /** - * 创建一组分页链接 - * - * @access public - * @param int $start - * @param int $end - * @return array - */ - public function getUrlRange(int $start, int $end): array - { - $urls = []; - - for ($page = $start; $page <= $end; $page++) { - $urls[$page] = $this->url($page); - } - - return $urls; - } - - /** - * 设置URL锚点 - * - * @access public - * @param string|null $fragment - * @return $this - */ - public function fragment(string $fragment = null) - { - $this->options['fragment'] = $fragment; - - return $this; - } - - /** - * 添加URL参数 - * - * @access public - * @param array $append - * @return $this - */ - public function appends(array $append) - { - foreach ($append as $k => $v) { - if ($k !== $this->options['var_page']) { - $this->options['query'][$k] = $v; - } - } - - return $this; - } - - /** - * 构造锚点字符串 - * - * @access public - * @return string - */ - protected function buildFragment(): string - { - return $this->options['fragment'] ? '#' . $this->options['fragment'] : ''; - } - - /** - * 渲染分页html - * @access public - * @return mixed - */ - abstract public function render(); - - public function items() - { - return $this->items->all(); - } - - /** - * 获取数据集 - * - * @return Collection|\think\model\Collection - */ - public function getCollection() - { - return $this->items; - } - - public function isEmpty(): bool - { - return $this->items->isEmpty(); - } - - /** - * 给每个元素执行个回调 - * - * @access public - * @param callable $callback - * @return $this - */ - public function each(callable $callback) - { - foreach ($this->items as $key => $item) { - $result = $callback($item, $key); - - if (false === $result) { - break; - } elseif (!is_object($item)) { - $this->items[$key] = $result; - } - } - - return $this; - } - - /** - * Retrieve an external iterator - * @access public - * @return Traversable An instance of an object implementing Iterator or - * Traversable - */ - public function getIterator() - { - return new ArrayIterator($this->items->all()); - } - - /** - * Whether a offset exists - * @access public - * @param mixed $offset - * @return bool - */ - public function offsetExists($offset) - { - return $this->items->offsetExists($offset); - } - - /** - * Offset to retrieve - * @access public - * @param mixed $offset - * @return mixed - */ - public function offsetGet($offset) - { - return $this->items->offsetGet($offset); - } - - /** - * Offset to set - * @access public - * @param mixed $offset - * @param mixed $value - */ - public function offsetSet($offset, $value) - { - $this->items->offsetSet($offset, $value); - } - - /** - * Offset to unset - * @access public - * @param mixed $offset - * @return void - * @since 5.0.0 - */ - public function offsetUnset($offset) - { - $this->items->offsetUnset($offset); - } - - /** - * Count elements of an object - */ - public function count(): int - { - return $this->items->count(); - } - - public function __toString() - { - return (string) $this->render(); - } - - public function toArray(): array - { - try { - $total = $this->total(); - } catch (DomainException $e) { - $total = null; - } - - return [ - 'total' => $total, - 'per_page' => $this->listRows(), - 'current_page' => $this->currentPage(), - 'last_page' => $this->lastPage, - 'data' => $this->items->toArray(), - ]; - } - - /** - * Specify data which should be serialized to JSON - */ - public function jsonSerialize() - { - return $this->toArray(); - } - - public function __call($name, $arguments) - { - $result = call_user_func_array([$this->items, $name], $arguments); - - if ($result instanceof Collection) { - $this->items = $result; - return $this; - } - - return $result; - } - -} diff --git a/vendor/topthink/think-orm/src/db/BaseQuery.php b/vendor/topthink/think-orm/src/db/BaseQuery.php deleted file mode 100644 index 83362a28..00000000 --- a/vendor/topthink/think-orm/src/db/BaseQuery.php +++ /dev/null @@ -1,1270 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use think\Collection; -use think\db\exception\DataNotFoundException; -use think\db\exception\DbException as Exception; -use think\db\exception\ModelNotFoundException; -use think\helper\Str; -use think\Model; -use think\Paginator; - -/** - * 数据查询基础类 - */ -abstract class BaseQuery -{ - use concern\TimeFieldQuery; - use concern\AggregateQuery; - use concern\ModelRelationQuery; - use concern\ResultOperation; - use concern\Transaction; - use concern\WhereQuery; - - /** - * 当前数据库连接对象 - * @var Connection - */ - protected $connection; - - /** - * 当前数据表名称(不含前缀) - * @var string - */ - protected $name = ''; - - /** - * 当前数据表主键 - * @var string|array - */ - protected $pk; - - /** - * 当前数据表自增主键 - * @var string - */ - protected $autoinc; - - /** - * 当前数据表前缀 - * @var string - */ - protected $prefix = ''; - - /** - * 当前查询参数 - * @var array - */ - protected $options = []; - - /** - * 架构函数 - * @access public - * @param ConnectionInterface $connection 数据库连接对象 - */ - public function __construct(ConnectionInterface $connection) - { - $this->connection = $connection; - - $this->prefix = $this->connection->getConfig('prefix'); - } - - /** - * 利用__call方法实现一些特殊的Model方法 - * @access public - * @param string $method 方法名称 - * @param array $args 调用参数 - * @return mixed - * @throws Exception - */ - public function __call(string $method, array $args) - { - if (strtolower(substr($method, 0, 5)) == 'getby') { - // 根据某个字段获取记录 - $field = Str::snake(substr($method, 5)); - return $this->where($field, '=', $args[0])->find(); - } elseif (strtolower(substr($method, 0, 10)) == 'getfieldby') { - // 根据某个字段获取记录的某个值 - $name = Str::snake(substr($method, 10)); - return $this->where($name, '=', $args[0])->value($args[1]); - } elseif (strtolower(substr($method, 0, 7)) == 'whereor') { - $name = Str::snake(substr($method, 7)); - array_unshift($args, $name); - return call_user_func_array([$this, 'whereOr'], $args); - } elseif (strtolower(substr($method, 0, 5)) == 'where') { - $name = Str::snake(substr($method, 5)); - array_unshift($args, $name); - return call_user_func_array([$this, 'where'], $args); - } elseif ($this->model && method_exists($this->model, 'scope' . $method)) { - // 动态调用命名范围 - $method = 'scope' . $method; - array_unshift($args, $this); - - call_user_func_array([$this->model, $method], $args); - return $this; - } else { - throw new Exception('method not exist:' . static::class . '->' . $method); - } - } - - /** - * 创建一个新的查询对象 - * @access public - * @return BaseQuery - */ - public function newQuery(): BaseQuery - { - $query = new static($this->connection); - - if ($this->model) { - $query->model($this->model); - } - - if (isset($this->options['table'])) { - $query->table($this->options['table']); - } else { - $query->name($this->name); - } - - if (isset($this->options['json'])) { - $query->json($this->options['json'], $this->options['json_assoc']); - } - - if (isset($this->options['field_type'])) { - $query->setFieldType($this->options['field_type']); - } - - return $query; - } - - /** - * 获取当前的数据库Connection对象 - * @access public - * @return ConnectionInterface - */ - public function getConnection() - { - return $this->connection; - } - - /** - * 指定当前数据表名(不含前缀) - * @access public - * @param string $name 不含前缀的数据表名字 - * @return $this - */ - public function name(string $name) - { - $this->name = $name; - return $this; - } - - /** - * 获取当前的数据表名称 - * @access public - * @return string - */ - public function getName(): string - { - return $this->name ?: $this->model->getName(); - } - - /** - * 获取数据库的配置参数 - * @access public - * @param string $name 参数名称 - * @return mixed - */ - public function getConfig(string $name = '') - { - return $this->connection->getConfig($name); - } - - /** - * 得到当前或者指定名称的数据表 - * @access public - * @param string $name 不含前缀的数据表名字 - * @return mixed - */ - public function getTable(string $name = '') - { - if (empty($name) && isset($this->options['table'])) { - return $this->options['table']; - } - - $name = $name ?: $this->name; - - return $this->prefix . Str::snake($name); - } - - /** - * 设置字段类型信息 - * @access public - * @param array $type 字段类型信息 - * @return $this - */ - public function setFieldType(array $type) - { - $this->options['field_type'] = $type; - return $this; - } - - /** - * 获取最近一次查询的sql语句 - * @access public - * @return string - */ - public function getLastSql(): string - { - return $this->connection->getLastSql(); - } - - /** - * 获取返回或者影响的记录数 - * @access public - * @return integer - */ - public function getNumRows(): int - { - return $this->connection->getNumRows(); - } - - /** - * 获取最近插入的ID - * @access public - * @param string $sequence 自增序列名 - * @return mixed - */ - public function getLastInsID(string $sequence = null) - { - return $this->connection->getLastInsID($this, $sequence); - } - - /** - * 得到某个字段的值 - * @access public - * @param string $field 字段名 - * @param mixed $default 默认值 - * @return mixed - */ - public function value(string $field, $default = null) - { - return $this->connection->value($this, $field, $default); - } - - /** - * 得到某个列的数组 - * @access public - * @param string $field 字段名 多个字段用逗号分隔 - * @param string $key 索引 - * @return array - */ - public function column(string $field, string $key = ''): array - { - return $this->connection->column($this, $field, $key); - } - - /** - * 查询SQL组装 union - * @access public - * @param mixed $union UNION - * @param boolean $all 是否适用UNION ALL - * @return $this - */ - public function union($union, bool $all = false) - { - $this->options['union']['type'] = $all ? 'UNION ALL' : 'UNION'; - - if (is_array($union)) { - $this->options['union'] = array_merge($this->options['union'], $union); - } else { - $this->options['union'][] = $union; - } - - return $this; - } - - /** - * 查询SQL组装 union all - * @access public - * @param mixed $union UNION数据 - * @return $this - */ - public function unionAll($union) - { - return $this->union($union, true); - } - - /** - * 指定查询字段 - * @access public - * @param mixed $field 字段信息 - * @return $this - */ - public function field($field) - { - if (empty($field)) { - return $this; - } elseif ($field instanceof Raw) { - $this->options['field'][] = $field; - return $this; - } - - if (is_string($field)) { - if (preg_match('/[\<\'\"\(]/', $field)) { - return $this->fieldRaw($field); - } - - $field = array_map('trim', explode(',', $field)); - } - - if (true === $field) { - // 获取全部字段 - $fields = $this->getTableFields(); - $field = $fields ?: ['*']; - } - - if (isset($this->options['field'])) { - $field = array_merge((array) $this->options['field'], $field); - } - - $this->options['field'] = array_unique($field); - - return $this; - } - - /** - * 指定要排除的查询字段 - * @access public - * @param array|string $field 要排除的字段 - * @return $this - */ - public function withoutField($field) - { - if (empty($field)) { - return $this; - } - - if (is_string($field)) { - $field = array_map('trim', explode(',', $field)); - } - - // 字段排除 - $fields = $this->getTableFields(); - $field = $fields ? array_diff($fields, $field) : $field; - - if (isset($this->options['field'])) { - $field = array_merge((array) $this->options['field'], $field); - } - - $this->options['field'] = array_unique($field); - - return $this; - } - - /** - * 指定其它数据表的查询字段 - * @access public - * @param mixed $field 字段信息 - * @param string $tableName 数据表名 - * @param string $prefix 字段前缀 - * @param string $alias 别名前缀 - * @return $this - */ - public function tableField($field, string $tableName, string $prefix = '', string $alias = '') - { - if (empty($field)) { - return $this; - } - - if (is_string($field)) { - $field = array_map('trim', explode(',', $field)); - } - - if (true === $field) { - // 获取全部字段 - $fields = $this->getTableFields($tableName); - $field = $fields ?: ['*']; - } - - // 添加统一的前缀 - $prefix = $prefix ?: $tableName; - foreach ($field as $key => &$val) { - if (is_numeric($key) && $alias) { - $field[$prefix . '.' . $val] = $alias . $val; - unset($field[$key]); - } elseif (is_numeric($key)) { - $val = $prefix . '.' . $val; - } - } - - if (isset($this->options['field'])) { - $field = array_merge((array) $this->options['field'], $field); - } - - $this->options['field'] = array_unique($field); - - return $this; - } - - /** - * 设置数据 - * @access public - * @param array $data 数据 - * @return $this - */ - public function data(array $data) - { - $this->options['data'] = $data; - - return $this; - } - - /** - * 去除查询参数 - * @access public - * @param string $option 参数名 留空去除所有参数 - * @return $this - */ - public function removeOption(string $option = '') - { - if ('' === $option) { - $this->options = []; - $this->bind = []; - } elseif (isset($this->options[$option])) { - unset($this->options[$option]); - } - - return $this; - } - - /** - * 指定查询数量 - * @access public - * @param int $offset 起始位置 - * @param int $length 查询数量 - * @return $this - */ - public function limit(int $offset, int $length = null) - { - $this->options['limit'] = $offset . ($length ? ',' . $length : ''); - - return $this; - } - - /** - * 指定分页 - * @access public - * @param int $page 页数 - * @param int $listRows 每页数量 - * @return $this - */ - public function page(int $page, int $listRows = null) - { - $this->options['page'] = [$page, $listRows]; - - return $this; - } - - /** - * 指定当前操作的数据表 - * @access public - * @param mixed $table 表名 - * @return $this - */ - public function table($table) - { - if (is_string($table)) { - if (strpos($table, ')')) { - // 子查询 - } elseif (false === strpos($table, ',')) { - if (strpos($table, ' ')) { - list($item, $alias) = explode(' ', $table); - $table = []; - $this->alias([$item => $alias]); - $table[$item] = $alias; - } - } else { - $tables = explode(',', $table); - $table = []; - - foreach ($tables as $item) { - $item = trim($item); - if (strpos($item, ' ')) { - list($item, $alias) = explode(' ', $item); - $this->alias([$item => $alias]); - $table[$item] = $alias; - } else { - $table[] = $item; - } - } - } - } elseif (is_array($table)) { - $tables = $table; - $table = []; - - foreach ($tables as $key => $val) { - if (is_numeric($key)) { - $table[] = $val; - } else { - $this->alias([$key => $val]); - $table[$key] = $val; - } - } - } - - $this->options['table'] = $table; - - return $this; - } - - /** - * 指定排序 order('id','desc') 或者 order(['id'=>'desc','create_time'=>'desc']) - * @access public - * @param string|array|Raw $field 排序字段 - * @param string $order 排序 - * @return $this - */ - public function order($field, string $order = '') - { - if (empty($field)) { - return $this; - } elseif ($field instanceof Raw) { - $this->options['order'][] = $field; - return $this; - } - - if (is_string($field)) { - if (!empty($this->options['via'])) { - $field = $this->options['via'] . '.' . $field; - } - if (strpos($field, ',')) { - $field = array_map('trim', explode(',', $field)); - } else { - $field = empty($order) ? $field : [$field => $order]; - } - } elseif (!empty($this->options['via'])) { - foreach ($field as $key => $val) { - if (is_numeric($key)) { - $field[$key] = $this->options['via'] . '.' . $val; - } else { - $field[$this->options['via'] . '.' . $key] = $val; - unset($field[$key]); - } - } - } - - if (!isset($this->options['order'])) { - $this->options['order'] = []; - } - - if (is_array($field)) { - $this->options['order'] = array_merge($this->options['order'], $field); - } else { - $this->options['order'][] = $field; - } - - return $this; - } - - /** - * 分页查询 - * @access public - * @param int|array $listRows 每页数量 数组表示配置参数 - * @param int|bool $simple 是否简洁模式或者总记录数 - * @return Paginator - * @throws Exception - */ - public function paginate($listRows = null, $simple = false): Paginator - { - if (is_int($simple)) { - $total = $simple; - $simple = false; - } - - $defaultConfig = [ - 'query' => [], //url额外参数 - 'fragment' => '', //url锚点 - 'var_page' => 'page', //分页变量 - 'list_rows' => 15, //每页数量 - ]; - - if (is_array($listRows)) { - $config = array_merge($defaultConfig, $listRows); - $listRows = intval($config['list_rows']); - } else { - $config = $defaultConfig; - $listRows = intval($listRows ?: $config['list_rows']); - } - - $page = isset($config['page']) ? (int) $config['page'] : Paginator::getCurrentPage($config['var_page']); - - $page = $page < 1 ? 1 : $page; - - $config['path'] = $config['path'] ?? Paginator::getCurrentPath(); - - if (!isset($total) && !$simple) { - $options = $this->getOptions(); - - unset($this->options['order'], $this->options['limit'], $this->options['page'], $this->options['field']); - - $bind = $this->bind; - $total = $this->count(); - $results = $this->options($options)->bind($bind)->page($page, $listRows)->select(); - } elseif ($simple) { - $results = $this->limit(($page - 1) * $listRows, $listRows + 1)->select(); - $total = null; - } else { - $results = $this->page($page, $listRows)->select(); - } - - $this->removeOption('limit'); - $this->removeOption('page'); - - return Paginator::make($results, $listRows, $page, $total, $simple, $config); - } - - /** - * 根据数字类型字段进行分页查询(大数据) - * @access public - * @param int|array $listRows 每页数量或者分页配置 - * @param string $key 分页索引键 - * @param string $sort 索引键排序 asc|desc - * @return Paginator - * @throws Exception - */ - public function paginateX($listRows = null, string $key = null, string $sort = null): Paginator - { - $defaultConfig = [ - 'query' => [], //url额外参数 - 'fragment' => '', //url锚点 - 'var_page' => 'page', //分页变量 - 'list_rows' => 15, //每页数量 - ]; - - $config = is_array($listRows) ? array_merge($defaultConfig, $listRows) : $defaultConfig; - $listRows = is_int($listRows) ? $listRows : (int) $config['list_rows']; - $page = isset($config['page']) ? (int) $config['page'] : Paginator::getCurrentPage($config['var_page']); - $page = $page < 1 ? 1 : $page; - - $config['path'] = $config['path'] ?? Paginator::getCurrentPath(); - - $key = $key ?: $this->getPk(); - $options = $this->getOptions(); - - if (is_null($sort)) { - $order = $options['order'] ?? ''; - if (!empty($order)) { - $sort = $order[$key] ?? 'desc'; - } else { - $this->order($key, 'desc'); - $sort = 'desc'; - } - } else { - $this->order($key, $sort); - } - - $newOption = $options; - unset($newOption['field'], $newOption['page']); - - $data = $this->newQuery() - ->options($newOption) - ->field($key) - ->where(true) - ->order($key, $sort) - ->limit(1) - ->find(); - - $result = $data[$key]; - - if (is_numeric($result)) { - $lastId = 'asc' == $sort ? ($result - 1) + ($page - 1) * $listRows : ($result + 1) - ($page - 1) * $listRows; - } else { - throw new Exception('not support type'); - } - - $results = $this->when($lastId, function ($query) use ($key, $sort, $lastId) { - $query->where($key, 'asc' == $sort ? '>' : '<', $lastId); - }) - ->limit($listRows) - ->select(); - - $this->options($options); - - return Paginator::make($results, $listRows, $page, null, true, $config); - } - - /** - * 根据最后ID查询更多N个数据 - * @access public - * @param int $limit LIMIT - * @param int|string $lastId LastId - * @param string $key 分页索引键 默认为主键 - * @param string $sort 索引键排序 asc|desc - * @return array - * @throws Exception - */ - public function more(int $limit, $lastId = null, string $key = null, string $sort = null): array - { - $key = $key ?: $this->getPk(); - - if (is_null($sort)) { - $order = $this->getOptions('order'); - if (!empty($order)) { - $sort = $order[$key] ?? 'desc'; - } else { - $this->order($key, 'desc'); - $sort = 'desc'; - } - } else { - $this->order($key, $sort); - } - - $result = $this->when($lastId, function ($query) use ($key, $sort, $lastId) { - $query->where($key, 'asc' == $sort ? '>' : '<', $lastId); - })->limit($limit)->select(); - - $last = $result->last(); - - $result->first(); - - return [ - 'data' => $result, - 'lastId' => $last[$key], - ]; - } - - /** - * 查询缓存 - * @access public - * @param mixed $key 缓存key - * @param integer|\DateTime $expire 缓存有效期 - * @param string $tag 缓存标签 - * @return $this - */ - public function cache($key = true, $expire = null, string $tag = null) - { - if (false === $key || !$this->getConnection()->getCache()) { - return $this; - } - - if ($key instanceof \DateTimeInterface || $key instanceof \DateInterval || (is_int($key) && is_null($expire))) { - $expire = $key; - $key = true; - } - - $this->options['cache'] = [$key, $expire, $tag]; - - return $this; - } - - /** - * 指定查询lock - * @access public - * @param bool|string $lock 是否lock - * @return $this - */ - public function lock($lock = false) - { - $this->options['lock'] = $lock; - - if ($lock) { - $this->options['master'] = true; - } - - return $this; - } - - /** - * 指定数据表别名 - * @access public - * @param array|string $alias 数据表别名 - * @return $this - */ - public function alias($alias) - { - if (is_array($alias)) { - $this->options['alias'] = $alias; - } else { - $table = $this->getTable(); - - $this->options['alias'][$table] = $alias; - } - - return $this; - } - - /** - * 设置从主服务器读取数据 - * @access public - * @param bool $readMaster 是否从主服务器读取 - * @return $this - */ - public function master(bool $readMaster = true) - { - $this->options['master'] = $readMaster; - return $this; - } - - /** - * 设置是否严格检查字段名 - * @access public - * @param bool $strict 是否严格检查字段 - * @return $this - */ - public function strict(bool $strict = true) - { - $this->options['strict'] = $strict; - return $this; - } - - /** - * 设置JSON字段信息 - * @access public - * @param array $json JSON字段 - * @param bool $assoc 是否取出数组 - * @return $this - */ - public function json(array $json = [], bool $assoc = false) - { - $this->options['json'] = $json; - $this->options['json_assoc'] = $assoc; - return $this; - } - - /** - * 指定数据表主键 - * @access public - * @param string|array $pk 主键 - * @return $this - */ - public function pk($pk) - { - $this->pk = $pk; - return $this; - } - - /** - * 查询参数批量赋值 - * @access protected - * @param array $options 表达式参数 - * @return $this - */ - protected function options(array $options) - { - $this->options = $options; - return $this; - } - - /** - * 获取当前的查询参数 - * @access public - * @param string $name 参数名 - * @return mixed - */ - public function getOptions(string $name = '') - { - if ('' === $name) { - return $this->options; - } - - return $this->options[$name] ?? null; - } - - /** - * 设置当前的查询参数 - * @access public - * @param string $option 参数名 - * @param mixed $value 参数值 - * @return $this - */ - public function setOption(string $option, $value) - { - $this->options[$option] = $value; - return $this; - } - - /** - * 设置当前字段添加的表别名 - * @access public - * @param string $via 临时表别名 - * @return $this - */ - public function via(string $via = '') - { - $this->options['via'] = $via; - - return $this; - } - - /** - * 保存记录 自动判断insert或者update - * @access public - * @param array $data 数据 - * @param bool $forceInsert 是否强制insert - * @return integer - */ - public function save(array $data = [], bool $forceInsert = false) - { - if ($forceInsert) { - return $this->insert($data); - } - - $this->options['data'] = array_merge($this->options['data'] ?? [], $data); - - if (!empty($this->options['where'])) { - $isUpdate = true; - } else { - $isUpdate = $this->parseUpdateData($this->options['data']); - } - - return $isUpdate ? $this->update() : $this->insert(); - } - - /** - * 插入记录 - * @access public - * @param array $data 数据 - * @param boolean $getLastInsID 返回自增主键 - * @return integer|string - */ - public function insert(array $data = [], bool $getLastInsID = false) - { - if (!empty($data)) { - $this->options['data'] = $data; - } - - return $this->connection->insert($this, $getLastInsID); - } - - /** - * 插入记录并获取自增ID - * @access public - * @param array $data 数据 - * @return integer|string - */ - public function insertGetId(array $data) - { - return $this->insert($data, true); - } - - /** - * 批量插入记录 - * @access public - * @param array $dataSet 数据集 - * @param integer $limit 每次写入数据限制 - * @return integer - */ - public function insertAll(array $dataSet = [], int $limit = 0): int - { - if (empty($dataSet)) { - $dataSet = $this->options['data'] ?? []; - } - - if (empty($limit) && !empty($this->options['limit']) && is_numeric($this->options['limit'])) { - $limit = (int) $this->options['limit']; - } - - return $this->connection->insertAll($this, $dataSet, $limit); - } - - /** - * 通过Select方式插入记录 - * @access public - * @param array $fields 要插入的数据表字段名 - * @param string $table 要插入的数据表名 - * @return integer - */ - public function selectInsert(array $fields, string $table): int - { - return $this->connection->selectInsert($this, $fields, $table); - } - - /** - * 更新记录 - * @access public - * @param mixed $data 数据 - * @return integer - * @throws Exception - */ - public function update(array $data = []): int - { - if (!empty($data)) { - $this->options['data'] = array_merge($this->options['data'] ?? [], $data); - } - - if (empty($this->options['where'])) { - $this->parseUpdateData($this->options['data']); - } - - if (empty($this->options['where']) && $this->model) { - $this->where($this->model->getWhere()); - } - - if (empty($this->options['where'])) { - // 如果没有任何更新条件则不执行 - throw new Exception('miss update condition'); - } - - return $this->connection->update($this); - } - - /** - * 删除记录 - * @access public - * @param mixed $data 表达式 true 表示强制删除 - * @return int - * @throws Exception - */ - public function delete($data = null): int - { - if (!is_null($data) && true !== $data) { - // AR模式分析主键条件 - $this->parsePkWhere($data); - } - - if (empty($this->options['where']) && $this->model) { - $this->where($this->model->getWhere()); - } - - if (true !== $data && empty($this->options['where'])) { - // 如果条件为空 不进行删除操作 除非设置 1=1 - throw new Exception('delete without condition'); - } - - if (!empty($this->options['soft_delete'])) { - // 软删除 - list($field, $condition) = $this->options['soft_delete']; - if ($condition) { - unset($this->options['soft_delete']); - $this->options['data'] = [$field => $condition]; - - return $this->connection->update($this); - } - } - - $this->options['data'] = $data; - - return $this->connection->delete($this); - } - - /** - * 查找记录 - * @access public - * @param mixed $data 数据 - * @return Collection - * @throws Exception - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - public function select($data = null): Collection - { - if (!is_null($data)) { - // 主键条件分析 - $this->parsePkWhere($data); - } - - $resultSet = $this->connection->select($this); - - // 返回结果处理 - if (!empty($this->options['fail']) && count($resultSet) == 0) { - $this->throwNotFound(); - } - - // 数据列表读取后的处理 - if (!empty($this->model)) { - // 生成模型对象 - $resultSet = $this->resultSetToModelCollection($resultSet); - } else { - $this->resultSet($resultSet); - } - - return $resultSet; - } - - /** - * 查找单条记录 - * @access public - * @param mixed $data 查询数据 - * @return array|Model|null - * @throws Exception - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - public function find($data = null) - { - if (!is_null($data)) { - // AR模式分析主键条件 - $this->parsePkWhere($data); - } - - if (empty($this->options['where']) && empty($this->options['order'])) { - $result = []; - } else { - $result = $this->connection->find($this); - } - - // 数据处理 - if (empty($result)) { - return $this->resultToEmpty(); - } - - if (!empty($this->model)) { - // 返回模型对象 - $this->resultToModel($result, $this->options); - } else { - $this->result($result); - } - - return $result; - } - - /** - * 分析表达式(可用于查询或者写入操作) - * @access public - * @return array - */ - public function parseOptions(): array - { - $options = $this->getOptions(); - - // 获取数据表 - if (empty($options['table'])) { - $options['table'] = $this->getTable(); - } - - if (!isset($options['where'])) { - $options['where'] = []; - } elseif (isset($options['view'])) { - // 视图查询条件处理 - $this->parseView($options); - } - - if (!isset($options['field'])) { - $options['field'] = '*'; - } - - foreach (['data', 'order', 'join', 'union'] as $name) { - if (!isset($options[$name])) { - $options[$name] = []; - } - } - - if (!isset($options['strict'])) { - $options['strict'] = $this->connection->getConfig('fields_strict'); - } - - foreach (['master', 'lock', 'fetch_sql', 'array', 'distinct', 'procedure'] as $name) { - if (!isset($options[$name])) { - $options[$name] = false; - } - } - - foreach (['group', 'having', 'limit', 'force', 'comment', 'partition', 'duplicate', 'extra'] as $name) { - if (!isset($options[$name])) { - $options[$name] = ''; - } - } - - if (isset($options['page'])) { - // 根据页数计算limit - list($page, $listRows) = $options['page']; - $page = $page > 0 ? $page : 1; - $listRows = $listRows ?: (is_numeric($options['limit']) ? $options['limit'] : 20); - $offset = $listRows * ($page - 1); - $options['limit'] = $offset . ',' . $listRows; - } - - $this->options = $options; - - return $options; - } - - /** - * 分析数据是否存在更新条件 - * @access public - * @param array $data 数据 - * @return bool - * @throws Exception - */ - public function parseUpdateData(&$data): bool - { - $pk = $this->getPk(); - $isUpdate = false; - // 如果存在主键数据 则自动作为更新条件 - if (is_string($pk) && isset($data[$pk])) { - $this->where($pk, '=', $data[$pk]); - $this->options['key'] = $data[$pk]; - unset($data[$pk]); - $isUpdate = true; - } elseif (is_array($pk)) { - foreach ($pk as $field) { - if (isset($data[$field])) { - $this->where($field, '=', $data[$field]); - $isUpdate = true; - } else { - // 如果缺少复合主键数据则不执行 - throw new Exception('miss complex primary data'); - } - unset($data[$field]); - } - } - - return $isUpdate; - } - - /** - * 把主键值转换为查询条件 支持复合主键 - * @access public - * @param array|string $data 主键数据 - * @return void - * @throws Exception - */ - public function parsePkWhere($data): void - { - $pk = $this->getPk(); - - if (is_string($pk)) { - // 获取数据表 - if (empty($this->options['table'])) { - $this->options['table'] = $this->getTable(); - } - - $table = is_array($this->options['table']) ? key($this->options['table']) : $this->options['table']; - - if (!empty($this->options['alias'][$table])) { - $alias = $this->options['alias'][$table]; - } - - $key = isset($alias) ? $alias . '.' . $pk : $pk; - // 根据主键查询 - if (is_array($data)) { - $this->where($key, 'in', $data); - } else { - $this->where($key, '=', $data); - $this->options['key'] = $data; - } - } - } - - /** - * 获取模型的更新条件 - * @access protected - * @param array $options 查询参数 - */ - protected function getModelUpdateCondition(array $options) - { - return $options['where']['AND'] ?? null; - } -} diff --git a/vendor/topthink/think-orm/src/db/Builder.php b/vendor/topthink/think-orm/src/db/Builder.php deleted file mode 100644 index c2a86d30..00000000 --- a/vendor/topthink/think-orm/src/db/Builder.php +++ /dev/null @@ -1,1281 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use Closure; -use PDO; -use think\db\exception\DbException as Exception; - -/** - * Db Builder - */ -abstract class Builder -{ - /** - * Connection对象 - * @var ConnectionInterface - */ - protected $connection; - - /** - * 查询表达式映射 - * @var array - */ - protected $exp = ['NOTLIKE' => 'NOT LIKE', 'NOTIN' => 'NOT IN', 'NOTBETWEEN' => 'NOT BETWEEN', 'NOTEXISTS' => 'NOT EXISTS', 'NOTNULL' => 'NOT NULL', 'NOTBETWEEN TIME' => 'NOT BETWEEN TIME']; - - /** - * 查询表达式解析 - * @var array - */ - protected $parser = [ - 'parseCompare' => ['=', '<>', '>', '>=', '<', '<='], - 'parseLike' => ['LIKE', 'NOT LIKE'], - 'parseBetween' => ['NOT BETWEEN', 'BETWEEN'], - 'parseIn' => ['NOT IN', 'IN'], - 'parseExp' => ['EXP'], - 'parseNull' => ['NOT NULL', 'NULL'], - 'parseBetweenTime' => ['BETWEEN TIME', 'NOT BETWEEN TIME'], - 'parseTime' => ['< TIME', '> TIME', '<= TIME', '>= TIME'], - 'parseExists' => ['NOT EXISTS', 'EXISTS'], - 'parseColumn' => ['COLUMN'], - ]; - - /** - * SELECT SQL表达式 - * @var string - */ - protected $selectSql = 'SELECT%DISTINCT%%EXTRA% %FIELD% FROM %TABLE%%FORCE%%JOIN%%WHERE%%GROUP%%HAVING%%UNION%%ORDER%%LIMIT% %LOCK%%COMMENT%'; - - /** - * INSERT SQL表达式 - * @var string - */ - protected $insertSql = '%INSERT%%EXTRA% INTO %TABLE% (%FIELD%) VALUES (%DATA%) %COMMENT%'; - - /** - * INSERT ALL SQL表达式 - * @var string - */ - protected $insertAllSql = '%INSERT%%EXTRA% INTO %TABLE% (%FIELD%) %DATA% %COMMENT%'; - - /** - * UPDATE SQL表达式 - * @var string - */ - protected $updateSql = 'UPDATE%EXTRA% %TABLE% SET %SET%%JOIN%%WHERE%%ORDER%%LIMIT% %LOCK%%COMMENT%'; - - /** - * DELETE SQL表达式 - * @var string - */ - protected $deleteSql = 'DELETE%EXTRA% FROM %TABLE%%USING%%JOIN%%WHERE%%ORDER%%LIMIT% %LOCK%%COMMENT%'; - - /** - * 架构函数 - * @access public - * @param ConnectionInterface $connection 数据库连接对象实例 - */ - public function __construct(ConnectionInterface $connection) - { - $this->connection = $connection; - } - - /** - * 获取当前的连接对象实例 - * @access public - * @return ConnectionInterface - */ - public function getConnection(): ConnectionInterface - { - return $this->connection; - } - - /** - * 注册查询表达式解析 - * @access public - * @param string $name 解析方法 - * @param array $parser 匹配表达式数据 - * @return $this - */ - public function bindParser(string $name, array $parser) - { - $this->parser[$name] = $parser; - return $this; - } - - /** - * 数据分析 - * @access protected - * @param Query $query 查询对象 - * @param array $data 数据 - * @param array $fields 字段信息 - * @param array $bind 参数绑定 - * @return array - */ - protected function parseData(Query $query, array $data = [], array $fields = [], array $bind = []): array - { - if (empty($data)) { - return []; - } - - $options = $query->getOptions(); - - // 获取绑定信息 - if (empty($bind)) { - $bind = $query->getFieldsBindType(); - } - - if (empty($fields)) { - if ('*' == $options['field']) { - $fields = array_keys($bind); - } else { - $fields = $options['field']; - } - } - - $result = []; - - foreach ($data as $key => $val) { - $item = $this->parseKey($query, $key, true); - - if ($val instanceof Raw) { - $result[$item] = $val->getValue(); - continue; - } elseif (!is_scalar($val) && (in_array($key, (array) $query->getOptions('json')) || 'json' == $query->getFieldType($key))) { - $val = json_encode($val); - } - - if (false !== strpos($key, '->')) { - list($key, $name) = explode('->', $key, 2); - $item = $this->parseKey($query, $key); - $result[$item] = 'json_set(' . $item . ', \'$.' . $name . '\', ' . $this->parseDataBind($query, $key . '->' . $name, $val, $bind) . ')'; - } elseif (false === strpos($key, '.') && !in_array($key, $fields, true)) { - if ($options['strict']) { - throw new Exception('fields not exists:[' . $key . ']'); - } - } elseif (is_null($val)) { - $result[$item] = 'NULL'; - } elseif (is_array($val) && !empty($val)) { - switch (strtoupper($val[0])) { - case 'INC': - $result[$item] = $item . ' + ' . floatval($val[1]); - break; - case 'DEC': - $result[$item] = $item . ' - ' . floatval($val[1]); - break; - } - } elseif (is_scalar($val)) { - // 过滤非标量数据 - $result[$item] = $this->parseDataBind($query, $key, $val, $bind); - } - } - - return $result; - } - - /** - * 数据绑定处理 - * @access protected - * @param Query $query 查询对象 - * @param string $key 字段名 - * @param mixed $data 数据 - * @param array $bind 绑定数据 - * @return string - */ - protected function parseDataBind(Query $query, string $key, $data, array $bind = []): string - { - if ($data instanceof Raw) { - return $data->getValue(); - } - - $name = $query->bindValue($data, $bind[$key] ?? PDO::PARAM_STR); - - return ':' . $name; - } - - /** - * 字段名分析 - * @access public - * @param Query $query 查询对象 - * @param mixed $key 字段名 - * @param bool $strict 严格检测 - * @return string - */ - public function parseKey(Query $query, $key, bool $strict = false): string - { - return $key; - } - - /** - * 查询额外参数分析 - * @access protected - * @param Query $query 查询对象 - * @param string $extra 额外参数 - * @return string - */ - protected function parseExtra(Query $query, string $extra): string - { - return preg_match('/^[\w]+$/i', $extra) ? ' ' . strtoupper($extra) : ''; - } - - /** - * field分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $fields 字段名 - * @return string - */ - protected function parseField(Query $query, $fields): string - { - if (is_array($fields)) { - // 支持 'field1'=>'field2' 这样的字段别名定义 - $array = []; - - foreach ($fields as $key => $field) { - if ($field instanceof Raw) { - $array[] = $field->getValue(); - } elseif (!is_numeric($key)) { - $array[] = $this->parseKey($query, $key) . ' AS ' . $this->parseKey($query, $field, true); - } else { - $array[] = $this->parseKey($query, $field); - } - } - - $fieldsStr = implode(',', $array); - } else { - $fieldsStr = '*'; - } - - return $fieldsStr; - } - - /** - * table分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $tables 表名 - * @return string - */ - protected function parseTable(Query $query, $tables): string - { - $item = []; - $options = $query->getOptions(); - - foreach ((array) $tables as $key => $table) { - if ($table instanceof Raw) { - $item[] = $table->getValue(); - } elseif (!is_numeric($key)) { - $item[] = $this->parseKey($query, $key) . ' ' . $this->parseKey($query, $table); - } elseif (isset($options['alias'][$table])) { - $item[] = $this->parseKey($query, $table) . ' ' . $this->parseKey($query, $options['alias'][$table]); - } else { - $item[] = $this->parseKey($query, $table); - } - } - - return implode(',', $item); - } - - /** - * where分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $where 查询条件 - * @return string - */ - protected function parseWhere(Query $query, array $where): string - { - $options = $query->getOptions(); - $whereStr = $this->buildWhere($query, $where); - - if (!empty($options['soft_delete'])) { - // 附加软删除条件 - list($field, $condition) = $options['soft_delete']; - - $binds = $query->getFieldsBindType(); - $whereStr = $whereStr ? '( ' . $whereStr . ' ) AND ' : ''; - $whereStr = $whereStr . $this->parseWhereItem($query, $field, $condition, $binds); - } - - return empty($whereStr) ? '' : ' WHERE ' . $whereStr; - } - - /** - * 生成查询条件SQL - * @access public - * @param Query $query 查询对象 - * @param mixed $where 查询条件 - * @return string - */ - public function buildWhere(Query $query, array $where): string - { - if (empty($where)) { - $where = []; - } - - $whereStr = ''; - - $binds = $query->getFieldsBindType(); - - foreach ($where as $logic => $val) { - $str = $this->parseWhereLogic($query, $logic, $val, $binds); - - $whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($logic) + 1) : implode(' ', $str); - } - - return $whereStr; - } - - /** - * 不同字段使用相同查询条件(AND) - * @access protected - * @param Query $query 查询对象 - * @param string $logic Logic - * @param array $val 查询条件 - * @param array $binds 参数绑定 - * @return array - */ - protected function parseWhereLogic(Query $query, string $logic, array $val, array $binds = []): array - { - $where = []; - foreach ($val as $value) { - if ($value instanceof Raw) { - $where[] = ' ' . $logic . ' ( ' . $value->getValue() . ' )'; - continue; - } - - if (is_array($value)) { - if (key($value) !== 0) { - throw new Exception('where express error:' . var_export($value, true)); - } - $field = array_shift($value); - } elseif (true === $value) { - $where[] = ' ' . $logic . ' 1 '; - continue; - } elseif (!($value instanceof Closure)) { - throw new Exception('where express error:' . var_export($value, true)); - } - - if ($value instanceof Closure) { - // 使用闭包查询 - $where[] = $this->parseClosureWhere($query, $value, $logic); - } elseif (is_array($field)) { - $where[] = $this->parseMultiWhereField($query, $value, $field, $logic, $binds); - } elseif ($field instanceof Raw) { - $where[] = ' ' . $logic . ' ' . $this->parseWhereItem($query, $field, $value, $binds); - } elseif (strpos($field, '|')) { - $where[] = $this->parseFieldsOr($query, $value, $field, $logic, $binds); - } elseif (strpos($field, '&')) { - $where[] = $this->parseFieldsAnd($query, $value, $field, $logic, $binds); - } else { - // 对字段使用表达式查询 - $field = is_string($field) ? $field : ''; - $where[] = ' ' . $logic . ' ' . $this->parseWhereItem($query, $field, $value, $binds); - } - } - - return $where; - } - - /** - * 不同字段使用相同查询条件(AND) - * @access protected - * @param Query $query 查询对象 - * @param mixed $value 查询条件 - * @param string $field 查询字段 - * @param string $logic Logic - * @param array $binds 参数绑定 - * @return string - */ - protected function parseFieldsAnd(Query $query, $value, string $field, string $logic, array $binds): string - { - $item = []; - - foreach (explode('&', $field) as $k) { - $item[] = $this->parseWhereItem($query, $k, $value, $binds); - } - - return ' ' . $logic . ' ( ' . implode(' AND ', $item) . ' )'; - } - - /** - * 不同字段使用相同查询条件(OR) - * @access protected - * @param Query $query 查询对象 - * @param mixed $value 查询条件 - * @param string $field 查询字段 - * @param string $logic Logic - * @param array $binds 参数绑定 - * @return string - */ - protected function parseFieldsOr(Query $query, $value, string $field, string $logic, array $binds): string - { - $item = []; - - foreach (explode('|', $field) as $k) { - $item[] = $this->parseWhereItem($query, $k, $value, $binds); - } - - return ' ' . $logic . ' ( ' . implode(' OR ', $item) . ' )'; - } - - /** - * 闭包查询 - * @access protected - * @param Query $query 查询对象 - * @param Closure $value 查询条件 - * @param string $logic Logic - * @return string - */ - protected function parseClosureWhere(Query $query, Closure $value, string $logic): string - { - $newQuery = $query->newQuery(); - $value($newQuery); - $whereClosure = $this->buildWhere($newQuery, $newQuery->getOptions('where') ?: []); - - if (!empty($whereClosure)) { - $query->bind($newQuery->getBind(false)); - $where = ' ' . $logic . ' ( ' . $whereClosure . ' )'; - } - - return $where ?? ''; - } - - /** - * 复合条件查询 - * @access protected - * @param Query $query 查询对象 - * @param mixed $value 查询条件 - * @param mixed $field 查询字段 - * @param string $logic Logic - * @param array $binds 参数绑定 - * @return string - */ - protected function parseMultiWhereField(Query $query, $value, $field, string $logic, array $binds): string - { - array_unshift($value, $field); - - $where = []; - foreach ($value as $item) { - $where[] = $this->parseWhereItem($query, array_shift($item), $item, $binds); - } - - return ' ' . $logic . ' ( ' . implode(' AND ', $where) . ' )'; - } - - /** - * where子单元分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $field 查询字段 - * @param array $val 查询条件 - * @param array $binds 参数绑定 - * @return string - */ - protected function parseWhereItem(Query $query, $field, array $val, array $binds = []): string - { - // 字段分析 - $key = $field ? $this->parseKey($query, $field, true) : ''; - - list($exp, $value) = $val; - - // 检测操作符 - if (!is_string($exp)) { - throw new Exception('where express error:' . var_export($exp, true)); - } - - $exp = strtoupper($exp); - if (isset($this->exp[$exp])) { - $exp = $this->exp[$exp]; - } - - if (is_string($field) && 'LIKE' != $exp) { - $bindType = $binds[$field] ?? PDO::PARAM_STR; - } else { - $bindType = PDO::PARAM_STR; - } - - if ($value instanceof Raw) { - - } elseif (is_object($value) && method_exists($value, '__toString')) { - // 对象数据写入 - $value = $value->__toString(); - } - - if (is_scalar($value) && !in_array($exp, ['EXP', 'NOT NULL', 'NULL', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) { - if (is_string($value) && 0 === strpos($value, ':') && $query->isBind(substr($value, 1))) { - } else { - $name = $query->bindValue($value, $bindType); - $value = ':' . $name; - } - } - - // 解析查询表达式 - foreach ($this->parser as $fun => $parse) { - if (in_array($exp, $parse)) { - return $this->$fun($query, $key, $exp, $value, $field, $bindType, $val[2] ?? 'AND'); - } - } - - throw new Exception('where express error:' . $exp); - } - - /** - * 模糊查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param array $value - * @param string $field - * @param integer $bindType - * @param string $logic - * @return string - */ - protected function parseLike(Query $query, string $key, string $exp, $value, $field, int $bindType, string $logic): string - { - // 模糊匹配 - if (is_array($value)) { - $array = []; - foreach ($value as $item) { - $name = $query->bindValue($item, PDO::PARAM_STR); - $array[] = $key . ' ' . $exp . ' :' . $name; - } - - $whereStr = '(' . implode(' ' . strtoupper($logic) . ' ', $array) . ')'; - } else { - $whereStr = $key . ' ' . $exp . ' ' . $value; - } - - return $whereStr; - } - - /** - * 表达式查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param array $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseExp(Query $query, string $key, string $exp, Raw $value, string $field, int $bindType): string - { - // 表达式查询 - return '( ' . $key . ' ' . $value->getValue() . ' )'; - } - - /** - * 表达式查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param array $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseColumn(Query $query, string $key, $exp, array $value, string $field, int $bindType): string - { - // 字段比较查询 - list($op, $field) = $value; - - if (!in_array(trim($op), ['=', '<>', '>', '>=', '<', '<='])) { - throw new Exception('where express error:' . var_export($value, true)); - } - - return '( ' . $key . ' ' . $op . ' ' . $this->parseKey($query, $field, true) . ' )'; - } - - /** - * Null查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseNull(Query $query, string $key, string $exp, $value, $field, int $bindType): string - { - // NULL 查询 - return $key . ' IS ' . $exp; - } - - /** - * 范围查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseBetween(Query $query, string $key, string $exp, $value, $field, int $bindType): string - { - // BETWEEN 查询 - $data = is_array($value) ? $value : explode(',', $value); - - $min = $query->bindValue($data[0], $bindType); - $max = $query->bindValue($data[1], $bindType); - - return $key . ' ' . $exp . ' :' . $min . ' AND :' . $max . ' '; - } - - /** - * Exists查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseExists(Query $query, string $key, string $exp, $value, string $field, int $bindType): string - { - // EXISTS 查询 - if ($value instanceof Closure) { - $value = $this->parseClosure($query, $value, false); - } elseif ($value instanceof Raw) { - $value = $value->getValue(); - } else { - throw new Exception('where express error:' . $value); - } - - return $exp . ' ( ' . $value . ' )'; - } - - /** - * 时间比较查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseTime(Query $query, string $key, string $exp, $value, $field, int $bindType): string - { - return $key . ' ' . substr($exp, 0, 2) . ' ' . $this->parseDateTime($query, $value, $field, $bindType); - } - - /** - * 大小比较查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseCompare(Query $query, string $key, string $exp, $value, $field, int $bindType): string - { - if (is_array($value)) { - throw new Exception('where express error:' . $exp . var_export($value, true)); - } - - // 比较运算 - if ($value instanceof Closure) { - $value = $this->parseClosure($query, $value); - } - - if ('=' == $exp && is_null($value)) { - return $key . ' IS NULL'; - } - - return $key . ' ' . $exp . ' ' . $value; - } - - /** - * 时间范围查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseBetweenTime(Query $query, string $key, string $exp, $value, $field, int $bindType): string - { - if (is_string($value)) { - $value = explode(',', $value); - } - - return $key . ' ' . substr($exp, 0, -4) - . $this->parseDateTime($query, $value[0], $field, $bindType) - . ' AND ' - . $this->parseDateTime($query, $value[1], $field, $bindType); - - } - - /** - * IN查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @param integer $bindType - * @return string - */ - protected function parseIn(Query $query, string $key, string $exp, $value, $field, int $bindType): string - { - // IN 查询 - if ($value instanceof Closure) { - $value = $this->parseClosure($query, $value, false); - } elseif ($value instanceof Raw) { - $value = $value->getValue(); - } else { - $value = array_unique(is_array($value) ? $value : explode(',', $value)); - $array = []; - - foreach ($value as $v) { - $name = $query->bindValue($v, $bindType); - $array[] = ':' . $name; - } - - if (count($array) == 1) { - return $key . ('IN' == $exp ? ' = ' : ' <> ') . $array[0]; - } else { - $zone = implode(',', $array); - $value = empty($zone) ? "''" : $zone; - } - } - - return $key . ' ' . $exp . ' (' . $value . ')'; - } - - /** - * 闭包子查询 - * @access protected - * @param Query $query 查询对象 - * @param \Closure $call - * @param bool $show - * @return string - */ - protected function parseClosure(Query $query, Closure $call, bool $show = true): string - { - $newQuery = $query->newQuery()->removeOption(); - $call($newQuery); - - return $newQuery->buildSql($show); - } - - /** - * 日期时间条件解析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $value - * @param string $key - * @param integer $bindType - * @return string - */ - protected function parseDateTime(Query $query, $value, string $key, int $bindType): string - { - $options = $query->getOptions(); - - // 获取时间字段类型 - if (strpos($key, '.')) { - list($table, $key) = explode('.', $key); - - if (isset($options['alias']) && $pos = array_search($table, $options['alias'])) { - $table = $pos; - } - } else { - $table = $options['table']; - } - - $type = $query->getFieldType($key); - - if ($type) { - if (is_string($value)) { - $value = strtotime($value) ?: $value; - } - - if (is_int($value)) { - if (preg_match('/(datetime|timestamp)/is', $type)) { - // 日期及时间戳类型 - $value = date('Y-m-d H:i:s', $value); - } elseif (preg_match('/(date)/is', $type)) { - // 日期及时间戳类型 - $value = date('Y-m-d', $value); - } - } - } - - $name = $query->bindValue($value, $bindType); - - return ':' . $name; - } - - /** - * limit分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $limit - * @return string - */ - protected function parseLimit(Query $query, string $limit): string - { - return (!empty($limit) && false === strpos($limit, '(')) ? ' LIMIT ' . $limit . ' ' : ''; - } - - /** - * join分析 - * @access protected - * @param Query $query 查询对象 - * @param array $join - * @return string - */ - protected function parseJoin(Query $query, array $join): string - { - $joinStr = ''; - - foreach ($join as $item) { - list($table, $type, $on) = $item; - - if (strpos($on, '=')) { - list($val1, $val2) = explode('=', $on, 2); - - $condition = $this->parseKey($query, $val1) . '=' . $this->parseKey($query, $val2); - } else { - $condition = $on; - } - - $table = $this->parseTable($query, $table); - - $joinStr .= ' ' . $type . ' JOIN ' . $table . ' ON ' . $condition; - } - - return $joinStr; - } - - /** - * order分析 - * @access protected - * @param Query $query 查询对象 - * @param array $order - * @return string - */ - protected function parseOrder(Query $query, array $order): string - { - $array = []; - foreach ($order as $key => $val) { - if ($val instanceof Raw) { - $array[] = $val->getValue(); - } elseif (is_array($val) && preg_match('/^[\w\.]+$/', $key)) { - $array[] = $this->parseOrderField($query, $key, $val); - } elseif ('[rand]' == $val) { - $array[] = $this->parseRand($query); - } elseif (is_string($val)) { - if (is_numeric($key)) { - list($key, $sort) = explode(' ', strpos($val, ' ') ? $val : $val . ' '); - } else { - $sort = $val; - } - - if (preg_match('/^[\w\.]+$/', $key)) { - $sort = strtoupper($sort); - $sort = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : ''; - $array[] = $this->parseKey($query, $key, true) . $sort; - } else { - throw new Exception('order express error:' . $key); - } - } - } - - return empty($array) ? '' : ' ORDER BY ' . implode(',', $array); - } - - /** - * 随机排序 - * @access protected - * @param Query $query 查询对象 - * @return string - */ - protected function parseRand(Query $query): string - { - return ''; - } - - /** - * orderField分析 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param array $val - * @return string - */ - protected function parseOrderField(Query $query, string $key, array $val): string - { - if (isset($val['sort'])) { - $sort = $val['sort']; - unset($val['sort']); - } else { - $sort = ''; - } - - $sort = strtoupper($sort); - $sort = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : ''; - $bind = $query->getFieldsBindType(); - - foreach ($val as $item) { - $val[] = $this->parseDataBind($query, $key, $item, $bind); - } - - return 'field(' . $this->parseKey($query, $key, true) . ',' . implode(',', $val) . ')' . $sort; - } - - /** - * group分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $group - * @return string - */ - protected function parseGroup(Query $query, $group): string - { - if (empty($group)) { - return ''; - } - - if (is_string($group)) { - $group = explode(',', $group); - } - - $val = []; - foreach ($group as $key) { - $val[] = $this->parseKey($query, $key); - } - - return ' GROUP BY ' . implode(',', $val); - } - - /** - * having分析 - * @access protected - * @param Query $query 查询对象 - * @param string $having - * @return string - */ - protected function parseHaving(Query $query, string $having): string - { - return !empty($having) ? ' HAVING ' . $having : ''; - } - - /** - * comment分析 - * @access protected - * @param Query $query 查询对象 - * @param string $comment - * @return string - */ - protected function parseComment(Query $query, string $comment): string - { - if (false !== strpos($comment, '*/')) { - $comment = strstr($comment, '*/', true); - } - - return !empty($comment) ? ' /* ' . $comment . ' */' : ''; - } - - /** - * distinct分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $distinct - * @return string - */ - protected function parseDistinct(Query $query, bool $distinct): string - { - return !empty($distinct) ? ' DISTINCT ' : ''; - } - - /** - * union分析 - * @access protected - * @param Query $query 查询对象 - * @param array $union - * @return string - */ - protected function parseUnion(Query $query, array $union): string - { - if (empty($union)) { - return ''; - } - - $type = $union['type']; - unset($union['type']); - - foreach ($union as $u) { - if ($u instanceof Closure) { - $sql[] = $type . ' ' . $this->parseClosure($query, $u); - } elseif (is_string($u)) { - $sql[] = $type . ' ( ' . $u . ' )'; - } - } - - return ' ' . implode(' ', $sql); - } - - /** - * index分析,可在操作链中指定需要强制使用的索引 - * @access protected - * @param Query $query 查询对象 - * @param mixed $index - * @return string - */ - protected function parseForce(Query $query, $index): string - { - if (empty($index)) { - return ''; - } - - if (is_array($index)) { - $index = join(',', $index); - } - - return sprintf(" FORCE INDEX ( %s ) ", $index); - } - - /** - * 设置锁机制 - * @access protected - * @param Query $query 查询对象 - * @param bool|string $lock - * @return string - */ - protected function parseLock(Query $query, $lock = false): string - { - if (is_bool($lock)) { - return $lock ? ' FOR UPDATE ' : ''; - } - - if (is_string($lock) && !empty($lock)) { - return ' ' . trim($lock) . ' '; - } else { - return ''; - } - } - - /** - * 生成查询SQL - * @access public - * @param Query $query 查询对象 - * @param bool $one 是否仅获取一个记录 - * @return string - */ - public function select(Query $query, bool $one = false): string - { - $options = $query->getOptions(); - - return str_replace( - ['%TABLE%', '%DISTINCT%', '%EXTRA%', '%FIELD%', '%JOIN%', '%WHERE%', '%GROUP%', '%HAVING%', '%ORDER%', '%LIMIT%', '%UNION%', '%LOCK%', '%COMMENT%', '%FORCE%'], - [ - $this->parseTable($query, $options['table']), - $this->parseDistinct($query, $options['distinct']), - $this->parseExtra($query, $options['extra']), - $this->parseField($query, $options['field']), - $this->parseJoin($query, $options['join']), - $this->parseWhere($query, $options['where']), - $this->parseGroup($query, $options['group']), - $this->parseHaving($query, $options['having']), - $this->parseOrder($query, $options['order']), - $this->parseLimit($query, $one ? '1' : $options['limit']), - $this->parseUnion($query, $options['union']), - $this->parseLock($query, $options['lock']), - $this->parseComment($query, $options['comment']), - $this->parseForce($query, $options['force']), - ], - $this->selectSql); - } - - /** - * 生成Insert SQL - * @access public - * @param Query $query 查询对象 - * @return string - */ - public function insert(Query $query): string - { - $options = $query->getOptions(); - - // 分析并处理数据 - $data = $this->parseData($query, $options['data']); - if (empty($data)) { - return ''; - } - - $fields = array_keys($data); - $values = array_values($data); - - return str_replace( - ['%INSERT%', '%TABLE%', '%EXTRA%', '%FIELD%', '%DATA%', '%COMMENT%'], - [ - !empty($options['replace']) ? 'REPLACE' : 'INSERT', - $this->parseTable($query, $options['table']), - $this->parseExtra($query, $options['extra']), - implode(' , ', $fields), - implode(' , ', $values), - $this->parseComment($query, $options['comment']), - ], - $this->insertSql); - } - - /** - * 生成insertall SQL - * @access public - * @param Query $query 查询对象 - * @param array $dataSet 数据集 - * @return string - */ - public function insertAll(Query $query, array $dataSet): string - { - $options = $query->getOptions(); - - // 获取绑定信息 - $bind = $query->getFieldsBindType(); - - // 获取合法的字段 - if ('*' == $options['field']) { - $allowFields = array_keys($bind); - } else { - $allowFields = $options['field']; - } - - $fields = []; - $values = []; - - foreach ($dataSet as $k => $data) { - $data = $this->parseData($query, $data, $allowFields, $bind); - - $values[] = 'SELECT ' . implode(',', array_values($data)); - - if (!isset($insertFields)) { - $insertFields = array_keys($data); - } - } - - foreach ($insertFields as $field) { - $fields[] = $this->parseKey($query, $field); - } - - return str_replace( - ['%INSERT%', '%TABLE%', '%EXTRA%', '%FIELD%', '%DATA%', '%COMMENT%'], - [ - !empty($options['replace']) ? 'REPLACE' : 'INSERT', - $this->parseTable($query, $options['table']), - $this->parseExtra($query, $options['extra']), - implode(' , ', $fields), - implode(' UNION ALL ', $values), - $this->parseComment($query, $options['comment']), - ], - $this->insertAllSql); - } - - /** - * 生成slect insert SQL - * @access public - * @param Query $query 查询对象 - * @param array $fields 数据 - * @param string $table 数据表 - * @return string - */ - public function selectInsert(Query $query, array $fields, string $table): string - { - foreach ($fields as &$field) { - $field = $this->parseKey($query, $field, true); - } - - return 'INSERT INTO ' . $this->parseTable($query, $table) . ' (' . implode(',', $fields) . ') ' . $this->select($query); - } - - /** - * 生成update SQL - * @access public - * @param Query $query 查询对象 - * @return string - */ - public function update(Query $query): string - { - $options = $query->getOptions(); - - $data = $this->parseData($query, $options['data']); - - if (empty($data)) { - return ''; - } - - $set = []; - foreach ($data as $key => $val) { - $set[] = $key . ' = ' . $val; - } - - return str_replace( - ['%TABLE%', '%EXTRA%', '%SET%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'], - [ - $this->parseTable($query, $options['table']), - $this->parseExtra($query, $options['extra']), - implode(' , ', $set), - $this->parseJoin($query, $options['join']), - $this->parseWhere($query, $options['where']), - $this->parseOrder($query, $options['order']), - $this->parseLimit($query, $options['limit']), - $this->parseLock($query, $options['lock']), - $this->parseComment($query, $options['comment']), - ], - $this->updateSql); - } - - /** - * 生成delete SQL - * @access public - * @param Query $query 查询对象 - * @return string - */ - public function delete(Query $query): string - { - $options = $query->getOptions(); - - return str_replace( - ['%TABLE%', '%EXTRA%', '%USING%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'], - [ - $this->parseTable($query, $options['table']), - $this->parseExtra($query, $options['extra']), - !empty($options['using']) ? ' USING ' . $this->parseTable($query, $options['using']) . ' ' : '', - $this->parseJoin($query, $options['join']), - $this->parseWhere($query, $options['where']), - $this->parseOrder($query, $options['order']), - $this->parseLimit($query, $options['limit']), - $this->parseLock($query, $options['lock']), - $this->parseComment($query, $options['comment']), - ], - $this->deleteSql); - } -} diff --git a/vendor/topthink/think-orm/src/db/CacheItem.php b/vendor/topthink/think-orm/src/db/CacheItem.php deleted file mode 100644 index 6e82523b..00000000 --- a/vendor/topthink/think-orm/src/db/CacheItem.php +++ /dev/null @@ -1,209 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use DateInterval; -use DateTime; -use DateTimeInterface; -use think\db\exception\InvalidArgumentException; - -/** - * CacheItem实现类 - */ -class CacheItem -{ - /** - * 缓存Key - * @var string - */ - protected $key; - - /** - * 缓存内容 - * @var mixed - */ - protected $value; - - /** - * 过期时间 - * @var int|DateTimeInterface - */ - protected $expire; - - /** - * 缓存tag - * @var string - */ - protected $tag; - - /** - * 缓存是否命中 - * @var bool - */ - protected $isHit = false; - - public function __construct(string $key = null) - { - $this->key = $key; - } - - /** - * 为此缓存项设置「键」 - * @access public - * @param string $key - * @return $this - */ - public function setKey(string $key) - { - $this->key = $key; - return $this; - } - - /** - * 返回当前缓存项的「键」 - * @access public - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * 返回当前缓存项的有效期 - * @access public - * @return DateTimeInterface|int|null - */ - public function getExpire() - { - if ($this->expire instanceof DateTimeInterface) { - return $this->expire; - } - - return $this->expire ? $this->expire - time() : null; - } - - /** - * 获取缓存Tag - * @access public - * @return string - */ - public function getTag() - { - return $this->tag; - } - - /** - * 凭借此缓存项的「键」从缓存系统里面取出缓存项 - * @access public - * @return mixed - */ - public function get() - { - return $this->value; - } - - /** - * 确认缓存项的检查是否命中 - * @access public - * @return bool - */ - public function isHit(): bool - { - return $this->isHit; - } - - /** - * 为此缓存项设置「值」 - * @access public - * @param mixed $value - * @return $this - */ - public function set($value) - { - $this->value = $value; - $this->isHit = true; - return $this; - } - - /** - * 为此缓存项设置所属标签 - * @access public - * @param string $tag - * @return $this - */ - public function tag(string $tag = null) - { - $this->tag = $tag; - return $this; - } - - /** - * 设置缓存项的有效期 - * @access public - * @param mixed $expire - * @return $this - */ - public function expire($expire) - { - if (is_null($expire)) { - $this->expire = null; - } elseif (is_numeric($expire) || $expire instanceof DateInterval) { - $this->expiresAfter($expire); - } elseif ($expire instanceof DateTimeInterface) { - $this->expire = $expire; - } else { - throw new InvalidArgumentException('not support datetime'); - } - - return $this; - } - - /** - * 设置缓存项的准确过期时间点 - * @access public - * @param DateTimeInterface $expiration - * @return $this - */ - public function expiresAt($expiration) - { - if ($expiration instanceof DateTimeInterface) { - $this->expire = $expiration; - } else { - throw new InvalidArgumentException('not support datetime'); - } - - return $this; - } - - /** - * 设置缓存项的过期时间 - * @access public - * @param int|DateInterval $timeInterval - * @return $this - * @throws InvalidArgumentException - */ - public function expiresAfter($timeInterval) - { - if ($timeInterval instanceof DateInterval) { - $this->expire = (int) DateTime::createFromFormat('U', (string) time())->add($timeInterval)->format('U'); - } elseif (is_numeric($timeInterval)) { - $this->expire = $timeInterval + time(); - } else { - throw new InvalidArgumentException('not support datetime'); - } - - return $this; - } - -} diff --git a/vendor/topthink/think-orm/src/db/Connection.php b/vendor/topthink/think-orm/src/db/Connection.php deleted file mode 100644 index ba51920d..00000000 --- a/vendor/topthink/think-orm/src/db/Connection.php +++ /dev/null @@ -1,275 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use Psr\SimpleCache\CacheInterface; -use think\DbManager; -use think\db\CacheItem; - -/** - * 数据库连接基础类 - */ -abstract class Connection -{ - - /** - * 当前SQL指令 - * @var string - */ - protected $queryStr = ''; - - /** - * 返回或者影响记录数 - * @var int - */ - protected $numRows = 0; - - /** - * 事务指令数 - * @var int - */ - protected $transTimes = 0; - - /** - * 错误信息 - * @var string - */ - protected $error = ''; - - /** - * 数据库连接ID 支持多个连接 - * @var array - */ - protected $links = []; - - /** - * 当前连接ID - * @var object - */ - protected $linkID; - - /** - * 当前读连接ID - * @var object - */ - protected $linkRead; - - /** - * 当前写连接ID - * @var object - */ - protected $linkWrite; - - /** - * 数据表信息 - * @var array - */ - protected $info = []; - - /** - * 查询开始时间 - * @var float - */ - protected $queryStartTime; - - /** - * Builder对象 - * @var Builder - */ - protected $builder; - - /** - * Db对象 - * @var Db - */ - protected $db; - - /** - * 是否读取主库 - * @var bool - */ - protected $readMaster = false; - - /** - * 数据库连接参数配置 - * @var array - */ - protected $config = []; - - /** - * 缓存对象 - * @var Cache - */ - protected $cache; - - /** - * 获取当前的builder实例对象 - * @access public - * @return Builder - */ - public function getBuilder() - { - return $this->builder; - } - - /** - * 设置当前的数据库Db对象 - * @access public - * @param DbManager $db - * @return void - */ - public function setDb(DbManager $db) - { - $this->db = $db; - } - - /** - * 设置当前的缓存对象 - * @access public - * @param CacheInterface $cache - * @return void - */ - public function setCache(CacheInterface $cache) - { - $this->cache = $cache; - } - - /** - * 获取当前的缓存对象 - * @access public - * @return CacheInterface|null - */ - public function getCache() - { - return $this->cache; - } - - /** - * 获取数据库的配置参数 - * @access public - * @param string $config 配置名称 - * @return mixed - */ - public function getConfig(string $config = '') - { - if ('' === $config) { - return $this->config; - } - - return $this->config[$config] ?? null; - } - - /** - * 数据库SQL监控 - * @access protected - * @param string $sql 执行的SQL语句 留空自动获取 - * @param bool $master 主从标记 - * @return void - */ - protected function trigger(string $sql = '', bool $master = false): void - { - $listen = $this->db->getListen(); - - if (!empty($listen)) { - $runtime = number_format((microtime(true) - $this->queryStartTime), 6); - $sql = $sql ?: $this->getLastsql(); - - if (empty($this->config['deploy'])) { - $master = null; - } - - foreach ($listen as $callback) { - if (is_callable($callback)) { - $callback($sql, $runtime, $master); - } - } - } - } - - /** - * 缓存数据 - * @access protected - * @param CacheItem $cacheItem 缓存Item - */ - protected function cacheData(CacheItem $cacheItem) - { - if ($cacheItem->getTag() && method_exists($this->cache, 'tag')) { - $this->cache->tag($cacheItem->getTag())->set($cacheItem->getKey(), $cacheItem->get(), $cacheItem->getExpire()); - } else { - $this->cache->set($cacheItem->getKey(), $cacheItem->get(), $cacheItem->getExpire()); - } - } - - /** - * 分析缓存Key - * @access protected - * @param BaseQuery $query 查询对象 - * @return string - */ - protected function getCacheKey(BaseQuery $query): string - { - if (!empty($query->getOptions('key'))) { - $key = 'think:' . $this->getConfig('database') . '.' . $query->getTable() . '|' . $query->getOptions('key'); - } else { - $key = $query->getQueryGuid(); - } - - return $key; - } - - /** - * 分析缓存 - * @access protected - * @param BaseQuery $query 查询对象 - * @param array $cache 缓存信息 - * @return CacheItem - */ - protected function parseCache(BaseQuery $query, array $cache): CacheItem - { - list($key, $expire, $tag) = $cache; - - if ($key instanceof CacheItem) { - $cacheItem = $key; - } else { - if (true === $key) { - $key = $this->getCacheKey($query); - } - - $cacheItem = new CacheItem($key); - $cacheItem->expire($expire); - $cacheItem->tag($tag); - } - - return $cacheItem; - } - - /** - * 获取返回或者影响的记录数 - * @access public - * @return integer - */ - public function getNumRows(): int - { - return $this->numRows; - } - - /** - * 析构方法 - * @access public - */ - public function __destruct() - { - // 关闭连接 - $this->close(); - } -} diff --git a/vendor/topthink/think-orm/src/db/ConnectionInterface.php b/vendor/topthink/think-orm/src/db/ConnectionInterface.php deleted file mode 100644 index f6b1e088..00000000 --- a/vendor/topthink/think-orm/src/db/ConnectionInterface.php +++ /dev/null @@ -1,196 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use Psr\SimpleCache\CacheInterface; -use think\DbManager; - -/** - * Connection interface - */ -interface ConnectionInterface -{ - /** - * 获取当前连接器类对应的Query类 - * @access public - * @return string - */ - public function getQueryClass(): string; - - /** - * 连接数据库方法 - * @access public - * @param array $config 接参数 - * @param integer $linkNum 连接序号 - * @return mixed - */ - public function connect(array $config = [], $linkNum = 0); - - /** - * 设置当前的数据库Db对象 - * @access public - * @param DbManager $db - * @return void - */ - public function setDb(DbManager $db); - - /** - * 设置当前的缓存对象 - * @access public - * @param CacheInterface $cache - * @return void - */ - public function setCache(CacheInterface $cache); - - /** - * 获取数据库的配置参数 - * @access public - * @param string $config 配置名称 - * @return mixed - */ - public function getConfig(string $config = ''); - - /** - * 关闭数据库(或者重新连接) - * @access public - * @return $this - */ - public function close(); - - /** - * 查找单条记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return array - * @throws DbException - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - public function find(BaseQuery $query): array; - - /** - * 查找记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return array - * @throws DbException - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - public function select(BaseQuery $query): array; - - /** - * 插入记录 - * @access public - * @param BaseQuery $query 查询对象 - * @param boolean $getLastInsID 返回自增主键 - * @return mixed - */ - public function insert(BaseQuery $query, bool $getLastInsID = false); - - /** - * 批量插入记录 - * @access public - * @param BaseQuery $query 查询对象 - * @param mixed $dataSet 数据集 - * @return integer - * @throws \Exception - * @throws \Throwable - */ - public function insertAll(BaseQuery $query, array $dataSet = []): int; - - /** - * 更新记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return integer - * @throws Exception - * @throws PDOException - */ - public function update(BaseQuery $query): int; - - /** - * 删除记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return int - * @throws Exception - * @throws PDOException - */ - public function delete(BaseQuery $query): int; - - /** - * 得到某个字段的值 - * @access public - * @param BaseQuery $query 查询对象 - * @param string $field 字段名 - * @param mixed $default 默认值 - * @param bool $one 返回一个值 - * @return mixed - */ - public function value(BaseQuery $query, string $field, $default = null); - - /** - * 得到某个列的数组 - * @access public - * @param BaseQuery $query 查询对象 - * @param string $column 字段名 多个字段用逗号分隔 - * @param string $key 索引 - * @return array - */ - public function column(BaseQuery $query, string $column, string $key = ''): array; - - /** - * 执行数据库事务 - * @access public - * @param callable $callback 数据操作方法回调 - * @return mixed - * @throws PDOException - * @throws \Exception - * @throws \Throwable - */ - public function transaction(callable $callback); - - /** - * 启动事务 - * @access public - * @return void - * @throws \PDOException - * @throws \Exception - */ - public function startTrans(); - - /** - * 用于非自动提交状态下面的查询提交 - * @access public - * @return void - * @throws PDOException - */ - public function commit(); - - /** - * 事务回滚 - * @access public - * @return void - * @throws PDOException - */ - public function rollback(); - - /** - * 获取最近一次查询的sql语句 - * @access public - * @return string - */ - public function getLastSql(): string; - -} diff --git a/vendor/topthink/think-orm/src/db/Fetch.php b/vendor/topthink/think-orm/src/db/Fetch.php deleted file mode 100644 index 38f797c2..00000000 --- a/vendor/topthink/think-orm/src/db/Fetch.php +++ /dev/null @@ -1,493 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use think\db\exception\DbException as Exception; -use think\helper\Str; - -/** - * SQL获取类 - */ -class Fetch -{ - /** - * 查询对象 - * @var Query - */ - protected $query; - - /** - * Connection对象 - * @var Connection - */ - protected $connection; - - /** - * Builder对象 - * @var Builder - */ - protected $builder; - - /** - * 创建一个查询SQL获取对象 - * - * @param Query $query 查询对象 - */ - public function __construct(Query $query) - { - $this->query = $query; - $this->connection = $query->getConnection(); - $this->builder = $this->connection->getBuilder(); - } - - /** - * 聚合查询 - * @access protected - * @param string $aggregate 聚合方法 - * @param string $field 字段名 - * @return string - */ - protected function aggregate(string $aggregate, string $field): string - { - $this->query->parseOptions(); - - $field = $aggregate . '(' . $this->builder->parseKey($this->query, $field) . ') AS think_' . strtolower($aggregate); - - return $this->value($field, 0, false); - } - - /** - * 得到某个字段的值 - * @access public - * @param string $field 字段名 - * @param mixed $default 默认值 - * @return string - */ - public function value(string $field, $default = null, bool $one = true): string - { - $options = $this->query->parseOptions(); - - if (isset($options['field'])) { - $this->query->removeOption('field'); - } - - $this->query->setOption('field', (array) $field); - - // 生成查询SQL - $sql = $this->builder->select($this->query, $one); - - if (isset($options['field'])) { - $this->query->setOption('field', $options['field']); - } else { - $this->query->removeOption('field'); - } - - return $this->fetch($sql); - } - - /** - * 得到某个列的数组 - * @access public - * @param string $field 字段名 多个字段用逗号分隔 - * @param string $key 索引 - * @return string - */ - public function column(string $field, string $key = ''): string - { - $options = $this->query->parseOptions(); - - if (isset($options['field'])) { - $this->query->removeOption('field'); - } - - if ($key && '*' != $field) { - $field = $key . ',' . $field; - } - - $field = array_map('trim', explode(',', $field)); - - $this->query->setOption('field', $field); - - // 生成查询SQL - $sql = $this->builder->select($this->query); - - if (isset($options['field'])) { - $this->query->setOption('field', $options['field']); - } else { - $this->query->removeOption('field'); - } - - return $this->fetch($sql); - } - - /** - * 插入记录 - * @access public - * @param array $data 数据 - * @return string - */ - public function insert(array $data = []): string - { - $options = $this->query->parseOptions(); - - if (!empty($data)) { - $this->query->setOption('data', $data); - } - - $sql = $this->builder->insert($this->query); - - return $this->fetch($sql); - } - - /** - * 插入记录并获取自增ID - * @access public - * @param array $data 数据 - * @return string - */ - public function insertGetId(array $data = []): string - { - return $this->insert($data); - } - - /** - * 保存数据 自动判断insert或者update - * @access public - * @param array $data 数据 - * @param bool $forceInsert 是否强制insert - * @return string - */ - public function save(array $data = [], bool $forceInsert = false): string - { - if ($forceInsert) { - return $this->insert($data); - } - - $data = array_merge($this->query->getOptions('data') ?: [], $data); - - $this->query->setOption('data', $data); - - if ($this->query->getOptions('where')) { - $isUpdate = true; - } else { - $isUpdate = $this->query->parseUpdateData($data); - } - - return $isUpdate ? $this->update() : $this->insert(); - } - - /** - * 批量插入记录 - * @access public - * @param array $dataSet 数据集 - * @param integer $limit 每次写入数据限制 - * @return string - */ - public function insertAll(array $dataSet = [], int $limit = null): string - { - $options = $this->query->parseOptions(); - - if (empty($dataSet)) { - $dataSet = $options['data']; - } - - if (empty($limit) && !empty($options['limit'])) { - $limit = $options['limit']; - } - - if ($limit) { - $array = array_chunk($dataSet, $limit, true); - $fetchSql = []; - foreach ($array as $item) { - $sql = $this->builder->insertAll($this->query, $item); - $bind = $this->query->getBind(); - - $fetchSql[] = $this->connection->getRealSql($sql, $bind); - } - - return implode(';', $fetchSql); - } - - $sql = $this->builder->insertAll($this->query, $dataSet); - - return $this->fetch($sql); - } - - /** - * 通过Select方式插入记录 - * @access public - * @param array $fields 要插入的数据表字段名 - * @param string $table 要插入的数据表名 - * @return string - */ - public function selectInsert(array $fields, string $table): string - { - $this->query->parseOptions(); - - $sql = $this->builder->selectInsert($this->query, $fields, $table); - - return $this->fetch($sql); - } - - /** - * 更新记录 - * @access public - * @param mixed $data 数据 - * @return string - */ - public function update(array $data = []): string - { - $options = $this->query->parseOptions(); - - $data = !empty($data) ? $data : $options['data']; - - $pk = $this->query->getPk(); - - if (empty($options['where'])) { - // 如果存在主键数据 则自动作为更新条件 - if (is_string($pk) && isset($data[$pk])) { - $this->query->where($pk, '=', $data[$pk]); - unset($data[$pk]); - } elseif (is_array($pk)) { - // 增加复合主键支持 - foreach ($pk as $field) { - if (isset($data[$field])) { - $this->query->where($field, '=', $data[$field]); - } else { - // 如果缺少复合主键数据则不执行 - throw new Exception('miss complex primary data'); - } - unset($data[$field]); - } - } - - if (empty($this->query->getOptions('where'))) { - // 如果没有任何更新条件则不执行 - throw new Exception('miss update condition'); - } - } - - // 更新数据 - $this->query->setOption('data', $data); - - // 生成UPDATE SQL语句 - $sql = $this->builder->update($this->query); - - return $this->fetch($sql); - } - - /** - * 删除记录 - * @access public - * @param mixed $data 表达式 true 表示强制删除 - * @return string - */ - public function delete($data = null): string - { - $options = $this->query->parseOptions(); - - if (!is_null($data) && true !== $data) { - // AR模式分析主键条件 - $this->query->parsePkWhere($data); - } - - if (!empty($options['soft_delete'])) { - // 软删除 - list($field, $condition) = $options['soft_delete']; - if ($condition) { - $this->query->setOption('soft_delete', null); - $this->query->setOption('data', [$field => $condition]); - // 生成删除SQL语句 - $sql = $this->builder->delete($this->query); - return $this->fetch($sql); - } - } - - // 生成删除SQL语句 - $sql = $this->builder->delete($this->query); - - return $this->fetch($sql); - } - - /** - * 查找记录 返回SQL - * @access public - * @param mixed $data - * @return string - */ - public function select($data = null): string - { - $this->query->parseOptions(); - - if (!is_null($data)) { - // 主键条件分析 - $this->query->parsePkWhere($data); - } - - // 生成查询SQL - $sql = $this->builder->select($this->query); - - return $this->fetch($sql); - } - - /** - * 查找单条记录 返回SQL语句 - * @access public - * @param mixed $data - * @return string - */ - public function find($data = null): string - { - $this->query->parseOptions(); - - if (!is_null($data)) { - // AR模式分析主键条件 - $this->query->parsePkWhere($data); - } - - // 生成查询SQL - $sql = $this->builder->select($this->query, true); - - // 获取实际执行的SQL语句 - return $this->fetch($sql); - } - - /** - * 查找多条记录 如果不存在则抛出异常 - * @access public - * @param mixed $data - * @return string - */ - public function selectOrFail($data = null): string - { - return $this->select($data); - } - - /** - * 查找单条记录 如果不存在则抛出异常 - * @access public - * @param mixed $data - * @return string - */ - public function findOrFail($data = null): string - { - return $this->find($data); - } - - /** - * 查找单条记录 不存在返回空数据(或者空模型) - * @access public - * @param mixed $data 数据 - * @return string - */ - public function findOrEmpty($data = null) - { - return $this->find($data); - } - - /** - * 获取实际的SQL语句 - * @access public - * @param string $sql - * @return string - */ - public function fetch(string $sql): string - { - $bind = $this->query->getBind(); - - return $this->connection->getRealSql($sql, $bind); - } - - /** - * COUNT查询 - * @access public - * @param string $field 字段名 - * @return string - */ - public function count(string $field = '*'): string - { - $options = $this->query->parseOptions(); - - if (!empty($options['group'])) { - // 支持GROUP - $bind = $this->query->getBind(); - $subSql = $this->query->options($options)->field('count(' . $field . ') AS think_count')->bind($bind)->buildSql(); - - $query = $this->query->newQuery()->table([$subSql => '_group_count_']); - - return $query->fetchsql()->aggregate('COUNT', '*'); - } else { - return $this->aggregate('COUNT', $field); - } - } - - /** - * SUM查询 - * @access public - * @param string $field 字段名 - * @return string - */ - public function sum(string $field): string - { - return $this->aggregate('SUM', $field); - } - - /** - * MIN查询 - * @access public - * @param string $field 字段名 - * @return string - */ - public function min(string $field): string - { - return $this->aggregate('MIN', $field); - } - - /** - * MAX查询 - * @access public - * @param string $field 字段名 - * @return string - */ - public function max(string $field): string - { - return $this->aggregate('MAX', $field); - } - - /** - * AVG查询 - * @access public - * @param string $field 字段名 - * @return string - */ - public function avg(string $field): string - { - return $this->aggregate('AVG', $field); - } - - public function __call($method, $args) - { - if (strtolower(substr($method, 0, 5)) == 'getby') { - // 根据某个字段获取记录 - $field = Str::snake(substr($method, 5)); - return $this->where($field, '=', $args[0])->find(); - } elseif (strtolower(substr($method, 0, 10)) == 'getfieldby') { - // 根据某个字段获取记录的某个值 - $name = Str::snake(substr($method, 10)); - return $this->where($name, '=', $args[0])->value($args[1]); - } - - $result = call_user_func_array([$this->query, $method], $args); - return $result === $this->query ? $this : $result; - } -} diff --git a/vendor/topthink/think-orm/src/db/Mongo.php b/vendor/topthink/think-orm/src/db/Mongo.php deleted file mode 100644 index 6f94f3c6..00000000 --- a/vendor/topthink/think-orm/src/db/Mongo.php +++ /dev/null @@ -1,715 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); -namespace think\db; - -use MongoDB\Driver\BulkWrite; -use MongoDB\Driver\Command; -use MongoDB\Driver\Cursor; -use MongoDB\Driver\Exception\AuthenticationException; -use MongoDB\Driver\Exception\BulkWriteException; -use MongoDB\Driver\Exception\ConnectionException; -use MongoDB\Driver\Exception\InvalidArgumentException; -use MongoDB\Driver\Exception\RuntimeException; -use MongoDB\Driver\Query as MongoQuery; -use MongoDB\Driver\ReadPreference; -use MongoDB\Driver\WriteConcern; -use think\Collection; -use think\db\connector\Mongo as Connection; -use think\db\exception\DbException as Exception; -use think\Paginator; - -class Mongo extends BaseQuery -{ - /** - * 执行查询 返回数据集 - * @access public - * @param MongoQuery $query 查询对象 - * @return mixed - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - */ - public function query(MongoQuery $query) - { - return $this->connection->query($this, $query); - } - - /** - * 执行指令 返回数据集 - * @access public - * @param Command $command 指令 - * @param string $dbName - * @param ReadPreference $readPreference readPreference - * @param string|array $typeMap 指定返回的typeMap - * @return mixed - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - */ - public function command(Command $command, string $dbName = '', ReadPreference $readPreference = null, $typeMap = null) - { - return $this->connection->command($command, $dbName, $readPreference, $typeMap); - } - - /** - * 执行语句 - * @access public - * @param BulkWrite $bulk - * @return int - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - * @throws BulkWriteException - */ - public function execute(BulkWrite $bulk) - { - return $this->connection->execute($this, $bulk); - } - - /** - * 执行command - * @access public - * @param string|array|object $command 指令 - * @param mixed $extra 额外参数 - * @param string $db 数据库名 - * @return array - */ - public function cmd($command, $extra = null, string $db = ''): array - { - $this->parseOptions(); - return $this->connection->cmd($this, $command, $extra, $db); - } - - /** - * 指定distinct查询 - * @access public - * @param string $field 字段名 - * @return array - */ - public function getDistinct(string $field) - { - $result = $this->cmd('distinct', $field); - return $result[0]['values']; - } - - /** - * 获取数据库的所有collection - * @access public - * @param string $db 数据库名称 留空为当前数据库 - * @throws Exception - */ - public function listCollections(string $db = '') - { - $cursor = $this->cmd('listCollections', null, $db); - $result = []; - foreach ($cursor as $collection) { - $result[] = $collection['name']; - } - - return $result; - } - - /** - * COUNT查询 - * @access public - * @param string $field 字段名 - * @return integer - */ - public function count(string $field = null): int - { - $result = $this->cmd('count'); - - return $result[0]['n']; - } - - /** - * 聚合查询 - * @access public - * @param string $aggregate 聚合指令 - * @param string $field 字段名 - * @param bool $force 强制转为数字类型 - * @return mixed - */ - public function aggregate(string $aggregate, $field, bool $force = false) - { - $result = $this->cmd('aggregate', [strtolower($aggregate), $field]); - $value = $result[0]['aggregate'] ?? 0; - - if ($force) { - $value += 0; - } - - return $value; - } - - /** - * 多聚合操作 - * - * @param array $aggregate 聚合指令, 可以聚合多个参数, 如 ['sum' => 'field1', 'avg' => 'field2'] - * @param array $groupBy 类似mysql里面的group字段, 可以传入多个字段, 如 ['field_a', 'field_b', 'field_c'] - * @return array 查询结果 - */ - public function multiAggregate(array $aggregate, array $groupBy): array - { - $result = $this->cmd('multiAggregate', [$aggregate, $groupBy]); - - foreach ($result as &$row) { - if (isset($row['_id']) && !empty($row['_id'])) { - foreach ($row['_id'] as $k => $v) { - $row[$k] = $v; - } - unset($row['_id']); - } - } - - return $result; - } - - /** - * 字段值增长 - * @access public - * @param string $field 字段名 - * @param float $step 增长值 - * @return $this - */ - public function inc(string $field, float $step = 1) - { - $this->options['data'][$field] = ['$inc', $step]; - - return $this; - } - - /** - * 字段值减少 - * @access public - * @param string $field 字段名 - * @param float $step 减少值 - * @return $this - */ - public function dec(string $field, float $step = 1) - { - return $this->inc($field, -1 * $step); - } - - /** - * 指定当前操作的Collection - * @access public - * @param string $table 表名 - * @return $this - */ - public function table($table) - { - $this->options['table'] = $table; - - return $this; - } - - /** - * table方法的别名 - * @access public - * @param string $collection - * @return $this - */ - public function collection(string $collection) - { - return $this->table($collection); - } - - /** - * 设置typeMap - * @access public - * @param string|array $typeMap - * @return $this - */ - public function typeMap($typeMap) - { - $this->options['typeMap'] = $typeMap; - return $this; - } - - /** - * awaitData - * @access public - * @param bool $awaitData - * @return $this - */ - public function awaitData(bool $awaitData) - { - $this->options['awaitData'] = $awaitData; - return $this; - } - - /** - * batchSize - * @access public - * @param integer $batchSize - * @return $this - */ - public function batchSize(int $batchSize) - { - $this->options['batchSize'] = $batchSize; - return $this; - } - - /** - * exhaust - * @access public - * @param bool $exhaust - * @return $this - */ - public function exhaust(bool $exhaust) - { - $this->options['exhaust'] = $exhaust; - return $this; - } - - /** - * 设置modifiers - * @access public - * @param array $modifiers - * @return $this - */ - public function modifiers(array $modifiers) - { - $this->options['modifiers'] = $modifiers; - return $this; - } - - /** - * 设置noCursorTimeout - * @access public - * @param bool $noCursorTimeout - * @return $this - */ - public function noCursorTimeout(bool $noCursorTimeout) - { - $this->options['noCursorTimeout'] = $noCursorTimeout; - return $this; - } - - /** - * 设置oplogReplay - * @access public - * @param bool $oplogReplay - * @return $this - */ - public function oplogReplay(bool $oplogReplay) - { - $this->options['oplogReplay'] = $oplogReplay; - return $this; - } - - /** - * 设置partial - * @access public - * @param bool $partial - * @return $this - */ - public function partial(bool $partial) - { - $this->options['partial'] = $partial; - return $this; - } - - /** - * maxTimeMS - * @access public - * @param string $maxTimeMS - * @return $this - */ - public function maxTimeMS(string $maxTimeMS) - { - $this->options['maxTimeMS'] = $maxTimeMS; - return $this; - } - - /** - * collation - * @access public - * @param array $collation - * @return $this - */ - public function collation(array $collation) - { - $this->options['collation'] = $collation; - return $this; - } - - /** - * 设置是否REPLACE - * @access public - * @param bool $replace 是否使用REPLACE写入数据 - * @return $this - */ - public function replace(bool $replace = true) - { - return $this; - } - - /** - * 设置返回字段 - * @access public - * @param mixed $field 字段信息 - * @return $this - */ - public function field($field) - { - if (empty($field) || '*' == $field) { - return $this; - } - - if (is_string($field)) { - $field = array_map('trim', explode(',', $field)); - } - - $projection = []; - foreach ($field as $key => $val) { - if (is_numeric($key)) { - $projection[$val] = 1; - } else { - $projection[$key] = $val; - } - } - - $this->options['projection'] = $projection; - - return $this; - } - - /** - * 指定要排除的查询字段 - * @access public - * @param array|string $field 要排除的字段 - * @return $this - */ - public function withoutField($field) - { - if (empty($field) || '*' == $field) { - return $this; - } - - if (is_string($field)) { - $field = array_map('trim', explode(',', $field)); - } - - $projection = []; - foreach ($field as $key => $val) { - if (is_numeric($key)) { - $projection[$val] = 0; - } else { - $projection[$key] = $val; - } - } - - $this->options['projection'] = $projection; - return $this; - } - - /** - * 设置skip - * @access public - * @param integer $skip - * @return $this - */ - public function skip(int $skip) - { - $this->options['skip'] = $skip; - return $this; - } - - /** - * 设置slaveOk - * @access public - * @param bool $slaveOk - * @return $this - */ - public function slaveOk(bool $slaveOk) - { - $this->options['slaveOk'] = $slaveOk; - return $this; - } - - /** - * 指定查询数量 - * @access public - * @param int $offset 起始位置 - * @param int $length 查询数量 - * @return $this - */ - public function limit(int $offset, int $length = null) - { - if (is_null($length)) { - $length = $offset; - $offset = 0; - } - - $this->options['skip'] = $offset; - $this->options['limit'] = $length; - - return $this; - } - - /** - * 设置sort - * @access public - * @param array|string $field - * @param string $order - * @return $this - */ - public function order($field, string $order = '') - { - if (is_array($field)) { - $this->options['sort'] = $field; - } else { - $this->options['sort'][$field] = 'asc' == strtolower($order) ? 1 : -1; - } - return $this; - } - - /** - * 设置tailable - * @access public - * @param bool $tailable - * @return $this - */ - public function tailable(bool $tailable) - { - $this->options['tailable'] = $tailable; - return $this; - } - - /** - * 设置writeConcern对象 - * @access public - * @param WriteConcern $writeConcern - * @return $this - */ - public function writeConcern(WriteConcern $writeConcern) - { - $this->options['writeConcern'] = $writeConcern; - return $this; - } - - /** - * 获取当前数据表的主键 - * @access public - * @return string|array - */ - public function getPk() - { - return $this->pk ?: $this->connection->getConfig('pk'); - } - - /** - * 执行查询但只返回Cursor对象 - * @access public - * @return Cursor - */ - public function getCursor(): Cursor - { - $this->parseOptions(); - - return $this->connection->getCursor($this); - } - - /** - * 获取当前的查询标识 - * @access public - * @param mixed $data 要序列化的数据 - * @return string - */ - public function getQueryGuid($data = null): string - { - return md5($this->getConfig('database') . serialize(var_export($data ?: $this->options, true))); - } - - /** - * 分页查询 - * @access public - * @param int|array $listRows 每页数量 数组表示配置参数 - * @param int|bool $simple 是否简洁模式或者总记录数 - * @return Paginator - * @throws Exception - */ - public function paginate($listRows = null, $simple = false): Paginator - { - if (is_int($simple)) { - $total = $simple; - $simple = false; - } - - $defaultConfig = [ - 'query' => [], //url额外参数 - 'fragment' => '', //url锚点 - 'var_page' => 'page', //分页变量 - 'list_rows' => 15, //每页数量 - ]; - - if (is_array($listRows)) { - $config = array_merge($defaultConfig, $listRows); - $listRows = intval($config['list_rows']); - } else { - $config = $defaultConfig; - $listRows = intval($listRows ?: $config['list_rows']); - } - - $page = isset($config['page']) ? (int) $config['page'] : Paginator::getCurrentPage($config['var_page']); - - $page = $page < 1 ? 1 : $page; - - $config['path'] = $config['path'] ?? Paginator::getCurrentPath(); - - if (!isset($total) && !$simple) { - $options = $this->getOptions(); - - unset($this->options['order'], $this->options['limit'], $this->options['page'], $this->options['field']); - - $total = $this->count(); - $results = $this->options($options)->page($page, $listRows)->select(); - } elseif ($simple) { - $results = $this->limit(($page - 1) * $listRows, $listRows + 1)->select(); - $total = null; - } else { - $results = $this->page($page, $listRows)->select(); - } - - $this->removeOption('limit'); - $this->removeOption('page'); - - return Paginator::make($results, $listRows, $page, $total, $simple, $config); - } - - /** - * 分批数据返回处理 - * @access public - * @param integer $count 每次处理的数据数量 - * @param callable $callback 处理回调方法 - * @param string|array $column 分批处理的字段名 - * @param string $order 字段排序 - * @return bool - * @throws Exception - */ - public function chunk(int $count, callable $callback, $column = null, string $order = 'asc'): bool - { - $options = $this->getOptions(); - $column = $column ?: $this->getPk(); - - if (isset($options['order'])) { - unset($options['order']); - } - - if (is_array($column)) { - $times = 1; - $query = $this->options($options)->page($times, $count); - } else { - $query = $this->options($options)->limit($count); - - if (strpos($column, '.')) { - list($alias, $key) = explode('.', $column); - } else { - $key = $column; - } - } - - $resultSet = $query->order($column, $order)->select(); - - while (count($resultSet) > 0) { - if (false === call_user_func($callback, $resultSet)) { - return false; - } - - if (isset($times)) { - $times++; - $query = $this->options($options)->page($times, $count); - } else { - $end = $resultSet->pop(); - $lastId = is_array($end) ? $end[$key] : $end->getData($key); - - $query = $this->options($options) - ->limit($count) - ->where($column, 'asc' == strtolower($order) ? '>' : '<', $lastId); - } - - $resultSet = $query->order($column, $order)->select(); - } - - return true; - } - - /** - * 分析表达式(可用于查询或者写入操作) - * @access public - * @return array - */ - public function parseOptions(): array - { - $options = $this->options; - - // 获取数据表 - if (empty($options['table'])) { - $options['table'] = $this->getTable(); - } - - foreach (['where', 'data'] as $name) { - if (!isset($options[$name])) { - $options[$name] = []; - } - } - - $modifiers = empty($options['modifiers']) ? [] : $options['modifiers']; - if (isset($options['comment'])) { - $modifiers['$comment'] = $options['comment']; - } - - if (isset($options['maxTimeMS'])) { - $modifiers['$maxTimeMS'] = $options['maxTimeMS']; - } - - if (!empty($modifiers)) { - $options['modifiers'] = $modifiers; - } - - if (!isset($options['projection'])) { - $options['projection'] = []; - } - - if (!isset($options['typeMap'])) { - $options['typeMap'] = $this->getConfig('type_map'); - } - - if (!isset($options['limit'])) { - $options['limit'] = 0; - } - - foreach (['master', 'fetch_sql', 'fetch_cursor'] as $name) { - if (!isset($options[$name])) { - $options[$name] = false; - } - } - - if (isset($options['page'])) { - // 根据页数计算limit - list($page, $listRows) = $options['page']; - $page = $page > 0 ? $page : 1; - $listRows = $listRows > 0 ? $listRows : (is_numeric($options['limit']) ? $options['limit'] : 20); - $offset = $listRows * ($page - 1); - $options['skip'] = intval($offset); - $options['limit'] = intval($listRows); - } - - $this->options = $options; - - return $options; - } - -} diff --git a/vendor/topthink/think-orm/src/db/PDOConnection.php b/vendor/topthink/think-orm/src/db/PDOConnection.php deleted file mode 100644 index b15d42be..00000000 --- a/vendor/topthink/think-orm/src/db/PDOConnection.php +++ /dev/null @@ -1,1686 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use Closure; -use PDO; -use PDOStatement; -use think\db\exception\BindParamException; -use think\db\exception\DataNotFoundException; -use think\db\exception\ModelNotFoundException; -use think\db\exception\PDOException; - -/** - * 数据库连接基础类 - */ -abstract class PDOConnection extends Connection implements ConnectionInterface -{ - const PARAM_FLOAT = 21; - - /** - * 数据库连接参数配置 - * @var array - */ - protected $config = [ - // 数据库类型 - 'type' => '', - // 服务器地址 - 'hostname' => '', - // 数据库名 - 'database' => '', - // 用户名 - 'username' => '', - // 密码 - 'password' => '', - // 端口 - 'hostport' => '', - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '', - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 模型写入后自动读取主服务器 - 'read_master' => false, - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 开启字段缓存 - 'fields_cache' => false, - // 监听SQL - 'trigger_sql' => true, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '', - // 是否需要断线重连 - 'break_reconnect' => false, - // 断线标识字符串 - 'break_match_str' => [], - // 字段缓存路径 - 'schema_cache_path' => '', - ]; - - /** - * PDO操作实例 - * @var PDOStatement - */ - protected $PDOStatement; - - /** - * 当前SQL指令 - * @var string - */ - protected $queryStr = ''; - - /** - * 事务指令数 - * @var int - */ - protected $transTimes = 0; - - /** - * 查询结果类型 - * @var int - */ - protected $fetchType = PDO::FETCH_ASSOC; - - /** - * 字段属性大小写 - * @var int - */ - protected $attrCase = PDO::CASE_LOWER; - - /** - * 数据表信息 - * @var array - */ - protected $info = []; - - /** - * 查询开始时间 - * @var float - */ - protected $queryStartTime; - - /** - * PDO连接参数 - * @var array - */ - protected $params = [ - PDO::ATTR_CASE => PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - PDO::ATTR_EMULATE_PREPARES => false, - ]; - - /** - * 参数绑定类型映射 - * @var array - */ - protected $bindType = [ - 'string' => PDO::PARAM_STR, - 'str' => PDO::PARAM_STR, - 'integer' => PDO::PARAM_INT, - 'int' => PDO::PARAM_INT, - 'boolean' => PDO::PARAM_BOOL, - 'bool' => PDO::PARAM_BOOL, - 'float' => self::PARAM_FLOAT, - 'datetime' => PDO::PARAM_STR, - 'timestamp' => PDO::PARAM_STR, - ]; - - /** - * 服务器断线标识字符 - * @var array - */ - protected $breakMatchStr = [ - 'server has gone away', - 'no connection to the server', - 'Lost connection', - 'is dead or not enabled', - 'Error while sending', - 'decryption failed or bad record mac', - 'server closed the connection unexpectedly', - 'SSL connection has been closed unexpectedly', - 'Error writing data to the connection', - 'Resource deadlock avoided', - 'failed with errno', - ]; - - /** - * 绑定参数 - * @var array - */ - protected $bind = []; - - /** - * 架构函数 读取数据库配置信息 - * @access public - * @param array $config 数据库配置数组 - */ - public function __construct(array $config = []) - { - if (!empty($config)) { - $this->config = array_merge($this->config, $config); - } - - // 创建Builder对象 - $class = $this->getBuilderClass(); - - $this->builder = new $class($this); - } - - /** - * 获取当前连接器类对应的Query类 - * @access public - * @return string - */ - public function getQueryClass(): string - { - return $this->getConfig('query') ?: Query::class; - } - - /** - * 获取当前连接器类对应的Builder类 - * @access public - * @return string - */ - public function getBuilderClass(): string - { - return $this->getConfig('builder') ?: '\\think\\db\\builder\\' . ucfirst($this->getConfig('type')); - } - - /** - * 解析pdo连接的dsn信息 - * @access protected - * @param array $config 连接信息 - * @return string - */ - abstract protected function parseDsn(array $config); - - /** - * 取得数据表的字段信息 - * @access public - * @param string $tableName 数据表名称 - * @return array - */ - abstract public function getFields(string $tableName); - - /** - * 取得数据库的表信息 - * @access public - * @param string $dbName 数据库名称 - * @return array - */ - abstract public function getTables(string $dbName); - - /** - * 对返数据表字段信息进行大小写转换出来 - * @access public - * @param array $info 字段信息 - * @return array - */ - public function fieldCase(array $info): array - { - // 字段大小写转换 - switch ($this->attrCase) { - case PDO::CASE_LOWER: - $info = array_change_key_case($info); - break; - case PDO::CASE_UPPER: - $info = array_change_key_case($info, CASE_UPPER); - break; - case PDO::CASE_NATURAL: - default: - // 不做转换 - } - - return $info; - } - - /** - * 获取字段类型 - * @access protected - * @param string $type 字段类型 - * @return string - */ - protected function getFieldType(string $type): string - { - if (0 === strpos($type, 'set') || 0 === strpos($type, 'enum')) { - $result = 'string'; - } elseif (preg_match('/(double|float|decimal|real|numeric)/is', $type)) { - $result = 'float'; - } elseif (preg_match('/(int|serial|bit)/is', $type)) { - $result = 'int'; - } elseif (preg_match('/bool/is', $type)) { - $result = 'bool'; - } elseif (0 === strpos($type, 'timestamp')) { - $result = 'timestamp'; - } elseif (0 === strpos($type, 'datetime')) { - $result = 'datetime'; - } else { - $result = 'string'; - } - - return $result; - } - - /** - * 获取字段绑定类型 - * @access public - * @param string $type 字段类型 - * @return integer - */ - public function getFieldBindType(string $type): int - { - if (in_array($type, ['integer', 'string', 'float', 'boolean', 'bool', 'int', 'str'])) { - $bind = $this->bindType[$type]; - } elseif (0 === strpos($type, 'set') || 0 === strpos($type, 'enum')) { - $bind = PDO::PARAM_STR; - } elseif (preg_match('/(double|float|decimal|real|numeric)/is', $type)) { - $bind = self::PARAM_FLOAT; - } elseif (preg_match('/(int|serial|bit)/is', $type)) { - $bind = PDO::PARAM_INT; - } elseif (preg_match('/bool/is', $type)) { - $bind = PDO::PARAM_BOOL; - } else { - $bind = PDO::PARAM_STR; - } - - return $bind; - } - - /** - * 获取数据表信息 - * @access public - * @param mixed $tableName 数据表名 留空自动获取 - * @param string $fetch 获取信息类型 包括 fields type bind pk - * @return mixed - */ - public function getTableInfo($tableName, string $fetch = '') - { - if (is_array($tableName)) { - $tableName = key($tableName) ?: current($tableName); - } - - if (strpos($tableName, ',') || strpos($tableName, ')')) { - // 多表不获取字段信息 - return []; - } - - list($tableName) = explode(' ', $tableName); - - if (!strpos($tableName, '.')) { - $schema = $this->getConfig('database') . '.' . $tableName; - } else { - $schema = $tableName; - } - - if (!isset($this->info[$schema])) { - // 读取字段缓存 - $cacheFile = $this->config['schema_cache_path'] . $schema . '.php'; - - if ($this->config['fields_cache'] && is_file($cacheFile)) { - $info = include $cacheFile; - } else { - $info = $this->getTableFieldsInfo($tableName); - if ($this->config['fields_cache']) { - if (!is_dir($this->config['schema_cache_path'])) { - mkdir($this->config['schema_cache_path'], 0755, true); - } - - $content = ' $val) { - $bind[$name] = $this->getFieldBindType($val); - } - - $this->info[$schema] = [ - 'fields' => array_keys($info), - 'type' => $info, - 'bind' => $bind, - 'pk' => $pk, - 'autoinc' => $autoinc, - ]; - } - - return $fetch ? $this->info[$schema][$fetch] : $this->info[$schema]; - } - - /** - * 获取数据表的字段信息 - * @access public - * @param string $tableName 数据表名 - * @return array - */ - public function getTableFieldsInfo(string $tableName): array - { - $fields = $this->getFields($tableName); - $info = []; - - foreach ($fields as $key => $val) { - // 记录字段类型 - $info[$key] = $this->getFieldType($val['type']); - - if (!empty($val['primary'])) { - $pk[] = $key; - } - - if (!empty($val['autoinc'])) { - $autoinc = $key; - } - } - - if (isset($pk)) { - // 设置主键 - $pk = count($pk) > 1 ? $pk : $pk[0]; - $info['_pk'] = $pk; - } - - if (isset($autoinc)) { - $info['_autoinc'] = $autoinc; - } - - return $info; - } - - /** - * 获取数据表的主键 - * @access public - * @param mixed $tableName 数据表名 - * @return string|array - */ - public function getPk($tableName) - { - return $this->getTableInfo($tableName, 'pk'); - } - - /** - * 获取数据表的自增主键 - * @access public - * @param mixed $tableName 数据表名 - * @return string - */ - public function getAutoInc($tableName) - { - return $this->getTableInfo($tableName, 'autoinc'); - } - - /** - * 获取数据表字段信息 - * @access public - * @param mixed $tableName 数据表名 - * @return array - */ - public function getTableFields($tableName): array - { - return $this->getTableInfo($tableName, 'fields'); - } - - /** - * 获取数据表字段类型 - * @access public - * @param mixed $tableName 数据表名 - * @param string $field 字段名 - * @return array|string - */ - public function getFieldsType($tableName, string $field = null) - { - $result = $this->getTableInfo($tableName, 'type'); - - if ($field && isset($result[$field])) { - return $result[$field]; - } - - return $result; - } - - /** - * 获取数据表绑定信息 - * @access public - * @param mixed $tableName 数据表名 - * @return array - */ - public function getFieldsBind($tableName): array - { - return $this->getTableInfo($tableName, 'bind'); - } - - /** - * 连接数据库方法 - * @access public - * @param array $config 连接参数 - * @param integer $linkNum 连接序号 - * @param array|bool $autoConnection 是否自动连接主数据库(用于分布式) - * @return PDO - * @throws PDOException - */ - public function connect(array $config = [], $linkNum = 0, $autoConnection = false): PDO - { - if (isset($this->links[$linkNum])) { - return $this->links[$linkNum]; - } - - if (empty($config)) { - $config = $this->config; - } else { - $config = array_merge($this->config, $config); - } - - // 连接参数 - if (isset($config['params']) && is_array($config['params'])) { - $params = $config['params'] + $this->params; - } else { - $params = $this->params; - } - - // 记录当前字段属性大小写设置 - $this->attrCase = $params[PDO::ATTR_CASE]; - - if (!empty($config['break_match_str'])) { - $this->breakMatchStr = array_merge($this->breakMatchStr, (array) $config['break_match_str']); - } - - try { - if (empty($config['dsn'])) { - $config['dsn'] = $this->parseDsn($config); - } - - $startTime = microtime(true); - - $this->links[$linkNum] = $this->createPdo($config['dsn'], $config['username'], $config['password'], $params); - - // SQL监控 - if (!empty($config['trigger_sql'])) { - $this->trigger('CONNECT:[ UseTime:' . number_format(microtime(true) - $startTime, 6) . 's ] ' . $config['dsn']); - } - - return $this->links[$linkNum]; - } catch (\PDOException $e) { - if ($autoConnection) { - $this->db->log($e->getMessage(), 'error'); - return $this->connect($autoConnection, $linkNum); - } else { - throw $e; - } - } - } - - /** - * 创建PDO实例 - * @param $dsn - * @param $username - * @param $password - * @param $params - * @return PDO - */ - protected function createPdo($dsn, $username, $password, $params) - { - return new PDO($dsn, $username, $password, $params); - } - - /** - * 释放查询结果 - * @access public - */ - public function free(): void - { - $this->PDOStatement = null; - } - - /** - * 获取PDO对象 - * @access public - * @return \PDO|false - */ - public function getPdo() - { - if (!$this->linkID) { - return false; - } - - return $this->linkID; - } - - /** - * 执行查询 使用生成器返回数据 - * @access public - * @param BaseQuery $query 查询对象 - * @param string $sql sql指令 - * @param array $bind 参数绑定 - * @param \think\Model $model 模型对象实例 - * @param array $condition 查询条件 - * @return \Generator - */ - public function getCursor(BaseQuery $query, string $sql, array $bind = [], $model = null, $condition = null) - { - $this->queryPDOStatement($query, $sql, $bind); - - // 返回结果集 - while ($result = $this->PDOStatement->fetch($this->fetchType)) { - if ($model) { - yield $model->newInstance($result, $condition); - } else { - yield $result; - } - } - } - - /** - * 执行查询 返回数据集 - * @access public - * @param BaseQuery $query 查询对象 - * @param mixed $sql sql指令 - * @param array $bind 参数绑定 - * @return array - * @throws BindParamException - * @throws \PDOException - * @throws \Exception - * @throws \Throwable - */ - public function query(BaseQuery $query, $sql, array $bind = []): array - { - // 分析查询表达式 - $query->parseOptions(); - - if ($query->getOptions('cache')) { - // 检查查询缓存 - $cacheItem = $this->parseCache($query, $query->getOptions('cache')); - $key = $cacheItem->getKey(); - - if ($this->cache->has($key)) { - return $this->cache->get($key); - } - } - - if ($sql instanceof Closure) { - $sql = $sql($query); - $bind = $query->getBind(); - } - - $master = $query->getOptions('master') ? true : false; - $procedure = $query->getOptions('procedure') ? true : in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); - - $this->getPDOStatement($sql, $bind, $master, $procedure); - - $resultSet = $this->getResult($procedure); - - if (isset($cacheItem) && $resultSet) { - // 缓存数据集 - $cacheItem->set($resultSet); - $this->cacheData($cacheItem); - } - - return $resultSet; - } - - /** - * 执行查询但只返回PDOStatement对象 - * @access public - * @param BaseQuery $query 查询对象 - * @return \PDOStatement - */ - public function pdo(BaseQuery $query): PDOStatement - { - $bind = $query->getBind(); - // 生成查询SQL - $sql = $this->builder->select($query); - - return $this->queryPDOStatement($query, $sql, $bind); - } - - /** - * 执行查询但只返回PDOStatement对象 - * @access public - * @param string $sql sql指令 - * @param array $bind 参数绑定 - * @param bool $master 是否在主服务器读操作 - * @param bool $procedure 是否为存储过程调用 - * @return PDOStatement - * @throws BindParamException - * @throws \PDOException - * @throws \Exception - * @throws \Throwable - */ - public function getPDOStatement(string $sql, array $bind = [], bool $master = false, bool $procedure = false): PDOStatement - { - $this->initConnect($this->readMaster ?: $master); - - // 记录SQL语句 - $this->queryStr = $sql; - - $this->bind = $bind; - - $this->db->updateQueryTimes(); - - try { - $this->queryStartTime = microtime(true); - - // 预处理 - $this->PDOStatement = $this->linkID->prepare($sql); - - // 参数绑定 - if ($procedure) { - $this->bindParam($bind); - } else { - $this->bindValue($bind); - } - - // 执行查询 - $this->PDOStatement->execute(); - - // SQL监控 - if (!empty($this->config['trigger_sql'])) { - $this->trigger('', $master); - } - - return $this->PDOStatement; - } catch (\Throwable | \Exception $e) { - if ($this->isBreak($e)) { - return $this->close()->getPDOStatement($sql, $bind, $master, $procedure); - } - - if ($e instanceof \PDOException) { - throw new PDOException($e, $this->config, $this->getLastsql()); - } else { - throw $e; - } - } - } - - /** - * 执行语句 - * @access public - * @param BaseQuery $query 查询对象 - * @param string $sql sql指令 - * @param array $bind 参数绑定 - * @param bool $origin 是否原生查询 - * @return int - * @throws BindParamException - * @throws \PDOException - * @throws \Exception - * @throws \Throwable - */ - public function execute(BaseQuery $query, string $sql, array $bind = [], bool $origin = false): int - { - if ($origin) { - $query->parseOptions(); - } - - $this->queryPDOStatement($query->master(true), $sql, $bind); - - if (!$origin && !empty($this->config['deploy']) && !empty($this->config['read_master'])) { - $this->readMaster = true; - } - - $this->numRows = $this->PDOStatement->rowCount(); - - if ($query->getOptions('cache')) { - // 清理缓存数据 - $cacheItem = $this->parseCache($query, $query->getOptions('cache')); - $key = $cacheItem->getKey(); - $tag = $cacheItem->getTag(); - - if (isset($key) && $this->cache->has($key)) { - $this->cache->delete($key); - } elseif (!empty($tag) && method_exists($this->cache, 'tag')) { - $this->cache->tag($tag)->clear(); - } - } - - return $this->numRows; - } - - protected function queryPDOStatement(BaseQuery $query, string $sql, array $bind = []): PDOStatement - { - $options = $query->getOptions(); - $master = !empty($options['master']) ? true : false; - $procedure = !empty($options['procedure']) ? true : in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); - - return $this->getPDOStatement($sql, $bind, $master, $procedure); - } - - /** - * 查找单条记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return array - * @throws DbException - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - public function find(BaseQuery $query): array - { - // 事件回调 - $result = $this->db->trigger('before_find', $query); - - if (!$result) { - // 执行查询 - $resultSet = $this->query($query, function ($query) { - return $this->builder->select($query, true); - }); - - $result = $resultSet[0] ?? []; - } - - return $result; - } - - /** - * 使用游标查询记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return \Generator - */ - public function cursor(BaseQuery $query) - { - // 分析查询表达式 - $options = $query->parseOptions(); - - // 生成查询SQL - $sql = $this->builder->select($query); - - $condition = $options['where']['AND'] ?? null; - - // 执行查询操作 - return $this->getCursor($query, $sql, $query->getBind(), $query->getModel(), $condition); - } - - /** - * 查找记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return array - * @throws DbException - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - public function select(BaseQuery $query): array - { - $resultSet = $this->db->trigger('before_select', $query); - - if (!$resultSet) { - // 执行查询操作 - $resultSet = $this->query($query, function ($query) { - return $this->builder->select($query); - }); - } - - return $resultSet; - } - - /** - * 插入记录 - * @access public - * @param BaseQuery $query 查询对象 - * @param boolean $getLastInsID 返回自增主键 - * @return mixed - */ - public function insert(BaseQuery $query, bool $getLastInsID = false) - { - // 分析查询表达式 - $options = $query->parseOptions(); - - // 生成SQL语句 - $sql = $this->builder->insert($query); - - // 执行操作 - $result = '' == $sql ? 0 : $this->execute($query, $sql, $query->getBind()); - - if ($result) { - $sequence = $options['sequence'] ?? null; - $lastInsId = $this->getLastInsID($query, $sequence); - - $data = $options['data']; - - if ($lastInsId) { - $pk = $query->getAutoInc(); - if ($pk) { - $data[$pk] = $lastInsId; - } - } - - $query->setOption('data', $data); - - $this->db->trigger('after_insert', $query); - - if ($getLastInsID && $lastInsId) { - return $lastInsId; - } - } - - return $result; - } - - /** - * 批量插入记录 - * @access public - * @param BaseQuery $query 查询对象 - * @param mixed $dataSet 数据集 - * @param integer $limit 每次写入数据限制 - * @return integer - * @throws \Exception - * @throws \Throwable - */ - public function insertAll(BaseQuery $query, array $dataSet = [], int $limit = 0): int - { - if (!is_array(reset($dataSet))) { - return 0; - } - - $query->parseOptions(); - - if (0 === $limit && count($dataSet) >= 5000) { - $limit = 1000; - } - - if ($limit) { - // 分批写入 自动启动事务支持 - $this->startTrans(); - - try { - $array = array_chunk($dataSet, $limit, true); - $count = 0; - - foreach ($array as $item) { - $sql = $this->builder->insertAll($query, $item); - $count += $this->execute($query, $sql, $query->getBind()); - } - - // 提交事务 - $this->commit(); - } catch (\Exception | \Throwable $e) { - $this->rollback(); - throw $e; - } - - return $count; - } - - $sql = $this->builder->insertAll($query, $dataSet); - - return $this->execute($query, $sql, $query->getBind()); - } - - /** - * 通过Select方式插入记录 - * @access public - * @param BaseQuery $query 查询对象 - * @param array $fields 要插入的数据表字段名 - * @param string $table 要插入的数据表名 - * @return integer - * @throws PDOException - */ - public function selectInsert(BaseQuery $query, array $fields, string $table): int - { - // 分析查询表达式 - $query->parseOptions(); - - $sql = $this->builder->selectInsert($query, $fields, $table); - - return $this->execute($query, $sql, $query->getBind()); - } - - /** - * 更新记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return integer - * @throws PDOException - */ - public function update(BaseQuery $query): int - { - $query->parseOptions(); - - // 生成UPDATE SQL语句 - $sql = $this->builder->update($query); - - // 执行操作 - $result = '' == $sql ? 0 : $this->execute($query, $sql, $query->getBind()); - - if ($result) { - $this->db->trigger('after_update', $query); - } - - return $result; - } - - /** - * 删除记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return int - * @throws PDOException - */ - public function delete(BaseQuery $query): int - { - // 分析查询表达式 - $query->parseOptions(); - - // 生成删除SQL语句 - $sql = $this->builder->delete($query); - - // 执行操作 - $result = $this->execute($query, $sql, $query->getBind()); - - if ($result) { - $this->db->trigger('after_delete', $query); - } - - return $result; - } - - /** - * 得到某个字段的值 - * @access public - * @param BaseQuery $query 查询对象 - * @param string $field 字段名 - * @param mixed $default 默认值 - * @param bool $one 返回一个值 - * @return mixed - */ - public function value(BaseQuery $query, string $field, $default = null, bool $one = true) - { - $options = $query->parseOptions(); - - if (isset($options['field'])) { - $query->removeOption('field'); - } - - if (isset($options['group'])) { - $query->group(''); - } - - $query->setOption('field', (array) $field); - - if (!empty($options['cache'])) { - $cacheItem = $this->parseCache($query, $options['cache']); - $key = $cacheItem->getKey(); - - if ($this->cache->has($key)) { - return $this->cache->get($key); - } - } - - // 生成查询SQL - $sql = $this->builder->select($query, $one); - - if (isset($options['field'])) { - $query->setOption('field', $options['field']); - } else { - $query->removeOption('field'); - } - - if (isset($options['group'])) { - $query->setOption('group', $options['group']); - } - - // 执行查询操作 - $pdo = $this->getPDOStatement($sql, $query->getBind(), $options['master']); - - $result = $pdo->fetchColumn(); - - if (isset($cacheItem)) { - // 缓存数据 - $cacheItem->set($result); - $this->cacheData($cacheItem); - } - - return false !== $result ? $result : $default; - } - - /** - * 得到某个字段的值 - * @access public - * @param BaseQuery $query 查询对象 - * @param string $aggregate 聚合方法 - * @param mixed $field 字段名 - * @param bool $force 强制转为数字类型 - * @return mixed - */ - public function aggregate(BaseQuery $query, string $aggregate, $field, bool $force = false) - { - if (is_string($field) && 0 === stripos($field, 'DISTINCT ')) { - list($distinct, $field) = explode(' ', $field); - } - - $field = $aggregate . '(' . (!empty($distinct) ? 'DISTINCT ' : '') . $this->builder->parseKey($query, $field, true) . ') AS think_' . strtolower($aggregate); - - $result = $this->value($query, $field, 0, false); - - return $force ? (float) $result : $result; - } - - /** - * 得到某个列的数组 - * @access public - * @param BaseQuery $query 查询对象 - * @param string $column 字段名 多个字段用逗号分隔 - * @param string $key 索引 - * @return array - */ - public function column(BaseQuery $query, string $column, string $key = ''): array - { - $options = $query->parseOptions(); - - if (isset($options['field'])) { - $query->removeOption('field'); - } - - if ($key && '*' != $column) { - $field = $key . ',' . $column; - } else { - $field = $column; - } - - $field = array_map('trim', explode(',', $field)); - - $query->setOption('field', $field); - - if (!empty($options['cache'])) { - // 判断查询缓存 - $cacheItem = $this->parseCache($query, $options['cache']); - $key = $cacheItem->getKey(); - - if ($this->cache->has($key)) { - return $this->cache->get($key); - } - } - - // 生成查询SQL - $sql = $this->builder->select($query); - - if (isset($options['field'])) { - $query->setOption('field', $options['field']); - } else { - $query->removeOption('field'); - } - - // 执行查询操作 - $pdo = $this->getPDOStatement($sql, $query->getBind(), $options['master']); - - $resultSet = $pdo->fetchAll(PDO::FETCH_ASSOC); - - if (empty($resultSet)) { - $result = []; - } elseif (('*' == $column || strpos($column, ',')) && $key) { - $result = array_column($resultSet, null, $key); - } else { - $fields = array_keys($resultSet[0]); - $key = $key ?: array_shift($fields); - - if (strpos($column, ',')) { - $column = null; - } elseif (strpos($column, '.')) { - list($alias, $column) = explode('.', $column); - } - - if (strpos($key, '.')) { - list($alias, $key) = explode('.', $key); - } - - $result = array_column($resultSet, $column, $key); - } - - if (isset($cacheItem)) { - // 缓存数据 - $cacheItem->set($result); - $this->cacheData($cacheItem); - } - - return $result; - } - - /** - * 根据参数绑定组装最终的SQL语句 便于调试 - * @access public - * @param string $sql 带参数绑定的sql语句 - * @param array $bind 参数绑定列表 - * @return string - */ - public function getRealSql(string $sql, array $bind = []): string - { - foreach ($bind as $key => $val) { - $value = is_array($val) ? $val[0] : $val; - $type = is_array($val) ? $val[1] : PDO::PARAM_STR; - - if ((self::PARAM_FLOAT == $type || PDO::PARAM_STR == $type) && is_string($value)) { - $value = '\'' . addslashes($value) . '\''; - } elseif (PDO::PARAM_INT == $type && '' === $value) { - $value = 0; - } - - // 判断占位符 - $sql = is_numeric($key) ? - substr_replace($sql, $value, strpos($sql, '?'), 1) : - substr_replace($sql, $value, strpos($sql, ':' . $key), strlen(':' . $key)); - } - - return rtrim($sql); - } - - /** - * 参数绑定 - * 支持 ['name'=>'value','id'=>123] 对应命名占位符 - * 或者 ['value',123] 对应问号占位符 - * @access public - * @param array $bind 要绑定的参数列表 - * @return void - * @throws BindParamException - */ - protected function bindValue(array $bind = []): void - { - foreach ($bind as $key => $val) { - // 占位符 - $param = is_numeric($key) ? $key + 1 : ':' . $key; - - if (is_array($val)) { - if (PDO::PARAM_INT == $val[1] && '' === $val[0]) { - $val[0] = 0; - } elseif (self::PARAM_FLOAT == $val[1]) { - $val[0] = is_string($val[0]) ? (float) $val[0] : $val[0]; - $val[1] = PDO::PARAM_STR; - } - - $result = $this->PDOStatement->bindValue($param, $val[0], $val[1]); - } else { - $result = $this->PDOStatement->bindValue($param, $val); - } - - if (!$result) { - throw new BindParamException( - "Error occurred when binding parameters '{$param}'", - $this->config, - $this->getLastsql(), - $bind - ); - } - } - } - - /** - * 存储过程的输入输出参数绑定 - * @access public - * @param array $bind 要绑定的参数列表 - * @return void - * @throws BindParamException - */ - protected function bindParam(array $bind): void - { - foreach ($bind as $key => $val) { - $param = is_numeric($key) ? $key + 1 : ':' . $key; - - if (is_array($val)) { - array_unshift($val, $param); - $result = call_user_func_array([$this->PDOStatement, 'bindParam'], $val); - } else { - $result = $this->PDOStatement->bindValue($param, $val); - } - - if (!$result) { - $param = array_shift($val); - - throw new BindParamException( - "Error occurred when binding parameters '{$param}'", - $this->config, - $this->getLastsql(), - $bind - ); - } - } - } - - /** - * 获得数据集数组 - * @access protected - * @param bool $procedure 是否存储过程 - * @return array - */ - protected function getResult(bool $procedure = false): array - { - if ($procedure) { - // 存储过程返回结果 - return $this->procedure(); - } - - $result = $this->PDOStatement->fetchAll($this->fetchType); - - $this->numRows = count($result); - - return $result; - } - - /** - * 获得存储过程数据集 - * @access protected - * @return array - */ - protected function procedure(): array - { - $item = []; - - do { - $result = $this->getResult(); - if (!empty($result)) { - $item[] = $result; - } - } while ($this->PDOStatement->nextRowset()); - - $this->numRows = count($item); - - return $item; - } - - /** - * 执行数据库事务 - * @access public - * @param callable $callback 数据操作方法回调 - * @return mixed - * @throws PDOException - * @throws \Exception - * @throws \Throwable - */ - public function transaction(callable $callback) - { - $this->startTrans(); - - try { - $result = null; - if (is_callable($callback)) { - $result = $callback($this); - } - - $this->commit(); - return $result; - } catch (\Exception | \Throwable $e) { - $this->rollback(); - throw $e; - } - } - - /** - * 启动事务 - * @access public - * @return void - * @throws \PDOException - * @throws \Exception - */ - public function startTrans(): void - { - $this->initConnect(true); - - ++$this->transTimes; - - try { - if (1 == $this->transTimes) { - $this->linkID->beginTransaction(); - } elseif ($this->transTimes > 1 && $this->supportSavepoint()) { - $this->linkID->exec( - $this->parseSavepoint('trans' . $this->transTimes) - ); - } - } catch (\Exception $e) { - if ($this->isBreak($e)) { - --$this->transTimes; - $this->close()->startTrans(); - } - throw $e; - } - } - - /** - * 用于非自动提交状态下面的查询提交 - * @access public - * @return void - * @throws PDOException - */ - public function commit(): void - { - $this->initConnect(true); - - if (1 == $this->transTimes) { - $this->linkID->commit(); - } - - --$this->transTimes; - } - - /** - * 事务回滚 - * @access public - * @return void - * @throws PDOException - */ - public function rollback(): void - { - $this->initConnect(true); - - if (1 == $this->transTimes) { - $this->linkID->rollBack(); - } elseif ($this->transTimes > 1 && $this->supportSavepoint()) { - $this->linkID->exec( - $this->parseSavepointRollBack('trans' . $this->transTimes) - ); - } - - $this->transTimes = max(0, $this->transTimes - 1); - } - - /** - * 是否支持事务嵌套 - * @return bool - */ - protected function supportSavepoint(): bool - { - return false; - } - - /** - * 生成定义保存点的SQL - * @access protected - * @param string $name 标识 - * @return string - */ - protected function parseSavepoint(string $name): string - { - return 'SAVEPOINT ' . $name; - } - - /** - * 生成回滚到保存点的SQL - * @access protected - * @param string $name 标识 - * @return string - */ - protected function parseSavepointRollBack(string $name): string - { - return 'ROLLBACK TO SAVEPOINT ' . $name; - } - - /** - * 批处理执行SQL语句 - * 批处理的指令都认为是execute操作 - * @access public - * @param BaseQuery $query 查询对象 - * @param array $sqlArray SQL批处理指令 - * @param array $bind 参数绑定 - * @return bool - */ - public function batchQuery(BaseQuery $query, array $sqlArray = [], array $bind = []): bool - { - // 自动启动事务支持 - $this->startTrans(); - - try { - foreach ($sqlArray as $sql) { - $this->execute($query, $sql, $bind); - } - // 提交事务 - $this->commit(); - } catch (\Exception $e) { - $this->rollback(); - throw $e; - } - - return true; - } - - /** - * 关闭数据库(或者重新连接) - * @access public - * @return $this - */ - public function close() - { - $this->linkID = null; - $this->linkWrite = null; - $this->linkRead = null; - $this->links = []; - - $this->free(); - - return $this; - } - - /** - * 是否断线 - * @access protected - * @param \PDOException|\Exception $e 异常对象 - * @return bool - */ - protected function isBreak($e): bool - { - if (!$this->config['break_reconnect']) { - return false; - } - - $error = $e->getMessage(); - - foreach ($this->breakMatchStr as $msg) { - if (false !== stripos($error, $msg)) { - return true; - } - } - - return false; - } - - /** - * 获取最近一次查询的sql语句 - * @access public - * @return string - */ - public function getLastSql(): string - { - return $this->getRealSql($this->queryStr, $this->bind); - } - - /** - * 获取最近插入的ID - * @access public - * @param BaseQuery $query 查询对象 - * @param string $sequence 自增序列名 - * @return mixed - */ - public function getLastInsID(BaseQuery $query, string $sequence = null) - { - try { - $insertId = $this->linkID->lastInsertId($sequence); - } catch (\Exception $e) { - $insertId = ''; - } - - return $this->autoInsIDType($query, $insertId); - } - - /** - * 获取最近插入的ID - * @access public - * @param BaseQuery $query 查询对象 - * @param string $insertId 自增ID - * @return mixed - */ - protected function autoInsIDType(BaseQuery $query, string $insertId) - { - $pk = $query->getAutoInc(); - - if ($pk) { - $type = $this->getFieldBindType($pk); - - if (PDO::PARAM_INT == $type) { - $insertId = (int) $insertId; - } elseif (self::PARAM_FLOAT == $type) { - $insertId = (float) $insertId; - } - } - - return $insertId; - } - - /** - * 获取最近的错误信息 - * @access public - * @return string - */ - public function getError(): string - { - if ($this->PDOStatement) { - $error = $this->PDOStatement->errorInfo(); - $error = $error[1] . ':' . $error[2]; - } else { - $error = ''; - } - - if ('' != $this->queryStr) { - $error .= "\n [ SQL语句 ] : " . $this->getLastsql(); - } - - return $error; - } - - /** - * 初始化数据库连接 - * @access protected - * @param boolean $master 是否主服务器 - * @return void - */ - protected function initConnect(bool $master = true): void - { - if (!empty($this->config['deploy'])) { - // 采用分布式数据库 - if ($master || $this->transTimes) { - if (!$this->linkWrite) { - $this->linkWrite = $this->multiConnect(true); - } - - $this->linkID = $this->linkWrite; - } else { - if (!$this->linkRead) { - $this->linkRead = $this->multiConnect(false); - } - - $this->linkID = $this->linkRead; - } - } elseif (!$this->linkID) { - // 默认单数据库 - $this->linkID = $this->connect(); - } - } - - /** - * 连接分布式服务器 - * @access protected - * @param boolean $master 主服务器 - * @return PDO - */ - protected function multiConnect(bool $master = false): PDO - { - $config = []; - - // 分布式数据库配置解析 - foreach (['username', 'password', 'hostname', 'hostport', 'database', 'dsn', 'charset'] as $name) { - $config[$name] = is_string($this->config[$name]) ? explode(',', $this->config[$name]) : $this->config[$name]; - } - - // 主服务器序号 - $m = floor(mt_rand(0, $this->config['master_num'] - 1)); - - if ($this->config['rw_separate']) { - // 主从式采用读写分离 - if ($master) // 主服务器写入 - { - $r = $m; - } elseif (is_numeric($this->config['slave_no'])) { - // 指定服务器读 - $r = $this->config['slave_no']; - } else { - // 读操作连接从服务器 每次随机连接的数据库 - $r = floor(mt_rand($this->config['master_num'], count($config['hostname']) - 1)); - } - } else { - // 读写操作不区分服务器 每次随机连接的数据库 - $r = floor(mt_rand(0, count($config['hostname']) - 1)); - } - $dbMaster = false; - - if ($m != $r) { - $dbMaster = []; - foreach (['username', 'password', 'hostname', 'hostport', 'database', 'dsn', 'charset'] as $name) { - $dbMaster[$name] = $config[$name][$m] ?? $config[$name][0]; - } - } - - $dbConfig = []; - - foreach (['username', 'password', 'hostname', 'hostport', 'database', 'dsn', 'charset'] as $name) { - $dbConfig[$name] = $config[$name][$r] ?? $config[$name][0]; - } - - return $this->connect($dbConfig, $r, $r == $m ? false : $dbMaster); - } - - /** - * 启动XA事务 - * @access public - * @param string $xid XA事务id - * @return void - */ - public function startTransXa(string $xid) - {} - - /** - * 预编译XA事务 - * @access public - * @param string $xid XA事务id - * @return void - */ - public function prepareXa(string $xid) - {} - - /** - * 提交XA事务 - * @access public - * @param string $xid XA事务id - * @return void - */ - public function commitXa(string $xid) - {} - - /** - * 回滚XA事务 - * @access public - * @param string $xid XA事务id - * @return void - */ - public function rollbackXa(string $xid) - {} -} diff --git a/vendor/topthink/think-orm/src/db/Query.php b/vendor/topthink/think-orm/src/db/Query.php deleted file mode 100644 index ba0e5e56..00000000 --- a/vendor/topthink/think-orm/src/db/Query.php +++ /dev/null @@ -1,493 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use PDOStatement; -use think\helper\Str; - -/** - * PDO数据查询类 - */ -class Query extends BaseQuery -{ - use concern\JoinAndViewQuery; - use concern\ParamsBind; - use concern\TableFieldInfo; - - /** - * 表达式方式指定Field排序 - * @access public - * @param string $field 排序字段 - * @param array $bind 参数绑定 - * @return $this - */ - public function orderRaw(string $field, array $bind = []) - { - if (!empty($bind)) { - $this->bindParams($field, $bind); - } - - $this->options['order'][] = new Raw($field); - - return $this; - } - - /** - * 表达式方式指定查询字段 - * @access public - * @param string $field 字段名 - * @return $this - */ - public function fieldRaw(string $field) - { - $this->options['field'][] = new Raw($field); - - return $this; - } - - /** - * 指定Field排序 orderField('id',[1,2,3],'desc') - * @access public - * @param string $field 排序字段 - * @param array $values 排序值 - * @param string $order 排序 desc/asc - * @return $this - */ - public function orderField(string $field, array $values, string $order = '') - { - if (!empty($values)) { - $values['sort'] = $order; - - $this->options['order'][$field] = $values; - } - - return $this; - } - - /** - * 随机排序 - * @access public - * @return $this - */ - public function orderRand() - { - $this->options['order'][] = '[rand]'; - return $this; - } - - /** - * 使用表达式设置数据 - * @access public - * @param string $field 字段名 - * @param string $value 字段值 - * @return $this - */ - public function exp(string $field, string $value) - { - $this->options['data'][$field] = new Raw($value); - return $this; - } - - /** - * 表达式方式指定当前操作的数据表 - * @access public - * @param mixed $table 表名 - * @return $this - */ - public function tableRaw(string $table) - { - $this->options['table'] = new Raw($table); - - return $this; - } - - /** - * 执行查询 返回数据集 - * @access public - * @param string $sql sql指令 - * @param array $bind 参数绑定 - * @return array - * @throws BindParamException - * @throws PDOException - */ - public function query(string $sql, array $bind = []): array - { - return $this->connection->query($this, $sql, $bind); - } - - /** - * 执行语句 - * @access public - * @param string $sql sql指令 - * @param array $bind 参数绑定 - * @return int - * @throws BindParamException - * @throws PDOException - */ - public function execute(string $sql, array $bind = []): int - { - return $this->connection->execute($this, $sql, $bind, true); - } - - /** - * 获取执行的SQL语句而不进行实际的查询 - * @access public - * @param bool $fetch 是否返回sql - * @return $this|Fetch - */ - public function fetchSql(bool $fetch = true) - { - $this->options['fetch_sql'] = $fetch; - - if ($fetch) { - return new Fetch($this); - } - - return $this; - } - - /** - * 批处理执行SQL语句 - * 批处理的指令都认为是execute操作 - * @access public - * @param array $sql SQL批处理指令 - * @return bool - */ - public function batchQuery(array $sql = []): bool - { - return $this->connection->batchQuery($this, $sql); - } - - /** - * USING支持 用于多表删除 - * @access public - * @param mixed $using USING - * @return $this - */ - public function using($using) - { - $this->options['using'] = $using; - return $this; - } - - /** - * 存储过程调用 - * @access public - * @param bool $procedure 是否为存储过程查询 - * @return $this - */ - public function procedure(bool $procedure = true) - { - $this->options['procedure'] = $procedure; - return $this; - } - - /** - * 指定group查询 - * @access public - * @param string|array $group GROUP - * @return $this - */ - public function group($group) - { - $this->options['group'] = $group; - return $this; - } - - /** - * 指定having查询 - * @access public - * @param string $having having - * @return $this - */ - public function having(string $having) - { - $this->options['having'] = $having; - return $this; - } - - /** - * 指定distinct查询 - * @access public - * @param bool $distinct 是否唯一 - * @return $this - */ - public function distinct(bool $distinct = true) - { - $this->options['distinct'] = $distinct; - return $this; - } - - /** - * 设置自增序列名 - * @access public - * @param string $sequence 自增序列名 - * @return $this - */ - public function sequence(string $sequence = null) - { - $this->options['sequence'] = $sequence; - return $this; - } - - /** - * 指定强制索引 - * @access public - * @param string $force 索引名称 - * @return $this - */ - public function force(string $force) - { - $this->options['force'] = $force; - return $this; - } - - /** - * 查询注释 - * @access public - * @param string $comment 注释 - * @return $this - */ - public function comment(string $comment) - { - $this->options['comment'] = $comment; - return $this; - } - - /** - * 设置是否REPLACE - * @access public - * @param bool $replace 是否使用REPLACE写入数据 - * @return $this - */ - public function replace(bool $replace = true) - { - $this->options['replace'] = $replace; - return $this; - } - - /** - * 设置当前查询所在的分区 - * @access public - * @param string|array $partition 分区名称 - * @return $this - */ - public function partition($partition) - { - $this->options['partition'] = $partition; - return $this; - } - - /** - * 设置DUPLICATE - * @access public - * @param array|string|Raw $duplicate DUPLICATE信息 - * @return $this - */ - public function duplicate($duplicate) - { - $this->options['duplicate'] = $duplicate; - return $this; - } - - /** - * 设置查询的额外参数 - * @access public - * @param string $extra 额外信息 - * @return $this - */ - public function extra(string $extra) - { - $this->options['extra'] = $extra; - return $this; - } - - /** - * 创建子查询SQL - * @access public - * @param bool $sub 是否添加括号 - * @return string - * @throws Exception - */ - public function buildSql(bool $sub = true): string - { - return $sub ? '( ' . $this->fetchSql()->select() . ' )' : $this->fetchSql()->select(); - } - - /** - * 获取当前数据表的主键 - * @access public - * @return string|array - */ - public function getPk() - { - if (empty($this->pk)) { - $this->pk = $this->connection->getPk($this->getTable()); - } - - return $this->pk; - } - - /** - * 指定数据表自增主键 - * @access public - * @param string $autoinc 自增键 - * @return $this - */ - public function autoinc(string $autoinc) - { - $this->autoinc = $autoinc; - return $this; - } - - /** - * 获取当前数据表的自增主键 - * @access public - * @return string - */ - public function getAutoInc() - { - if (empty($this->autoinc)) { - $this->autoinc = $this->connection->getAutoInc($this->getTable()); - } - - return $this->autoinc; - } - - /** - * 字段值增长 - * @access public - * @param string $field 字段名 - * @param float $step 增长值 - * @return $this - */ - public function inc(string $field, float $step = 1) - { - $this->options['data'][$field] = ['INC', $step]; - - return $this; - } - - /** - * 字段值减少 - * @access public - * @param string $field 字段名 - * @param float $step 增长值 - * @return $this - */ - public function dec(string $field, float $step = 1) - { - $this->options['data'][$field] = ['DEC', $step]; - return $this; - } - - /** - * 获取当前的查询标识 - * @access public - * @param mixed $data 要序列化的数据 - * @return string - */ - public function getQueryGuid($data = null): string - { - return md5($this->getConfig('database') . serialize(var_export($data ?: $this->options, true)) . serialize($this->getBind(false))); - } - - /** - * 执行查询但只返回PDOStatement对象 - * @access public - * @return PDOStatement - */ - public function getPdo(): PDOStatement - { - return $this->connection->pdo($this); - } - - /** - * 使用游标查找记录 - * @access public - * @param mixed $data 数据 - * @return \Generator - */ - public function cursor($data = null) - { - if (!is_null($data)) { - // 主键条件分析 - $this->parsePkWhere($data); - } - - $this->options['data'] = $data; - - $connection = clone $this->connection; - - return $connection->cursor($this); - } - - /** - * 分批数据返回处理 - * @access public - * @param integer $count 每次处理的数据数量 - * @param callable $callback 处理回调方法 - * @param string|array $column 分批处理的字段名 - * @param string $order 字段排序 - * @return bool - * @throws Exception - */ - public function chunk(int $count, callable $callback, $column = null, string $order = 'asc'): bool - { - $options = $this->getOptions(); - $column = $column ?: $this->getPk(); - - if (isset($options['order'])) { - unset($options['order']); - } - - $bind = $this->bind; - - if (is_array($column)) { - $times = 1; - $query = $this->options($options)->page($times, $count); - } else { - $query = $this->options($options)->limit($count); - - if (strpos($column, '.')) { - list($alias, $key) = explode('.', $column); - } else { - $key = $column; - } - } - - $resultSet = $query->order($column, $order)->select(); - - while (count($resultSet) > 0) { - if (false === call_user_func($callback, $resultSet)) { - return false; - } - - if (isset($times)) { - $times++; - $query = $this->options($options)->page($times, $count); - } else { - $end = $resultSet->pop(); - $lastId = is_array($end) ? $end[$key] : $end->getData($key); - - $query = $this->options($options) - ->limit($count) - ->where($column, 'asc' == strtolower($order) ? '>' : '<', $lastId); - } - - $resultSet = $query->bind($bind)->order($column, $order)->select(); - } - - return true; - } -} diff --git a/vendor/topthink/think-orm/src/db/Raw.php b/vendor/topthink/think-orm/src/db/Raw.php deleted file mode 100644 index 0091a5d6..00000000 --- a/vendor/topthink/think-orm/src/db/Raw.php +++ /dev/null @@ -1,52 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -/** - * SQL Raw - */ -class Raw -{ - /** - * 查询表达式 - * - * @var string - */ - protected $value; - - /** - * 创建一个查询表达式 - * - * @param string $value - * @return void - */ - public function __construct(string $value) - { - $this->value = $value; - } - - /** - * 获取表达式 - * - * @return string - */ - public function getValue(): string - { - return $this->value; - } - - public function __toString() - { - return (string) $this->value; - } -} diff --git a/vendor/topthink/think-orm/src/db/Where.php b/vendor/topthink/think-orm/src/db/Where.php deleted file mode 100644 index 08804608..00000000 --- a/vendor/topthink/think-orm/src/db/Where.php +++ /dev/null @@ -1,182 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db; - -use ArrayAccess; - -/** - * 数组查询对象 - */ -class Where implements ArrayAccess -{ - /** - * 查询表达式 - * @var array - */ - protected $where = []; - - /** - * 是否需要把查询条件两边增加括号 - * @var bool - */ - protected $enclose = false; - - /** - * 创建一个查询表达式 - * - * @param array $where 查询条件数组 - * @param bool $enclose 是否增加括号 - */ - public function __construct(array $where = [], bool $enclose = false) - { - $this->where = $where; - $this->enclose = $enclose; - } - - /** - * 设置是否添加括号 - * @access public - * @param bool $enclose - * @return $this - */ - public function enclose(bool $enclose = true) - { - $this->enclose = $enclose; - return $this; - } - - /** - * 解析为Query对象可识别的查询条件数组 - * @access public - * @return array - */ - public function parse(): array - { - $where = []; - - foreach ($this->where as $key => $val) { - if ($val instanceof Raw) { - $where[] = [$key, 'exp', $val]; - } elseif (is_null($val)) { - $where[] = [$key, 'NULL', '']; - } elseif (is_array($val)) { - $where[] = $this->parseItem($key, $val); - } else { - $where[] = [$key, '=', $val]; - } - } - - return $this->enclose ? [$where] : $where; - } - - /** - * 分析查询表达式 - * @access protected - * @param string $field 查询字段 - * @param array $where 查询条件 - * @return array - */ - protected function parseItem(string $field, array $where = []): array - { - $op = $where[0]; - $condition = $where[1] ?? null; - - if (is_array($op)) { - // 同一字段多条件查询 - array_unshift($where, $field); - } elseif (is_null($condition)) { - if (is_string($op) && in_array(strtoupper($op), ['NULL', 'NOTNULL', 'NOT NULL'], true)) { - // null查询 - $where = [$field, $op, '']; - } elseif (is_null($op) || '=' == $op) { - $where = [$field, 'NULL', '']; - } elseif ('<>' == $op) { - $where = [$field, 'NOTNULL', '']; - } else { - // 字段相等查询 - $where = [$field, '=', $op]; - } - } else { - $where = [$field, $op, $condition]; - } - - return $where; - } - - /** - * 修改器 设置数据对象的值 - * @access public - * @param string $name 名称 - * @param mixed $value 值 - * @return void - */ - public function __set($name, $value) - { - $this->where[$name] = $value; - } - - /** - * 获取器 获取数据对象的值 - * @access public - * @param string $name 名称 - * @return mixed - */ - public function __get($name) - { - return $this->where[$name] ?? null; - } - - /** - * 检测数据对象的值 - * @access public - * @param string $name 名称 - * @return bool - */ - public function __isset($name) - { - return isset($this->where[$name]); - } - - /** - * 销毁数据对象的值 - * @access public - * @param string $name 名称 - * @return void - */ - public function __unset($name) - { - unset($this->where[$name]); - } - - // ArrayAccess - public function offsetSet($name, $value) - { - $this->__set($name, $value); - } - - public function offsetExists($name) - { - return $this->__isset($name); - } - - public function offsetUnset($name) - { - $this->__unset($name); - } - - public function offsetGet($name) - { - return $this->__get($name); - } - -} diff --git a/vendor/topthink/think-orm/src/db/builder/Mongo.php b/vendor/topthink/think-orm/src/db/builder/Mongo.php deleted file mode 100644 index 85b06003..00000000 --- a/vendor/topthink/think-orm/src/db/builder/Mongo.php +++ /dev/null @@ -1,675 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); -namespace think\db\builder; - -use MongoDB\BSON\Javascript; -use MongoDB\BSON\ObjectID; -use MongoDB\BSON\Regex; -use MongoDB\Driver\BulkWrite; -use MongoDB\Driver\Command; -use MongoDB\Driver\Exception\InvalidArgumentException; -use MongoDB\Driver\Query as MongoQuery; -use think\db\connector\Mongo as Connection; -use think\db\exception\DbException as Exception; -use think\db\Mongo as Query; - -class Mongo -{ - // connection对象实例 - protected $connection; - // 最后插入ID - protected $insertId = []; - // 查询表达式 - protected $exp = ['<>' => 'ne', '=' => 'eq', '>' => 'gt', '>=' => 'gte', '<' => 'lt', '<=' => 'lte', 'in' => 'in', 'not in' => 'nin', 'nin' => 'nin', 'mod' => 'mod', 'exists' => 'exists', 'null' => 'null', 'notnull' => 'not null', 'not null' => 'not null', 'regex' => 'regex', 'type' => 'type', 'all' => 'all', '> time' => '> time', '< time' => '< time', 'between' => 'between', 'not between' => 'not between', 'between time' => 'between time', 'not between time' => 'not between time', 'notbetween time' => 'not between time', 'like' => 'like', 'near' => 'near', 'size' => 'size']; - - /** - * 架构函数 - * @access public - * @param Connection $connection 数据库连接对象实例 - */ - public function __construct(Connection $connection) - { - $this->connection = $connection; - } - - /** - * 获取当前的连接对象实例 - * @access public - * @return Connection - */ - public function getConnection(): Connection - { - return $this->connection; - } - - /** - * key分析 - * @access protected - * @param string $key - * @return string - */ - protected function parseKey(Query $query, string $key): string - { - if (0 === strpos($key, '__TABLE__.')) { - list($collection, $key) = explode('.', $key, 2); - } - - if ('id' == $key && $this->connection->getConfig('pk_convert_id')) { - $key = '_id'; - } - - return trim($key); - } - - /** - * value分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $value - * @param string $field - * @return string - */ - protected function parseValue(Query $query, $value, $field = '') - { - if ('_id' == $field && 'ObjectID' == $this->connection->getConfig('pk_type') && is_string($value)) { - try { - return new ObjectID($value); - } catch (InvalidArgumentException $e) { - return new ObjectID(); - } - } - - return $value; - } - - /** - * insert数据分析 - * @access protected - * @param Query $query 查询对象 - * @param array $data 数据 - * @return array - */ - protected function parseData(Query $query, array $data): array - { - if (empty($data)) { - return []; - } - - $result = []; - - foreach ($data as $key => $val) { - $item = $this->parseKey($query, $key); - - if (is_object($val)) { - $result[$item] = $val; - } elseif (isset($val[0]) && 'exp' == $val[0]) { - $result[$item] = $val[1]; - } elseif (is_null($val)) { - $result[$item] = 'NULL'; - } else { - $result[$item] = $this->parseValue($query, $val, $key); - } - } - - return $result; - } - - /** - * Set数据分析 - * @access protected - * @param Query $query 查询对象 - * @param array $data 数据 - * @return array - */ - protected function parseSet(Query $query, array $data): array - { - if (empty($data)) { - return []; - } - - $result = []; - - foreach ($data as $key => $val) { - $item = $this->parseKey($query, $key); - - if (is_array($val) && isset($val[0]) && is_string($val[0]) && 0 === strpos($val[0], '$')) { - $result[$val[0]][$item] = $this->parseValue($query, $val[1], $key); - } else { - $result['$set'][$item] = $this->parseValue($query, $val, $key); - } - } - - return $result; - } - - /** - * 生成查询过滤条件 - * @access public - * @param Query $query 查询对象 - * @param mixed $where - * @return array - */ - public function parseWhere(Query $query, array $where): array - { - if (empty($where)) { - $where = []; - } - - $filter = []; - foreach ($where as $logic => $val) { - $logic = '$' . strtolower($logic); - foreach ($val as $field => $value) { - if (is_array($value)) { - if (key($value) !== 0) { - throw new Exception('where express error:' . var_export($value, true)); - } - $field = array_shift($value); - } elseif (!($value instanceof \Closure)) { - throw new Exception('where express error:' . var_export($value, true)); - } - - if ($value instanceof \Closure) { - // 使用闭包查询 - $query = new Query($this->connection); - call_user_func_array($value, [ & $query]); - $filter[$logic][] = $this->parseWhere($query, $query->getOptions('where')); - } else { - if (strpos($field, '|')) { - // 不同字段使用相同查询条件(OR) - $array = explode('|', $field); - foreach ($array as $k) { - $filter['$or'][] = $this->parseWhereItem($query, $k, $value); - } - } elseif (strpos($field, '&')) { - // 不同字段使用相同查询条件(AND) - $array = explode('&', $field); - foreach ($array as $k) { - $filter['$and'][] = $this->parseWhereItem($query, $k, $value); - } - } else { - // 对字段使用表达式查询 - $field = is_string($field) ? $field : ''; - $filter[$logic][] = $this->parseWhereItem($query, $field, $value); - } - } - } - } - - $options = $query->getOptions(); - if (!empty($options['soft_delete'])) { - // 附加软删除条件 - list($field, $condition) = $options['soft_delete']; - $filter['$and'][] = $this->parseWhereItem($query, $field, $condition); - } - - return $filter; - } - - // where子单元分析 - protected function parseWhereItem(Query $query, $field, $val): array - { - $key = $field ? $this->parseKey($query, $field) : ''; - // 查询规则和条件 - if (!is_array($val)) { - $val = ['=', $val]; - } - list($exp, $value) = $val; - - // 对一个字段使用多个查询条件 - if (is_array($exp)) { - $data = []; - foreach ($val as $value) { - $exp = $value[0]; - $value = $value[1]; - if (!in_array($exp, $this->exp)) { - $exp = strtolower($exp); - if (isset($this->exp[$exp])) { - $exp = $this->exp[$exp]; - } - } - $k = '$' . $exp; - $data[$k] = $value; - } - $result[$key] = $data; - return $result; - } elseif (!in_array($exp, $this->exp)) { - $exp = strtolower($exp); - if (isset($this->exp[$exp])) { - $exp = $this->exp[$exp]; - } else { - throw new Exception('where express error:' . $exp); - } - } - - $result = []; - if ('=' == $exp) { - // 普通查询 - $result[$key] = $this->parseValue($query, $value, $key); - } elseif (in_array($exp, ['neq', 'ne', 'gt', 'egt', 'gte', 'lt', 'lte', 'elt', 'mod'])) { - // 比较运算 - $k = '$' . $exp; - $result[$key] = [$k => $this->parseValue($query, $value, $key)]; - } elseif ('null' == $exp) { - // NULL 查询 - $result[$key] = null; - } elseif ('not null' == $exp) { - $result[$key] = ['$ne' => null]; - } elseif ('all' == $exp) { - // 满足所有指定条件 - $result[$key] = ['$all', $this->parseValue($query, $value, $key)]; - } elseif ('between' == $exp) { - // 区间查询 - $value = is_array($value) ? $value : explode(',', $value); - $result[$key] = ['$gte' => $this->parseValue($query, $value[0], $key), '$lte' => $this->parseValue($query, $value[1], $key)]; - } elseif ('not between' == $exp) { - // 范围查询 - $value = is_array($value) ? $value : explode(',', $value); - $result[$key] = ['$lt' => $this->parseValue($query, $value[0], $key), '$gt' => $this->parseValue($query, $value[1], $key)]; - } elseif ('exists' == $exp) { - // 字段是否存在 - $result[$key] = ['$exists' => (bool) $value]; - } elseif ('type' == $exp) { - // 类型查询 - $result[$key] = ['$type' => intval($value)]; - } elseif ('exp' == $exp) { - // 表达式查询 - $result['$where'] = $value instanceof Javascript ? $value : new Javascript($value); - } elseif ('like' == $exp) { - // 模糊查询 采用正则方式 - $result[$key] = $value instanceof Regex ? $value : new Regex($value, 'i'); - } elseif (in_array($exp, ['nin', 'in'])) { - // IN 查询 - $value = is_array($value) ? $value : explode(',', $value); - foreach ($value as $k => $val) { - $value[$k] = $this->parseValue($query, $val, $key); - } - $result[$key] = ['$' . $exp => $value]; - } elseif ('regex' == $exp) { - $result[$key] = $value instanceof Regex ? $value : new Regex($value, 'i'); - } elseif ('< time' == $exp) { - $result[$key] = ['$lt' => $this->parseDateTime($query, $value, $field)]; - } elseif ('> time' == $exp) { - $result[$key] = ['$gt' => $this->parseDateTime($query, $value, $field)]; - } elseif ('between time' == $exp) { - // 区间查询 - $value = is_array($value) ? $value : explode(',', $value); - $result[$key] = ['$gte' => $this->parseDateTime($query, $value[0], $field), '$lte' => $this->parseDateTime($query, $value[1], $field)]; - } elseif ('not between time' == $exp) { - // 范围查询 - $value = is_array($value) ? $value : explode(',', $value); - $result[$key] = ['$lt' => $this->parseDateTime($query, $value[0], $field), '$gt' => $this->parseDateTime($query, $value[1], $field)]; - } elseif ('near' == $exp) { - // 经纬度查询 - $result[$key] = ['$near' => $this->parseValue($query, $value, $key)]; - } elseif ('size' == $exp) { - // 元素长度查询 - $result[$key] = ['$size' => intval($value)]; - } else { - // 普通查询 - $result[$key] = $this->parseValue($query, $value, $key); - } - - return $result; - } - - /** - * 日期时间条件解析 - * @access protected - * @param Query $query 查询对象 - * @param string $value - * @param string $key - * @return string - */ - protected function parseDateTime(Query $query, $value, $key) - { - // 获取时间字段类型 - $type = $query->getFieldType($key); - - if ($type) { - if (is_string($value)) { - $value = strtotime($value) ?: $value; - } - - if (is_int($value)) { - if (preg_match('/(datetime|timestamp)/is', $type)) { - // 日期及时间戳类型 - $value = date('Y-m-d H:i:s', $value); - } elseif (preg_match('/(date)/is', $type)) { - // 日期及时间戳类型 - $value = date('Y-m-d', $value); - } - } - } - - return $value; - } - - /** - * 获取最后写入的ID 如果是insertAll方法的话 返回所有写入的ID - * @access public - * @return mixed - */ - public function getLastInsID() - { - return $this->insertId; - } - - /** - * 生成insert BulkWrite对象 - * @access public - * @param Query $query 查询对象 - * @return BulkWrite - */ - public function insert(Query $query): BulkWrite - { - // 分析并处理数据 - $options = $query->getOptions(); - - $data = $this->parseData($query, $options['data']); - - $bulk = new BulkWrite; - - if ($insertId = $bulk->insert($data)) { - $this->insertId = $insertId; - } - - $this->log('insert', $data, $options); - - return $bulk; - } - - /** - * 生成insertall BulkWrite对象 - * @access public - * @param Query $query 查询对象 - * @param array $dataSet 数据集 - * @return BulkWrite - */ - public function insertAll(Query $query, array $dataSet): BulkWrite - { - $bulk = new BulkWrite; - $options = $query->getOptions(); - - $this->insertId = []; - foreach ($dataSet as $data) { - // 分析并处理数据 - $data = $this->parseData($query, $data); - if ($insertId = $bulk->insert($data)) { - $this->insertId[] = $insertId; - } - } - - $this->log('insert', $dataSet, $options); - - return $bulk; - } - - /** - * 生成update BulkWrite对象 - * @access public - * @param Query $query 查询对象 - * @return BulkWrite - */ - public function update(Query $query): BulkWrite - { - $options = $query->getOptions(); - - $data = $this->parseSet($query, $options['data']); - $where = $this->parseWhere($query, $options['where']); - - if (1 == $options['limit']) { - $updateOptions = ['multi' => false]; - } else { - $updateOptions = ['multi' => true]; - } - - $bulk = new BulkWrite; - - $bulk->update($where, $data, $updateOptions); - - $this->log('update', $data, $where); - - return $bulk; - } - - /** - * 生成delete BulkWrite对象 - * @access public - * @param Query $query 查询对象 - * @return BulkWrite - */ - public function delete(Query $query): BulkWrite - { - $options = $query->getOptions(); - $where = $this->parseWhere($query, $options['where']); - - $bulk = new BulkWrite; - - if (1 == $options['limit']) { - $deleteOptions = ['limit' => 1]; - } else { - $deleteOptions = ['limit' => 0]; - } - - $bulk->delete($where, $deleteOptions); - - $this->log('remove', $where, $deleteOptions); - - return $bulk; - } - - /** - * 生成Mongo查询对象 - * @access public - * @param Query $query 查询对象 - * @param bool $one 是否仅获取一个记录 - * @return MongoQuery - */ - public function select(Query $query, bool $one = false): MongoQuery - { - $options = $query->getOptions(); - - $where = $this->parseWhere($query, $options['where']); - - if ($one) { - $options['limit'] = 1; - } - - $query = new MongoQuery($where, $options); - - $this->log('find', $where, $options); - - return $query; - } - - /** - * 生成Count命令 - * @access public - * @param Query $query 查询对象 - * @return Command - */ - public function count(Query $query): Command - { - $options = $query->getOptions(); - - $cmd['count'] = $options['table']; - $cmd['query'] = (object) $this->parseWhere($query, $options['where']); - - foreach (['hint', 'limit', 'maxTimeMS', 'skip'] as $option) { - if (isset($options[$option])) { - $cmd[$option] = $options[$option]; - } - } - - $command = new Command($cmd); - $this->log('cmd', 'count', $cmd); - - return $command; - } - - /** - * 聚合查询命令 - * @access public - * @param Query $query 查询对象 - * @param array $extra 指令和字段 - * @return Command - */ - public function aggregate(Query $query, array $extra): Command - { - $options = $query->getOptions(); - list($fun, $field) = $extra; - - if ('id' == $field && $this->connection->getConfig('pk_convert_id')) { - $field = '_id'; - } - - $group = isset($options['group']) ? '$' . $options['group'] : null; - - $pipeline = [ - ['$match' => (object) $this->parseWhere($query, $options['where'])], - ['$group' => ['_id' => $group, 'aggregate' => ['$' . $fun => '$' . $field]]], - ]; - - $cmd = [ - 'aggregate' => $options['table'], - 'allowDiskUse' => true, - 'pipeline' => $pipeline, - 'cursor' => new \stdClass, - ]; - - foreach (['explain', 'collation', 'bypassDocumentValidation', 'readConcern'] as $option) { - if (isset($options[$option])) { - $cmd[$option] = $options[$option]; - } - } - - $command = new Command($cmd); - - $this->log('aggregate', $cmd); - - return $command; - } - - /** - * 多聚合查询命令, 可以对多个字段进行 group by 操作 - * - * @param Query $query 查询对象 - * @param array $extra 指令和字段 - * @return Command - */ - public function multiAggregate(Query $query, $extra): Command - { - $options = $query->getOptions(); - - list($aggregate, $groupBy) = $extra; - - $groups = ['_id' => []]; - - foreach ($groupBy as $field) { - $groups['_id'][$field] = '$' . $field; - } - - foreach ($aggregate as $fun => $field) { - $groups[$field . '_' . $fun] = ['$' . $fun => '$' . $field]; - } - - $pipeline = [ - ['$match' => (object) $this->parseWhere($query, $options['where'])], - ['$group' => $groups], - ]; - - $cmd = [ - 'aggregate' => $options['table'], - 'allowDiskUse' => true, - 'pipeline' => $pipeline, - 'cursor' => new \stdClass, - ]; - - foreach (['explain', 'collation', 'bypassDocumentValidation', 'readConcern'] as $option) { - if (isset($options[$option])) { - $cmd[$option] = $options[$option]; - } - } - - $command = new Command($cmd); - $this->log('group', $cmd); - - return $command; - } - - /** - * 生成distinct命令 - * @access public - * @param Query $query 查询对象 - * @param string $field 字段名 - * @return Command - */ - public function distinct(Query $query, $field): Command - { - $options = $query->getOptions(); - - $cmd = [ - 'distinct' => $options['table'], - 'key' => $field, - ]; - - if (!empty($options['where'])) { - $cmd['query'] = (object) $this->parseWhere($query, $options['where']); - } - - if (isset($options['maxTimeMS'])) { - $cmd['maxTimeMS'] = $options['maxTimeMS']; - } - - $command = new Command($cmd); - - $this->log('cmd', 'distinct', $cmd); - - return $command; - } - - /** - * 查询所有的collection - * @access public - * @return Command - */ - public function listcollections(): Command - { - $cmd = ['listCollections' => 1]; - $command = new Command($cmd); - - $this->log('cmd', 'listCollections', $cmd); - - return $command; - } - - /** - * 查询数据表的状态信息 - * @access public - * @param Query $query 查询对象 - * @return Command - */ - public function collStats(Query $query): Command - { - $options = $query->getOptions(); - - $cmd = ['collStats' => $options['table']]; - $command = new Command($cmd); - - $this->log('cmd', 'collStats', $cmd); - - return $command; - } - - protected function log($type, $data, $options = []) - { - $this->connection->mongoLog($type, $data, $options); - } -} diff --git a/vendor/topthink/think-orm/src/db/builder/Mysql.php b/vendor/topthink/think-orm/src/db/builder/Mysql.php deleted file mode 100644 index 33aec85a..00000000 --- a/vendor/topthink/think-orm/src/db/builder/Mysql.php +++ /dev/null @@ -1,421 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\builder; - -use think\db\Builder; -use think\db\exception\DbException as Exception; -use think\db\Query; -use think\db\Raw; - -/** - * mysql数据库驱动 - */ -class Mysql extends Builder -{ - /** - * 查询表达式解析 - * @var array - */ - protected $parser = [ - 'parseCompare' => ['=', '<>', '>', '>=', '<', '<='], - 'parseLike' => ['LIKE', 'NOT LIKE'], - 'parseBetween' => ['NOT BETWEEN', 'BETWEEN'], - 'parseIn' => ['NOT IN', 'IN'], - 'parseExp' => ['EXP'], - 'parseRegexp' => ['REGEXP', 'NOT REGEXP'], - 'parseNull' => ['NOT NULL', 'NULL'], - 'parseBetweenTime' => ['BETWEEN TIME', 'NOT BETWEEN TIME'], - 'parseTime' => ['< TIME', '> TIME', '<= TIME', '>= TIME'], - 'parseExists' => ['NOT EXISTS', 'EXISTS'], - 'parseColumn' => ['COLUMN'], - 'parseFindInSet' => ['FIND IN SET'], - ]; - - /** - * SELECT SQL表达式 - * @var string - */ - protected $selectSql = 'SELECT%DISTINCT%%EXTRA% %FIELD% FROM %TABLE%%PARTITION%%FORCE%%JOIN%%WHERE%%GROUP%%HAVING%%UNION%%ORDER%%LIMIT% %LOCK%%COMMENT%'; - - /** - * INSERT SQL表达式 - * @var string - */ - protected $insertSql = '%INSERT%%EXTRA% INTO %TABLE%%PARTITION% SET %SET% %DUPLICATE%%COMMENT%'; - - /** - * INSERT ALL SQL表达式 - * @var string - */ - protected $insertAllSql = '%INSERT%%EXTRA% INTO %TABLE%%PARTITION% (%FIELD%) VALUES %DATA% %DUPLICATE%%COMMENT%'; - - /** - * UPDATE SQL表达式 - * @var string - */ - protected $updateSql = 'UPDATE%EXTRA% %TABLE%%PARTITION% %JOIN% SET %SET% %WHERE% %ORDER%%LIMIT% %LOCK%%COMMENT%'; - - /** - * DELETE SQL表达式 - * @var string - */ - protected $deleteSql = 'DELETE%EXTRA% FROM %TABLE%%PARTITION%%USING%%JOIN%%WHERE%%ORDER%%LIMIT% %LOCK%%COMMENT%'; - - /** - * 生成查询SQL - * @access public - * @param Query $query 查询对象 - * @param bool $one 是否仅获取一个记录 - * @return string - */ - public function select(Query $query, bool $one = false): string - { - $options = $query->getOptions(); - - return str_replace( - ['%TABLE%', '%PARTITION%', '%DISTINCT%', '%EXTRA%', '%FIELD%', '%JOIN%', '%WHERE%', '%GROUP%', '%HAVING%', '%ORDER%', '%LIMIT%', '%UNION%', '%LOCK%', '%COMMENT%', '%FORCE%'], - [ - $this->parseTable($query, $options['table']), - $this->parsePartition($query, $options['partition']), - $this->parseDistinct($query, $options['distinct']), - $this->parseExtra($query, $options['extra']), - $this->parseField($query, $options['field']), - $this->parseJoin($query, $options['join']), - $this->parseWhere($query, $options['where']), - $this->parseGroup($query, $options['group']), - $this->parseHaving($query, $options['having']), - $this->parseOrder($query, $options['order']), - $this->parseLimit($query, $one ? '1' : $options['limit']), - $this->parseUnion($query, $options['union']), - $this->parseLock($query, $options['lock']), - $this->parseComment($query, $options['comment']), - $this->parseForce($query, $options['force']), - ], - $this->selectSql); - } - - /** - * 生成Insert SQL - * @access public - * @param Query $query 查询对象 - * @return string - */ - public function insert(Query $query): string - { - $options = $query->getOptions(); - - // 分析并处理数据 - $data = $this->parseData($query, $options['data']); - if (empty($data)) { - return ''; - } - - $set = []; - foreach ($data as $key => $val) { - $set[] = $key . ' = ' . $val; - } - - return str_replace( - ['%INSERT%', '%EXTRA%', '%TABLE%', '%PARTITION%', '%SET%', '%DUPLICATE%', '%COMMENT%'], - [ - !empty($options['replace']) ? 'REPLACE' : 'INSERT', - $this->parseExtra($query, $options['extra']), - $this->parseTable($query, $options['table']), - $this->parsePartition($query, $options['partition']), - implode(' , ', $set), - $this->parseDuplicate($query, $options['duplicate']), - $this->parseComment($query, $options['comment']), - ], - $this->insertSql); - } - - /** - * 生成insertall SQL - * @access public - * @param Query $query 查询对象 - * @param array $dataSet 数据集 - * @param bool $replace 是否replace - * @return string - */ - public function insertAll(Query $query, array $dataSet, bool $replace = false): string - { - $options = $query->getOptions(); - - // 获取绑定信息 - $bind = $query->getFieldsBindType(); - - // 获取合法的字段 - if ('*' == $options['field']) { - $allowFields = array_keys($bind); - } else { - $allowFields = $options['field']; - } - - $fields = []; - $values = []; - - foreach ($dataSet as $data) { - $data = $this->parseData($query, $data, $allowFields, $bind); - - $values[] = '( ' . implode(',', array_values($data)) . ' )'; - - if (!isset($insertFields)) { - $insertFields = array_keys($data); - } - } - - foreach ($insertFields as $field) { - $fields[] = $this->parseKey($query, $field); - } - - return str_replace( - ['%INSERT%', '%EXTRA%', '%TABLE%', '%PARTITION%', '%FIELD%', '%DATA%', '%DUPLICATE%', '%COMMENT%'], - [ - $replace ? 'REPLACE' : 'INSERT', - $this->parseExtra($query, $options['extra']), - $this->parseTable($query, $options['table']), - $this->parsePartition($query, $options['partition']), - implode(' , ', $fields), - implode(' , ', $values), - $this->parseDuplicate($query, $options['duplicate']), - $this->parseComment($query, $options['comment']), - ], - $this->insertAllSql); - } - - /** - * 生成update SQL - * @access public - * @param Query $query 查询对象 - * @return string - */ - public function update(Query $query): string - { - $options = $query->getOptions(); - - $data = $this->parseData($query, $options['data']); - - if (empty($data)) { - return ''; - } - $set = []; - foreach ($data as $key => $val) { - $set[] = $key . ' = ' . $val; - } - - return str_replace( - ['%TABLE%', '%PARTITION%', '%EXTRA%', '%SET%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'], - [ - $this->parseTable($query, $options['table']), - $this->parsePartition($query, $options['partition']), - $this->parseExtra($query, $options['extra']), - implode(' , ', $set), - $this->parseJoin($query, $options['join']), - $this->parseWhere($query, $options['where']), - $this->parseOrder($query, $options['order']), - $this->parseLimit($query, $options['limit']), - $this->parseLock($query, $options['lock']), - $this->parseComment($query, $options['comment']), - ], - $this->updateSql); - } - - /** - * 生成delete SQL - * @access public - * @param Query $query 查询对象 - * @return string - */ - public function delete(Query $query): string - { - $options = $query->getOptions(); - - return str_replace( - ['%TABLE%', '%PARTITION%', '%EXTRA%', '%USING%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'], - [ - $this->parseTable($query, $options['table']), - $this->parsePartition($query, $options['partition']), - $this->parseExtra($query, $options['extra']), - !empty($options['using']) ? ' USING ' . $this->parseTable($query, $options['using']) . ' ' : '', - $this->parseJoin($query, $options['join']), - $this->parseWhere($query, $options['where']), - $this->parseOrder($query, $options['order']), - $this->parseLimit($query, $options['limit']), - $this->parseLock($query, $options['lock']), - $this->parseComment($query, $options['comment']), - ], - $this->deleteSql); - } - - /** - * 正则查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @return string - */ - protected function parseRegexp(Query $query, string $key, string $exp, $value, string $field): string - { - if ($value instanceof Raw) { - $value = $value->getValue(); - } - - return $key . ' ' . $exp . ' ' . $value; - } - - /** - * FIND_IN_SET 查询 - * @access protected - * @param Query $query 查询对象 - * @param string $key - * @param string $exp - * @param mixed $value - * @param string $field - * @return string - */ - protected function parseFindInSet(Query $query, string $key, string $exp, $value, string $field): string - { - if ($value instanceof Raw) { - $value = $value->getValue(); - } - - return 'FIND_IN_SET(' . $value . ', ' . $key . ')'; - } - - /** - * 字段和表名处理 - * @access public - * @param Query $query 查询对象 - * @param mixed $key 字段名 - * @param bool $strict 严格检测 - * @return string - */ - public function parseKey(Query $query, $key, bool $strict = false): string - { - if (is_int($key)) { - return (string) $key; - } elseif ($key instanceof Raw) { - return $key->getValue(); - } - - $key = trim($key); - - if (strpos($key, '->') && false === strpos($key, '(')) { - // JSON字段支持 - list($field, $name) = explode('->', $key, 2); - return 'json_extract(' . $this->parseKey($query, $field) . ', \'$' . (strpos($name, '[') === 0 ? '' : '.') . str_replace('->', '.', $name) . '\')'; - } elseif (strpos($key, '.') && !preg_match('/[,\'\"\(\)`\s]/', $key)) { - list($table, $key) = explode('.', $key, 2); - - $alias = $query->getOptions('alias'); - - if ('__TABLE__' == $table) { - $table = $query->getOptions('table'); - $table = is_array($table) ? array_shift($table) : $table; - } - - if (isset($alias[$table])) { - $table = $alias[$table]; - } - } - - if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) { - throw new Exception('not support data:' . $key); - } - - if ('*' != $key && !preg_match('/[,\'\"\*\(\)`.\s]/', $key)) { - $key = '`' . $key . '`'; - } - - if (isset($table)) { - if (strpos($table, '.')) { - $table = str_replace('.', '`.`', $table); - } - - $key = '`' . $table . '`.' . $key; - } - - return $key; - } - - /** - * 随机排序 - * @access protected - * @param Query $query 查询对象 - * @return string - */ - protected function parseRand(Query $query): string - { - return 'rand()'; - } - - /** - * Partition 分析 - * @access protected - * @param Query $query 查询对象 - * @param string|array $partition 分区 - * @return string - */ - protected function parsePartition(Query $query, $partition): string - { - if ('' == $partition) { - return ''; - } - - if (is_string($partition)) { - $partition = explode(',', $partition); - } - - return ' PARTITION (' . implode(' , ', $partition) . ') '; - } - - /** - * ON DUPLICATE KEY UPDATE 分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $duplicate - * @return string - */ - protected function parseDuplicate(Query $query, $duplicate): string - { - if ('' == $duplicate) { - return ''; - } - - if ($duplicate instanceof Raw) { - return ' ON DUPLICATE KEY UPDATE ' . $duplicate->getValue() . ' '; - } - - if (is_string($duplicate)) { - $duplicate = explode(',', $duplicate); - } - - $updates = []; - foreach ($duplicate as $key => $val) { - if (is_numeric($key)) { - $val = $this->parseKey($query, $val); - $updates[] = $val . ' = VALUES(' . $val . ')'; - } elseif ($val instanceof Raw) { - $updates[] = $this->parseKey($query, $key) . " = " . $val->getValue(); - } else { - $name = $query->bindValue($val, $query->getConnection()->getFieldBindType($key)); - $updates[] = $this->parseKey($query, $key) . " = :" . $name; - } - } - - return ' ON DUPLICATE KEY UPDATE ' . implode(' , ', $updates) . ' '; - } -} diff --git a/vendor/topthink/think-orm/src/db/builder/Oracle.php b/vendor/topthink/think-orm/src/db/builder/Oracle.php deleted file mode 100644 index 8b6e225d..00000000 --- a/vendor/topthink/think-orm/src/db/builder/Oracle.php +++ /dev/null @@ -1,95 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\builder; - -use think\db\Builder; -use think\db\Query; - -/** - * Oracle数据库驱动 - */ -class Oracle extends Builder -{ - protected $selectSql = 'SELECT * FROM (SELECT thinkphp.*, rownum AS numrow FROM (SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%) thinkphp ) %LIMIT%%COMMENT%'; - - /** - * limit分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $limit - * @return string - */ - protected function parseLimit(Query $query, string $limit): string - { - $limitStr = ''; - - if (!empty($limit)) { - $limit = explode(',', $limit); - - if (count($limit) > 1) { - $limitStr = "(numrow>" . $limit[0] . ") AND (numrow<=" . ($limit[0] + $limit[1]) . ")"; - } else { - $limitStr = "(numrow>0 AND numrow<=" . $limit[0] . ")"; - } - - } - - return $limitStr ? ' WHERE ' . $limitStr : ''; - } - - /** - * 设置锁机制 - * @access protected - * @param Query $query 查询对象 - * @param bool|false $lock - * @return string - */ - protected function parseLock(Query $query, $lock = false): string - { - if (!$lock) { - return ''; - } - - return ' FOR UPDATE NOWAIT '; - } - - /** - * 字段和表名处理 - * @access public - * @param Query $query 查询对象 - * @param string $key - * @param string $strict - * @return string - */ - public function parseKey(Query $query, $key, bool $strict = false): string - { - $key = trim($key); - - if (strpos($key, '->') && false === strpos($key, '(')) { - // JSON字段支持 - list($field, $name) = explode($key, '->'); - $key = $field . '."' . $name . '"'; - } - - return $key; - } - - /** - * 随机排序 - * @access protected - * @param Query $query 查询对象 - * @return string - */ - protected function parseRand(Query $query): string - { - return 'DBMS_RANDOM.value'; - } -} diff --git a/vendor/topthink/think-orm/src/db/builder/Pgsql.php b/vendor/topthink/think-orm/src/db/builder/Pgsql.php deleted file mode 100644 index e1c2856b..00000000 --- a/vendor/topthink/think-orm/src/db/builder/Pgsql.php +++ /dev/null @@ -1,118 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\builder; - -use think\db\Builder; -use think\db\Query; -use think\db\Raw; - -/** - * Pgsql数据库驱动 - */ -class Pgsql extends Builder -{ - /** - * INSERT SQL表达式 - * @var string - */ - protected $insertSql = 'INSERT INTO %TABLE% (%FIELD%) VALUES (%DATA%) %COMMENT%'; - - /** - * INSERT ALL SQL表达式 - * @var string - */ - protected $insertAllSql = 'INSERT INTO %TABLE% (%FIELD%) %DATA% %COMMENT%'; - - /** - * limit分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $limit - * @return string - */ - public function parseLimit(Query $query, string $limit): string - { - $limitStr = ''; - - if (!empty($limit)) { - $limit = explode(',', $limit); - if (count($limit) > 1) { - $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' '; - } else { - $limitStr .= ' LIMIT ' . $limit[0] . ' '; - } - } - - return $limitStr; - } - - /** - * 字段和表名处理 - * @access public - * @param Query $query 查询对象 - * @param mixed $key 字段名 - * @param bool $strict 严格检测 - * @return string - */ - public function parseKey(Query $query, $key, bool $strict = false): string - { - if (is_int($key)) { - return (string) $key; - } elseif ($key instanceof Raw) { - return $key->getValue(); - } - - $key = trim($key); - - if (strpos($key, '->') && false === strpos($key, '(')) { - // JSON字段支持 - list($field, $name) = explode('->', $key); - $key = '"' . $field . '"' . '->>\'' . $name . '\''; - } elseif (strpos($key, '.')) { - list($table, $key) = explode('.', $key, 2); - - $alias = $query->getOptions('alias'); - - if ('__TABLE__' == $table) { - $table = $query->getOptions('table'); - $table = is_array($table) ? array_shift($table) : $table; - } - - if (isset($alias[$table])) { - $table = $alias[$table]; - } - - if ('*' != $key && !preg_match('/[,\"\*\(\).\s]/', $key)) { - $key = '"' . $key . '"'; - } - } - - if (isset($table)) { - $key = $table . '.' . $key; - } - - return $key; - } - - /** - * 随机排序 - * @access protected - * @param Query $query 查询对象 - * @return string - */ - protected function parseRand(Query $query): string - { - return 'RANDOM()'; - } - -} diff --git a/vendor/topthink/think-orm/src/db/builder/Sqlite.php b/vendor/topthink/think-orm/src/db/builder/Sqlite.php deleted file mode 100644 index bf8f129b..00000000 --- a/vendor/topthink/think-orm/src/db/builder/Sqlite.php +++ /dev/null @@ -1,97 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\builder; - -use think\db\Builder; -use think\db\Query; -use think\db\Raw; - -/** - * Sqlite数据库驱动 - */ -class Sqlite extends Builder -{ - /** - * limit - * @access public - * @param Query $query 查询对象 - * @param mixed $limit - * @return string - */ - public function parseLimit(Query $query, string $limit): string - { - $limitStr = ''; - - if (!empty($limit)) { - $limit = explode(',', $limit); - if (count($limit) > 1) { - $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' '; - } else { - $limitStr .= ' LIMIT ' . $limit[0] . ' '; - } - } - - return $limitStr; - } - - /** - * 随机排序 - * @access protected - * @param Query $query 查询对象 - * @return string - */ - protected function parseRand(Query $query): string - { - return 'RANDOM()'; - } - - /** - * 字段和表名处理 - * @access public - * @param Query $query 查询对象 - * @param mixed $key 字段名 - * @param bool $strict 严格检测 - * @return string - */ - public function parseKey(Query $query, $key, bool $strict = false): string - { - if (is_int($key)) { - return (string) $key; - } elseif ($key instanceof Raw) { - return $key->getValue(); - } - - $key = trim($key); - - if (strpos($key, '.')) { - list($table, $key) = explode('.', $key, 2); - - $alias = $query->getOptions('alias'); - - if ('__TABLE__' == $table) { - $table = $query->getOptions('table'); - $table = is_array($table) ? array_shift($table) : $table; - } - - if (isset($alias[$table])) { - $table = $alias[$table]; - } - } - - if (isset($table)) { - $key = $table . '.' . $key; - } - - return $key; - } -} diff --git a/vendor/topthink/think-orm/src/db/builder/Sqlsrv.php b/vendor/topthink/think-orm/src/db/builder/Sqlsrv.php deleted file mode 100644 index cd06c342..00000000 --- a/vendor/topthink/think-orm/src/db/builder/Sqlsrv.php +++ /dev/null @@ -1,184 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\db\builder; - -use think\db\Builder; -use think\db\exception\DbException as Exception; -use think\db\Query; -use think\db\Raw; - -/** - * Sqlsrv数据库驱动 - */ -class Sqlsrv extends Builder -{ - /** - * SELECT SQL表达式 - * @var string - */ - protected $selectSql = 'SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER (%ORDER%) AS ROW_NUMBER FROM (SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%) AS thinkphp) AS T1 %LIMIT%%COMMENT%'; - /** - * SELECT INSERT SQL表达式 - * @var string - */ - protected $selectInsertSql = 'SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%'; - - /** - * UPDATE SQL表达式 - * @var string - */ - protected $updateSql = 'UPDATE %TABLE% SET %SET% FROM %TABLE% %JOIN% %WHERE% %LIMIT% %LOCK%%COMMENT%'; - - /** - * DELETE SQL表达式 - * @var string - */ - protected $deleteSql = 'DELETE FROM %TABLE% %USING% FROM %TABLE% %JOIN% %WHERE% %LIMIT% %LOCK%%COMMENT%'; - - /** - * INSERT SQL表达式 - * @var string - */ - protected $insertSql = 'INSERT INTO %TABLE% (%FIELD%) VALUES (%DATA%) %COMMENT%'; - - /** - * INSERT ALL SQL表达式 - * @var string - */ - protected $insertAllSql = 'INSERT INTO %TABLE% (%FIELD%) %DATA% %COMMENT%'; - - /** - * order分析 - * @access protected - * @param Query $query 查询对象 - * @param mixed $order - * @return string - */ - protected function parseOrder(Query $query, array $order): string - { - if (empty($order)) { - return ' ORDER BY rand()'; - } - - $array = []; - - foreach ($order as $key => $val) { - if ($val instanceof Raw) { - $array[] = $val->getValue(); - } elseif ('[rand]' == $val) { - $array[] = $this->parseRand($query); - } else { - if (is_numeric($key)) { - list($key, $sort) = explode(' ', strpos($val, ' ') ? $val : $val . ' '); - } else { - $sort = $val; - } - - $sort = in_array(strtolower($sort), ['asc', 'desc'], true) ? ' ' . $sort : ''; - $array[] = $this->parseKey($query, $key, true) . $sort; - } - } - - return ' ORDER BY ' . implode(',', $array); - } - - /** - * 随机排序 - * @access protected - * @param Query $query 查询对象 - * @return string - */ - protected function parseRand(Query $query): string - { - return 'rand()'; - } - - /** - * 字段和表名处理 - * @access public - * @param Query $query 查询对象 - * @param mixed $key 字段名 - * @param bool $strict 严格检测 - * @return string - */ - public function parseKey(Query $query, $key, bool $strict = false): string - { - if (is_int($key)) { - return (string) $key; - } elseif ($key instanceof Raw) { - return $key->getValue(); - } - - $key = trim($key); - - if (strpos($key, '.') && !preg_match('/[,\'\"\(\)\[\s]/', $key)) { - list($table, $key) = explode('.', $key, 2); - - $alias = $query->getOptions('alias'); - - if ('__TABLE__' == $table) { - $table = $query->getOptions('table'); - $table = is_array($table) ? array_shift($table) : $table; - } - - if (isset($alias[$table])) { - $table = $alias[$table]; - } - } - - if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) { - throw new Exception('not support data:' . $key); - } - - if ('*' != $key && !preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) { - $key = '[' . $key . ']'; - } - - if (isset($table)) { - $key = '[' . $table . '].' . $key; - } - - return $key; - } - - /** - * limit - * @access protected - * @param Query $query 查询对象 - * @param mixed $limit - * @return string - */ - protected function parseLimit(Query $query, string $limit): string - { - if (empty($limit)) { - return ''; - } - - $limit = explode(',', $limit); - - if (count($limit) > 1) { - $limitStr = '(T1.ROW_NUMBER BETWEEN ' . $limit[0] . ' + 1 AND ' . $limit[0] . ' + ' . $limit[1] . ')'; - } else { - $limitStr = '(T1.ROW_NUMBER BETWEEN 1 AND ' . $limit[0] . ")"; - } - - return 'WHERE ' . $limitStr; - } - - public function selectInsert(Query $query, array $fields, string $table): string - { - $this->selectSql = $this->selectInsertSql; - - return parent::selectInsert($query, $fields, $table); - } - -} diff --git a/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php b/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php deleted file mode 100644 index dabfb921..00000000 --- a/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php +++ /dev/null @@ -1,107 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -use think\db\Raw; - -/** - * 聚合查询 - */ -trait AggregateQuery -{ - /** - * 聚合查询 - * @access protected - * @param string $aggregate 聚合方法 - * @param string|Raw $field 字段名 - * @param bool $force 强制转为数字类型 - * @return mixed - */ - protected function aggregate(string $aggregate, $field, bool $force = false) - { - return $this->connection->aggregate($this, $aggregate, $field, $force); - } - - /** - * COUNT查询 - * @access public - * @param string|Raw $field 字段名 - * @return int - */ - public function count(string $field = '*'): int - { - if (!empty($this->options['group'])) { - // 支持GROUP - $options = $this->getOptions(); - $subSql = $this->options($options) - ->field('count(' . $field . ') AS think_count') - ->bind($this->bind) - ->buildSql(); - - $query = $this->newQuery()->table([$subSql => '_group_count_']); - - $count = $query->aggregate('COUNT', '*'); - } else { - $count = $this->aggregate('COUNT', $field); - } - - return (int) $count; - } - - /** - * SUM查询 - * @access public - * @param string|Raw $field 字段名 - * @return float - */ - public function sum($field): float - { - return $this->aggregate('SUM', $field, true); - } - - /** - * MIN查询 - * @access public - * @param string|Raw $field 字段名 - * @param bool $force 强制转为数字类型 - * @return mixed - */ - public function min($field, bool $force = true) - { - return $this->aggregate('MIN', $field, $force); - } - - /** - * MAX查询 - * @access public - * @param string|Raw $field 字段名 - * @param bool $force 强制转为数字类型 - * @return mixed - */ - public function max($field, bool $force = true) - { - return $this->aggregate('MAX', $field, $force); - } - - /** - * AVG查询 - * @access public - * @param string|Raw $field 字段名 - * @return float - */ - public function avg($field): float - { - return $this->aggregate('AVG', $field, true); - } - -} diff --git a/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php b/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php deleted file mode 100644 index cd48ab28..00000000 --- a/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php +++ /dev/null @@ -1,229 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -use think\db\Raw; -use think\helper\Str; - -/** - * JOIN和VIEW查询 - */ -trait JoinAndViewQuery -{ - - /** - * 查询SQL组装 join - * @access public - * @param mixed $join 关联的表名 - * @param mixed $condition 条件 - * @param string $type JOIN类型 - * @param array $bind 参数绑定 - * @return $this - */ - public function join($join, string $condition = null, string $type = 'INNER', array $bind = []) - { - $table = $this->getJoinTable($join); - - if (!empty($bind) && $condition) { - $this->bindParams($condition, $bind); - } - - $this->options['join'][] = [$table, strtoupper($type), $condition]; - - return $this; - } - - /** - * LEFT JOIN - * @access public - * @param mixed $join 关联的表名 - * @param mixed $condition 条件 - * @param array $bind 参数绑定 - * @return $this - */ - public function leftJoin($join, string $condition = null, array $bind = []) - { - return $this->join($join, $condition, 'LEFT', $bind); - } - - /** - * RIGHT JOIN - * @access public - * @param mixed $join 关联的表名 - * @param mixed $condition 条件 - * @param array $bind 参数绑定 - * @return $this - */ - public function rightJoin($join, string $condition = null, array $bind = []) - { - return $this->join($join, $condition, 'RIGHT', $bind); - } - - /** - * FULL JOIN - * @access public - * @param mixed $join 关联的表名 - * @param mixed $condition 条件 - * @param array $bind 参数绑定 - * @return $this - */ - public function fullJoin($join, string $condition = null, array $bind = []) - { - return $this->join($join, $condition, 'FULL'); - } - - /** - * 获取Join表名及别名 支持 - * ['prefix_table或者子查询'=>'alias'] 'table alias' - * @access protected - * @param array|string|Raw $join JION表名 - * @param string $alias 别名 - * @return string|array - */ - protected function getJoinTable($join, &$alias = null) - { - if (is_array($join)) { - $table = $join; - $alias = array_shift($join); - return $table; - } elseif ($join instanceof Raw) { - return $join; - } - - $join = trim($join); - - if (false !== strpos($join, '(')) { - // 使用子查询 - $table = $join; - } else { - // 使用别名 - if (strpos($join, ' ')) { - // 使用别名 - list($table, $alias) = explode(' ', $join); - } else { - $table = $join; - if (false === strpos($join, '.')) { - $alias = $join; - } - } - - if ($this->prefix && false === strpos($table, '.') && 0 !== strpos($table, $this->prefix)) { - $table = $this->getTable($table); - } - } - - if (!empty($alias) && $table != $alias) { - $table = [$table => $alias]; - } - - return $table; - } - - /** - * 指定JOIN查询字段 - * @access public - * @param string|array $join 数据表 - * @param string|array $field 查询字段 - * @param string $on JOIN条件 - * @param string $type JOIN类型 - * @param array $bind 参数绑定 - * @return $this - */ - public function view($join, $field = true, $on = null, string $type = 'INNER', array $bind = []) - { - $this->options['view'] = true; - - $fields = []; - $table = $this->getJoinTable($join, $alias); - - if (true === $field) { - $fields = $alias . '.*'; - } else { - if (is_string($field)) { - $field = explode(',', $field); - } - - foreach ($field as $key => $val) { - if (is_numeric($key)) { - $fields[] = $alias . '.' . $val; - - $this->options['map'][$val] = $alias . '.' . $val; - } else { - if (preg_match('/[,=\.\'\"\(\s]/', $key)) { - $name = $key; - } else { - $name = $alias . '.' . $key; - } - - $fields[] = $name . ' AS ' . $val; - - $this->options['map'][$val] = $name; - } - } - } - - $this->field($fields); - - if ($on) { - $this->join($table, $on, $type, $bind); - } else { - $this->table($table); - } - - return $this; - } - - /** - * 视图查询处理 - * @access protected - * @param array $options 查询参数 - * @return void - */ - protected function parseView(array &$options): void - { - foreach (['AND', 'OR'] as $logic) { - if (isset($options['where'][$logic])) { - foreach ($options['where'][$logic] as $key => $val) { - if (array_key_exists($key, $options['map'])) { - array_shift($val); - array_unshift($val, $options['map'][$key]); - $options['where'][$logic][$options['map'][$key]] = $val; - unset($options['where'][$logic][$key]); - } - } - } - } - - if (isset($options['order'])) { - // 视图查询排序处理 - foreach ($options['order'] as $key => $val) { - if (is_numeric($key) && is_string($val)) { - if (strpos($val, ' ')) { - list($field, $sort) = explode(' ', $val); - if (array_key_exists($field, $options['map'])) { - $options['order'][$options['map'][$field]] = $sort; - unset($options['order'][$key]); - } - } elseif (array_key_exists($val, $options['map'])) { - $options['order'][$options['map'][$val]] = 'asc'; - unset($options['order'][$key]); - } - } elseif (array_key_exists($key, $options['map'])) { - $options['order'][$options['map'][$key]] = $val; - unset($options['order'][$key]); - } - } - } - } - -} diff --git a/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php b/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php deleted file mode 100644 index 9a211379..00000000 --- a/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php +++ /dev/null @@ -1,516 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -use Closure; -use think\helper\Str; -use think\Model; -use think\model\Collection as ModelCollection; - -/** - * 模型及关联查询 - */ -trait ModelRelationQuery -{ - - /** - * 当前模型对象 - * @var Model - */ - protected $model; - - /** - * 指定模型 - * @access public - * @param Model $model 模型对象实例 - * @return $this - */ - public function model(Model $model) - { - $this->model = $model; - return $this; - } - - /** - * 获取当前的模型对象 - * @access public - * @return Model|null - */ - public function getModel() - { - return $this->model; - } - - /** - * 设置需要隐藏的输出属性 - * @access public - * @param array $hidden 需要隐藏的字段名 - * @return $this - */ - public function hidden(array $hidden) - { - $this->options['hidden'] = $hidden; - return $this; - } - - /** - * 设置需要输出的属性 - * @access public - * @param array $visible 需要输出的属性 - * @return $this - */ - public function visible(array $visible) - { - $this->options['visible'] = $visible; - return $this; - } - - /** - * 设置需要追加输出的属性 - * @access public - * @param array $append 需要追加的属性 - * @return $this - */ - public function append(array $append) - { - $this->options['append'] = $append; - return $this; - } - - /** - * 添加查询范围 - * @access public - * @param array|string|Closure $scope 查询范围定义 - * @param array $args 参数 - * @return $this - */ - public function scope($scope, ...$args) - { - // 查询范围的第一个参数始终是当前查询对象 - array_unshift($args, $this); - - if ($scope instanceof Closure) { - call_user_func_array($scope, $args); - return $this; - } - - if (is_string($scope)) { - $scope = explode(',', $scope); - } - - if ($this->model) { - // 检查模型类的查询范围方法 - foreach ($scope as $name) { - $method = 'scope' . trim($name); - - if (method_exists($this->model, $method)) { - call_user_func_array([$this->model, $method], $args); - } - } - } - - return $this; - } - - /** - * 设置关联查询 - * @access public - * @param array $relation 关联名称 - * @return $this - */ - public function relation(array $relation) - { - if (!empty($relation)) { - $this->options['relation'] = $relation; - } - - return $this; - } - - /** - * 使用搜索器条件搜索字段 - * @access public - * @param array $fields 搜索字段 - * @param array $data 搜索数据 - * @param string $prefix 字段前缀标识 - * @return $this - */ - public function withSearch(array $fields, array $data = [], string $prefix = '') - { - foreach ($fields as $key => $field) { - if ($field instanceof Closure) { - $field($this, $data[$key] ?? null, $data, $prefix); - } elseif ($this->model) { - // 检测搜索器 - $fieldName = is_numeric($key) ? $field : $key; - $method = 'search' . Str::studly($fieldName) . 'Attr'; - - if (method_exists($this->model, $method)) { - $this->model->$method($this, $data[$field] ?? null, $data, $prefix); - } - } - } - - return $this; - } - - /** - * 设置数据字段获取器 - * @access public - * @param string|array $name 字段名 - * @param callable $callback 闭包获取器 - * @return $this - */ - public function withAttr($name, callable $callback = null) - { - if (is_array($name)) { - $this->options['with_attr'] = $name; - } else { - $this->options['with_attr'][$name] = $callback; - } - - return $this; - } - - /** - * 关联预载入 In方式 - * @access public - * @param array|string $with 关联方法名称 - * @return $this - */ - public function with($with) - { - if (!empty($with)) { - $this->options['with'] = (array) $with; - } - - return $this; - } - - /** - * 关联预载入 JOIN方式 - * @access protected - * @param array|string $with 关联方法名 - * @param string $joinType JOIN方式 - * @return $this - */ - public function withJoin($with, string $joinType = '') - { - if (empty($with)) { - return $this; - } - - $with = (array) $with; - $first = true; - - foreach ($with as $key => $relation) { - $closure = null; - $field = true; - - if ($relation instanceof Closure) { - // 支持闭包查询过滤关联条件 - $closure = $relation; - $relation = $key; - } elseif (is_array($relation)) { - $field = $relation; - $relation = $key; - } elseif (is_string($relation) && strpos($relation, '.')) { - $relation = strstr($relation, '.', true); - } - - $result = $this->model->eagerly($this, $relation, $field, $joinType, $closure, $first); - - if (!$result) { - unset($with[$key]); - } else { - $first = false; - } - } - - $this->via(); - - $this->options['with_join'] = $with; - - return $this; - } - - /** - * 关联统计 - * @access protected - * @param array|string $relations 关联方法名 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param bool $subQuery 是否使用子查询 - * @return $this - */ - protected function withAggregate($relations, string $aggregate = 'count', $field = '*', bool $subQuery = true) - { - if (!$subQuery) { - $this->options['with_count'][] = [$relations, $aggregate, $field]; - } else { - if (!isset($this->options['field'])) { - $this->field('*'); - } - - $this->model->relationCount($this, (array) $relations, $aggregate, $field, true); - } - - return $this; - } - - /** - * 关联缓存 - * @access public - * @param string|array|bool $relation 关联方法名 - * @param mixed $key 缓存key - * @param integer|\DateTime $expire 缓存有效期 - * @param string $tag 缓存标签 - * @return $this - */ - public function withCache($relation = true, $key = true, $expire = null, string $tag = null) - { - if (false === $relation || false === $key || !$this->getConnection()->getCache()) { - return $this; - } - - if ($key instanceof \DateTimeInterface || $key instanceof \DateInterval || (is_int($key) && is_null($expire))) { - $expire = $key; - $key = true; - } - - if (true === $relation || is_numeric($relation)) { - $this->options['with_cache'] = $relation; - return $this; - } - - $relations = (array) $relation; - foreach ($relations as $name => $relation) { - if (!is_numeric($name)) { - $this->options['with_cache'][$name] = is_array($relation) ? $relation : [$key, $relation, $tag]; - } else { - $this->options['with_cache'][$relation] = [$key, $expire, $tag]; - } - } - - return $this; - } - - /** - * 关联统计 - * @access public - * @param string|array $relation 关联方法名 - * @param bool $subQuery 是否使用子查询 - * @return $this - */ - public function withCount($relation, bool $subQuery = true) - { - return $this->withAggregate($relation, 'count', '*', $subQuery); - } - - /** - * 关联统计Sum - * @access public - * @param string|array $relation 关联方法名 - * @param string $field 字段 - * @param bool $subQuery 是否使用子查询 - * @return $this - */ - public function withSum($relation, string $field, bool $subQuery = true) - { - return $this->withAggregate($relation, 'sum', $field, $subQuery); - } - - /** - * 关联统计Max - * @access public - * @param string|array $relation 关联方法名 - * @param string $field 字段 - * @param bool $subQuery 是否使用子查询 - * @return $this - */ - public function withMax($relation, string $field, bool $subQuery = true) - { - return $this->withAggregate($relation, 'max', $field, $subQuery); - } - - /** - * 关联统计Min - * @access public - * @param string|array $relation 关联方法名 - * @param string $field 字段 - * @param bool $subQuery 是否使用子查询 - * @return $this - */ - public function withMin($relation, string $field, bool $subQuery = true) - { - return $this->withAggregate($relation, 'min', $field, $subQuery); - } - - /** - * 关联统计Avg - * @access public - * @param string|array $relation 关联方法名 - * @param string $field 字段 - * @param bool $subQuery 是否使用子查询 - * @return $this - */ - public function withAvg($relation, string $field, bool $subQuery = true) - { - return $this->withAggregate($relation, 'avg', $field, $subQuery); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $relation 关联方法名 - * @param mixed $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return $this - */ - public function has(string $relation, string $operator = '>=', int $count = 1, string $id = '*', string $joinType = '') - { - return $this->model->has($relation, $operator, $count, $id, $joinType, $this); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $relation 关联方法名 - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @return $this - */ - public function hasWhere(string $relation, $where = [], string $fields = '*', string $joinType = '') - { - return $this->model->hasWhere($relation, $where, $fields, $joinType, $this); - } - - /** - * 查询数据转换为模型数据集对象 - * @access protected - * @param array $resultSet 数据集 - * @return ModelCollection - */ - protected function resultSetToModelCollection(array $resultSet): ModelCollection - { - if (empty($resultSet)) { - return $this->model->toCollection(); - } - - // 检查动态获取器 - if (!empty($this->options['with_attr'])) { - foreach ($this->options['with_attr'] as $name => $val) { - if (strpos($name, '.')) { - list($relation, $field) = explode('.', $name); - - $withRelationAttr[$relation][$field] = $val; - unset($this->options['with_attr'][$name]); - } - } - } - - $withRelationAttr = $withRelationAttr ?? []; - - foreach ($resultSet as $key => &$result) { - // 数据转换为模型对象 - $this->resultToModel($result, $this->options, true, $withRelationAttr); - } - - if (!empty($this->options['with'])) { - // 预载入 - $result->eagerlyResultSet($resultSet, $this->options['with'], $withRelationAttr, false, $this->options['with_cache'] ?? false); - } - - if (!empty($this->options['with_join'])) { - // 预载入 - $result->eagerlyResultSet($resultSet, $this->options['with_join'], $withRelationAttr, true, $this->options['with_cache'] ?? false); - } - - // 模型数据集转换 - return $this->model->toCollection($resultSet); - } - - /** - * 查询数据转换为模型对象 - * @access protected - * @param array $result 查询数据 - * @param array $options 查询参数 - * @param bool $resultSet 是否为数据集查询 - * @param array $withRelationAttr 关联字段获取器 - * @return void - */ - protected function resultToModel(array &$result, array $options = [], bool $resultSet = false, array $withRelationAttr = []): void - { - // 动态获取器 - if (!empty($options['with_attr']) && empty($withRelationAttr)) { - foreach ($options['with_attr'] as $name => $val) { - if (strpos($name, '.')) { - list($relation, $field) = explode('.', $name); - - $withRelationAttr[$relation][$field] = $val; - unset($options['with_attr'][$name]); - } - } - } - - // JSON 数据处理 - if (!empty($options['json'])) { - $this->jsonResult($result, $options['json'], $options['json_assoc'], $withRelationAttr); - } - - $result = $this->model - ->newInstance($result, $resultSet ? null : $this->getModelUpdateCondition($options)); - - // 动态获取器 - if (!empty($options['with_attr'])) { - $result->withAttribute($options['with_attr']); - } - - // 输出属性控制 - if (!empty($options['visible'])) { - $result->visible($options['visible']); - } elseif (!empty($options['hidden'])) { - $result->hidden($options['hidden']); - } - - if (!empty($options['append'])) { - $result->append($options['append']); - } - - // 关联查询 - if (!empty($options['relation'])) { - $result->relationQuery($options['relation'], $withRelationAttr); - } - - // 预载入查询 - if (!$resultSet && !empty($options['with'])) { - $result->eagerlyResult($result, $options['with'], $withRelationAttr, false, $options['with_cache'] ?? false); - } - - // JOIN预载入查询 - if (!$resultSet && !empty($options['with_join'])) { - $result->eagerlyResult($result, $options['with_join'], $withRelationAttr, true, $options['with_cache'] ?? false); - } - - // 关联统计 - if (!empty($options['with_count'])) { - foreach ($options['with_count'] as $val) { - $result->relationCount($this, (array) $val[0], $val[1], $val[2], false); - } - } - } - -} diff --git a/vendor/topthink/think-orm/src/db/concern/ParamsBind.php b/vendor/topthink/think-orm/src/db/concern/ParamsBind.php deleted file mode 100644 index 2ae858c2..00000000 --- a/vendor/topthink/think-orm/src/db/concern/ParamsBind.php +++ /dev/null @@ -1,106 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -use PDO; - -/** - * 参数绑定支持 - */ -trait ParamsBind -{ - /** - * 当前参数绑定 - * @var array - */ - protected $bind = []; - - /** - * 批量参数绑定 - * @access public - * @param array $value 绑定变量值 - * @return $this - */ - public function bind(array $value) - { - $this->bind = array_merge($this->bind, $value); - return $this; - } - - /** - * 单个参数绑定 - * @access public - * @param mixed $value 绑定变量值 - * @param integer $type 绑定类型 - * @param string $name 绑定标识 - * @return string - */ - public function bindValue($value, int $type = null, string $name = null) - { - $name = $name ?: 'ThinkBind_' . (count($this->bind) + 1) . '_' . mt_rand() . '_'; - - $this->bind[$name] = [$value, $type ?: PDO::PARAM_STR]; - return $name; - } - - /** - * 检测参数是否已经绑定 - * @access public - * @param string $key 参数名 - * @return bool - */ - public function isBind($key) - { - return isset($this->bind[$key]); - } - - /** - * 参数绑定 - * @access public - * @param string $sql 绑定的sql表达式 - * @param array $bind 参数绑定 - * @return void - */ - protected function bindParams(string &$sql, array $bind = []): void - { - foreach ($bind as $key => $value) { - if (is_array($value)) { - $name = $this->bindValue($value[0], $value[1], $value[2] ?? null); - } else { - $name = $this->bindValue($value); - } - - if (is_numeric($key)) { - $sql = substr_replace($sql, ':' . $name, strpos($sql, '?'), 1); - } else { - $sql = str_replace(':' . $key, ':' . $name, $sql); - } - } - } - - /** - * 获取绑定的参数 并清空 - * @access public - * @param bool $clear 是否清空绑定数据 - * @return array - */ - public function getBind(bool $clear = true): array - { - $bind = $this->bind; - if ($clear) { - $this->bind = []; - } - - return $bind; - } -} diff --git a/vendor/topthink/think-orm/src/db/concern/ResultOperation.php b/vendor/topthink/think-orm/src/db/concern/ResultOperation.php deleted file mode 100644 index 563f9893..00000000 --- a/vendor/topthink/think-orm/src/db/concern/ResultOperation.php +++ /dev/null @@ -1,248 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -use think\Collection; -use think\db\exception\DataNotFoundException; -use think\db\exception\ModelNotFoundException; -use think\helper\Str; - -/** - * 查询数据处理 - */ -trait ResultOperation -{ - /** - * 是否允许返回空数据(或空模型) - * @access public - * @param bool $allowEmpty 是否允许为空 - * @return $this - */ - public function allowEmpty(bool $allowEmpty = true) - { - $this->options['allow_empty'] = $allowEmpty; - return $this; - } - - /** - * 设置查询数据不存在是否抛出异常 - * @access public - * @param bool $fail 数据不存在是否抛出异常 - * @return $this - */ - public function failException(bool $fail = true) - { - $this->options['fail'] = $fail; - return $this; - } - - /** - * 处理数据 - * @access protected - * @param array $result 查询数据 - * @return void - */ - protected function result(array &$result): void - { - if (!empty($this->options['json'])) { - $this->jsonResult($result, $this->options['json'], true); - } - - if (!empty($this->options['with_attr'])) { - $this->getResultAttr($result, $this->options['with_attr']); - } - - $this->filterResult($result); - } - - /** - * 处理数据集 - * @access public - * @param array $resultSet 数据集 - * @return void - */ - protected function resultSet(array &$resultSet): void - { - if (!empty($this->options['json'])) { - foreach ($resultSet as &$result) { - $this->jsonResult($result, $this->options['json'], true); - } - } - - if (!empty($this->options['with_attr'])) { - foreach ($resultSet as &$result) { - $this->getResultAttr($result, $this->options['with_attr']); - } - } - - if (!empty($this->options['visible']) || !empty($this->options['hidden'])) { - foreach ($resultSet as &$result) { - $this->filterResult($result); - } - } - - // 返回Collection对象 - $resultSet = new Collection($resultSet); - } - - /** - * 处理数据的可见和隐藏 - * @access protected - * @param array $result 查询数据 - * @return void - */ - protected function filterResult(&$result): void - { - if (!empty($this->options['visible'])) { - foreach ($this->options['visible'] as $key) { - $array[] = $key; - } - $result = array_intersect_key($result, array_flip($array)); - } elseif (!empty($this->options['hidden'])) { - foreach ($this->options['hidden'] as $key) { - $array[] = $key; - } - $result = array_diff_key($result, array_flip($array)); - } - } - - /** - * 使用获取器处理数据 - * @access protected - * @param array $result 查询数据 - * @param array $withAttr 字段获取器 - * @return void - */ - protected function getResultAttr(array &$result, array $withAttr = []): void - { - foreach ($withAttr as $name => $closure) { - $name = Str::snake($name); - - if (strpos($name, '.')) { - // 支持JSON字段 获取器定义 - list($key, $field) = explode('.', $name); - - if (isset($result[$key])) { - $result[$key][$field] = $closure($result[$key][$field] ?? null, $result[$key]); - } - } else { - $result[$name] = $closure($result[$name] ?? null, $result); - } - } - } - - /** - * 处理空数据 - * @access protected - * @return array|Model|null - * @throws DbException - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - protected function resultToEmpty() - { - if (!empty($this->options['fail'])) { - $this->throwNotFound(); - } elseif (!empty($this->options['allow_empty'])) { - return !empty($this->model) ? $this->model->newInstance() : []; - } - } - - /** - * 查找单条记录 不存在返回空数据(或者空模型) - * @access public - * @param mixed $data 数据 - * @return array|Model - */ - public function findOrEmpty($data = null) - { - return $this->allowEmpty(true)->find($data); - } - - /** - * JSON字段数据转换 - * @access protected - * @param array $result 查询数据 - * @param array $json JSON字段 - * @param bool $assoc 是否转换为数组 - * @param array $withRelationAttr 关联获取器 - * @return void - */ - protected function jsonResult(array &$result, array $json = [], bool $assoc = false, array $withRelationAttr = []): void - { - foreach ($json as $name) { - if (!isset($result[$name])) { - continue; - } - - $result[$name] = json_decode($result[$name], true); - - if (isset($withRelationAttr[$name])) { - foreach ($withRelationAttr[$name] as $key => $closure) { - $result[$name][$key] = $closure($result[$name][$key] ?? null, $result[$name]); - } - } - - if (!$assoc) { - $result[$name] = (object) $result[$name]; - } - } - } - - /** - * 查询失败 抛出异常 - * @access protected - * @return void - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - protected function throwNotFound(): void - { - if (!empty($this->model)) { - $class = get_class($this->model); - throw new ModelNotFoundException('model data Not Found:' . $class, $class, $this->options); - } - - $table = $this->getTable(); - throw new DataNotFoundException('table data not Found:' . $table, $table, $this->options); - } - - /** - * 查找多条记录 如果不存在则抛出异常 - * @access public - * @param array|string|Query|Closure $data 数据 - * @return array|Model - * @throws DbException - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - public function selectOrFail($data = null) - { - return $this->failException(true)->select($data); - } - - /** - * 查找单条记录 如果不存在则抛出异常 - * @access public - * @param array|string|Query|Closure $data 数据 - * @return array|Model - * @throws DbException - * @throws ModelNotFoundException - * @throws DataNotFoundException - */ - public function findOrFail($data = null) - { - return $this->failException(true)->find($data); - } - -} diff --git a/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php b/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php deleted file mode 100644 index 9070befe..00000000 --- a/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php +++ /dev/null @@ -1,99 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -/** - * 数据字段信息 - */ -trait TableFieldInfo -{ - - /** - * 获取数据表字段信息 - * @access public - * @param string $tableName 数据表名 - * @return array - */ - public function getTableFields($tableName = ''): array - { - if ('' == $tableName) { - $tableName = $this->getTable(); - } - - return $this->connection->getTableFields($tableName); - } - - /** - * 获取详细字段类型信息 - * @access public - * @param string $tableName 数据表名称 - * @return array - */ - public function getFields(string $tableName = ''): array - { - return $this->connection->getFields($tableName ?: $this->getTable()); - } - - /** - * 获取字段类型信息 - * @access public - * @return array - */ - public function getFieldsType(): array - { - if (!empty($this->options['field_type'])) { - return $this->options['field_type']; - } - - return $this->connection->getFieldsType($this->getTable()); - } - - /** - * 获取字段类型信息 - * @access public - * @param string $field 字段名 - * @return string|null - */ - public function getFieldType(string $field) - { - $fieldType = $this->getFieldsType(); - - return $fieldType[$field] ?? null; - } - - /** - * 获取字段类型信息 - * @access public - * @return array - */ - public function getFieldsBindType(): array - { - $fieldType = $this->getFieldsType(); - - return array_map([$this->connection, 'getFieldBindType'], $fieldType); - } - - /** - * 获取字段类型信息 - * @access public - * @param string $field 字段名 - * @return int - */ - public function getFieldBindType(string $field): int - { - $fieldType = $this->getFieldType($field); - - return $this->connection->getFieldBindType($fieldType ?: ''); - } - -} diff --git a/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php b/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php deleted file mode 100644 index 1267e540..00000000 --- a/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php +++ /dev/null @@ -1,214 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -/** - * 时间查询支持 - */ -trait TimeFieldQuery -{ - /** - * 日期查询表达式 - * @var array - */ - protected $timeRule = [ - 'today' => ['today', 'tomorrow -1second'], - 'yesterday' => ['yesterday', 'today -1second'], - 'week' => ['this week 00:00:00', 'next week 00:00:00 -1second'], - 'last week' => ['last week 00:00:00', 'this week 00:00:00 -1second'], - 'month' => ['first Day of this month 00:00:00', 'first Day of next month 00:00:00 -1second'], - 'last month' => ['first Day of last month 00:00:00', 'first Day of this month 00:00:00 -1second'], - 'year' => ['this year 1/1', 'next year 1/1 -1second'], - 'last year' => ['last year 1/1', 'this year 1/1 -1second'], - ]; - - /** - * 添加日期或者时间查询规则 - * @access public - * @param array $rule 时间表达式 - * @return $this - */ - public function timeRule(array $rule) - { - $this->timeRule = array_merge($this->timeRule, $rule); - return $this; - } - - /** - * 查询日期或者时间 - * @access public - * @param string $field 日期字段名 - * @param string $op 比较运算符或者表达式 - * @param string|array $range 比较范围 - * @param string $logic AND OR - * @return $this - */ - public function whereTime(string $field, string $op, $range = null, string $logic = 'AND') - { - if (is_null($range)) { - if (isset($this->timeRule[$op])) { - $range = $this->timeRule[$op]; - } else { - $range = $op; - } - $op = is_array($range) ? 'between' : '>='; - } - - return $this->parseWhereExp($logic, $field, strtolower($op) . ' time', $range, [], true); - } - - /** - * 查询某个时间间隔数据 - * @access public - * @param string $field 日期字段名 - * @param string $start 开始时间 - * @param string $interval 时间间隔单位 day/month/year/week/hour/minute/second - * @param int $step 间隔 - * @param string $logic AND OR - * @return $this - */ - public function whereTimeInterval(string $field, string $start, string $interval = 'day', int $step = 1, string $logic = 'AND') - { - $startTime = strtotime($start); - $endTime = strtotime(($step > 0 ? '+' : '-') . abs($step) . ' ' . $interval . (abs($step) > 1 ? 's' : ''), $startTime); - - return $this->whereTime($field, 'between', $step > 0 ? [$startTime, $endTime - 1] : [$endTime, $startTime - 1], $logic); - } - - /** - * 查询月数据 whereMonth('time_field', '2018-1') - * @access public - * @param string $field 日期字段名 - * @param string $month 月份信息 - * @param int $step 间隔 - * @param string $logic AND OR - * @return $this - */ - public function whereMonth(string $field, string $month = 'this month', int $step = 1, string $logic = 'AND') - { - if (in_array($month, ['this month', 'last month'])) { - $month = date('Y-m', strtotime($month)); - } - - return $this->whereTimeInterval($field, $month, 'month', $step, $logic); - } - - /** - * 查询周数据 whereWeek('time_field', '2018-1-1') 从2018-1-1开始的一周数据 - * @access public - * @param string $field 日期字段名 - * @param string $week 周信息 - * @param int $step 间隔 - * @param string $logic AND OR - * @return $this - */ - public function whereWeek(string $field, string $week = 'this week', int $step = 1, string $logic = 'AND') - { - if (in_array($week, ['this week', 'last week'])) { - $week = date('Y-m-d', strtotime($week)); - } - - return $this->whereTimeInterval($field, $week, 'week', $step, $logic); - } - - /** - * 查询年数据 whereYear('time_field', '2018') - * @access public - * @param string $field 日期字段名 - * @param string $year 年份信息 - * @param int $step 间隔 - * @param string $logic AND OR - * @return $this - */ - public function whereYear(string $field, string $year = 'this year', int $step = 1, string $logic = 'AND') - { - if (in_array($year, ['this year', 'last year'])) { - $year = date('Y', strtotime($year)); - } - - return $this->whereTimeInterval($field, $year . '-1-1', 'year', $step, $logic); - } - - /** - * 查询日数据 whereDay('time_field', '2018-1-1') - * @access public - * @param string $field 日期字段名 - * @param string $day 日期信息 - * @param int $step 间隔 - * @param string $logic AND OR - * @return $this - */ - public function whereDay(string $field, string $day = 'today', int $step = 1, string $logic = 'AND') - { - if (in_array($day, ['today', 'yesterday'])) { - $day = date('Y-m-d', strtotime($day)); - } - - return $this->whereTimeInterval($field, $day, 'day', $step, $logic); - } - - /** - * 查询日期或者时间范围 whereBetweenTime('time_field', '2018-1-1','2018-1-15') - * @access public - * @param string $field 日期字段名 - * @param string|int $startTime 开始时间 - * @param string|int $endTime 结束时间 - * @param string $logic AND OR - * @return $this - */ - public function whereBetweenTime(string $field, $startTime, $endTime, string $logic = 'AND') - { - return $this->whereTime($field, 'between', [$startTime, $endTime], $logic); - } - - /** - * 查询日期或者时间范围 whereNotBetweenTime('time_field', '2018-1-1','2018-1-15') - * @access public - * @param string $field 日期字段名 - * @param string|int $startTime 开始时间 - * @param string|int $endTime 结束时间 - * @return $this - */ - public function whereNotBetweenTime(string $field, $startTime, $endTime) - { - return $this->whereTime($field, '<', $startTime) - ->whereTime($field, '>', $endTime); - } - - /** - * 查询当前时间在两个时间字段范围 whereBetweenTimeField('start_time', 'end_time') - * @access public - * @param string $startField 开始时间字段 - * @param string $endField 结束时间字段 - * @return $this - */ - public function whereBetweenTimeField(string $startField, string $endField) - { - return $this->whereTime($startField, '<=', time()) - ->whereTime($endField, '>=', time()); - } - - /** - * 查询当前时间不在两个时间字段范围 whereNotBetweenTimeField('start_time', 'end_time') - * @access public - * @param string $startField 开始时间字段 - * @param string $endField 结束时间字段 - * @return $this - */ - public function whereNotBetweenTimeField(string $startField, string $endField) - { - return $this->whereTime($startField, '>', time()) - ->whereTime($endField, '<', time(), 'OR'); - } - -} diff --git a/vendor/topthink/think-orm/src/db/concern/Transaction.php b/vendor/topthink/think-orm/src/db/concern/Transaction.php deleted file mode 100644 index f804ae2d..00000000 --- a/vendor/topthink/think-orm/src/db/concern/Transaction.php +++ /dev/null @@ -1,117 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -use think\db\BaseQuery; - -/** - * 事务支持 - */ -trait Transaction -{ - - /** - * 执行数据库Xa事务 - * @access public - * @param callable $callback 数据操作方法回调 - * @param array $dbs 多个查询对象或者连接对象 - * @return mixed - * @throws PDOException - * @throws \Exception - * @throws \Throwable - */ - public function transactionXa($callback, array $dbs = []) - { - $xid = uniqid('xa'); - - if (empty($dbs)) { - $dbs[] = $this->getConnection(); - } - - foreach ($dbs as $key => $db) { - if ($db instanceof BaseQuery) { - $db = $db->getConnection(); - - $dbs[$key] = $db; - } - - $db->startTransXa($xid); - } - - try { - $result = null; - if (is_callable($callback)) { - $result = call_user_func_array($callback, [$this]); - } - - foreach ($dbs as $db) { - $db->prepareXa($xid); - } - - foreach ($dbs as $db) { - $db->commitXa($xid); - } - - return $result; - } catch (\Exception | \Throwable $e) { - foreach ($dbs as $db) { - $db->rollbackXa($xid); - } - throw $e; - } - } - - /** - * 执行数据库事务 - * @access public - * @param callable $callback 数据操作方法回调 - * @return mixed - */ - public function transaction(callable $callback) - { - return $this->connection->transaction($callback); - } - - /** - * 启动事务 - * @access public - * @return void - */ - public function startTrans(): void - { - $this->connection->startTrans(); - } - - /** - * 用于非自动提交状态下面的查询提交 - * @access public - * @return void - * @throws PDOException - */ - public function commit(): void - { - $this->connection->commit(); - } - - /** - * 事务回滚 - * @access public - * @return void - * @throws PDOException - */ - public function rollback(): void - { - $this->connection->rollback(); - } - -} diff --git a/vendor/topthink/think-orm/src/db/concern/WhereQuery.php b/vendor/topthink/think-orm/src/db/concern/WhereQuery.php deleted file mode 100644 index 33b07637..00000000 --- a/vendor/topthink/think-orm/src/db/concern/WhereQuery.php +++ /dev/null @@ -1,540 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\concern; - -use Closure; -use think\db\BaseQuery; -use think\db\Raw; - -trait WhereQuery -{ - /** - * 指定AND查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @return $this - */ - public function where($field, $op = null, $condition = null) - { - if ($field instanceof $this) { - $this->parseQueryWhere($field); - return $this; - } elseif (true === $field || 1 === $field) { - $this->options['where']['AND'][] = true; - return $this; - } - - $param = func_get_args(); - array_shift($param); - return $this->parseWhereExp('AND', $field, $op, $condition, $param); - } - - /** - * 解析Query对象查询条件 - * @access public - * @param BaseQuery $query 查询对象 - * @return void - */ - protected function parseQueryWhere(BaseQuery $query): void - { - $this->options['where'] = $query->getOptions('where'); - - if ($query->getOptions('via')) { - $via = $query->getOptions('via'); - foreach ($this->options['where'] as $logic => &$where) { - foreach ($where as $key => &$val) { - if (is_array($val) && !strpos($val[0], '.')) { - $val[0] = $via . '.' . $val[0]; - } - } - } - } - - $this->bind($query->getBind(false)); - } - - /** - * 指定OR查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @return $this - */ - public function whereOr($field, $op = null, $condition = null) - { - $param = func_get_args(); - array_shift($param); - return $this->parseWhereExp('OR', $field, $op, $condition, $param); - } - - /** - * 指定XOR查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @return $this - */ - public function whereXor($field, $op = null, $condition = null) - { - $param = func_get_args(); - array_shift($param); - return $this->parseWhereExp('XOR', $field, $op, $condition, $param); - } - - /** - * 指定Null查询条件 - * @access public - * @param mixed $field 查询字段 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereNull(string $field, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'NULL', null, [], true); - } - - /** - * 指定NotNull查询条件 - * @access public - * @param mixed $field 查询字段 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereNotNull(string $field, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'NOTNULL', null, [], true); - } - - /** - * 指定Exists查询条件 - * @access public - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereExists($condition, string $logic = 'AND') - { - if (is_string($condition)) { - $condition = new Raw($condition); - } - - $this->options['where'][strtoupper($logic)][] = ['', 'EXISTS', $condition]; - return $this; - } - - /** - * 指定NotExists查询条件 - * @access public - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereNotExists($condition, string $logic = 'AND') - { - if (is_string($condition)) { - $condition = new Raw($condition); - } - - $this->options['where'][strtoupper($logic)][] = ['', 'NOT EXISTS', $condition]; - return $this; - } - - /** - * 指定In查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereIn(string $field, $condition, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'IN', $condition, [], true); - } - - /** - * 指定NotIn查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereNotIn(string $field, $condition, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'NOT IN', $condition, [], true); - } - - /** - * 指定Like查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereLike(string $field, $condition, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'LIKE', $condition, [], true); - } - - /** - * 指定NotLike查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereNotLike(string $field, $condition, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'NOT LIKE', $condition, [], true); - } - - /** - * 指定Between查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereBetween(string $field, $condition, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'BETWEEN', $condition, [], true); - } - - /** - * 指定NotBetween查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereNotBetween(string $field, $condition, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'NOT BETWEEN', $condition, [], true); - } - - /** - * 指定FIND_IN_SET查询条件 - * @access public - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereFindInSet(string $field, $condition, string $logic = 'AND') - { - return $this->parseWhereExp($logic, $field, 'FIND IN SET', $condition, [], true); - } - - /** - * 比较两个字段 - * @access public - * @param string $field1 查询字段 - * @param string $operator 比较操作符 - * @param string $field2 比较字段 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereColumn(string $field1, string $operator, string $field2 = null, string $logic = 'AND') - { - if (is_null($field2)) { - $field2 = $operator; - $operator = '='; - } - - return $this->parseWhereExp($logic, $field1, 'COLUMN', [$operator, $field2], [], true); - } - - /** - * 设置软删除字段及条件 - * @access public - * @param string $field 查询字段 - * @param mixed $condition 查询条件 - * @return $this - */ - public function useSoftDelete(string $field, $condition = null) - { - if ($field) { - $this->options['soft_delete'] = [$field, $condition]; - } - - return $this; - } - - /** - * 指定Exp查询条件 - * @access public - * @param mixed $field 查询字段 - * @param string $where 查询条件 - * @param array $bind 参数绑定 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereExp(string $field, string $where, array $bind = [], string $logic = 'AND') - { - if (!empty($bind)) { - $this->bindParams($where, $bind); - } - - $this->options['where'][$logic][] = [$field, 'EXP', new Raw($where)]; - - return $this; - } - - /** - * 指定字段Raw查询 - * @access public - * @param string $field 查询字段表达式 - * @param mixed $op 查询表达式 - * @param string $condition 查询条件 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereFieldRaw(string $field, $op, $condition = null, string $logic = 'AND') - { - if (is_null($condition)) { - $condition = $op; - $op = '='; - } - - $this->options['where'][$logic][] = [new Raw($field), $op, $condition]; - return $this; - } - - /** - * 指定表达式查询条件 - * @access public - * @param string $where 查询条件 - * @param array $bind 参数绑定 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function whereRaw(string $where, array $bind = [], string $logic = 'AND') - { - if (!empty($bind)) { - $this->bindParams($where, $bind); - } - - $this->options['where'][$logic][] = new Raw($where); - - return $this; - } - - /** - * 指定表达式查询条件 OR - * @access public - * @param string $where 查询条件 - * @param array $bind 参数绑定 - * @return $this - */ - public function whereOrRaw(string $where, array $bind = []) - { - return $this->whereRaw($where, $bind, 'OR'); - } - - /** - * 分析查询表达式 - * @access protected - * @param string $logic 查询逻辑 and or xor - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @param array $param 查询参数 - * @param bool $strict 严格模式 - * @return $this - */ - protected function parseWhereExp(string $logic, $field, $op, $condition, array $param = [], bool $strict = false) - { - $logic = strtoupper($logic); - - if (is_string($field) && !empty($this->options['via']) && false === strpos($field, '.')) { - $field = $this->options['via'] . '.' . $field; - } - - if ($field instanceof Raw) { - return $this->whereRaw($field, is_array($op) ? $op : [], $logic); - } elseif ($strict) { - // 使用严格模式查询 - if ('=' == $op) { - $where = $this->whereEq($field, $condition); - } else { - $where = [$field, $op, $condition, $logic]; - } - } elseif (is_array($field)) { - // 解析数组批量查询 - return $this->parseArrayWhereItems($field, $logic); - } elseif ($field instanceof Closure) { - $where = $field; - } elseif (is_string($field)) { - if (preg_match('/[,=\<\'\"\(\s]/', $field)) { - return $this->whereRaw($field, is_array($op) ? $op : [], $logic); - } elseif (is_string($op) && strtolower($op) == 'exp') { - $bind = isset($param[2]) && is_array($param[2]) ? $param[2] : []; - return $this->whereExp($field, $condition, $bind, $logic); - } - - $where = $this->parseWhereItem($logic, $field, $op, $condition, $param); - } - - if (!empty($where)) { - $this->options['where'][$logic][] = $where; - } - - return $this; - } - - /** - * 分析查询表达式 - * @access protected - * @param string $logic 查询逻辑 and or xor - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @param array $param 查询参数 - * @return array - */ - protected function parseWhereItem(string $logic, $field, $op, $condition, array $param = []): array - { - if (is_array($op)) { - // 同一字段多条件查询 - array_unshift($param, $field); - $where = $param; - } elseif ($field && is_null($condition)) { - if (is_string($op) && in_array(strtoupper($op), ['NULL', 'NOTNULL', 'NOT NULL'], true)) { - // null查询 - $where = [$field, $op, '']; - } elseif ('=' === $op || is_null($op)) { - $where = [$field, 'NULL', '']; - } elseif ('<>' === $op) { - $where = [$field, 'NOTNULL', '']; - } else { - // 字段相等查询 - $where = $this->whereEq($field, $op); - } - } elseif (is_string($op) && in_array(strtoupper($op), ['EXISTS', 'NOT EXISTS', 'NOTEXISTS'], true)) { - $where = [$field, $op, is_string($condition) ? new Raw($condition) : $condition]; - } else { - $where = $field ? [$field, $op, $condition, $param[2] ?? null] : []; - } - - return $where; - } - - /** - * 相等查询的主键处理 - * @access protected - * @param string $field 字段名 - * @param mixed $value 字段值 - * @return array - */ - protected function whereEq(string $field, $value): array - { - if ($this->getPk() == $field) { - $this->options['key'] = $value; - } - - return [$field, '=', $value]; - } - - /** - * 数组批量查询 - * @access protected - * @param array $field 批量查询 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - protected function parseArrayWhereItems(array $field, string $logic) - { - if (key($field) !== 0) { - $where = []; - foreach ($field as $key => $val) { - if ($val instanceof Raw) { - $where[] = [$key, 'exp', $val]; - } else { - $where[] = is_null($val) ? [$key, 'NULL', ''] : [$key, is_array($val) ? 'IN' : '=', $val]; - } - } - } else { - // 数组批量查询 - $where = $field; - } - - if (!empty($where)) { - $this->options['where'][$logic] = isset($this->options['where'][$logic]) ? - array_merge($this->options['where'][$logic], $where) : $where; - } - - return $this; - } - - /** - * 去除某个查询条件 - * @access public - * @param string $field 查询字段 - * @param string $logic 查询逻辑 and or xor - * @return $this - */ - public function removeWhereField(string $field, string $logic = 'AND') - { - $logic = strtoupper($logic); - - if (isset($this->options['where'][$logic])) { - foreach ($this->options['where'][$logic] as $key => $val) { - if (is_array($val) && $val[0] == $field) { - unset($this->options['where'][$logic][$key]); - } - } - } - - return $this; - } - - /** - * 条件查询 - * @access public - * @param mixed $condition 满足条件(支持闭包) - * @param Closure|array $query 满足条件后执行的查询表达式(闭包或数组) - * @param Closure|array $otherwise 不满足条件后执行 - * @return $this - */ - public function when($condition, $query, $otherwise = null) - { - if ($condition instanceof Closure) { - $condition = $condition($this); - } - - if ($condition) { - if ($query instanceof Closure) { - $query($this, $condition); - } elseif (is_array($query)) { - $this->where($query); - } - } elseif ($otherwise) { - if ($otherwise instanceof Closure) { - $otherwise($this, $condition); - } elseif (is_array($otherwise)) { - $this->where($otherwise); - } - } - - return $this; - } -} diff --git a/vendor/topthink/think-orm/src/db/connector/Mongo.php b/vendor/topthink/think-orm/src/db/connector/Mongo.php deleted file mode 100644 index 647c286e..00000000 --- a/vendor/topthink/think-orm/src/db/connector/Mongo.php +++ /dev/null @@ -1,1055 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\connector; - -use Closure; -use MongoDB\BSON\ObjectID; -use MongoDB\Driver\BulkWrite; -use MongoDB\Driver\Command; -use MongoDB\Driver\Cursor; -use MongoDB\Driver\Exception\AuthenticationException; -use MongoDB\Driver\Exception\BulkWriteException; -use MongoDB\Driver\Exception\ConnectionException; -use MongoDB\Driver\Exception\InvalidArgumentException; -use MongoDB\Driver\Exception\RuntimeException; -use MongoDB\Driver\Manager; -use MongoDB\Driver\Query as MongoQuery; -use MongoDB\Driver\ReadPreference; -use think\db\BaseQuery; -use think\db\builder\Mongo as Builder; -use think\db\Connection; -use think\db\ConnectionInterface; -use think\db\exception\DbException as Exception; -use think\db\Mongo as Query; - -/** - * Mongo数据库驱动 - */ -class Mongo extends Connection implements ConnectionInterface -{ - - // 查询数据类型 - protected $dbName = ''; - protected $typeMap = 'array'; - protected $mongo; // MongoDb Object - protected $cursor; // MongoCursor Object - - // 数据库连接参数配置 - protected $config = [ - // 数据库类型 - 'type' => '', - // 服务器地址 - 'hostname' => '', - // 数据库名 - 'database' => '', - // 是否是复制集 - 'is_replica_set' => false, - // 用户名 - 'username' => '', - // 密码 - 'password' => '', - // 端口 - 'hostport' => '', - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 主键名 - 'pk' => '_id', - // 主键类型 - 'pk_type' => 'ObjectID', - // 数据库表前缀 - 'prefix' => '', - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 开启字段缓存 - 'fields_cache' => false, - // 监听SQL - 'trigger_sql' => true, - // 自动写入时间戳字段 - 'auto_timestamp' => false, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 是否_id转换为id - 'pk_convert_id' => false, - // typeMap - 'type_map' => ['root' => 'array', 'document' => 'array'], - ]; - - /** - * 架构函数 读取数据库配置信息 - * @access public - * @param array $config 数据库配置数组 - */ - public function __construct(array $config = []) - { - if (!empty($config)) { - $this->config = array_merge($this->config, $config); - } - - // 创建Builder对象 - $class = $this->getBuilderClass(); - - $this->builder = new $class($this); - } - - /** - * 获取当前连接器类对应的Query类 - * @access public - * @return string - */ - public function getQueryClass(): string - { - return Query::class; - } - - /** - * 获取当前的builder实例对象 - * @access public - * @return Builder - */ - public function getBuilder(): Builder - { - return $this->builder; - } - - /** - * 获取当前连接器类对应的Builder类 - * @access public - * @return string - */ - public function getBuilderClass(): string - { - return Builder::class; - } - - /** - * 连接数据库方法 - * @access public - * @param array $config 连接参数 - * @param integer $linkNum 连接序号 - * @return Manager - * @throws InvalidArgumentException - * @throws RuntimeException - */ - public function connect(array $config = [], $linkNum = 0) - { - if (!isset($this->links[$linkNum])) { - if (empty($config)) { - $config = $this->config; - } else { - $config = array_merge($this->config, $config); - } - - $this->dbName = $config['database']; - $this->typeMap = $config['type_map']; - - if ($config['pk_convert_id'] && '_id' == $config['pk']) { - $this->config['pk'] = 'id'; - } - - if (empty($config['dsn'])) { - $config['dsn'] = 'mongodb://' . ($config['username'] ? "{$config['username']}" : '') . ($config['password'] ? ":{$config['password']}@" : '') . $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}" : ''); - } - - $startTime = microtime(true); - - $this->links[$linkNum] = new Manager($config['dsn'], $config['params']); - - if (!empty($config['trigger_sql'])) { - // 记录数据库连接信息 - $this->trigger('CONNECT:[ UseTime:' . number_format(microtime(true) - $startTime, 6) . 's ] ' . $config['dsn']); - } - - } - - return $this->links[$linkNum]; - } - - /** - * 获取Mongo Manager对象 - * @access public - * @return Manager|null - */ - public function getMongo() - { - return $this->mongo ?: null; - } - - /** - * 设置/获取当前操作的database - * @access public - * @param string $db db - * @throws Exception - */ - public function db(string $db = null) - { - if (is_null($db)) { - return $this->dbName; - } else { - $this->dbName = $db; - } - } - - /** - * 执行查询但只返回Cursor对象 - * @access public - * @param BaseQuery $query 查询对象 - * @return Cursor - */ - public function cursor(BaseQuery $query) - { - // 分析查询表达式 - $options = $query->parseOptions(); - - // 生成MongoQuery对象 - $mongoQuery = $this->builder->select($query); - - $master = $query->getOptions('master') ? true : false; - - // 执行查询操作 - return $this->getCursor($query, $mongoQuery, $master); - } - - /** - * 执行查询并返回Cursor对象 - * @access public - * @param BaseQuery $query 查询对象 - * @param MongoQuery|Closure $mongoQuery Mongo查询对象 - * @param bool $master 是否主库操作 - * @return Cursor - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - */ - public function getCursor(BaseQuery $query, $mongoQuery, bool $master = false): Cursor - { - $this->initConnect($master); - $this->db->updateQueryTimes(); - - $options = $query->getOptions(); - $namespace = $options['table']; - - if (false === strpos($namespace, '.')) { - $namespace = $this->dbName . '.' . $namespace; - } - - if (!empty($this->queryStr)) { - // 记录执行指令 - $this->queryStr = 'db' . strstr($namespace, '.') . '.' . $this->queryStr; - } - - if ($mongoQuery instanceof Closure) { - $mongoQuery = $mongoQuery($query); - } - - $readPreference = $options['readPreference'] ?? null; - $this->queryStartTime = microtime(true); - - $this->cursor = $this->mongo->executeQuery($namespace, $mongoQuery, $readPreference); - - // SQL监控 - if (!empty($this->config['trigger_sql'])) { - $this->trigger('', $master); - } - - return $this->cursor; - } - - /** - * 执行查询 - * @access public - * @param BaseQuery $query 查询对象 - * @param MongoQuery|Closure $mongoQuery Mongo查询对象 - * @return array - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - */ - public function query(BaseQuery $query, $mongoQuery): array - { - $options = $query->parseOptions(); - - if ($query->getOptions('cache')) { - // 检查查询缓存 - $cacheItem = $this->parseCache($query, $query->getOptions('cache')); - $key = $cacheItem->getKey(); - - if ($this->cache->has($key)) { - return $this->cache->get($key); - } - } - - if ($mongoQuery instanceof Closure) { - $mongoQuery = $mongoQuery($query); - } - - $master = $query->getOptions('master') ? true : false; - $this->getCursor($query, $mongoQuery, $master); - - $resultSet = $this->getResult($options['typeMap']); - - if (isset($cacheItem) && $resultSet) { - // 缓存数据集 - $cacheItem->set($resultSet); - $this->cacheData($cacheItem); - } - - return $resultSet; - } - - /** - * 执行写操作 - * @access public - * @param BaseQuery $query - * @param BulkWrite $bulk - * - * @return WriteResult - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - * @throws BulkWriteException - */ - public function execute(BaseQuery $query, BulkWrite $bulk) - { - $this->initConnect(true); - $this->db->updateQueryTimes(); - - $options = $query->getOptions(); - - $namespace = $options['table']; - if (false === strpos($namespace, '.')) { - $namespace = $this->dbName . '.' . $namespace; - } - - if (!empty($this->queryStr)) { - // 记录执行指令 - $this->queryStr = 'db' . strstr($namespace, '.') . '.' . $this->queryStr; - } - - $writeConcern = $options['writeConcern'] ?? null; - $this->queryStartTime = microtime(true); - - $writeResult = $this->mongo->executeBulkWrite($namespace, $bulk, $writeConcern); - - // SQL监控 - if (!empty($this->config['trigger_sql'])) { - $this->trigger(); - } - - $this->numRows = $writeResult->getMatchedCount(); - - if ($query->getOptions('cache')) { - // 清理缓存数据 - $cacheItem = $this->parseCache($query, $query->getOptions('cache')); - $key = $cacheItem->getKey(); - $tag = $cacheItem->getTag(); - - if (isset($key) && $this->cache->has($key)) { - $this->cache->delete($key); - } elseif (!empty($tag) && method_exists($this->cache, 'tag')) { - $this->cache->tag($tag)->clear(); - } - } - - return $writeResult; - } - - /** - * 执行指令 - * @access public - * @param Command $command 指令 - * @param string $dbName 当前数据库名 - * @param ReadPreference $readPreference readPreference - * @param string|array $typeMap 指定返回的typeMap - * @param bool $master 是否主库操作 - * @return array - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - */ - public function command(Command $command, string $dbName = '', ReadPreference $readPreference = null, $typeMap = null, bool $master = false): array - { - $this->initConnect($master); - $this->db->updateQueryTimes(); - - $this->queryStartTime = microtime(true); - - $dbName = $dbName ?: $this->dbName; - - if (!empty($this->queryStr)) { - $this->queryStr = 'db.' . $this->queryStr; - } - - $this->cursor = $this->mongo->executeCommand($dbName, $command, $readPreference); - - // SQL监控 - if (!empty($this->config['trigger_sql'])) { - $this->trigger('', $master); - } - - return $this->getResult($typeMap); - } - - /** - * 获得数据集 - * @access protected - * @param string|array $typeMap 指定返回的typeMap - * @return mixed - */ - protected function getResult($typeMap = null): array - { - // 设置结果数据类型 - if (is_null($typeMap)) { - $typeMap = $this->typeMap; - } - - $typeMap = is_string($typeMap) ? ['root' => $typeMap] : $typeMap; - - $this->cursor->setTypeMap($typeMap); - - // 获取数据集 - $result = $this->cursor->toArray(); - - if ($this->getConfig('pk_convert_id')) { - // 转换ObjectID 字段 - foreach ($result as &$data) { - $this->convertObjectID($data); - } - } - - $this->numRows = count($result); - - return $result; - } - - /** - * ObjectID处理 - * @access protected - * @param array $data 数据 - * @return void - */ - protected function convertObjectID(array &$data): void - { - if (isset($data['_id']) && is_object($data['_id'])) { - $data['id'] = $data['_id']->__toString(); - unset($data['_id']); - } - } - - /** - * 数据库日志记录(仅供参考) - * @access public - * @param string $type 类型 - * @param mixed $data 数据 - * @param array $options 参数 - * @return void - */ - public function mongoLog(string $type, $data, array $options = []) - { - if (!$this->config['trigger_sql']) { - return; - } - - if (is_array($data)) { - array_walk_recursive($data, function (&$value) { - if ($value instanceof ObjectID) { - $value = $value->__toString(); - } - }); - } - - switch (strtolower($type)) { - case 'aggregate': - $this->queryStr = 'runCommand(' . ($data ? json_encode($data) : '') . ');'; - break; - case 'find': - $this->queryStr = $type . '(' . ($data ? json_encode($data) : '') . ')'; - - if (isset($options['sort'])) { - $this->queryStr .= '.sort(' . json_encode($options['sort']) . ')'; - } - - if (isset($options['skip'])) { - $this->queryStr .= '.skip(' . $options['skip'] . ')'; - } - - if (isset($options['limit'])) { - $this->queryStr .= '.limit(' . $options['limit'] . ')'; - } - - $this->queryStr .= ';'; - break; - case 'insert': - case 'remove': - $this->queryStr = $type . '(' . ($data ? json_encode($data) : '') . ');'; - break; - case 'update': - $this->queryStr = $type . '(' . json_encode($options) . ',' . json_encode($data) . ');'; - break; - case 'cmd': - $this->queryStr = $data . '(' . json_encode($options) . ');'; - break; - } - - $this->options = $options; - } - - /** - * 获取最近执行的指令 - * @access public - * @return string - */ - public function getLastSql(): string - { - return $this->queryStr; - } - - /** - * 关闭数据库 - * @access public - */ - public function close() - { - $this->mongo = null; - $this->cursor = null; - $this->linkRead = null; - $this->linkWrite = null; - $this->links = []; - } - - /** - * 初始化数据库连接 - * @access protected - * @param boolean $master 是否主服务器 - * @return void - */ - protected function initConnect(bool $master = true): void - { - if (!empty($this->config['deploy'])) { - // 采用分布式数据库 - if ($master) { - if (!$this->linkWrite) { - $this->linkWrite = $this->multiConnect(true); - } - - $this->mongo = $this->linkWrite; - } else { - if (!$this->linkRead) { - $this->linkRead = $this->multiConnect(false); - } - - $this->mongo = $this->linkRead; - } - } elseif (!$this->mongo) { - // 默认单数据库 - $this->mongo = $this->connect(); - } - } - - /** - * 连接分布式服务器 - * @access protected - * @param boolean $master 主服务器 - * @return Manager - */ - protected function multiConnect(bool $master = false): Manager - { - $config = []; - // 分布式数据库配置解析 - foreach (['username', 'password', 'hostname', 'hostport', 'database', 'dsn'] as $name) { - $config[$name] = is_string($this->config[$name]) ? explode(',', $this->config[$name]) : $this->config[$name]; - } - - // 主服务器序号 - $m = floor(mt_rand(0, $this->config['master_num'] - 1)); - - if ($this->config['rw_separate']) { - // 主从式采用读写分离 - if ($master) // 主服务器写入 - { - if ($this->config['is_replica_set']) { - return $this->replicaSetConnect(); - } else { - $r = $m; - } - } elseif (is_numeric($this->config['slave_no'])) { - // 指定服务器读 - $r = $this->config['slave_no']; - } else { - // 读操作连接从服务器 每次随机连接的数据库 - $r = floor(mt_rand($this->config['master_num'], count($config['hostname']) - 1)); - } - } else { - // 读写操作不区分服务器 每次随机连接的数据库 - $r = floor(mt_rand(0, count($config['hostname']) - 1)); - } - - $dbConfig = []; - - foreach (['username', 'password', 'hostname', 'hostport', 'database', 'dsn'] as $name) { - $dbConfig[$name] = $config[$name][$r] ?? $config[$name][0]; - } - - return $this->connect($dbConfig, $r); - } - - /** - * 创建基于复制集的连接 - * @return Manager - */ - public function replicaSetConnect(): Manager - { - $this->dbName = $this->config['database']; - $this->typeMap = $this->config['type_map']; - - $startTime = microtime(true); - - $this->config['params']['replicaSet'] = $this->config['database']; - - $manager = new Manager($this->buildUrl(), $this->config['params']); - - // 记录数据库连接信息 - if (!empty($config['trigger_sql'])) { - $this->trigger('CONNECT:ReplicaSet[ UseTime:' . number_format(microtime(true) - $startTime, 6) . 's ] ' . $this->config['dsn']); - } - - return $manager; - } - - /** - * 根据配置信息 生成适用于连接复制集的 URL - * @return string - */ - private function buildUrl(): string - { - $url = 'mongodb://' . ($this->config['username'] ? "{$this->config['username']}" : '') . ($this->config['password'] ? ":{$this->config['password']}@" : ''); - - $hostList = is_string($this->config['hostname']) ? explode(',', $this->config['hostname']) : $this->config['hostname']; - $portList = is_string($this->config['hostport']) ? explode(',', $this->config['hostport']) : $this->config['hostport']; - - for ($i = 0; $i < count($hostList); $i++) { - $url = $url . $hostList[$i] . ':' . $portList[0] . ','; - } - - return rtrim($url, ",") . '/'; - } - - /** - * 插入记录 - * @access public - * @param BaseQuery $query 查询对象 - * @param boolean $getLastInsID 返回自增主键 - * @return mixed - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - * @throws BulkWriteException - */ - public function insert(BaseQuery $query, bool $getLastInsID = false) - { - // 分析查询表达式 - $options = $query->parseOptions(); - - if (empty($options['data'])) { - throw new Exception('miss data to insert'); - } - - // 生成bulk对象 - $bulk = $this->builder->insert($query); - - $writeResult = $this->execute($query, $bulk); - $result = $writeResult->getInsertedCount(); - - if ($result) { - $data = $options['data']; - $lastInsId = $this->getLastInsID($query); - - if ($lastInsId) { - $pk = $query->getPk(); - $data[$pk] = $lastInsId; - } - - $query->setOption('data', $data); - - $this->db->trigger('after_insert', $query); - - if ($getLastInsID) { - return $lastInsId; - } - } - - return $result; - } - - /** - * 获取最近插入的ID - * @access public - * @param BaseQuery $query 查询对象 - * @return mixed - */ - public function getLastInsID(BaseQuery $query) - { - $id = $this->builder->getLastInsID(); - - if (is_array($id)) { - array_walk($id, function (&$item, $key) { - if ($item instanceof ObjectID) { - $item = $item->__toString(); - } - }); - } elseif ($id instanceof ObjectID) { - $id = $id->__toString(); - } - - return $id; - } - - /** - * 批量插入记录 - * @access public - * @param BaseQuery $query 查询对象 - * @param array $dataSet 数据集 - * @return integer - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - * @throws BulkWriteException - */ - public function insertAll(BaseQuery $query, array $dataSet = []): int - { - // 分析查询表达式 - $query->parseOptions(); - - if (!is_array(reset($dataSet))) { - return 0; - } - - // 生成bulkWrite对象 - $bulk = $this->builder->insertAll($query, $dataSet); - - $writeResult = $this->execute($query, $bulk); - - return $writeResult->getInsertedCount(); - } - - /** - * 更新记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return int - * @throws Exception - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - * @throws BulkWriteException - */ - public function update(BaseQuery $query): int - { - $query->parseOptions(); - - // 生成bulkWrite对象 - $bulk = $this->builder->update($query); - - $writeResult = $this->execute($query, $bulk); - - $result = $writeResult->getModifiedCount(); - - if ($result) { - $this->db->trigger('after_update', $query); - } - - return $result; - } - - /** - * 删除记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return int - * @throws Exception - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - * @throws BulkWriteException - */ - public function delete(BaseQuery $query): int - { - // 分析查询表达式 - $query->parseOptions(); - - // 生成bulkWrite对象 - $bulk = $this->builder->delete($query); - - // 执行操作 - $writeResult = $this->execute($query, $bulk); - - $result = $writeResult->getDeletedCount(); - - if ($result) { - $this->db->trigger('after_delete', $query); - } - - return $result; - } - - /** - * 查找记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return array - * @throws ModelNotFoundException - * @throws DataNotFoundException - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - */ - public function select(BaseQuery $query): array - { - $resultSet = $this->db->trigger('before_select', $query); - - if (!$resultSet) { - $resultSet = $this->query($query, function ($query) { - return $this->builder->select($query); - }); - } - - return $resultSet; - } - - /** - * 查找单条记录 - * @access public - * @param BaseQuery $query 查询对象 - * @return array - * @throws ModelNotFoundException - * @throws DataNotFoundException - * @throws AuthenticationException - * @throws InvalidArgumentException - * @throws ConnectionException - * @throws RuntimeException - */ - public function find(BaseQuery $query): array - { - // 事件回调 - $result = $this->db->trigger('before_find', $query); - - if (!$result) { - // 执行查询 - $resultSet = $this->query($query, function ($query) { - return $this->builder->select($query, true); - }); - - $result = $resultSet[0] ?? []; - } - - return $result; - } - - /** - * 得到某个字段的值 - * @access public - * @param string $field 字段名 - * @param mixed $default 默认值 - * @return mixed - */ - public function value(BaseQuery $query, string $field, $default = null) - { - $options = $query->parseOptions(); - - if (isset($options['projection'])) { - $query->removeOption('projection'); - } - - $query->setOption('projection', (array) $field); - - if (!empty($options['cache'])) { - $cacheItem = $this->parseCache($query, $options['cache']); - $key = $cacheItem->getKey(); - - if ($this->cache->has($key)) { - return $this->cache->get($key); - } - } - - $mongoQuery = $this->builder->select($query, true); - - if (isset($options['projection'])) { - $query->setOption('projection', $options['projection']); - } else { - $query->removeOption('projection'); - } - - // 执行查询操作 - $resultSet = $this->query($query, $mongoQuery); - - if (!empty($resultSet)) { - $data = array_shift($resultSet); - $result = $data[$field]; - } else { - $result = false; - } - - if (isset($cacheItem) && false !== $result) { - // 缓存数据 - $cacheItem->set($result); - $this->cacheData($cacheItem); - } - - return false !== $result ? $result : $default; - } - - /** - * 得到某个列的数组 - * @access public - * @param string $field 字段名 多个字段用逗号分隔 - * @param string $key 索引 - * @return array - */ - public function column(BaseQuery $query, string $field, string $key = ''): array - { - $options = $query->parseOptions(); - - if (isset($options['projection'])) { - $query->removeOption('projection'); - } - - if ($key && '*' != $field) { - $projection = $key . ',' . $field; - } else { - $projection = $field; - } - - $query->field($projection); - - if (!empty($options['cache'])) { - // 判断查询缓存 - $cacheItem = $this->parseCache($query, $options['cache']); - $key = $cacheItem->getKey(); - - if ($this->cache->has($key)) { - return $this->cache->get($key); - } - } - - $mongoQuery = $this->builder->select($query); - - if (isset($options['projection'])) { - $query->setOption('projection', $options['projection']); - } else { - $query->removeOption('projection'); - } - - // 执行查询操作 - $resultSet = $this->query($query, $mongoQuery); - - if (('*' == $field || strpos($field, ',')) && $key) { - $result = array_column($resultSet, null, $key); - } elseif (!empty($resultSet)) { - $result = array_column($resultSet, $field, $key); - } else { - $result = []; - } - - if (isset($cacheItem)) { - // 缓存数据 - $cacheItem->set($result); - $this->cacheData($cacheItem); - } - - return $result; - } - - /** - * 执行command - * @access public - * @param BaseQuery $query 查询对象 - * @param string|array|object $command 指令 - * @param mixed $extra 额外参数 - * @param string $db 数据库名 - * @return array - */ - public function cmd(BaseQuery $query, $command, $extra = null, string $db = ''): array - { - if (is_array($command) || is_object($command)) { - - $this->mongoLog('cmd', 'cmd', $command); - - // 直接创建Command对象 - $command = new Command($command); - } else { - // 调用Builder封装的Command对象 - $command = $this->builder->$command($query, $extra); - } - - return $this->command($command, $db); - } - - /** - * 执行数据库事务 - * @access public - * @param callable $callback 数据操作方法回调 - * @return mixed - * @throws PDOException - * @throws \Exception - * @throws \Throwable - */ - public function transaction(callable $callback) - {} - - /** - * 启动事务 - * @access public - * @return void - * @throws \PDOException - * @throws \Exception - */ - public function startTrans() - {} - - /** - * 用于非自动提交状态下面的查询提交 - * @access public - * @return void - * @throws PDOException - */ - public function commit() - {} - - /** - * 事务回滚 - * @access public - * @return void - * @throws PDOException - */ - public function rollback() - {} - -} diff --git a/vendor/topthink/think-orm/src/db/connector/Mysql.php b/vendor/topthink/think-orm/src/db/connector/Mysql.php deleted file mode 100644 index e82f4f05..00000000 --- a/vendor/topthink/think-orm/src/db/connector/Mysql.php +++ /dev/null @@ -1,162 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\connector; - -use PDO; -use think\db\PDOConnection; - -/** - * mysql数据库驱动 - */ -class Mysql extends PDOConnection -{ - - /** - * 解析pdo连接的dsn信息 - * @access protected - * @param array $config 连接信息 - * @return string - */ - protected function parseDsn(array $config): string - { - if (!empty($config['socket'])) { - $dsn = 'mysql:unix_socket=' . $config['socket']; - } elseif (!empty($config['hostport'])) { - $dsn = 'mysql:host=' . $config['hostname'] . ';port=' . $config['hostport']; - } else { - $dsn = 'mysql:host=' . $config['hostname']; - } - $dsn .= ';dbname=' . $config['database']; - - if (!empty($config['charset'])) { - $dsn .= ';charset=' . $config['charset']; - } - - return $dsn; - } - - /** - * 取得数据表的字段信息 - * @access public - * @param string $tableName - * @return array - */ - public function getFields(string $tableName): array - { - list($tableName) = explode(' ', $tableName); - - if (false === strpos($tableName, '`')) { - if (strpos($tableName, '.')) { - $tableName = str_replace('.', '`.`', $tableName); - } - $tableName = '`' . $tableName . '`'; - } - - $sql = 'SHOW FULL COLUMNS FROM ' . $tableName; - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - if (!empty($result)) { - foreach ($result as $key => $val) { - $val = array_change_key_case($val); - - $info[$val['field']] = [ - 'name' => $val['field'], - 'type' => $val['type'], - 'notnull' => (bool) ('' === $val['null']), // not null is empty, null is yes - 'default' => $val['default'], - 'primary' => (strtolower($val['key']) == 'pri'), - 'autoinc' => (strtolower($val['extra']) == 'auto_increment'), - 'comment' => $val['comment'], - ]; - } - } - - return $this->fieldCase($info); - } - - /** - * 取得数据库的表信息 - * @access public - * @param string $dbName - * @return array - */ - public function getTables(string $dbName = ''): array - { - $sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES '; - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - foreach ($result as $key => $val) { - $info[$key] = current($val); - } - - return $info; - } - - protected function supportSavepoint(): bool - { - return true; - } - - /** - * 启动XA事务 - * @access public - * @param string $xid XA事务id - * @return void - */ - public function startTransXa(string $xid) - { - $this->initConnect(true); - $this->linkID->execute("XA START '$xid'"); - } - - /** - * 预编译XA事务 - * @access public - * @param string $xid XA事务id - * @return void - */ - public function prepareXa(string $xid) - { - $this->initConnect(true); - $this->linkID->execute("XA END '$xid'"); - $this->linkID->execute("XA PREPARE '$xid'"); - } - - /** - * 提交XA事务 - * @access public - * @param string $xid XA事务id - * @return void - */ - public function commitXa(string $xid) - { - $this->initConnect(true); - $this->linkID->execute("XA COMMIT '$xid'"); - } - - /** - * 回滚XA事务 - * @access public - * @param string $xid XA事务id - * @return void - */ - public function rollbackXa(string $xid) - { - $this->initConnect(true); - $this->linkID->execute("XA ROLLBACK '$xid'"); - } -} diff --git a/vendor/topthink/think-orm/src/db/connector/Oracle.php b/vendor/topthink/think-orm/src/db/connector/Oracle.php deleted file mode 100644 index 1c803238..00000000 --- a/vendor/topthink/think-orm/src/db/connector/Oracle.php +++ /dev/null @@ -1,117 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\db\connector; - -use PDO; -use think\db\BaseQuery; -use think\db\PDOConnection; - -/** - * Oracle数据库驱动 - */ -class Oracle extends PDOConnection -{ - /** - * 解析pdo连接的dsn信息 - * @access protected - * @param array $config 连接信息 - * @return string - */ - protected function parseDsn(array $config): string - { - $dsn = 'oci:dbname='; - - if (!empty($config['hostname'])) { - // Oracle Instant Client - $dsn .= '//' . $config['hostname'] . ($config['hostport'] ? ':' . $config['hostport'] : '') . '/'; - } - - $dsn .= $config['database']; - - if (!empty($config['charset'])) { - $dsn .= ';charset=' . $config['charset']; - } - - return $dsn; - } - - /** - * 取得数据表的字段信息 - * @access public - * @param string $tableName - * @return array - */ - public function getFields(string $tableName): array - { - list($tableName) = explode(' ', $tableName); - $sql = "select a.column_name,data_type,DECODE (nullable, 'Y', 0, 1) notnull,data_default, DECODE (A .column_name,b.column_name,1,0) pk from all_tab_columns a,(select column_name from all_constraints c, all_cons_columns col where c.constraint_name = col.constraint_name and c.constraint_type = 'P' and c.table_name = '" . strtoupper($tableName) . "' ) b where table_name = '" . strtoupper($tableName) . "' and a.column_name = b.column_name (+)"; - - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - if ($result) { - foreach ($result as $key => $val) { - $val = array_change_key_case($val); - - $info[$val['column_name']] = [ - 'name' => $val['column_name'], - 'type' => $val['data_type'], - 'notnull' => $val['notnull'], - 'default' => $val['data_default'], - 'primary' => $val['pk'], - 'autoinc' => $val['pk'], - ]; - } - } - - return $this->fieldCase($info); - } - - /** - * 取得数据库的表信息(暂时实现取得用户表信息) - * @access public - * @param string $dbName - * @return array - */ - public function getTables(string $dbName = ''): array - { - $sql = 'select table_name from all_tables'; - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - foreach ($result as $key => $val) { - $info[$key] = current($val); - } - - return $info; - } - - /** - * 获取最近插入的ID - * @access public - * @param BaseQuery $query 查询对象 - * @param string $sequence 自增序列名 - * @return mixed - */ - public function getLastInsID(BaseQuery $query, string $sequence = null) - { - $pdo = $this->linkID->query("select {$sequence}.currval as id from dual"); - $result = $pdo->fetchColumn(); - - return $result; - } - - protected function supportSavepoint(): bool - { - return true; - } -} diff --git a/vendor/topthink/think-orm/src/db/connector/Pgsql.php b/vendor/topthink/think-orm/src/db/connector/Pgsql.php deleted file mode 100644 index 1310b973..00000000 --- a/vendor/topthink/think-orm/src/db/connector/Pgsql.php +++ /dev/null @@ -1,108 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\db\connector; - -use PDO; -use think\db\PDOConnection; - -/** - * Pgsql数据库驱动 - */ -class Pgsql extends PDOConnection -{ - - /** - * 默认PDO连接参数 - * @var array - */ - protected $params = [ - PDO::ATTR_CASE => PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - ]; - - /** - * 解析pdo连接的dsn信息 - * @access protected - * @param array $config 连接信息 - * @return string - */ - protected function parseDsn(array $config): string - { - $dsn = 'pgsql:dbname=' . $config['database'] . ';host=' . $config['hostname']; - - if (!empty($config['hostport'])) { - $dsn .= ';port=' . $config['hostport']; - } - - return $dsn; - } - - /** - * 取得数据表的字段信息 - * @access public - * @param string $tableName - * @return array - */ - public function getFields(string $tableName): array - { - list($tableName) = explode(' ', $tableName); - $sql = 'select fields_name as "field",fields_type as "type",fields_not_null as "null",fields_key_name as "key",fields_default as "default",fields_default as "extra" from table_msg(\'' . $tableName . '\');'; - - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - if (!empty($result)) { - foreach ($result as $key => $val) { - $val = array_change_key_case($val); - - $info[$val['field']] = [ - 'name' => $val['field'], - 'type' => $val['type'], - 'notnull' => (bool) ('' !== $val['null']), - 'default' => $val['default'], - 'primary' => !empty($val['key']), - 'autoinc' => (0 === strpos($val['extra'], 'nextval(')), - ]; - } - } - - return $this->fieldCase($info); - } - - /** - * 取得数据库的表信息 - * @access public - * @param string $dbName - * @return array - */ - public function getTables(string $dbName = ''): array - { - $sql = "select tablename as Tables_in_test from pg_tables where schemaname ='public'"; - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - foreach ($result as $key => $val) { - $info[$key] = current($val); - } - - return $info; - } - - protected function supportSavepoint(): bool - { - return true; - } -} diff --git a/vendor/topthink/think-orm/src/db/connector/Sqlite.php b/vendor/topthink/think-orm/src/db/connector/Sqlite.php deleted file mode 100644 index 12a05171..00000000 --- a/vendor/topthink/think-orm/src/db/connector/Sqlite.php +++ /dev/null @@ -1,96 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\db\connector; - -use PDO; -use think\db\PDOConnection; - -/** - * Sqlite数据库驱动 - */ -class Sqlite extends PDOConnection -{ - - /** - * 解析pdo连接的dsn信息 - * @access protected - * @param array $config 连接信息 - * @return string - */ - protected function parseDsn(array $config): string - { - $dsn = 'sqlite:' . $config['database']; - - return $dsn; - } - - /** - * 取得数据表的字段信息 - * @access public - * @param string $tableName - * @return array - */ - public function getFields(string $tableName): array - { - list($tableName) = explode(' ', $tableName); - $sql = 'PRAGMA table_info( ' . $tableName . ' )'; - - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - if (!empty($result)) { - foreach ($result as $key => $val) { - $val = array_change_key_case($val); - - $info[$val['name']] = [ - 'name' => $val['name'], - 'type' => $val['type'], - 'notnull' => 1 === $val['notnull'], - 'default' => $val['dflt_value'], - 'primary' => '1' == $val['pk'], - 'autoinc' => '1' == $val['pk'], - ]; - } - } - - return $this->fieldCase($info); - } - - /** - * 取得数据库的表信息 - * @access public - * @param string $dbName - * @return array - */ - public function getTables(string $dbName = ''): array - { - $sql = "SELECT name FROM sqlite_master WHERE type='table' " - . "UNION ALL SELECT name FROM sqlite_temp_master " - . "WHERE type='table' ORDER BY name"; - - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - foreach ($result as $key => $val) { - $info[$key] = current($val); - } - - return $info; - } - - protected function supportSavepoint(): bool - { - return true; - } -} diff --git a/vendor/topthink/think-orm/src/db/connector/Sqlsrv.php b/vendor/topthink/think-orm/src/db/connector/Sqlsrv.php deleted file mode 100644 index 1a5fffe4..00000000 --- a/vendor/topthink/think-orm/src/db/connector/Sqlsrv.php +++ /dev/null @@ -1,122 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\db\connector; - -use PDO; -use think\db\PDOConnection; - -/** - * Sqlsrv数据库驱动 - */ -class Sqlsrv extends PDOConnection -{ - /** - * 默认PDO连接参数 - * @var array - */ - protected $params = [ - PDO::ATTR_CASE => PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - ]; - - /** - * 解析pdo连接的dsn信息 - * @access protected - * @param array $config 连接信息 - * @return string - */ - protected function parseDsn(array $config): string - { - $dsn = 'sqlsrv:Database=' . $config['database'] . ';Server=' . $config['hostname']; - - if (!empty($config['hostport'])) { - $dsn .= ',' . $config['hostport']; - } - - return $dsn; - } - - /** - * 取得数据表的字段信息 - * @access public - * @param string $tableName - * @return array - */ - public function getFields(string $tableName): array - { - list($tableName) = explode(' ', $tableName); - - $sql = "SELECT column_name, data_type, column_default, is_nullable - FROM information_schema.tables AS t - JOIN information_schema.columns AS c - ON t.table_catalog = c.table_catalog - AND t.table_schema = c.table_schema - AND t.table_name = c.table_name - WHERE t.table_name = '$tableName'"; - - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - if (!empty($result)) { - foreach ($result as $key => $val) { - $val = array_change_key_case($val); - - $info[$val['column_name']] = [ - 'name' => $val['column_name'], - 'type' => $val['data_type'], - 'notnull' => (bool) ('' === $val['is_nullable']), // not null is empty, null is yes - 'default' => $val['column_default'], - 'primary' => false, - 'autoinc' => false, - ]; - } - } - - $sql = "SELECT column_name FROM information_schema.key_column_usage WHERE table_name='$tableName'"; - $pdo = $this->linkID->query($sql); - $result = $pdo->fetch(PDO::FETCH_ASSOC); - - if ($result) { - $info[$result['column_name']]['primary'] = true; - } - - return $this->fieldCase($info); - } - - /** - * 取得数据表的字段信息 - * @access public - * @param string $dbName - * @return array - */ - public function getTables(string $dbName = ''): array - { - $sql = "SELECT TABLE_NAME - FROM INFORMATION_SCHEMA.TABLES - WHERE TABLE_TYPE = 'BASE TABLE' - "; - - $pdo = $this->getPDOStatement($sql); - $result = $pdo->fetchAll(PDO::FETCH_ASSOC); - $info = []; - - foreach ($result as $key => $val) { - $info[$key] = current($val); - } - - return $info; - } - -} diff --git a/vendor/topthink/think-orm/src/db/connector/pgsql.sql b/vendor/topthink/think-orm/src/db/connector/pgsql.sql deleted file mode 100644 index e1a09a30..00000000 --- a/vendor/topthink/think-orm/src/db/connector/pgsql.sql +++ /dev/null @@ -1,117 +0,0 @@ -CREATE OR REPLACE FUNCTION pgsql_type(a_type varchar) RETURNS varchar AS -$BODY$ -DECLARE - v_type varchar; -BEGIN - IF a_type='int8' THEN - v_type:='bigint'; - ELSIF a_type='int4' THEN - v_type:='integer'; - ELSIF a_type='int2' THEN - v_type:='smallint'; - ELSIF a_type='bpchar' THEN - v_type:='char'; - ELSE - v_type:=a_type; - END IF; - RETURN v_type; -END; -$BODY$ -LANGUAGE PLPGSQL; - -CREATE TYPE "public"."tablestruct" AS ( - "fields_key_name" varchar(100), - "fields_name" VARCHAR(200), - "fields_type" VARCHAR(20), - "fields_length" BIGINT, - "fields_not_null" VARCHAR(10), - "fields_default" VARCHAR(500), - "fields_comment" VARCHAR(1000) -); - -CREATE OR REPLACE FUNCTION "public"."table_msg" (a_schema_name varchar, a_table_name varchar) RETURNS SETOF "public"."tablestruct" AS -$body$ -DECLARE - v_ret tablestruct; - v_oid oid; - v_sql varchar; - v_rec RECORD; - v_key varchar; -BEGIN - SELECT - pg_class.oid INTO v_oid - FROM - pg_class - INNER JOIN pg_namespace ON (pg_class.relnamespace = pg_namespace.oid AND lower(pg_namespace.nspname) = a_schema_name) - WHERE - pg_class.relname=a_table_name; - IF NOT FOUND THEN - RETURN; - END IF; - - v_sql=' - SELECT - pg_attribute.attname AS fields_name, - pg_attribute.attnum AS fields_index, - pgsql_type(pg_type.typname::varchar) AS fields_type, - pg_attribute.atttypmod-4 as fields_length, - CASE WHEN pg_attribute.attnotnull THEN ''not null'' - ELSE '''' - END AS fields_not_null, - pg_attrdef.adsrc AS fields_default, - pg_description.description AS fields_comment - FROM - pg_attribute - INNER JOIN pg_class ON pg_attribute.attrelid = pg_class.oid - INNER JOIN pg_type ON pg_attribute.atttypid = pg_type.oid - LEFT OUTER JOIN pg_attrdef ON pg_attrdef.adrelid = pg_class.oid AND pg_attrdef.adnum = pg_attribute.attnum - LEFT OUTER JOIN pg_description ON pg_description.objoid = pg_class.oid AND pg_description.objsubid = pg_attribute.attnum - WHERE - pg_attribute.attnum > 0 - AND attisdropped <> ''t'' - AND pg_class.oid = ' || v_oid || ' - ORDER BY pg_attribute.attnum' ; - - FOR v_rec IN EXECUTE v_sql LOOP - v_ret.fields_name=v_rec.fields_name; - v_ret.fields_type=v_rec.fields_type; - IF v_rec.fields_length > 0 THEN - v_ret.fields_length:=v_rec.fields_length; - ELSE - v_ret.fields_length:=NULL; - END IF; - v_ret.fields_not_null=v_rec.fields_not_null; - v_ret.fields_default=v_rec.fields_default; - v_ret.fields_comment=v_rec.fields_comment; - SELECT constraint_name INTO v_key FROM information_schema.key_column_usage WHERE table_schema=a_schema_name AND table_name=a_table_name AND column_name=v_rec.fields_name; - IF FOUND THEN - v_ret.fields_key_name=v_key; - ELSE - v_ret.fields_key_name=''; - END IF; - RETURN NEXT v_ret; - END LOOP; - RETURN ; -END; -$body$ -LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; - -COMMENT ON FUNCTION "public"."table_msg"(a_schema_name varchar, a_table_name varchar) -IS '获得表信息'; - ----重载一个函数 -CREATE OR REPLACE FUNCTION "public"."table_msg" (a_table_name varchar) RETURNS SETOF "public"."tablestruct" AS -$body$ -DECLARE - v_ret tablestruct; -BEGIN - FOR v_ret IN SELECT * FROM table_msg('public',a_table_name) LOOP - RETURN NEXT v_ret; - END LOOP; - RETURN; -END; -$body$ -LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; - -COMMENT ON FUNCTION "public"."table_msg"(a_table_name varchar) -IS '获得表信息'; \ No newline at end of file diff --git a/vendor/topthink/think-orm/src/db/exception/BindParamException.php b/vendor/topthink/think-orm/src/db/exception/BindParamException.php deleted file mode 100644 index 08bb3880..00000000 --- a/vendor/topthink/think-orm/src/db/exception/BindParamException.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\exception; - -/** - * PDO参数绑定异常 - */ -class BindParamException extends DbException -{ - - /** - * BindParamException constructor. - * @access public - * @param string $message - * @param array $config - * @param string $sql - * @param array $bind - * @param int $code - */ - public function __construct(string $message, array $config, string $sql, array $bind, int $code = 10502) - { - $this->setData('Bind Param', $bind); - parent::__construct($message, $config, $sql, $code); - } -} diff --git a/vendor/topthink/think-orm/src/db/exception/DataNotFoundException.php b/vendor/topthink/think-orm/src/db/exception/DataNotFoundException.php deleted file mode 100644 index d10dd433..00000000 --- a/vendor/topthink/think-orm/src/db/exception/DataNotFoundException.php +++ /dev/null @@ -1,43 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\exception; - -class DataNotFoundException extends DbException -{ - protected $table; - - /** - * DbException constructor. - * @access public - * @param string $message - * @param string $table - * @param array $config - */ - public function __construct(string $message, string $table = '', array $config = []) - { - $this->message = $message; - $this->table = $table; - - $this->setData('Database Config', $config); - } - - /** - * 获取数据表名 - * @access public - * @return string - */ - public function getTable() - { - return $this->table; - } -} diff --git a/vendor/topthink/think-orm/src/db/exception/DbException.php b/vendor/topthink/think-orm/src/db/exception/DbException.php deleted file mode 100644 index d5bfc3f0..00000000 --- a/vendor/topthink/think-orm/src/db/exception/DbException.php +++ /dev/null @@ -1,81 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\exception; - -use Exception; - -/** - * Database相关异常处理类 - */ -class DbException extends Exception -{ - /** - * DbException constructor. - * @access public - * @param string $message - * @param array $config - * @param string $sql - * @param int $code - */ - public function __construct(string $message, array $config = [], string $sql = '', int $code = 10500) - { - $this->message = $message; - $this->code = $code; - - $this->setData('Database Status', [ - 'Error Code' => $code, - 'Error Message' => $message, - 'Error SQL' => $sql, - ]); - - unset($config['username'], $config['password']); - $this->setData('Database Config', $config); - } - - /** - * 保存异常页面显示的额外Debug数据 - * @var array - */ - protected $data = []; - - /** - * 设置异常额外的Debug数据 - * 数据将会显示为下面的格式 - * - * Exception Data - * -------------------------------------------------- - * Label 1 - * key1 value1 - * key2 value2 - * Label 2 - * key1 value1 - * key2 value2 - * - * @param string $label 数据分类,用于异常页面显示 - * @param array $data 需要显示的数据,必须为关联数组 - */ - final protected function setData($label, array $data) - { - $this->data[$label] = $data; - } - - /** - * 获取异常额外Debug数据 - * 主要用于输出到异常页面便于调试 - * @return array 由setData设置的Debug数据 - */ - final public function getData() - { - return $this->data; - } -} diff --git a/vendor/topthink/think-orm/src/db/exception/InvalidArgumentException.php b/vendor/topthink/think-orm/src/db/exception/InvalidArgumentException.php deleted file mode 100644 index 047e45e9..00000000 --- a/vendor/topthink/think-orm/src/db/exception/InvalidArgumentException.php +++ /dev/null @@ -1,21 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); -namespace think\db\exception; - -use Psr\SimpleCache\InvalidArgumentException as SimpleCacheInvalidArgumentInterface; - -/** - * 非法数据异常 - */ -class InvalidArgumentException extends \InvalidArgumentException implements SimpleCacheInvalidArgumentInterface -{ -} diff --git a/vendor/topthink/think-orm/src/db/exception/ModelEventException.php b/vendor/topthink/think-orm/src/db/exception/ModelEventException.php deleted file mode 100644 index 767bc1a9..00000000 --- a/vendor/topthink/think-orm/src/db/exception/ModelEventException.php +++ /dev/null @@ -1,19 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\db\exception; - -/** - * 模型事件异常 - */ -class ModelEventException extends DbException -{ -} diff --git a/vendor/topthink/think-orm/src/db/exception/ModelNotFoundException.php b/vendor/topthink/think-orm/src/db/exception/ModelNotFoundException.php deleted file mode 100644 index 84a15257..00000000 --- a/vendor/topthink/think-orm/src/db/exception/ModelNotFoundException.php +++ /dev/null @@ -1,44 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\exception; - -class ModelNotFoundException extends DbException -{ - protected $model; - - /** - * 构造方法 - * @access public - * @param string $message - * @param string $model - * @param array $config - */ - public function __construct(string $message, string $model = '', array $config = []) - { - $this->message = $message; - $this->model = $model; - - $this->setData('Database Config', $config); - } - - /** - * 获取模型类名 - * @access public - * @return string - */ - public function getModel() - { - return $this->model; - } - -} diff --git a/vendor/topthink/think-orm/src/db/exception/PDOException.php b/vendor/topthink/think-orm/src/db/exception/PDOException.php deleted file mode 100644 index 41c0d738..00000000 --- a/vendor/topthink/think-orm/src/db/exception/PDOException.php +++ /dev/null @@ -1,41 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\db\exception; - -/** - * PDO异常处理类 - * 重新封装了系统的\PDOException类 - */ -class PDOException extends DbException -{ - /** - * PDOException constructor. - * @access public - * @param \PDOException $exception - * @param array $config - * @param string $sql - * @param int $code - */ - public function __construct(\PDOException $exception, array $config = [], string $sql = '', int $code = 10501) - { - $error = $exception->errorInfo; - - $this->setData('PDO Error Info', [ - 'SQLSTATE' => $error[0], - 'Driver Error Code' => isset($error[1]) ? $error[1] : 0, - 'Driver Error Message' => isset($error[2]) ? $error[2] : '', - ]); - - parent::__construct($exception->getMessage(), $config, $sql, $code); - } -} diff --git a/vendor/topthink/think-orm/src/facade/Db.php b/vendor/topthink/think-orm/src/facade/Db.php deleted file mode 100644 index 174a4f02..00000000 --- a/vendor/topthink/think-orm/src/facade/Db.php +++ /dev/null @@ -1,86 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -if (class_exists('think\Facade')) { - class Facade extends \think\Facade - {} -} else { - class Facade - { - /** - * 始终创建新的对象实例 - * @var bool - */ - protected static $alwaysNewInstance; - - protected static $instance; - - /** - * 获取当前Facade对应类名 - * @access protected - * @return string - */ - protected static function getFacadeClass() - {} - - /** - * 创建Facade实例 - * @static - * @access protected - * @param bool $newInstance 是否每次创建新的实例 - * @return object - */ - protected static function createFacade(bool $newInstance = false) - { - $class = static::getFacadeClass() ?: 'think\DbManager'; - - if (static::$alwaysNewInstance) { - $newInstance = true; - } - - if ($newInstance) { - return new $class(); - } - - if (!self::$instance) { - self::$instance = new $class(); - } - - return self::$instance; - - } - - // 调用实际类的方法 - public static function __callStatic($method, $params) - { - return call_user_func_array([static::createFacade(), $method], $params); - } - } -} - -/** - * @see \think\DbManager - * @mixin \think\DbManager - */ -class Db extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'think\DbManager'; - } -} diff --git a/vendor/topthink/think-orm/src/model/Collection.php b/vendor/topthink/think-orm/src/model/Collection.php deleted file mode 100644 index fd54272c..00000000 --- a/vendor/topthink/think-orm/src/model/Collection.php +++ /dev/null @@ -1,250 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model; - -use think\Collection as BaseCollection; -use think\Model; -use think\Paginator; - -/** - * 模型数据集类 - */ -class Collection extends BaseCollection -{ - /** - * 延迟预载入关联查询 - * @access public - * @param array|string $relation 关联 - * @param mixed $cache 关联缓存 - * @return $this - */ - public function load($relation, $cache = false) - { - if (!$this->isEmpty()) { - $item = current($this->items); - $item->eagerlyResultSet($this->items, (array) $relation, [], false, $cache); - } - - return $this; - } - - /** - * 删除数据集的数据 - * @access public - * @return bool - */ - public function delete(): bool - { - $this->each(function (Model $model) { - $model->delete(); - }); - - return true; - } - - /** - * 更新数据 - * @access public - * @param array $data 数据数组 - * @param array $allowField 允许字段 - * @return bool - */ - public function update(array $data, array $allowField = []): bool - { - $this->each(function (Model $model) use ($data, $allowField) { - if (!empty($allowField)) { - $model->allowField($allowField); - } - - $model->save($data); - }); - - return true; - } - - /** - * 设置需要隐藏的输出属性 - * @access public - * @param array $hidden 属性列表 - * @return $this - */ - public function hidden(array $hidden) - { - $this->each(function (Model $model) use ($hidden) { - $model->hidden($hidden); - }); - - return $this; - } - - /** - * 设置需要输出的属性 - * @access public - * @param array $visible - * @return $this - */ - public function visible(array $visible) - { - $this->each(function (Model $model) use ($visible) { - $model->visible($visible); - }); - - return $this; - } - - /** - * 设置需要追加的输出属性 - * @access public - * @param array $append 属性列表 - * @return $this - */ - public function append(array $append) - { - $this->each(function (Model $model) use ($append) { - $model->append($append); - }); - - return $this; - } - - /** - * 设置父模型 - * @access public - * @param Model $parent 父模型 - * @return $this - */ - public function setParent(Model $parent) - { - $this->each(function (Model $model) use ($parent) { - $model->setParent($parent); - }); - - return $this; - } - - /** - * 设置数据字段获取器 - * @access public - * @param string|array $name 字段名 - * @param callable $callback 闭包获取器 - * @return $this - */ - public function withAttr($name, $callback = null) - { - $this->each(function (Model $model) use ($name, $callback) { - $model->withAttribute($name, $callback); - }); - - return $this; - } - - /** - * 绑定(一对一)关联属性到当前模型 - * @access protected - * @param string $relation 关联名称 - * @param array $attrs 绑定属性 - * @return $this - * @throws Exception - */ - public function bindAttr(string $relation, array $attrs = []) - { - $this->each(function (Model $model) use ($relation, $attrs) { - $model->bindAttr($relation, $attrs); - }); - - return $this; - } - - /** - * 按指定键整理数据 - * - * @access public - * @param mixed $items 数据 - * @param string $indexKey 键名 - * @return array - */ - public function dictionary($items = null, string &$indexKey = null) - { - if ($items instanceof self || $items instanceof Paginator) { - $items = $items->all(); - } - - $items = is_null($items) ? $this->items : $items; - - if ($items && empty($indexKey)) { - $indexKey = $items[0]->getPk(); - } - - if (isset($indexKey) && is_string($indexKey)) { - return array_column($items, null, $indexKey); - } - - return $items; - } - - /** - * 比较数据集,返回差集 - * - * @access public - * @param mixed $items 数据 - * @param string $indexKey 指定比较的键名 - * @return static - */ - public function diff($items, string $indexKey = null) - { - if ($this->isEmpty()) { - return new static($items); - } - - $diff = []; - $dictionary = $this->dictionary($items, $indexKey); - - if (is_string($indexKey)) { - foreach ($this->items as $item) { - if (!isset($dictionary[$item[$indexKey]])) { - $diff[] = $item; - } - } - } - - return new static($diff); - } - - /** - * 比较数据集,返回交集 - * - * @access public - * @param mixed $items 数据 - * @param string $indexKey 指定比较的键名 - * @return static - */ - public function intersect($items, string $indexKey = null) - { - if ($this->isEmpty()) { - return new static([]); - } - - $intersect = []; - $dictionary = $this->dictionary($items, $indexKey); - - if (is_string($indexKey)) { - foreach ($this->items as $item) { - if (isset($dictionary[$item[$indexKey]])) { - $intersect[] = $item; - } - } - } - - return new static($intersect); - } -} diff --git a/vendor/topthink/think-orm/src/model/Pivot.php b/vendor/topthink/think-orm/src/model/Pivot.php deleted file mode 100644 index 893c01b7..00000000 --- a/vendor/topthink/think-orm/src/model/Pivot.php +++ /dev/null @@ -1,53 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model; - -use think\Model; - -/** - * 多对多中间表模型类 - */ -class Pivot extends Model -{ - - /** - * 父模型 - * @var Model - */ - public $parent; - - /** - * 是否时间自动写入 - * @var bool - */ - protected $autoWriteTimestamp = false; - - /** - * 架构函数 - * @access public - * @param array $data 数据 - * @param Model $parent 上级模型 - * @param string $table 中间数据表名 - */ - public function __construct(array $data = [], Model $parent = null, string $table = '') - { - $this->parent = $parent; - - if (is_null($this->name)) { - $this->name = $table; - } - - parent::__construct($data); - } - -} diff --git a/vendor/topthink/think-orm/src/model/Relation.php b/vendor/topthink/think-orm/src/model/Relation.php deleted file mode 100644 index 12ab8a81..00000000 --- a/vendor/topthink/think-orm/src/model/Relation.php +++ /dev/null @@ -1,258 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model; - -use Closure; -use ReflectionFunction; -use think\db\BaseQuery as Query; -use think\db\exception\DbException as Exception; -use think\Model; - -/** - * 模型关联基础类 - * @package think\model - * @mixin Query - */ -abstract class Relation -{ - /** - * 父模型对象 - * @var Model - */ - protected $parent; - - /** - * 当前关联的模型类名 - * @var string - */ - protected $model; - - /** - * 关联模型查询对象 - * @var Query - */ - protected $query; - - /** - * 关联表外键 - * @var string - */ - protected $foreignKey; - - /** - * 关联表主键 - * @var string - */ - protected $localKey; - - /** - * 是否执行关联基础查询 - * @var bool - */ - protected $baseQuery; - - /** - * 是否为自关联 - * @var bool - */ - protected $selfRelation = false; - - /** - * 关联数据数量限制 - * @var int - */ - protected $withLimit; - - /** - * 关联数据字段限制 - * @var array - */ - protected $withField; - - /** - * 获取关联的所属模型 - * @access public - * @return Model - */ - public function getParent(): Model - { - return $this->parent; - } - - /** - * 获取当前的关联模型类的Query实例 - * @access public - * @return Query - */ - public function getQuery() - { - return $this->query; - } - - /** - * 获取当前的关联模型类的实例 - * @access public - * @return Model - */ - public function getModel(): Model - { - return $this->query->getModel(); - } - - /** - * 当前关联是否为自关联 - * @access public - * @return bool - */ - public function isSelfRelation(): bool - { - return $this->selfRelation; - } - - /** - * 封装关联数据集 - * @access public - * @param array $resultSet 数据集 - * @param Model $parent 父模型 - * @return mixed - */ - protected function resultSetBuild(array $resultSet, Model $parent = null) - { - return (new $this->model)->toCollection($resultSet)->setParent($parent); - } - - protected function getQueryFields(string $model) - { - $fields = $this->query->getOptions('field'); - return $this->getRelationQueryFields($fields, $model); - } - - protected function getRelationQueryFields($fields, string $model) - { - if (empty($fields) || '*' == $fields) { - return $model . '.*'; - } - - if (is_string($fields)) { - $fields = explode(',', $fields); - } - - foreach ($fields as &$field) { - if (false === strpos($field, '.')) { - $field = $model . '.' . $field; - } - } - - return $fields; - } - - protected function getQueryWhere(array &$where, string $relation): void - { - foreach ($where as $key => &$val) { - if (is_string($key)) { - $where[] = [false === strpos($key, '.') ? $relation . '.' . $key : $key, '=', $val]; - unset($where[$key]); - } elseif (isset($val[0]) && false === strpos($val[0], '.')) { - $val[0] = $relation . '.' . $val[0]; - } - } - } - - /** - * 更新数据 - * @access public - * @param array $data 更新数据 - * @return integer - */ - public function update(array $data = []): int - { - return $this->query->update($data); - } - - /** - * 删除记录 - * @access public - * @param mixed $data 表达式 true 表示强制删除 - * @return int - * @throws Exception - * @throws PDOException - */ - public function delete($data = null): int - { - return $this->query->delete($data); - } - - /** - * 限制关联数据的数量 - * @access public - * @param int $limit 关联数量限制 - * @return $this - */ - public function withLimit(int $limit) - { - $this->withLimit = $limit; - return $this; - } - - /** - * 限制关联数据的字段 - * @access public - * @param array $field 关联字段限制 - * @return $this - */ - public function withField(array $field) - { - $this->withField = $field; - return $this; - } - - /** - * 判断闭包的参数类型 - * @access protected - * @return mixed - */ - protected function getClosureType(Closure $closure) - { - $reflect = new ReflectionFunction($closure); - $params = $reflect->getParameters(); - - if (!empty($params)) { - $type = $params[0]->getType(); - return Relation::class == $type || is_null($type) ? $this : $this->query; - } - - return $this; - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery(): void - {} - - public function __call($method, $args) - { - if ($this->query) { - // 执行基础查询 - $this->baseQuery(); - - $result = call_user_func_array([$this->query, $method], $args); - - return $result === $this->query ? $this : $result; - } - - throw new Exception('method not exists:' . __CLASS__ . '->' . $method); - } -} diff --git a/vendor/topthink/think-orm/src/model/concern/Attribute.php b/vendor/topthink/think-orm/src/model/concern/Attribute.php deleted file mode 100644 index a89b0b0f..00000000 --- a/vendor/topthink/think-orm/src/model/concern/Attribute.php +++ /dev/null @@ -1,651 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\concern; - -use InvalidArgumentException; -use think\db\Raw; -use think\helper\Str; -use think\model\Relation; - -/** - * 模型数据处理 - */ -trait Attribute -{ - /** - * 数据表主键 复合主键使用数组定义 - * @var string|array - */ - protected $pk = 'id'; - - /** - * 数据表字段信息 留空则自动获取 - * @var array - */ - protected $schema = []; - - /** - * 当前允许写入的字段 - * @var array - */ - protected $field = []; - - /** - * 字段自动类型转换 - * @var array - */ - protected $type = []; - - /** - * 数据表废弃字段 - * @var array - */ - protected $disuse = []; - - /** - * 数据表只读字段 - * @var array - */ - protected $readonly = []; - - /** - * 当前模型数据 - * @var array - */ - private $data = []; - - /** - * 原始数据 - * @var array - */ - private $origin = []; - - /** - * JSON数据表字段 - * @var array - */ - protected $json = []; - - /** - * JSON数据表字段类型 - * @var array - */ - protected $jsonType = []; - - /** - * JSON数据取出是否需要转换为数组 - * @var bool - */ - protected $jsonAssoc = false; - - /** - * 是否严格字段大小写 - * @var bool - */ - protected $strict = true; - - /** - * 修改器执行记录 - * @var array - */ - private $set = []; - - /** - * 动态获取器 - * @var array - */ - private $withAttr = []; - - /** - * 获取模型对象的主键 - * @access public - * @return string|array - */ - public function getPk() - { - return $this->pk; - } - - /** - * 判断一个字段名是否为主键字段 - * @access public - * @param string $key 名称 - * @return bool - */ - protected function isPk(string $key): bool - { - $pk = $this->getPk(); - - if (is_string($pk) && $pk == $key) { - return true; - } elseif (is_array($pk) && in_array($key, $pk)) { - return true; - } - - return false; - } - - /** - * 获取模型对象的主键值 - * @access public - * @return mixed - */ - public function getKey() - { - $pk = $this->getPk(); - - if (is_string($pk) && array_key_exists($pk, $this->data)) { - return $this->data[$pk]; - } - - return; - } - - /** - * 设置允许写入的字段 - * @access public - * @param array $field 允许写入的字段 - * @return $this - */ - public function allowField(array $field) - { - $this->field = $field; - - return $this; - } - - /** - * 设置只读字段 - * @access public - * @param array $field 只读字段 - * @return $this - */ - public function readOnly(array $field) - { - $this->readonly = $field; - - return $this; - } - - /** - * 获取实际的字段名 - * @access protected - * @param string $name 字段名 - * @return string - */ - protected function getRealFieldName(string $name): string - { - return $this->strict ? $name : Str::snake($name); - } - - /** - * 设置数据对象值 - * @access public - * @param array $data 数据 - * @param bool $set 是否调用修改器 - * @param array $allow 允许的字段名 - * @return $this - */ - public function data(array $data, bool $set = false, array $allow = []) - { - // 清空数据 - $this->data = []; - - // 废弃字段 - foreach ($this->disuse as $key) { - if (array_key_exists($key, $data)) { - unset($data[$key]); - } - } - - if (!empty($allow)) { - $result = []; - foreach ($allow as $name) { - if (isset($data[$name])) { - $result[$name] = $data[$name]; - } - } - $data = $result; - } - - if ($set) { - // 数据对象赋值 - $this->setAttrs($data); - } else { - $this->data = $data; - } - - return $this; - } - - /** - * 批量追加数据对象值 - * @access public - * @param array $data 数据 - * @param bool $set 是否需要进行数据处理 - * @return $this - */ - public function appendData(array $data, bool $set = false) - { - if ($set) { - $this->setAttrs($data); - } else { - $this->data = array_merge($this->data, $data); - } - - return $this; - } - - /** - * 获取对象原始数据 如果不存在指定字段返回null - * @access public - * @param string $name 字段名 留空获取全部 - * @return mixed - */ - public function getOrigin(string $name = null) - { - if (is_null($name)) { - return $this->origin; - } - - return array_key_exists($name, $this->origin) ? $this->origin[$name] : null; - } - - /** - * 获取对象原始数据 如果不存在指定字段返回false - * @access public - * @param string $name 字段名 留空获取全部 - * @return mixed - * @throws InvalidArgumentException - */ - public function getData(string $name = null) - { - if (is_null($name)) { - return $this->data; - } - - $fieldName = $this->getRealFieldName($name); - - if (array_key_exists($fieldName, $this->data)) { - return $this->data[$fieldName]; - } elseif (array_key_exists($fieldName, $this->relation)) { - return $this->relation[$fieldName]; - } - - throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name); - } - - /** - * 获取变化的数据 并排除只读数据 - * @access public - * @return array - */ - public function getChangedData(): array - { - $data = $this->force ? $this->data : array_udiff_assoc($this->data, $this->origin, function ($a, $b) { - if ((empty($a) || empty($b)) && $a !== $b) { - return 1; - } - - return is_object($a) || $a != $b ? 1 : 0; - }); - - // 只读字段不允许更新 - foreach ($this->readonly as $key => $field) { - if (isset($data[$field])) { - unset($data[$field]); - } - } - - return $data; - } - - /** - * 直接设置数据对象值 - * @access public - * @param string $name 属性名 - * @param mixed $value 值 - * @return void - */ - public function set(string $name, $value): void - { - $name = $this->getRealFieldName($name); - - $this->data[$name] = $value; - } - - /** - * 通过修改器 批量设置数据对象值 - * @access public - * @param array $data 数据 - * @return void - */ - public function setAttrs(array $data): void - { - // 进行数据处理 - foreach ($data as $key => $value) { - $this->setAttr($key, $value, $data); - } - } - - /** - * 通过修改器 设置数据对象值 - * @access public - * @param string $name 属性名 - * @param mixed $value 属性值 - * @param array $data 数据 - * @return void - */ - public function setAttr(string $name, $value, array $data = []): void - { - $name = $this->getRealFieldName($name); - - if (isset($this->set[$name])) { - return; - } - - if (is_null($value) && $this->autoWriteTimestamp && in_array($name, [$this->createTime, $this->updateTime])) { - // 自动写入的时间戳字段 - $value = $this->autoWriteTimestamp(); - } else { - // 检测修改器 - $method = 'set' . Str::studly($name) . 'Attr'; - - if (method_exists($this, $method)) { - $array = $this->data; - - $value = $this->$method($value, array_merge($this->data, $data)); - - $this->set[$name] = true; - if (is_null($value) && $array !== $this->data) { - return; - } - } elseif (isset($this->type[$name])) { - // 类型转换 - $value = $this->writeTransform($value, $this->type[$name]); - } - } - - // 设置数据对象属性 - $this->data[$name] = $value; - } - - /** - * 数据写入 类型转换 - * @access protected - * @param mixed $value 值 - * @param string|array $type 要转换的类型 - * @return mixed - */ - protected function writeTransform($value, $type) - { - if (is_null($value)) { - return; - } - - if ($value instanceof Raw) { - return $value; - } - - if (is_array($type)) { - list($type, $param) = $type; - } elseif (strpos($type, ':')) { - list($type, $param) = explode(':', $type, 2); - } - - switch ($type) { - case 'integer': - $value = (int) $value; - break; - case 'float': - if (empty($param)) { - $value = (float) $value; - } else { - $value = (float) number_format($value, $param, '.', ''); - } - break; - case 'boolean': - $value = (bool) $value; - break; - case 'timestamp': - if (!is_numeric($value)) { - $value = strtotime($value); - } - break; - case 'datetime': - $value = is_numeric($value) ? $value : strtotime($value); - $value = $this->formatDateTime('Y-m-d H:i:s.u', $value); - break; - case 'object': - if (is_object($value)) { - $value = json_encode($value, JSON_FORCE_OBJECT); - } - break; - case 'array': - $value = (array) $value; - case 'json': - $option = !empty($param) ? (int) $param : JSON_UNESCAPED_UNICODE; - $value = json_encode($value, $option); - break; - case 'serialize': - $value = serialize($value); - break; - default: - if (is_object($value) && false !== strpos($type, '\\') && method_exists($value, '__toString')) { - // 对象类型 - $value = $value->__toString(); - } - } - - return $value; - } - - /** - * 获取器 获取数据对象的值 - * @access public - * @param string $name 名称 - * @return mixed - * @throws InvalidArgumentException - */ - public function getAttr(string $name) - { - try { - $relation = false; - $value = $this->getData($name); - } catch (InvalidArgumentException $e) { - $relation = $this->isRelationAttr($name); - $value = null; - } - - return $this->getValue($name, $value, $relation); - } - - /** - * 获取经过获取器处理后的数据对象的值 - * @access protected - * @param string $name 字段名称 - * @param mixed $value 字段值 - * @param bool|string $relation 是否为关联属性或者关联名 - * @return mixed - * @throws InvalidArgumentException - */ - protected function getValue(string $name, $value, $relation = false) - { - // 检测属性获取器 - $fieldName = $this->getRealFieldName($name); - $method = 'get' . Str::studly($name) . 'Attr'; - - if (isset($this->withAttr[$fieldName])) { - if ($relation) { - $value = $this->getRelationValue($relation); - } - - if (in_array($fieldName, $this->json) && is_array($this->withAttr[$fieldName])) { - $value = $this->getJsonValue($fieldName, $value); - } else { - $closure = $this->withAttr[$fieldName]; - $value = $closure($value, $this->data); - } - } elseif (method_exists($this, $method)) { - if ($relation) { - $value = $this->getRelationValue($relation); - } - - $value = $this->$method($value, $this->data); - } elseif (isset($this->type[$fieldName])) { - // 类型转换 - $value = $this->readTransform($value, $this->type[$fieldName]); - } elseif ($this->autoWriteTimestamp && in_array($fieldName, [$this->createTime, $this->updateTime])) { - $value = $this->getTimestampValue($value); - } elseif ($relation) { - $value = $this->getRelationValue($relation); - // 保存关联对象值 - $this->relation[$name] = $value; - } - - return $value; - } - - /** - * 获取JSON字段属性值 - * @access protected - * @param string $name 属性名 - * @param mixed $value JSON数据 - * @return mixed - */ - protected function getJsonValue($name, $value) - { - foreach ($this->withAttr[$name] as $key => $closure) { - if ($this->jsonAssoc) { - $value[$key] = $closure($value[$key], $value); - } else { - $value->$key = $closure($value->$key, $value); - } - } - - return $value; - } - - /** - * 获取关联属性值 - * @access protected - * @param string $relation 关联名 - * @return mixed - */ - protected function getRelationValue(string $relation) - { - $modelRelation = $this->$relation(); - - return $modelRelation instanceof Relation ? $this->getRelationData($modelRelation) : null; - } - - /** - * 数据读取 类型转换 - * @access protected - * @param mixed $value 值 - * @param string|array $type 要转换的类型 - * @return mixed - */ - protected function readTransform($value, $type) - { - if (is_null($value)) { - return; - } - - if (is_array($type)) { - list($type, $param) = $type; - } elseif (strpos($type, ':')) { - list($type, $param) = explode(':', $type, 2); - } - - switch ($type) { - case 'integer': - $value = (int) $value; - break; - case 'float': - if (empty($param)) { - $value = (float) $value; - } else { - $value = (float) number_format($value, $param, '.', ''); - } - break; - case 'boolean': - $value = (bool) $value; - break; - case 'timestamp': - if (!is_null($value)) { - $format = !empty($param) ? $param : $this->dateFormat; - $value = $this->formatDateTime($format, $value, true); - } - break; - case 'datetime': - if (!is_null($value)) { - $format = !empty($param) ? $param : $this->dateFormat; - $value = $this->formatDateTime($format, $value); - } - break; - case 'json': - $value = json_decode($value, true); - break; - case 'array': - $value = empty($value) ? [] : json_decode($value, true); - break; - case 'object': - $value = empty($value) ? new \stdClass() : json_decode($value); - break; - case 'serialize': - try { - $value = unserialize($value); - } catch (\Exception $e) { - $value = null; - } - break; - default: - if (false !== strpos($type, '\\')) { - // 对象类型 - $value = new $type($value); - } - } - - return $value; - } - - /** - * 设置数据字段获取器 - * @access public - * @param string|array $name 字段名 - * @param callable $callback 闭包获取器 - * @return $this - */ - public function withAttribute($name, callable $callback = null) - { - if (is_array($name)) { - foreach ($name as $key => $val) { - $this->withAttribute($key, $val); - } - } else { - $name = $this->getRealFieldName($name); - - if (strpos($name, '.')) { - list($name, $key) = explode('.', $name); - - $this->withAttr[$name][$key] = $callback; - } else { - $this->withAttr[$name] = $callback; - } - } - - return $this; - } - -} diff --git a/vendor/topthink/think-orm/src/model/concern/Conversion.php b/vendor/topthink/think-orm/src/model/concern/Conversion.php deleted file mode 100644 index 178ad0fb..00000000 --- a/vendor/topthink/think-orm/src/model/concern/Conversion.php +++ /dev/null @@ -1,278 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\concern; - -use think\Collection; -use think\db\exception\DbException as Exception; -use think\helper\Str; -use think\Model; -use think\model\Collection as ModelCollection; -use think\model\relation\OneToOne; - -/** - * 模型数据转换处理 - */ -trait Conversion -{ - /** - * 数据输出显示的属性 - * @var array - */ - protected $visible = []; - - /** - * 数据输出隐藏的属性 - * @var array - */ - protected $hidden = []; - - /** - * 数据输出需要追加的属性 - * @var array - */ - protected $append = []; - - /** - * 数据集对象名 - * @var string - */ - protected $resultSetType; - - /** - * 设置需要附加的输出属性 - * @access public - * @param array $append 属性列表 - * @return $this - */ - public function append(array $append = []) - { - $this->append = $append; - - return $this; - } - - /** - * 设置附加关联对象的属性 - * @access public - * @param string $attr 关联属性 - * @param string|array $append 追加属性名 - * @return $this - * @throws Exception - */ - public function appendRelationAttr(string $attr, array $append) - { - $relation = Str::camel($attr); - - if (isset($this->relation[$relation])) { - $model = $this->relation[$relation]; - } else { - $model = $this->getRelationData($this->$relation()); - } - - if ($model instanceof Model) { - foreach ($append as $key => $attr) { - $key = is_numeric($key) ? $attr : $key; - if (isset($this->data[$key])) { - throw new Exception('bind attr has exists:' . $key); - } - - $this->data[$key] = $model->$attr; - } - } - - return $this; - } - - /** - * 设置需要隐藏的输出属性 - * @access public - * @param array $hidden 属性列表 - * @return $this - */ - public function hidden(array $hidden = []) - { - $this->hidden = $hidden; - - return $this; - } - - /** - * 设置需要输出的属性 - * @access public - * @param array $visible - * @return $this - */ - public function visible(array $visible = []) - { - $this->visible = $visible; - - return $this; - } - - /** - * 转换当前模型对象为数组 - * @access public - * @return array - */ - public function toArray(): array - { - $item = []; - $hasVisible = false; - - foreach ($this->visible as $key => $val) { - if (is_string($val)) { - if (strpos($val, '.')) { - list($relation, $name) = explode('.', $val); - $this->visible[$relation][] = $name; - } else { - $this->visible[$val] = true; - $hasVisible = true; - } - unset($this->visible[$key]); - } - } - - foreach ($this->hidden as $key => $val) { - if (is_string($val)) { - if (strpos($val, '.')) { - list($relation, $name) = explode('.', $val); - $this->hidden[$relation][] = $name; - } else { - $this->hidden[$val] = true; - } - unset($this->hidden[$key]); - } - } - - // 合并关联数据 - $data = array_merge($this->data, $this->relation); - - foreach ($data as $key => $val) { - if ($val instanceof Model || $val instanceof ModelCollection) { - // 关联模型对象 - if (isset($this->visible[$key]) && is_array($this->visible[$key])) { - $val->visible($this->visible[$key]); - } elseif (isset($this->hidden[$key]) && is_array($this->hidden[$key])) { - $val->hidden($this->hidden[$key]); - } - // 关联模型对象 - if (!isset($this->hidden[$key]) || true !== $this->hidden[$key]) { - $item[$key] = $val->toArray(); - } - } elseif (isset($this->visible[$key])) { - $item[$key] = $this->getAttr($key); - } elseif (!isset($this->hidden[$key]) && !$hasVisible) { - $item[$key] = $this->getAttr($key); - } - } - - // 追加属性(必须定义获取器) - foreach ($this->append as $key => $name) { - $this->appendAttrToArray($item, $key, $name); - } - - return $item; - } - - protected function appendAttrToArray(array &$item, $key, $name) - { - if (is_array($name)) { - // 追加关联对象属性 - $relation = $this->getRelation($key, true); - $item[$key] = $relation ? $relation->append($name) - ->toArray() : []; - } elseif (strpos($name, '.')) { - list($key, $attr) = explode('.', $name); - // 追加关联对象属性 - $relation = $this->getRelation($key, true); - $item[$key] = $relation ? $relation->append([$attr]) - ->toArray() : []; - } else { - $value = $this->getAttr($name); - $item[$name] = $value; - - $this->getBindAttr($name, $value, $item); - } - } - - protected function getBindAttr(string $name, $value, array &$item = []) - { - $relation = $this->isRelationAttr($name); - if (!$relation) { - return false; - } - - $modelRelation = $this->$relation(); - - if ($modelRelation instanceof OneToOne) { - $bindAttr = $modelRelation->getBindAttr(); - - if (!empty($bindAttr)) { - unset($item[$name]); - } - - foreach ($bindAttr as $key => $attr) { - $key = is_numeric($key) ? $attr : $key; - - if (isset($item[$key])) { - throw new Exception('bind attr has exists:' . $key); - } - - $item[$key] = $value ? $value->getAttr($attr) : null; - } - } - } - - /** - * 转换当前模型对象为JSON字符串 - * @access public - * @param integer $options json参数 - * @return string - */ - public function toJson(int $options = JSON_UNESCAPED_UNICODE): string - { - return json_encode($this->toArray(), $options); - } - - public function __toString() - { - return $this->toJson(); - } - - // JsonSerializable - public function jsonSerialize() - { - return $this->toArray(); - } - - /** - * 转换数据集为数据集对象 - * @access public - * @param array|Collection $collection 数据集 - * @param string $resultSetType 数据集类 - * @return Collection - */ - public function toCollection(iterable $collection = [], string $resultSetType = null): Collection - { - $resultSetType = $resultSetType ?: $this->resultSetType; - - if ($resultSetType && false !== strpos($resultSetType, '\\')) { - $collection = new $resultSetType($collection); - } else { - $collection = new ModelCollection($collection); - } - - return $collection; - } - -} diff --git a/vendor/topthink/think-orm/src/model/concern/ModelEvent.php b/vendor/topthink/think-orm/src/model/concern/ModelEvent.php deleted file mode 100644 index f560379e..00000000 --- a/vendor/topthink/think-orm/src/model/concern/ModelEvent.php +++ /dev/null @@ -1,88 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\concern; - -use think\db\exception\ModelEventException; -use think\helper\Str; - -/** - * 模型事件处理 - */ -trait ModelEvent -{ - - /** - * Event对象 - * @var object - */ - protected static $event; - - /** - * 是否需要事件响应 - * @var bool - */ - protected $withEvent = true; - - /** - * 设置Event对象 - * @access public - * @param object $event Event对象 - * @return void - */ - public static function setEvent($event) - { - self::$event = $event; - } - - /** - * 当前操作的事件响应 - * @access protected - * @param bool $event 是否需要事件响应 - * @return $this - */ - public function withEvent(bool $event) - { - $this->withEvent = $event; - return $this; - } - - /** - * 触发事件 - * @access protected - * @param string $event 事件名 - * @return bool - */ - protected function trigger(string $event): bool - { - if (!$this->withEvent) { - return true; - } - - $call = 'on' . Str::studly($event); - - try { - if (method_exists(static::class, $call)) { - $result = call_user_func([static::class, $call], $this); - } elseif (is_object(self::$event) && method_exists(self::$event, 'trigger')) { - $result = self::$event->trigger(static::class . '.' . $event, $this); - $result = empty($result) ? true : end($result); - } else { - $result = true; - } - - return false === $result ? false : true; - } catch (ModelEventException $e) { - return false; - } - } -} diff --git a/vendor/topthink/think-orm/src/model/concern/OptimLock.php b/vendor/topthink/think-orm/src/model/concern/OptimLock.php deleted file mode 100644 index 5e613183..00000000 --- a/vendor/topthink/think-orm/src/model/concern/OptimLock.php +++ /dev/null @@ -1,85 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\concern; - -use think\db\exception\DbException as Exception; - -/** - * 乐观锁 - */ -trait OptimLock -{ - protected function getOptimLockField() - { - return property_exists($this, 'optimLock') && isset($this->optimLock) ? $this->optimLock : 'lock_version'; - } - - /** - * 数据检查 - * @access protected - * @return void - */ - protected function checkData(): void - { - $this->isExists() ? $this->updateLockVersion() : $this->recordLockVersion(); - } - - /** - * 记录乐观锁 - * @access protected - * @return void - */ - protected function recordLockVersion(): void - { - $optimLock = $this->getOptimLockField(); - - if ($optimLock) { - $this->set($optimLock, 0); - } - } - - /** - * 更新乐观锁 - * @access protected - * @return void - */ - protected function updateLockVersion(): void - { - $optimLock = $this->getOptimLockField(); - - if ($optimLock && $lockVer = $this->getOrigin($optimLock)) { - // 更新乐观锁 - $this->set($optimLock, $lockVer + 1); - } - } - - public function getWhere() - { - $where = parent::getWhere(); - $optimLock = $this->getOptimLockField(); - - if ($optimLock && $lockVer = $this->getOrigin($optimLock)) { - $where[] = [$optimLock, '=', $lockVer]; - } - - return $where; - } - - protected function checkResult($result): void - { - if (!$result) { - throw new Exception('record has update'); - } - } - -} diff --git a/vendor/topthink/think-orm/src/model/concern/RelationShip.php b/vendor/topthink/think-orm/src/model/concern/RelationShip.php deleted file mode 100644 index dd75b8e1..00000000 --- a/vendor/topthink/think-orm/src/model/concern/RelationShip.php +++ /dev/null @@ -1,781 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\concern; - -use Closure; -use think\Collection; -use think\db\BaseQuery as Query; -use think\db\exception\DbException as Exception; -use think\helper\Str; -use think\Model; -use think\model\Relation; -use think\model\relation\BelongsTo; -use think\model\relation\BelongsToMany; -use think\model\relation\HasMany; -use think\model\relation\HasManyThrough; -use think\model\relation\HasOne; -use think\model\relation\HasOneThrough; -use think\model\relation\MorphMany; -use think\model\relation\MorphOne; -use think\model\relation\MorphTo; -use think\model\relation\OneToOne; - -/** - * 模型关联处理 - */ -trait RelationShip -{ - /** - * 父关联模型对象 - * @var object - */ - private $parent; - - /** - * 模型关联数据 - * @var array - */ - private $relation = []; - - /** - * 关联写入定义信息 - * @var array - */ - private $together = []; - - /** - * 关联自动写入信息 - * @var array - */ - protected $relationWrite = []; - - /** - * 设置父关联对象 - * @access public - * @param Model $model 模型对象 - * @return $this - */ - public function setParent(Model $model) - { - $this->parent = $model; - - return $this; - } - - /** - * 获取父关联对象 - * @access public - * @return Model - */ - public function getParent(): Model - { - return $this->parent; - } - - /** - * 获取当前模型的关联模型数据 - * @access public - * @param string $name 关联方法名 - * @param bool $auto 不存在是否自动获取 - * @return mixed - */ - public function getRelation(string $name = null, bool $auto = false) - { - if (is_null($name)) { - return $this->relation; - } - - if (array_key_exists($name, $this->relation)) { - return $this->relation[$name]; - } elseif ($auto) { - $relation = Str::camel($name); - return $this->getRelationValue($relation); - } - } - - /** - * 设置关联数据对象值 - * @access public - * @param string $name 属性名 - * @param mixed $value 属性值 - * @param array $data 数据 - * @return $this - */ - public function setRelation(string $name, $value, array $data = []) - { - // 检测修改器 - $method = 'set' . Str::studly($name) . 'Attr'; - - if (method_exists($this, $method)) { - $value = $this->$method($value, array_merge($this->data, $data)); - } - - $this->relation[$this->getRealFieldName($name)] = $value; - - return $this; - } - - /** - * 查询当前模型的关联数据 - * @access public - * @param array $relations 关联名 - * @param array $withRelationAttr 关联获取器 - * @return void - */ - public function relationQuery(array $relations, array $withRelationAttr = []): void - { - foreach ($relations as $key => $relation) { - $subRelation = ''; - $closure = null; - - if ($relation instanceof Closure) { - // 支持闭包查询过滤关联条件 - $closure = $relation; - $relation = $key; - } - - if (is_array($relation)) { - $subRelation = $relation; - $relation = $key; - } elseif (strpos($relation, '.')) { - list($relation, $subRelation) = explode('.', $relation, 2); - } - - $method = Str::camel($relation); - $relationName = Str::snake($relation); - - $relationResult = $this->$method(); - - if (isset($withRelationAttr[$relationName])) { - $relationResult->withAttr($withRelationAttr[$relationName]); - } - - $this->relation[$relation] = $relationResult->getRelation($subRelation, $closure); - } - } - - /** - * 关联数据写入 - * @access public - * @param array $relation 关联 - * @return $this - */ - public function together(array $relation) - { - $this->together = $relation; - - $this->checkAutoRelationWrite(); - - return $this; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $relation 关联方法名 - * @param mixed $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public static function has(string $relation, string $operator = '>=', int $count = 1, string $id = '*', string $joinType = '', Query $query = null): Query - { - return (new static()) - ->$relation() - ->has($operator, $count, $id, $joinType, $query); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $relation 关联方法名 - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public static function hasWhere(string $relation, $where = [], string $fields = '*', string $joinType = '', Query $query = null): Query - { - return (new static()) - ->$relation() - ->hasWhere($where, $fields, $joinType, $query); - } - - /** - * 预载入关联查询 JOIN方式 - * @access public - * @param Query $query Query对象 - * @param string $relation 关联方法名 - * @param mixed $field 字段 - * @param string $joinType JOIN类型 - * @param Closure $closure 闭包 - * @param bool $first - * @return bool - */ - public function eagerly(Query $query, string $relation, $field, string $joinType = '', Closure $closure = null, bool $first = false): bool - { - $relation = Str::camel($relation); - $class = $this->$relation(); - - if ($class instanceof OneToOne) { - $class->eagerly($query, $relation, $field, $joinType, $closure, $first); - return true; - } else { - return false; - } - } - - /** - * 预载入关联查询 返回数据集 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 关联名 - * @param array $withRelationAttr 关联获取器 - * @param bool $join 是否为JOIN方式 - * @param mixed $cache 关联缓存 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, array $relations, array $withRelationAttr = [], bool $join = false, $cache = false): void - { - foreach ($relations as $key => $relation) { - $subRelation = []; - $closure = null; - - if ($relation instanceof Closure) { - $closure = $relation; - $relation = $key; - } - - if (is_array($relation)) { - $subRelation = $relation; - $relation = $key; - } elseif (strpos($relation, '.')) { - list($relation, $subRelation) = explode('.', $relation, 2); - - $subRelation = [$subRelation]; - } - - $relationName = $relation; - $relation = Str::camel($relation); - - $relationResult = $this->$relation(); - - if (isset($withRelationAttr[$relationName])) { - $relationResult->withAttr($withRelationAttr[$relationName]); - } - - if (is_scalar($cache)) { - $relationCache = [$cache]; - } else { - $relationCache = $cache[$relationName] ?? $cache; - } - - $relationResult->eagerlyResultSet($resultSet, $relationName, $subRelation, $closure, $relationCache, $join); - } - } - - /** - * 预载入关联查询 返回模型对象 - * @access public - * @param Model $result 数据对象 - * @param array $relations 关联 - * @param array $withRelationAttr 关联获取器 - * @param bool $join 是否为JOIN方式 - * @param mixed $cache 关联缓存 - * @return void - */ - public function eagerlyResult(Model $result, array $relations, array $withRelationAttr = [], bool $join = false, $cache = false): void - { - foreach ($relations as $key => $relation) { - $subRelation = []; - $closure = null; - - if ($relation instanceof Closure) { - $closure = $relation; - $relation = $key; - } - - if (is_array($relation)) { - $subRelation = $relation; - $relation = $key; - } elseif (strpos($relation, '.')) { - list($relation, $subRelation) = explode('.', $relation, 2); - - $subRelation = [$subRelation]; - } - - $relationName = $relation; - $relation = Str::camel($relation); - - $relationResult = $this->$relation(); - - if (isset($withRelationAttr[$relationName])) { - $relationResult->withAttr($withRelationAttr[$relationName]); - } - - if (is_scalar($cache)) { - $relationCache = [$cache]; - } else { - $relationCache = $cache[$relationName] ?? []; - } - - $relationResult->eagerlyResult($result, $relationName, $subRelation, $closure, $relationCache, $join); - } - } - - /** - * 绑定(一对一)关联属性到当前模型 - * @access protected - * @param string $relation 关联名称 - * @param array $attrs 绑定属性 - * @return $this - * @throws Exception - */ - public function bindAttr(string $relation, array $attrs = []) - { - $relation = $this->getRelation($relation); - - foreach ($attrs as $key => $attr) { - $key = is_numeric($key) ? $attr : $key; - $value = $this->getOrigin($key); - - if (!is_null($value)) { - throw new Exception('bind attr has exists:' . $key); - } - - $this->set($key, $relation ? $relation->$attr : null); - } - - return $this; - } - - /** - * 关联统计 - * @access public - * @param Query $query 查询对象 - * @param array $relations 关联名 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param bool $useSubQuery 子查询 - * @return void - */ - public function relationCount(Query $query, array $relations, string $aggregate = 'sum', string $field = '*', bool $useSubQuery = true): void - { - foreach ($relations as $key => $relation) { - $closure = $name = null; - - if ($relation instanceof Closure) { - $closure = $relation; - $relation = $key; - } elseif (is_string($key)) { - $name = $relation; - $relation = $key; - } - - $relation = Str::camel($relation); - - if ($useSubQuery) { - $count = $this->$relation()->getRelationCountQuery($closure, $aggregate, $field, $name); - } else { - $count = $this->$relation()->relationCount($this, $closure, $aggregate, $field, $name); - } - - if (empty($name)) { - $name = Str::snake($relation) . '_' . $aggregate; - } - - if ($useSubQuery) { - $query->field(['(' . $count . ')' => $name]); - } else { - $this->setAttr($name, $count); - } - } - } - - /** - * HAS ONE 关联定义 - * @access public - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前主键 - * @return HasOne - */ - public function hasOne(string $model, string $foreignKey = '', string $localKey = ''): HasOne - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $localKey = $localKey ?: $this->getPk(); - $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); - - return new HasOne($this, $model, $foreignKey, $localKey); - } - - /** - * BELONGS TO 关联定义 - * @access public - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 关联主键 - * @return BelongsTo - */ - public function belongsTo(string $model, string $foreignKey = '', string $localKey = ''): BelongsTo - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $foreignKey = $foreignKey ?: $this->getForeignKey((new $model)->getName()); - $localKey = $localKey ?: (new $model)->getPk(); - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); - $relation = Str::snake($trace[1]['function']); - - return new BelongsTo($this, $model, $foreignKey, $localKey, $relation); - } - - /** - * HAS MANY 关联定义 - * @access public - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前主键 - * @return HasMany - */ - public function hasMany(string $model, string $foreignKey = '', string $localKey = ''): HasMany - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $localKey = $localKey ?: $this->getPk(); - $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); - - return new HasMany($this, $model, $foreignKey, $localKey); - } - - /** - * HAS MANY 远程关联定义 - * @access public - * @param string $model 模型名 - * @param string $through 中间模型名 - * @param string $foreignKey 关联外键 - * @param string $throughKey 关联外键 - * @param string $localKey 当前主键 - * @param string $throughPk 中间表主键 - * @return HasManyThrough - */ - public function hasManyThrough(string $model, string $through, string $foreignKey = '', string $throughKey = '', string $localKey = '', string $throughPk = ''): HasManyThrough - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $through = $this->parseModel($through); - $localKey = $localKey ?: $this->getPk(); - $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); - $throughKey = $throughKey ?: $this->getForeignKey((new $through)->getName()); - $throughPk = $throughPk ?: (new $through)->getPk(); - - return new HasManyThrough($this, $model, $through, $foreignKey, $throughKey, $localKey, $throughPk); - } - - /** - * HAS ONE 远程关联定义 - * @access public - * @param string $model 模型名 - * @param string $through 中间模型名 - * @param string $foreignKey 关联外键 - * @param string $throughKey 关联外键 - * @param string $localKey 当前主键 - * @param string $throughPk 中间表主键 - * @return HasOneThrough - */ - public function hasOneThrough(string $model, string $through, string $foreignKey = '', string $throughKey = '', string $localKey = '', string $throughPk = ''): HasOneThrough - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $through = $this->parseModel($through); - $localKey = $localKey ?: $this->getPk(); - $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); - $throughKey = $throughKey ?: $this->getForeignKey((new $through)->getName()); - $throughPk = $throughPk ?: (new $through)->getPk(); - - return new HasOneThrough($this, $model, $through, $foreignKey, $throughKey, $localKey, $throughPk); - } - - /** - * BELONGS TO MANY 关联定义 - * @access public - * @param string $model 模型名 - * @param string $middle 中间表/模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前模型关联键 - * @return BelongsToMany - */ - public function belongsToMany(string $model, string $middle = '', string $foreignKey = '', string $localKey = ''): BelongsToMany - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $name = Str::snake(class_basename($model)); - $middle = $middle ?: Str::snake($this->name) . '_' . $name; - $foreignKey = $foreignKey ?: $name . '_id'; - $localKey = $localKey ?: $this->getForeignKey($this->name); - - return new BelongsToMany($this, $model, $middle, $foreignKey, $localKey); - } - - /** - * MORPH One 关联定义 - * @access public - * @param string $model 模型名 - * @param string|array $morph 多态字段信息 - * @param string $type 多态类型 - * @return MorphOne - */ - public function morphOne(string $model, $morph = null, string $type = ''): MorphOne - { - // 记录当前关联信息 - $model = $this->parseModel($model); - - if (is_null($morph)) { - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); - $morph = Str::snake($trace[1]['function']); - } - - if (is_array($morph)) { - list($morphType, $foreignKey) = $morph; - } else { - $morphType = $morph . '_type'; - $foreignKey = $morph . '_id'; - } - - $type = $type ?: get_class($this); - - return new MorphOne($this, $model, $foreignKey, $morphType, $type); - } - - /** - * MORPH MANY 关联定义 - * @access public - * @param string $model 模型名 - * @param string|array $morph 多态字段信息 - * @param string $type 多态类型 - * @return MorphMany - */ - public function morphMany(string $model, $morph = null, string $type = ''): MorphMany - { - // 记录当前关联信息 - $model = $this->parseModel($model); - - if (is_null($morph)) { - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); - $morph = Str::snake($trace[1]['function']); - } - - $type = $type ?: get_class($this); - - if (is_array($morph)) { - list($morphType, $foreignKey) = $morph; - } else { - $morphType = $morph . '_type'; - $foreignKey = $morph . '_id'; - } - - return new MorphMany($this, $model, $foreignKey, $morphType, $type); - } - - /** - * MORPH TO 关联定义 - * @access public - * @param string|array $morph 多态字段信息 - * @param array $alias 多态别名定义 - * @return MorphTo - */ - public function morphTo($morph = null, array $alias = []): MorphTo - { - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); - $relation = Str::snake($trace[1]['function']); - - if (is_null($morph)) { - $morph = $relation; - } - - // 记录当前关联信息 - if (is_array($morph)) { - list($morphType, $foreignKey) = $morph; - } else { - $morphType = $morph . '_type'; - $foreignKey = $morph . '_id'; - } - - return new MorphTo($this, $morphType, $foreignKey, $alias, $relation); - } - - /** - * 解析模型的完整命名空间 - * @access protected - * @param string $model 模型名(或者完整类名) - * @return string - */ - protected function parseModel(string $model): string - { - if (false === strpos($model, '\\')) { - $path = explode('\\', static::class); - array_pop($path); - array_push($path, Str::studly($model)); - $model = implode('\\', $path); - } - - return $model; - } - - /** - * 获取模型的默认外键名 - * @access protected - * @param string $name 模型名 - * @return string - */ - protected function getForeignKey(string $name): string - { - if (strpos($name, '\\')) { - $name = class_basename($name); - } - - return Str::snake($name) . '_id'; - } - - /** - * 检查属性是否为关联属性 如果是则返回关联方法名 - * @access protected - * @param string $attr 关联属性名 - * @return string|false - */ - protected function isRelationAttr(string $attr) - { - $relation = Str::camel($attr); - - if (method_exists($this, $relation) && !method_exists('think\Model', $relation)) { - return $relation; - } - - return false; - } - - /** - * 智能获取关联模型数据 - * @access protected - * @param Relation $modelRelation 模型关联对象 - * @return mixed - */ - protected function getRelationData(Relation $modelRelation) - { - if ($this->parent && !$modelRelation->isSelfRelation() - && get_class($this->parent) == get_class($modelRelation->getModel())) { - return $this->parent; - } - - // 获取关联数据 - return $modelRelation->getRelation(); - } - - /** - * 关联数据自动写入检查 - * @access protected - * @return void - */ - protected function checkAutoRelationWrite(): void - { - foreach ($this->together as $key => $name) { - if (is_array($name)) { - if (key($name) === 0) { - $this->relationWrite[$key] = []; - // 绑定关联属性 - foreach ($name as $val) { - if (isset($this->data[$val])) { - $this->relationWrite[$key][$val] = $this->data[$val]; - } - } - } else { - // 直接传入关联数据 - $this->relationWrite[$key] = $name; - } - } elseif (isset($this->relation[$name])) { - $this->relationWrite[$name] = $this->relation[$name]; - } elseif (isset($this->data[$name])) { - $this->relationWrite[$name] = $this->data[$name]; - unset($this->data[$name]); - } - } - } - - /** - * 自动关联数据更新(针对一对一关联) - * @access protected - * @return void - */ - protected function autoRelationUpdate(): void - { - foreach ($this->relationWrite as $name => $val) { - if ($val instanceof Model) { - $val->exists(true)->save(); - } else { - $model = $this->getRelation($name, true); - - if ($model instanceof Model) { - $model->exists(true)->save($val); - } - } - } - } - - /** - * 自动关联数据写入(针对一对一关联) - * @access protected - * @return void - */ - protected function autoRelationInsert(): void - { - foreach ($this->relationWrite as $name => $val) { - $method = Str::camel($name); - $this->$method()->save($val); - } - } - - /** - * 自动关联数据删除(支持一对一及一对多关联) - * @access protected - * @return void - */ - protected function autoRelationDelete(): void - { - foreach ($this->relationWrite as $key => $name) { - $name = is_numeric($key) ? $name : $key; - $result = $this->getRelation($name, true); - - if ($result instanceof Model) { - $result->delete(); - } elseif ($result instanceof Collection) { - foreach ($result as $model) { - $model->delete(); - } - } - } - } - - /** - * 移除当前模型的关联属性 - * @access public - * @return $this - */ - public function removeRelation() - { - $this->relation = []; - return $this; - } -} diff --git a/vendor/topthink/think-orm/src/model/concern/SoftDelete.php b/vendor/topthink/think-orm/src/model/concern/SoftDelete.php deleted file mode 100644 index 7357bc5f..00000000 --- a/vendor/topthink/think-orm/src/model/concern/SoftDelete.php +++ /dev/null @@ -1,246 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\concern; - -use think\db\BaseQuery as Query; - -/** - * 数据软删除 - */ -trait SoftDelete -{ - /** - * 是否包含软删除数据 - * @var bool - */ - protected $withTrashed = false; - - /** - * 判断当前实例是否被软删除 - * @access public - * @return bool - */ - public function trashed(): bool - { - $field = $this->getDeleteTimeField(); - - if ($field && !empty($this->getOrigin($field))) { - return true; - } - - return false; - } - - /** - * 查询软删除数据 - * @access public - * @return Query - */ - public static function withTrashed(): Query - { - $model = new static(); - - return $model->withTrashedData(true)->db(); - } - - /** - * 是否包含软删除数据 - * @access protected - * @param bool $withTrashed 是否包含软删除数据 - * @return $this - */ - protected function withTrashedData(bool $withTrashed) - { - $this->withTrashed = $withTrashed; - return $this; - } - - /** - * 只查询软删除数据 - * @access public - * @return Query - */ - public static function onlyTrashed(): Query - { - $model = new static(); - $field = $model->getDeleteTimeField(true); - - if ($field) { - return $model - ->db() - ->useSoftDelete($field, $model->getWithTrashedExp()); - } - - return $model->db(); - } - - /** - * 获取软删除数据的查询条件 - * @access protected - * @return array - */ - protected function getWithTrashedExp(): array - { - return is_null($this->defaultSoftDelete) ? ['notnull', ''] : ['<>', $this->defaultSoftDelete]; - } - - /** - * 删除当前的记录 - * @access public - * @return bool - */ - public function delete(): bool - { - if (!$this->isExists() || $this->isEmpty() || false === $this->trigger('BeforeDelete')) { - return false; - } - - $name = $this->getDeleteTimeField(); - - if ($name && !$this->isForce()) { - // 软删除 - $this->set($name, $this->autoWriteTimestamp($name)); - - $result = $this->exists()->withEvent(false)->save(); - - $this->withEvent(true); - } else { - // 读取更新条件 - $where = $this->getWhere(); - - // 删除当前模型数据 - $result = $this->db() - ->where($where) - ->removeOption('soft_delete') - ->delete(); - - $this->lazySave(false); - } - - // 关联删除 - if (!empty($this->relationWrite)) { - $this->autoRelationDelete(); - } - - $this->trigger('AfterDelete'); - - $this->exists(false); - - return true; - } - - /** - * 删除记录 - * @access public - * @param mixed $data 主键列表 支持闭包查询条件 - * @param bool $force 是否强制删除 - * @return bool - */ - public static function destroy($data, bool $force = false): bool - { - // 包含软删除数据 - $query = (new static())->db(false); - - if (is_array($data) && key($data) !== 0) { - $query->where($data); - $data = null; - } elseif ($data instanceof \Closure) { - call_user_func_array($data, [ & $query]); - $data = null; - } elseif (is_null($data)) { - return false; - } - - $resultSet = $query->select($data); - - foreach ($resultSet as $result) { - $result->force($force)->delete(); - } - - return true; - } - - /** - * 恢复被软删除的记录 - * @access public - * @param array $where 更新条件 - * @return bool - */ - public function restore($where = []): bool - { - $name = $this->getDeleteTimeField(); - - if (!$name || false === $this->trigger('BeforeRestore')) { - return false; - } - - if (empty($where)) { - $pk = $this->getPk(); - if (is_string($pk)) { - $where[] = [$pk, '=', $this->getData($pk)]; - } - } - - // 恢复删除 - $this->db(false) - ->where($where) - ->useSoftDelete($name, $this->getWithTrashedExp()) - ->update([$name => $this->defaultSoftDelete]); - - $this->trigger('AfterRestore'); - - return true; - } - - /** - * 获取软删除字段 - * @access protected - * @param bool $read 是否查询操作 写操作的时候会自动去掉表别名 - * @return string|false - */ - protected function getDeleteTimeField(bool $read = false) - { - $field = property_exists($this, 'deleteTime') && isset($this->deleteTime) ? $this->deleteTime : 'delete_time'; - - if (false === $field) { - return false; - } - - if (false === strpos($field, '.')) { - $field = '__TABLE__.' . $field; - } - - if (!$read && strpos($field, '.')) { - $array = explode('.', $field); - $field = array_pop($array); - } - - return $field; - } - - /** - * 查询的时候默认排除软删除数据 - * @access protected - * @param Query $query - * @return void - */ - protected function withNoTrashed(Query $query): void - { - $field = $this->getDeleteTimeField(true); - - if ($field) { - $condition = is_null($this->defaultSoftDelete) ? ['null', ''] : ['=', $this->defaultSoftDelete]; - $query->useSoftDelete($field, $condition); - } - } -} diff --git a/vendor/topthink/think-orm/src/model/concern/TimeStamp.php b/vendor/topthink/think-orm/src/model/concern/TimeStamp.php deleted file mode 100644 index e207961f..00000000 --- a/vendor/topthink/think-orm/src/model/concern/TimeStamp.php +++ /dev/null @@ -1,208 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\concern; - -use DateTime; - -/** - * 自动时间戳 - */ -trait TimeStamp -{ - /** - * 是否需要自动写入时间戳 如果设置为字符串 则表示时间字段的类型 - * @var bool|string - */ - protected $autoWriteTimestamp; - - /** - * 创建时间字段 false表示关闭 - * @var false|string - */ - protected $createTime = 'create_time'; - - /** - * 更新时间字段 false表示关闭 - * @var false|string - */ - protected $updateTime = 'update_time'; - - /** - * 时间字段显示格式 - * @var string - */ - protected $dateFormat; - - /** - * 是否需要自动写入时间字段 - * @access public - * @param bool|string $auto - * @return $this - */ - public function isAutoWriteTimestamp($auto) - { - $this->autoWriteTimestamp = $this->checkTimeFieldType($auto); - - return $this; - } - - /** - * 检测时间字段的实际类型 - * @access public - * @param bool|string $type - * @return mixed - */ - protected function checkTimeFieldType($type) - { - if (true === $type) { - if (isset($this->type[$this->createTime])) { - $type = $this->type[$this->createTime]; - } elseif (isset($this->schema[$this->createTime]) && in_array($this->schema[$this->createTime], ['datetime', 'date', 'timestamp', 'int'])) { - $type = $this->schema[$this->createTime]; - } else { - $type = $this->getFieldType($this->createTime); - } - } - - return $type; - } - - /** - * 获取自动写入时间字段 - * @access public - * @return bool|string - */ - public function getAutoWriteTimestamp() - { - return $this->autoWriteTimestamp; - } - - /** - * 设置时间字段格式化 - * @access public - * @param string|false $format - * @return $this - */ - public function setDateFormat($format) - { - $this->dateFormat = $format; - - return $this; - } - - /** - * 获取自动写入时间字段 - * @access public - * @return string|false - */ - public function getDateFormat() - { - return $this->dateFormat; - } - - /** - * 自动写入时间戳 - * @access protected - * @return mixed - */ - protected function autoWriteTimestamp() - { - // 检测时间字段类型 - $type = $this->checkTimeFieldType($this->autoWriteTimestamp); - - return is_string($type) ? $this->getTimeTypeValue($type) : time(); - } - - /** - * 获取指定类型的时间字段值 - * @access protected - * @param string $type 时间字段类型 - * @return mixed - */ - protected function getTimeTypeValue(string $type) - { - $value = time(); - - switch ($type) { - case 'datetime': - case 'date': - case 'timestamp': - $value = $this->formatDateTime('Y-m-d H:i:s.u'); - break; - default: - if (false !== strpos($type, '\\')) { - // 对象数据写入 - $obj = new $type(); - if (method_exists($obj, '__toString')) { - // 对象数据写入 - $value = $obj->__toString(); - } - } - } - - return $value; - } - - /** - * 时间日期字段格式化处理 - * @access protected - * @param mixed $format 日期格式 - * @param mixed $time 时间日期表达式 - * @param bool $timestamp 时间表达式是否为时间戳 - * @return mixed - */ - protected function formatDateTime($format, $time = 'now', bool $timestamp = false) - { - if (empty($time)) { - return; - } - - if (false === $format) { - return $time; - } elseif (false !== strpos($format, '\\')) { - return new $format($time); - } - - if ($time instanceof DateTime) { - $dateTime = $time; - } elseif ($timestamp) { - $dateTime = new DateTime(); - $dateTime->setTimestamp((int) $time); - } else { - $dateTime = new DateTime($time); - } - - return $dateTime->format($format); - } - - /** - * 获取时间字段值 - * @access protected - * @param mixed $value - * @return mixed - */ - protected function getTimestampValue($value) - { - $type = $this->checkTimeFieldType($this->autoWriteTimestamp); - - if (is_string($type) && in_array(strtolower($type), [ - 'datetime', 'date', 'timestamp', - ])) { - $value = $this->formatDateTime($this->dateFormat, $value); - } else { - $value = $this->formatDateTime($this->dateFormat, $value, true); - } - - return $value; - } -} diff --git a/vendor/topthink/think-orm/src/model/relation/BelongsTo.php b/vendor/topthink/think-orm/src/model/relation/BelongsTo.php deleted file mode 100644 index 76c7019b..00000000 --- a/vendor/topthink/think-orm/src/model/relation/BelongsTo.php +++ /dev/null @@ -1,331 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\relation; - -use Closure; -use think\db\BaseQuery as Query; -use think\helper\Str; -use think\Model; - -/** - * BelongsTo关联类 - */ -class BelongsTo extends OneToOne -{ - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 关联主键 - * @param string $relation 关联名 - */ - public function __construct(Model $parent, string $model, string $foreignKey, string $localKey, string $relation = null) - { - $this->parent = $parent; - $this->model = $model; - $this->foreignKey = $foreignKey; - $this->localKey = $localKey; - $this->query = (new $model)->db(); - $this->relation = $relation; - - if (get_class($parent) == $model) { - $this->selfRelation = true; - } - } - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation(array $subRelation = [], Closure $closure = null) - { - if ($closure) { - $closure($this->getClosureType($closure)); - } - - $foreignKey = $this->foreignKey; - - $relationModel = $this->query - ->removeWhereField($this->localKey) - ->where($this->localKey, $this->parent->$foreignKey) - ->relation($subRelation) - ->find(); - - if ($relationModel) { - if (!empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $this->parent); - } - - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 创建关联统计子查询 - * @access public - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 聚合字段别名 - * @return string - */ - public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', &$name = ''): string - { - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->query - ->whereExp($this->localKey, '=' . $this->parent->getTable() . '.' . $this->foreignKey) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount(Model $result, Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null) - { - $foreignKey = $this->foreignKey; - - if (!isset($result->$foreignKey)) { - return 0; - } - - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->query - ->where($this->localKey, '=', $result->$foreignKey) - ->$aggregate($field); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = '', Query $query = null): Query - { - $table = $this->query->getTable(); - $model = class_basename($this->parent); - $relation = class_basename($this->model); - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - $softDelete = $this->query->getOptions('soft_delete'); - $query = $query ?: $this->parent->db()->alias($model); - - return $query->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey, $softDelete) { - $query->table([$table => $relation]) - ->field($relation . '.' . $localKey) - ->whereExp($model . '.' . $foreignKey, '=' . $relation . '.' . $localKey) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }); - }); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function hasWhere($where = [], $fields = null, string $joinType = '', Query $query = null): Query - { - $table = $this->query->getTable(); - $model = class_basename($this->parent); - $relation = class_basename($this->model); - - if (is_array($where)) { - $this->getQueryWhere($where, $relation); - } elseif ($where instanceof Query) { - $where->via($relation); - } elseif ($where instanceof Closure) { - $where($this->query->via($relation)); - $where = $this->query; - } - - $fields = $this->getRelationQueryFields($fields, $model); - $softDelete = $this->query->getOptions('soft_delete'); - $query = $query ?: $this->parent->db()->alias($model); - - return $query->field($fields) - ->join([$table => $relation], $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $joinType ?: $this->joinType) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->where($where); - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - protected function eagerlySet(array &$resultSet, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $range = []; - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$foreignKey)) { - $range[] = $result->$foreignKey; - } - } - - if (!empty($range)) { - $this->query->removeWhereField($localKey); - - $data = $this->eagerlyWhere([ - [$localKey, 'in', $range], - ], $localKey, $subRelation, $closure, $cache); - - // 关联数据封装 - foreach ($resultSet as $result) { - // 关联模型 - if (!isset($data[$result->$foreignKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$foreignKey]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - if ($relationModel && !empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $result); - } else { - // 设置关联属性 - $result->setRelation($relation, $relationModel); - } - } - } - } - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - protected function eagerlyOne(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $this->query->removeWhereField($localKey); - - $data = $this->eagerlyWhere([ - [$localKey, '=', $result->$foreignKey], - ], $localKey, $subRelation, $closure, $cache); - - // 关联模型 - if (!isset($data[$result->$foreignKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$foreignKey]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - if ($relationModel && !empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $result); - } else { - // 设置关联属性 - $result->setRelation($relation, $relationModel); - } - } - - /** - * 添加关联数据 - * @access public - * @param Model $model关联模型对象 - * @return Model - */ - public function associate(Model $model): Model - { - $this->parent->setAttr($this->foreignKey, $model->getKey()); - $this->parent->save(); - - return $this->parent->setRelation($this->relation, $model); - } - - /** - * 注销关联数据 - * @access public - * @return Model - */ - public function dissociate(): Model - { - $foreignKey = $this->foreignKey; - - $this->parent->setAttr($foreignKey, null); - $this->parent->save(); - - return $this->parent->setRelation($this->relation, null); - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery(): void - { - if (empty($this->baseQuery)) { - if (isset($this->parent->{$this->foreignKey})) { - // 关联查询带入关联条件 - $this->query->where($this->localKey, '=', $this->parent->{$this->foreignKey}); - } - - $this->baseQuery = true; - } - } -} diff --git a/vendor/topthink/think-orm/src/model/relation/BelongsToMany.php b/vendor/topthink/think-orm/src/model/relation/BelongsToMany.php deleted file mode 100644 index 16f4bf5e..00000000 --- a/vendor/topthink/think-orm/src/model/relation/BelongsToMany.php +++ /dev/null @@ -1,708 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\Collection; -use think\db\BaseQuery as Query; -use think\db\exception\DbException as Exception; -use think\db\Raw; -use think\helper\Str; -use think\Model; -use think\model\Pivot; -use think\model\Relation; -use think\Paginator; - -/** - * 多对多关联类 - */ -class BelongsToMany extends Relation -{ - /** - * 中间表表名 - * @var string - */ - protected $middle; - - /** - * 中间表模型名称 - * @var string - */ - protected $pivotName; - - /** - * 中间表模型对象 - * @var Pivot - */ - protected $pivot; - - /** - * 中间表数据名称 - * @var string - */ - protected $pivotDataName = 'pivot'; - - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $middle 中间表/模型名 - * @param string $foreignKey 关联模型外键 - * @param string $localKey 当前模型关联键 - */ - public function __construct(Model $parent, string $model, string $middle, string $foreignKey, string $localKey) - { - $this->parent = $parent; - $this->model = $model; - $this->foreignKey = $foreignKey; - $this->localKey = $localKey; - - if (false !== strpos($middle, '\\')) { - $this->pivotName = $middle; - $this->middle = class_basename($middle); - } else { - $this->middle = $middle; - } - - $this->query = (new $model)->db(); - $this->pivot = $this->newPivot(); - } - - /** - * 设置中间表模型 - * @access public - * @param $pivot - * @return $this - */ - public function pivot(string $pivot) - { - $this->pivotName = $pivot; - return $this; - } - - /** - * 设置中间表数据名称 - * @access public - * @param string $name - * @return $this - */ - public function name(string $name) - { - $this->pivotDataName = $name; - return $this; - } - - /** - * 实例化中间表模型 - * @access public - * @param $data - * @return Pivot - * @throws Exception - */ - protected function newPivot(array $data = []): Pivot - { - $class = $this->pivotName ?: Pivot::class; - $pivot = new $class($data, $this->parent, $this->middle); - - if ($pivot instanceof Pivot) { - return $pivot; - } else { - throw new Exception('pivot model must extends: \think\model\Pivot'); - } - } - - /** - * 合成中间表模型 - * @access protected - * @param array|Collection|Paginator $models - */ - protected function hydratePivot(iterable $models) - { - foreach ($models as $model) { - $pivot = []; - - foreach ($model->getData() as $key => $val) { - if (strpos($key, '__')) { - list($name, $attr) = explode('__', $key, 2); - - if ('pivot' == $name) { - $pivot[$attr] = $val; - unset($model->$key); - } - } - } - - $model->setRelation($this->pivotDataName, $this->newPivot($pivot)); - } - } - - /** - * 创建关联查询Query对象 - * @access protected - * @return Query - */ - protected function buildQuery(): Query - { - $foreignKey = $this->foreignKey; - $localKey = $this->localKey; - - // 关联查询 - $pk = $this->parent->getPk(); - - $condition = ['pivot.' . $localKey, '=', $this->parent->$pk]; - - return $this->belongsToManyQuery($foreignKey, $localKey, [$condition]); - } - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Collection - */ - public function getRelation(array $subRelation = [], Closure $closure = null): Collection - { - if ($closure) { - $closure($this->getClosureType($closure)); - } - - $result = $this->buildQuery() - ->relation($subRelation) - ->select() - ->setParent(clone $this->parent); - - $this->hydratePivot($result); - - return $result; - } - - /** - * 重载select方法 - * @access public - * @param mixed $data - * @return Collection - */ - public function select($data = null): Collection - { - $result = $this->buildQuery()->select($data); - $this->hydratePivot($result); - - return $result; - } - - /** - * 重载paginate方法 - * @access public - * @param int|array $listRows - * @param int|bool $simple - * @param array $config - * @return Paginator - */ - public function paginate($listRows = null, $simple = false, $config = []): Paginator - { - $result = $this->buildQuery()->paginate($listRows, $simple, $config); - $this->hydratePivot($result); - - return $result; - } - - /** - * 重载find方法 - * @access public - * @param mixed $data - * @return Model - */ - public function find($data = null) - { - $result = $this->buildQuery()->find($data); - - if (!$result->isEmpty()) { - $this->hydratePivot([$result]); - } - - return $result; - } - - /** - * 查找多条记录 如果不存在则抛出异常 - * @access public - * @param array|string|Query|\Closure $data - * @return Collection - */ - public function selectOrFail($data = null): Collection - { - return $this->buildQuery()->failException(true)->select($data); - } - - /** - * 查找单条记录 如果不存在则抛出异常 - * @access public - * @param array|string|Query|\Closure $data - * @return Model - */ - public function findOrFail($data = null): Model - { - return $this->buildQuery()->failException(true)->find($data); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Model - */ - public function has(string $operator = '>=', $count = 1, $id = '*', string $joinType = 'INNER', Query $query = null) - { - return $this->parent; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - * @throws Exception - */ - public function hasWhere($where = [], $fields = null, string $joinType = '', Query $query = null) - { - throw new Exception('relation not support: hasWhere'); - } - - /** - * 设置中间表的查询条件 - * @access public - * @param string $field - * @param string $op - * @param mixed $condition - * @return $this - */ - public function wherePivot($field, $op = null, $condition = null) - { - $this->query->where('pivot.' . $field, $op, $condition); - return $this; - } - - /** - * 预载入关联查询(数据集) - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation, Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $pk = $resultSet[0]->getPk(); - $range = []; - - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$pk)) { - $range[] = $result->$pk; - } - } - - if (!empty($range)) { - // 查询关联数据 - $data = $this->eagerlyManyToMany([ - ['pivot.' . $localKey, 'in', $range], - ], $subRelation, $closure, $cache); - - // 关联数据封装 - foreach ($resultSet as $result) { - if (!isset($data[$result->$pk])) { - $data[$result->$pk] = []; - } - - $result->setRelation($relation, $this->resultSetBuild($data[$result->$pk], clone $this->parent)); - } - } - } - - /** - * 预载入关联查询(单个数据) - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation, Closure $closure = null, array $cache = []): void - { - $pk = $result->getPk(); - - if (isset($result->$pk)) { - $pk = $result->$pk; - // 查询管理数据 - $data = $this->eagerlyManyToMany([ - ['pivot.' . $this->localKey, '=', $pk], - ], $subRelation, $closure, $cache); - - // 关联数据封装 - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - $result->setRelation($relation, $this->resultSetBuild($data[$pk], clone $this->parent)); - } - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount(Model $result, Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): float - { - $pk = $result->getPk(); - - if (!isset($result->$pk)) { - return 0; - } - - $pk = $result->$pk; - - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ - ['pivot.' . $this->localKey, '=', $pk], - ])->$aggregate($field); - } - - /** - * 获取关联统计子查询 - * @access public - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return string - */ - public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): string - { - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ - [ - 'pivot.' . $this->localKey, 'exp', new Raw('=' . $this->parent->db(false)->getTable() . '.' . $this->parent->getPk()), - ], - ])->fetchSql()->$aggregate($field); - } - - /** - * 多对多 关联模型预查询 - * @access protected - * @param array $where 关联预查询条件 - * @param array $subRelation 子关联 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return array - */ - protected function eagerlyManyToMany(array $where, array $subRelation = [], Closure $closure = null, array $cache = []): array - { - if ($closure) { - $closure($this->getClosureType($closure)); - } - - // 预载入关联查询 支持嵌套预载入 - $list = $this->belongsToManyQuery($this->foreignKey, $this->localKey, $where) - ->with($subRelation) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->select(); - - // 组装模型数据 - $data = []; - foreach ($list as $set) { - $pivot = []; - foreach ($set->getData() as $key => $val) { - if (strpos($key, '__')) { - list($name, $attr) = explode('__', $key, 2); - if ('pivot' == $name) { - $pivot[$attr] = $val; - unset($set->$key); - } - } - } - - $key = $pivot[$this->localKey]; - - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { - continue; - } - - $set->setRelation($this->pivotDataName, $this->newPivot($pivot)); - - $data[$key][] = $set; - } - - return $data; - } - - /** - * BELONGS TO MANY 关联查询 - * @access protected - * @param string $foreignKey 关联模型关联键 - * @param string $localKey 当前模型关联键 - * @param array $condition 关联查询条件 - * @return Query - */ - protected function belongsToManyQuery(string $foreignKey, string $localKey, array $condition = []): Query - { - // 关联查询封装 - $tableName = $this->query->getTable(); - $table = $this->pivot->db()->getTable(); - $fields = $this->getQueryFields($tableName); - - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - - $query = $this->query - ->field($fields) - ->tableField(true, $table, 'pivot', 'pivot__'); - - if (empty($this->baseQuery)) { - $relationFk = $this->query->getPk(); - $query->join([$table => 'pivot'], 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk) - ->where($condition); - } - - return $query; - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 - * @param array $pivot 中间表额外数据 - * @return array|Pivot - */ - public function save($data, array $pivot = []) - { - // 保存关联表/中间表数据 - return $this->attach($data, $pivot); - } - - /** - * 批量保存当前关联数据对象 - * @access public - * @param iterable $dataSet 数据集 - * @param array $pivot 中间表额外数据 - * @param bool $samePivot 额外数据是否相同 - * @return array|false - */ - public function saveAll(iterable $dataSet, array $pivot = [], bool $samePivot = false) - { - $result = []; - - foreach ($dataSet as $key => $data) { - if (!$samePivot) { - $pivotData = $pivot[$key] ?? []; - } else { - $pivotData = $pivot; - } - - $result[] = $this->attach($data, $pivotData); - } - - return empty($result) ? false : $result; - } - - /** - * 附加关联的一个中间表数据 - * @access public - * @param mixed $data 数据 可以使用数组、关联模型对象 或者 关联对象的主键 - * @param array $pivot 中间表额外数据 - * @return array|Pivot - * @throws Exception - */ - public function attach($data, array $pivot = []) - { - if (is_array($data)) { - if (key($data) === 0) { - $id = $data; - } else { - // 保存关联表数据 - $model = new $this->model; - $id = $model->insertGetId($data); - } - } elseif (is_numeric($data) || is_string($data)) { - // 根据关联表主键直接写入中间表 - $id = $data; - } elseif ($data instanceof Model) { - // 根据关联表主键直接写入中间表 - $relationFk = $data->getPk(); - $id = $data->$relationFk; - } - - if (!empty($id)) { - // 保存中间表数据 - $pk = $this->parent->getPk(); - $pivot[$this->localKey] = $this->parent->$pk; - $ids = (array) $id; - - foreach ($ids as $id) { - $pivot[$this->foreignKey] = $id; - $this->pivot->replace() - ->exists(false) - ->data([]) - ->save($pivot); - $result[] = $this->newPivot($pivot); - } - - if (count($result) == 1) { - // 返回中间表模型对象 - $result = $result[0]; - } - - return $result; - } else { - throw new Exception('miss relation data'); - } - } - - /** - * 判断是否存在关联数据 - * @access public - * @param mixed $data 数据 可以使用关联模型对象 或者 关联对象的主键 - * @return Pivot|false - */ - public function attached($data) - { - if ($data instanceof Model) { - $id = $data->getKey(); - } else { - $id = $data; - } - - $pivot = $this->pivot - ->where($this->localKey, $this->parent->getKey()) - ->where($this->foreignKey, $id) - ->find(); - - return $pivot ?: false; - } - - /** - * 解除关联的一个中间表数据 - * @access public - * @param integer|array $data 数据 可以使用关联对象的主键 - * @param bool $relationDel 是否同时删除关联表数据 - * @return integer - */ - public function detach($data = null, bool $relationDel = false): int - { - if (is_array($data)) { - $id = $data; - } elseif (is_numeric($data) || is_string($data)) { - // 根据关联表主键直接写入中间表 - $id = $data; - } elseif ($data instanceof Model) { - // 根据关联表主键直接写入中间表 - $relationFk = $data->getPk(); - $id = $data->$relationFk; - } - - // 删除中间表数据 - $pk = $this->parent->getPk(); - $pivot = []; - $pivot[] = [$this->localKey, '=', $this->parent->$pk]; - - if (isset($id)) { - $pivot[] = [$this->foreignKey, is_array($id) ? 'in' : '=', $id]; - } - - $result = $this->pivot->where($pivot)->delete(); - - // 删除关联表数据 - if (isset($id) && $relationDel) { - $model = $this->model; - $model::destroy($id); - } - - return $result; - } - - /** - * 数据同步 - * @access public - * @param array $ids - * @param bool $detaching - * @return array - */ - public function sync(array $ids, bool $detaching = true): array - { - $changes = [ - 'attached' => [], - 'detached' => [], - 'updated' => [], - ]; - - $pk = $this->parent->getPk(); - - $current = $this->pivot - ->where($this->localKey, $this->parent->$pk) - ->column($this->foreignKey); - - $records = []; - - foreach ($ids as $key => $value) { - if (!is_array($value)) { - $records[$value] = []; - } else { - $records[$key] = $value; - } - } - - $detach = array_diff($current, array_keys($records)); - - if ($detaching && count($detach) > 0) { - $this->detach($detach); - $changes['detached'] = $detach; - } - - foreach ($records as $id => $attributes) { - if (!in_array($id, $current)) { - $this->attach($id, $attributes); - $changes['attached'][] = $id; - } elseif (count($attributes) > 0 && $this->attach($id, $attributes)) { - $changes['updated'][] = $id; - } - } - - return $changes; - } - -} diff --git a/vendor/topthink/think-orm/src/model/relation/HasMany.php b/vendor/topthink/think-orm/src/model/relation/HasMany.php deleted file mode 100644 index aa46a88b..00000000 --- a/vendor/topthink/think-orm/src/model/relation/HasMany.php +++ /dev/null @@ -1,367 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\relation; - -use Closure; -use think\Collection; -use think\db\BaseQuery as Query; -use think\helper\Str; -use think\Model; -use think\model\Relation; - -/** - * 一对多关联类 - */ -class HasMany extends Relation -{ - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前模型主键 - */ - public function __construct(Model $parent, string $model, string $foreignKey, string $localKey) - { - $this->parent = $parent; - $this->model = $model; - $this->foreignKey = $foreignKey; - $this->localKey = $localKey; - $this->query = (new $model)->db(); - - if (get_class($parent) == $model) { - $this->selfRelation = true; - } - } - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Collection - */ - public function getRelation(array $subRelation = [], Closure $closure = null): Collection - { - if ($closure) { - $closure($this->getClosureType($closure)); - } - - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - - return $this->query - ->where($this->foreignKey, $this->parent->{$this->localKey}) - ->relation($subRelation) - ->select() - ->setParent(clone $this->parent); - } - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation, Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $range = []; - - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$localKey)) { - $range[] = $result->$localKey; - } - } - - if (!empty($range)) { - $data = $this->eagerlyOneToMany([ - [$this->foreignKey, 'in', $range], - ], $subRelation, $closure, $cache); - - // 关联数据封装 - foreach ($resultSet as $result) { - $pk = $result->$localKey; - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - $result->setRelation($relation, $this->resultSetBuild($data[$pk], clone $this->parent)); - } - } - } - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - - if (isset($result->$localKey)) { - $pk = $result->$localKey; - $data = $this->eagerlyOneToMany([ - [$this->foreignKey, '=', $pk], - ], $subRelation, $closure, $cache); - - // 关联数据封装 - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - $result->setRelation($relation, $this->resultSetBuild($data[$pk], clone $this->parent)); - } - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount(Model $result, Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null) - { - $localKey = $this->localKey; - - if (!isset($result->$localKey)) { - return 0; - } - - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->query - ->where($this->foreignKey, '=', $result->$localKey) - ->$aggregate($field); - } - - /** - * 创建关联统计子查询 - * @access public - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return string - */ - public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): string - { - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->query->alias($aggregate . '_table') - ->whereExp($aggregate . '_table.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 一对多 关联模型预查询 - * @access public - * @param array $where 关联预查询条件 - * @param array $subRelation 子关联 - * @param Closure $closure - * @param array $cache 关联缓存 - * @return array - */ - protected function eagerlyOneToMany(array $where, array $subRelation = [], Closure $closure = null, array $cache = []): array - { - $foreignKey = $this->foreignKey; - - $this->query->removeWhereField($this->foreignKey); - - // 预载入关联查询 支持嵌套预载入 - if ($closure) { - $this->baseQuery = true; - $closure($this->getClosureType($closure)); - } - - $list = $this->query - ->where($where) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->with($subRelation) - ->select(); - - // 组装模型数据 - $data = []; - - foreach ($list as $set) { - $key = $set->$foreignKey; - - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { - continue; - } - - $data[$key][] = $set; - } - - return $data; - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 可以使用数组 关联模型对象 - * @param boolean $replace 是否自动识别更新和写入 - * @return Model|false - */ - public function save($data, bool $replace = true) - { - $model = $this->make(); - - return $model->replace($replace)->save($data) ? $model : false; - } - - /** - * 创建关联对象实例 - * @param array|Model $data - * @return Model - */ - public function make($data = []): Model - { - if ($data instanceof Model) { - $data = $data->getData(); - } - - // 保存关联表数据 - $data[$this->foreignKey] = $this->parent->{$this->localKey}; - - return new $this->model($data); - } - - /** - * 批量保存当前关联数据对象 - * @access public - * @param iterable $dataSet 数据集 - * @param boolean $replace 是否自动识别更新和写入 - * @return array|false - */ - public function saveAll(iterable $dataSet, bool $replace = true) - { - $result = []; - - foreach ($dataSet as $key => $data) { - $result[] = $this->save($data, $replace); - } - - return empty($result) ? false : $result; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = 'INNER', Query $query = null): Query - { - $table = $this->query->getTable(); - - $model = class_basename($this->parent); - $relation = class_basename($this->model); - - if ('*' != $id) { - $id = $relation . '.' . (new $this->model)->getPk(); - } - - $softDelete = $this->query->getOptions('soft_delete'); - $query = $query ?: $this->parent->db()->alias($model); - - return $query->field($model . '.*') - ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->group($relation . '.' . $this->foreignKey) - ->having('count(' . $id . ')' . $operator . $count); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function hasWhere($where = [], $fields = null, string $joinType = '', Query $query = null): Query - { - $table = $this->query->getTable(); - $model = class_basename($this->parent); - $relation = class_basename($this->model); - - if (is_array($where)) { - $this->getQueryWhere($where, $relation); - } elseif ($where instanceof Query) { - $where->via($relation); - } elseif ($where instanceof Closure) { - $where($this->query->via($relation)); - $where = $this->query; - } - - $fields = $this->getRelationQueryFields($fields, $model); - $softDelete = $this->query->getOptions('soft_delete'); - $query = $query ?: $this->parent->db()->alias($model); - - return $query->group($model . '.' . $this->localKey) - ->field($fields) - ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->where($where); - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery(): void - { - if (empty($this->baseQuery)) { - if (isset($this->parent->{$this->localKey})) { - // 关联查询带入关联条件 - $this->query->where($this->foreignKey, '=', $this->parent->{$this->localKey}); - } - - $this->baseQuery = true; - } - } - -} diff --git a/vendor/topthink/think-orm/src/model/relation/HasManyThrough.php b/vendor/topthink/think-orm/src/model/relation/HasManyThrough.php deleted file mode 100644 index 23367f34..00000000 --- a/vendor/topthink/think-orm/src/model/relation/HasManyThrough.php +++ /dev/null @@ -1,382 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\Collection; -use think\db\BaseQuery as Query; -use think\helper\Str; -use think\Model; -use think\model\Relation; - -/** - * 远程一对多关联类 - */ -class HasManyThrough extends Relation -{ - /** - * 中间关联表外键 - * @var string - */ - protected $throughKey; - - /** - * 中间主键 - * @var string - */ - protected $throughPk; - - /** - * 中间表查询对象 - * @var Query - */ - protected $through; - - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 关联模型名 - * @param string $through 中间模型名 - * @param string $foreignKey 关联外键 - * @param string $throughKey 中间关联外键 - * @param string $localKey 当前模型主键 - * @param string $throughPk 中间模型主键 - */ - public function __construct(Model $parent, string $model, string $through, string $foreignKey, string $throughKey, string $localKey, string $throughPk) - { - $this->parent = $parent; - $this->model = $model; - $this->through = (new $through)->db(); - $this->foreignKey = $foreignKey; - $this->throughKey = $throughKey; - $this->localKey = $localKey; - $this->throughPk = $throughPk; - $this->query = (new $model)->db(); - } - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Collection - */ - public function getRelation(array $subRelation = [], Closure $closure = null) - { - if ($closure) { - $closure($this->getClosureType($closure)); - } - - $this->baseQuery(); - - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - - return $this->query->relation($subRelation) - ->select() - ->setParent(clone $this->parent); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = '', Query $query = null): Query - { - $model = Str::snake(class_basename($this->parent)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $relation = new $this->model; - $relationTable = $relation->getTable(); - $softDelete = $this->query->getOptions('soft_delete'); - - if ('*' != $id) { - $id = $relationTable . '.' . $relation->getPk(); - } - $query = $query ?: $this->parent->db()->alias($model); - - return $query->field($model . '.*') - ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey) - ->join($relationTable, $relationTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk) - ->when($softDelete, function ($query) use ($softDelete, $relationTable) { - $query->where($relationTable . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->group($relationTable . '.' . $this->throughKey) - ->having('count(' . $id . ')' . $operator . $count); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function hasWhere($where = [], $fields = null, $joinType = '', Query $query = null): Query - { - $model = Str::snake(class_basename($this->parent)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $modelTable = (new $this->model)->getTable(); - - if (is_array($where)) { - $this->getQueryWhere($where, $modelTable); - } elseif ($where instanceof Query) { - $where->via($modelTable); - } elseif ($where instanceof Closure) { - $where($this->query->via($modelTable)); - $where = $this->query; - } - - $fields = $this->getRelationQueryFields($fields, $model); - $softDelete = $this->query->getOptions('soft_delete'); - $query = $query ?: $this->parent->db()->alias($model); - - return $query->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey) - ->join($modelTable, $modelTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk) - ->when($softDelete, function ($query) use ($softDelete, $modelTable) { - $query->where($modelTable . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->group($modelTable . '.' . $this->throughKey) - ->where($where) - ->field($fields); - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $range = []; - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$localKey)) { - $range[] = $result->$localKey; - } - } - - if (!empty($range)) { - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$this->foreignKey, 'in', $range], - ], $foreignKey, $subRelation, $closure, $cache); - - // 关联数据封装 - foreach ($resultSet as $result) { - $pk = $result->$localKey; - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - // 设置关联属性 - $result->setRelation($relation, $this->resultSetBuild($data[$pk], clone $this->parent)); - } - } - } - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - $pk = $result->$localKey; - - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$foreignKey, '=', $pk], - ], $foreignKey, $subRelation, $closure, $cache); - - // 关联数据封装 - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - $result->setRelation($relation, $this->resultSetBuild($data[$pk], clone $this->parent)); - } - - /** - * 关联模型预查询 - * @access public - * @param array $where 关联预查询条件 - * @param string $key 关联键名 - * @param array $subRelation 子关联 - * @param Closure $closure - * @param array $cache 关联缓存 - * @return array - */ - protected function eagerlyWhere(array $where, string $key, array $subRelation = [], Closure $closure = null, array $cache = []): array - { - // 预载入关联查询 支持嵌套预载入 - $throughList = $this->through->where($where)->select(); - $keys = $throughList->column($this->throughPk, $this->throughPk); - - if ($closure) { - $this->baseQuery = true; - $closure($this->getClosureType($closure)); - } - - $list = $this->query - ->where($this->throughKey, 'in', $keys) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->select(); - - // 组装模型数据 - $data = []; - $keys = $throughList->column($this->foreignKey, $this->throughPk); - - foreach ($list as $set) { - $key = $keys[$set->{$this->throughKey}]; - - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { - continue; - } - - $data[$key][] = $set; - } - - return $data; - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return mixed - */ - public function relationCount(Model $result, Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null) - { - $localKey = $this->localKey; - - if (!isset($result->$localKey)) { - return 0; - } - - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - $alias = Str::snake(class_basename($this->model)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $modelTable = $this->parent->getTable(); - - if (false === strpos($field, '.')) { - $field = $alias . '.' . $field; - } - - return $this->query - ->alias($alias) - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) - ->where($throughTable . '.' . $this->foreignKey, $result->$localKey) - ->$aggregate($field); - } - - /** - * 创建关联统计子查询 - * @access public - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return string - */ - public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): string - { - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - $alias = Str::snake(class_basename($this->model)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $modelTable = $this->parent->getTable(); - - if (false === strpos($field, '.')) { - $field = $alias . '.' . $field; - } - - return $this->query - ->alias($alias) - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) - ->whereExp($throughTable . '.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery(): void - { - if (empty($this->baseQuery) && $this->parent->getData()) { - $alias = Str::snake(class_basename($this->model)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $modelTable = $this->parent->getTable(); - $fields = $this->getQueryFields($alias); - - $this->query - ->field($fields) - ->alias($alias) - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) - ->where($throughTable . '.' . $this->foreignKey, $this->parent->{$this->localKey}); - - $this->baseQuery = true; - } - } - -} diff --git a/vendor/topthink/think-orm/src/model/relation/HasOne.php b/vendor/topthink/think-orm/src/model/relation/HasOne.php deleted file mode 100644 index 98bdf89b..00000000 --- a/vendor/topthink/think-orm/src/model/relation/HasOne.php +++ /dev/null @@ -1,300 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\model\relation; - -use Closure; -use think\db\BaseQuery as Query; -use think\helper\Str; -use think\Model; - -/** - * HasOne 关联类 - */ -class HasOne extends OneToOne -{ - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前模型主键 - */ - public function __construct(Model $parent, string $model, string $foreignKey, string $localKey) - { - $this->parent = $parent; - $this->model = $model; - $this->foreignKey = $foreignKey; - $this->localKey = $localKey; - $this->query = (new $model)->db(); - - if (get_class($parent) == $model) { - $this->selfRelation = true; - } - } - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation(array $subRelation = [], Closure $closure = null) - { - $localKey = $this->localKey; - - if ($closure) { - $closure($this->getClosureType($closure)); - } - - // 判断关联类型执行查询 - $relationModel = $this->query - ->removeWhereField($this->foreignKey) - ->where($this->foreignKey, $this->parent->$localKey) - ->relation($subRelation) - ->find(); - - if ($relationModel) { - if (!empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $this->parent); - } - - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 创建关联统计子查询 - * @access public - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return string - */ - public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): string - { - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->query - ->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount(Model $result, Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null) - { - $localKey = $this->localKey; - - if (!isset($result->$localKey)) { - return 0; - } - - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->query - ->where($this->foreignKey, '=', $result->$localKey) - ->$aggregate($field); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = '', Query $query = null): Query - { - $table = $this->query->getTable(); - $model = class_basename($this->parent); - $relation = class_basename($this->model); - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - $softDelete = $this->query->getOptions('soft_delete'); - $query = $query ?: $this->parent->db()->alias($model); - - return $query->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey, $softDelete) { - $query->table([$table => $relation]) - ->field($relation . '.' . $foreignKey) - ->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }); - }); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function hasWhere($where = [], $fields = null, string $joinType = '', Query $query = null): Query - { - $table = $this->query->getTable(); - $model = class_basename($this->parent); - $relation = class_basename($this->model); - - if (is_array($where)) { - $this->getQueryWhere($where, $relation); - } elseif ($where instanceof Query) { - $where->via($relation); - } elseif ($where instanceof Closure) { - $where($this->query->via($relation)); - $where = $this->query; - } - - $fields = $this->getRelationQueryFields($fields, $model); - $softDelete = $this->query->getOptions('soft_delete'); - $query = $query ?: $this->parent->db()->alias($model); - - return $query->field($fields) - ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType ?: $this->joinType) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->where($where); - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - protected function eagerlySet(array &$resultSet, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $range = []; - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$localKey)) { - $range[] = $result->$localKey; - } - } - - if (!empty($range)) { - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$foreignKey, 'in', $range], - ], $foreignKey, $subRelation, $closure, $cache); - - // 关联数据封装 - foreach ($resultSet as $result) { - // 关联模型 - if (!isset($data[$result->$localKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$localKey]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - if ($relationModel && !empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $result); - } else { - // 设置关联属性 - $result->setRelation($relation, $relationModel); - } - } - } - } - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - protected function eagerlyOne(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$foreignKey, '=', $result->$localKey], - ], $foreignKey, $subRelation, $closure, $cache); - - // 关联模型 - if (!isset($data[$result->$localKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$localKey]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - if ($relationModel && !empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $result); - } else { - $result->setRelation($relation, $relationModel); - } - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery(): void - { - if (empty($this->baseQuery)) { - if (isset($this->parent->{$this->localKey})) { - // 关联查询带入关联条件 - $this->query->where($this->foreignKey, '=', $this->parent->{$this->localKey}); - } - - $this->baseQuery = true; - } - } -} diff --git a/vendor/topthink/think-orm/src/model/relation/HasOneThrough.php b/vendor/topthink/think-orm/src/model/relation/HasOneThrough.php deleted file mode 100644 index 8ec42df4..00000000 --- a/vendor/topthink/think-orm/src/model/relation/HasOneThrough.php +++ /dev/null @@ -1,163 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\helper\Str; -use think\Model; - -/** - * 远程一对一关联类 - */ -class HasOneThrough extends HasManyThrough -{ - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation(array $subRelation = [], Closure $closure = null) - { - if ($closure) { - $closure($this->getClosureType($closure)); - } - - $this->baseQuery(); - - $relationModel = $this->query->relation($subRelation)->find(); - - if ($relationModel) { - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $range = []; - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$localKey)) { - $range[] = $result->$localKey; - } - } - - if (!empty($range)) { - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$this->foreignKey, 'in', $range], - ], $foreignKey, $subRelation, $closure, $cache); - - // 关联数据封装 - foreach ($resultSet as $result) { - // 关联模型 - if (!isset($data[$result->$localKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$localKey]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - // 设置关联属性 - $result->setRelation($relation, $relationModel); - } - } - } - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$foreignKey, '=', $result->$localKey], - ], $foreignKey, $subRelation, $closure, $cache); - - // 关联模型 - if (!isset($data[$result->$localKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$localKey]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - $result->setRelation($relation, $relationModel); - } - - /** - * 关联模型预查询 - * @access public - * @param array $where 关联预查询条件 - * @param string $key 关联键名 - * @param array $subRelation 子关联 - * @param Closure $closure - * @param array $cache 关联缓存 - * @return array - */ - protected function eagerlyWhere(array $where, string $key, array $subRelation = [], Closure $closure = null, array $cache = []): array - { - // 预载入关联查询 支持嵌套预载入 - $keys = $this->through->where($where)->column($this->throughPk, $this->foreignKey); - - if ($closure) { - $closure($this->getClosureType($closure)); - } - - $list = $this->query - ->where($this->throughKey, 'in', $keys) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->select(); - - // 组装模型数据 - $data = []; - $keys = array_flip($keys); - - foreach ($list as $set) { - $data[$keys[$set->{$this->throughKey}]] = $set; - } - - return $data; - } - -} diff --git a/vendor/topthink/think-orm/src/model/relation/MorphMany.php b/vendor/topthink/think-orm/src/model/relation/MorphMany.php deleted file mode 100644 index 82910cbc..00000000 --- a/vendor/topthink/think-orm/src/model/relation/MorphMany.php +++ /dev/null @@ -1,353 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\Collection; -use think\db\BaseQuery as Query; -use think\db\exception\DbException as Exception; -use think\helper\Str; -use think\Model; -use think\model\Relation; - -/** - * 多态一对多关联 - */ -class MorphMany extends Relation -{ - - /** - * 多态关联外键 - * @var string - */ - protected $morphKey; - /** - * 多态字段名 - * @var string - */ - protected $morphType; - - /** - * 多态类型 - * @var string - */ - protected $type; - - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $morphKey 关联外键 - * @param string $morphType 多态字段名 - * @param string $type 多态类型 - */ - public function __construct(Model $parent, string $model, string $morphKey, string $morphType, string $type) - { - $this->parent = $parent; - $this->model = $model; - $this->type = $type; - $this->morphKey = $morphKey; - $this->morphType = $morphType; - $this->query = (new $model)->db(); - } - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Collection - */ - public function getRelation(array $subRelation = [], Closure $closure = null): Collection - { - if ($closure) { - $closure($this->getClosureType($closure)); - } - - $this->baseQuery(); - - if ($this->withLimit) { - $this->query->limit($this->withLimit); - } - - return $this->query->relation($subRelation) - ->select() - ->setParent(clone $this->parent); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = '', Query $query = null) - { - throw new Exception('relation not support: has'); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function hasWhere($where = [], $fields = null, string $joinType = '', Query $query = null) - { - throw new Exception('relation not support: hasWhere'); - } - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation, Closure $closure = null, array $cache = []): void - { - $morphType = $this->morphType; - $morphKey = $this->morphKey; - $type = $this->type; - $range = []; - - foreach ($resultSet as $result) { - $pk = $result->getPk(); - // 获取关联外键列表 - if (isset($result->$pk)) { - $range[] = $result->$pk; - } - } - - if (!empty($range)) { - $where = [ - [$morphKey, 'in', $range], - [$morphType, '=', $type], - ]; - $data = $this->eagerlyMorphToMany($where, $subRelation, $closure, $cache); - - // 关联数据封装 - foreach ($resultSet as $result) { - if (!isset($data[$result->$pk])) { - $data[$result->$pk] = []; - } - - $result->setRelation($relation, $this->resultSetBuild($data[$result->$pk], clone $this->parent)); - } - } - } - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $pk = $result->getPk(); - - if (isset($result->$pk)) { - $key = $result->$pk; - $data = $this->eagerlyMorphToMany([ - [$this->morphKey, '=', $key], - [$this->morphType, '=', $this->type], - ], $subRelation, $closure, $cache); - - if (!isset($data[$key])) { - $data[$key] = []; - } - - $result->setRelation($relation, $this->resultSetBuild($data[$key], clone $this->parent)); - } - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return mixed - */ - public function relationCount(Model $result, Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null) - { - $pk = $result->getPk(); - - if (!isset($result->$pk)) { - return 0; - } - - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->query - ->where([ - [$this->morphKey, '=', $result->$pk], - [$this->morphType, '=', $this->type], - ]) - ->$aggregate($field); - } - - /** - * 获取关联统计子查询 - * @access public - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return string - */ - public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): string - { - if ($closure) { - $closure($this->getClosureType($closure), $name); - } - - return $this->query - ->whereExp($this->morphKey, '=' . $this->parent->getTable() . '.' . $this->parent->getPk()) - ->where($this->morphType, '=', $this->type) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 多态一对多 关联模型预查询 - * @access protected - * @param array $where 关联预查询条件 - * @param array $subRelation 子关联 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return array - */ - protected function eagerlyMorphToMany(array $where, array $subRelation = [], Closure $closure = null, array $cache = []): array - { - // 预载入关联查询 支持嵌套预载入 - $this->query->removeOption('where'); - - if ($closure) { - $this->baseQuery = true; - $closure($this->getClosureType($closure)); - } - - $list = $this->query - ->where($where) - ->with($subRelation) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->select(); - $morphKey = $this->morphKey; - - // 组装模型数据 - $data = []; - foreach ($list as $set) { - $key = $set->$morphKey; - - if ($this->withLimit && isset($data[$key]) && count($data[$key]) >= $this->withLimit) { - continue; - } - - $data[$key][] = $set; - } - - return $data; - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 可以使用数组 关联模型对象 - * @param bool $replace 是否自动识别更新和写入 - * @return Model|false - */ - public function save($data, bool $replace = true) - { - $model = $this->make(); - - return $model->replace($replace)->save($data) ? $model : false; - } - - /** - * 创建关联对象实例 - * @param array|Model $data - * @return Model - */ - public function make($data = []): Model - { - if ($data instanceof Model) { - $data = $data->getData(); - } - - // 保存关联表数据 - $pk = $this->parent->getPk(); - - $data[$this->morphKey] = $this->parent->$pk; - $data[$this->morphType] = $this->type; - - return new $this->model($data); - } - - /** - * 批量保存当前关联数据对象 - * @access public - * @param iterable $dataSet 数据集 - * @param boolean $replace 是否自动识别更新和写入 - * @return array|false - */ - public function saveAll(iterable $dataSet, bool $replace = true) - { - $result = []; - - foreach ($dataSet as $key => $data) { - $result[] = $this->save($data, $replace); - } - - return empty($result) ? false : $result; - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery(): void - { - if (empty($this->baseQuery) && $this->parent->getData()) { - $pk = $this->parent->getPk(); - - $this->query->where([ - [$this->morphKey, '=', $this->parent->$pk], - [$this->morphType, '=', $this->type], - ]); - - $this->baseQuery = true; - } - } - -} diff --git a/vendor/topthink/think-orm/src/model/relation/MorphOne.php b/vendor/topthink/think-orm/src/model/relation/MorphOne.php deleted file mode 100644 index 6789c761..00000000 --- a/vendor/topthink/think-orm/src/model/relation/MorphOne.php +++ /dev/null @@ -1,280 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\BaseQuery as Query; -use think\db\exception\DbException as Exception; -use think\helper\Str; -use think\Model; -use think\model\Relation; - -/** - * 多态一对一关联类 - */ -class MorphOne extends Relation -{ - /** - * 多态关联外键 - * @var string - */ - protected $morphKey; - - /** - * 多态字段 - * @var string - */ - protected $morphType; - - /** - * 多态类型 - * @var string - */ - protected $type; - - /** - * 构造函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $morphKey 关联外键 - * @param string $morphType 多态字段名 - * @param string $type 多态类型 - */ - public function __construct(Model $parent, string $model, string $morphKey, string $morphType, string $type) - { - $this->parent = $parent; - $this->model = $model; - $this->type = $type; - $this->morphKey = $morphKey; - $this->morphType = $morphType; - $this->query = (new $model)->db(); - } - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation(array $subRelation = [], Closure $closure = null) - { - if ($closure) { - $closure($this->getClosureType($closure)); - } - - $this->baseQuery(); - - $relationModel = $this->query->relation($subRelation)->find(); - - if ($relationModel) { - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = '', Query $query = null) - { - return $this->parent; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function hasWhere($where = [], $fields = null, string $joinType = '', Query $query = null) - { - throw new Exception('relation not support: hasWhere'); - } - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation, Closure $closure = null, array $cache = []): void - { - $morphType = $this->morphType; - $morphKey = $this->morphKey; - $type = $this->type; - $range = []; - - foreach ($resultSet as $result) { - $pk = $result->getPk(); - // 获取关联外键列表 - if (isset($result->$pk)) { - $range[] = $result->$pk; - } - } - - if (!empty($range)) { - $data = $this->eagerlyMorphToOne([ - [$morphKey, 'in', $range], - [$morphType, '=', $type], - ], $subRelation, $closure, $cache); - - // 关联数据封装 - foreach ($resultSet as $result) { - if (!isset($data[$result->$pk])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$pk]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - $result->setRelation($relation, $relationModel); - } - } - } - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - $pk = $result->getPk(); - - if (isset($result->$pk)) { - $pk = $result->$pk; - $data = $this->eagerlyMorphToOne([ - [$this->morphKey, '=', $pk], - [$this->morphType, '=', $this->type], - ], $subRelation, $closure, $cache); - - if (isset($data[$pk])) { - $relationModel = $data[$pk]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } else { - $relationModel = null; - } - - $result->setRelation($relation, $relationModel); - } - } - - /** - * 多态一对一 关联模型预查询 - * @access protected - * @param array $where 关联预查询条件 - * @param array $subRelation 子关联 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return array - */ - protected function eagerlyMorphToOne(array $where, array $subRelation = [], $closure = null, array $cache = []): array - { - // 预载入关联查询 支持嵌套预载入 - if ($closure) { - $this->baseQuery = true; - $closure($this->getClosureType($closure)); - } - - $list = $this->query - ->where($where) - ->with($subRelation) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->select(); - $morphKey = $this->morphKey; - - // 组装模型数据 - $data = []; - - foreach ($list as $set) { - $data[$set->$morphKey] = $set; - } - - return $data; - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 可以使用数组 关联模型对象 - * @param boolean $replace 是否自动识别更新和写入 - * @return Model|false - */ - public function save($data, bool $replace = true) - { - $model = $this->make(); - return $model->replace($replace)->save($data) ? $model : false; - } - - /** - * 创建关联对象实例 - * @param array|Model $data - * @return Model - */ - public function make($data = []): Model - { - if ($data instanceof Model) { - $data = $data->getData(); - } - - // 保存关联表数据 - $pk = $this->parent->getPk(); - - $data[$this->morphKey] = $this->parent->$pk; - $data[$this->morphType] = $this->type; - - return new $this->model($data); - } - - /** - * 执行基础查询(进执行一次) - * @access protected - * @return void - */ - protected function baseQuery(): void - { - if (empty($this->baseQuery) && $this->parent->getData()) { - $pk = $this->parent->getPk(); - - $this->query->where([ - [$this->morphKey, '=', $this->parent->$pk], - [$this->morphType, '=', $this->type], - ]); - $this->baseQuery = true; - } - } - -} diff --git a/vendor/topthink/think-orm/src/model/relation/MorphTo.php b/vendor/topthink/think-orm/src/model/relation/MorphTo.php deleted file mode 100644 index c939c1d9..00000000 --- a/vendor/topthink/think-orm/src/model/relation/MorphTo.php +++ /dev/null @@ -1,333 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\exception\DbException as Exception; -use think\helper\Str; -use think\Model; -use think\model\Relation; - -/** - * 多态关联类 - */ -class MorphTo extends Relation -{ - /** - * 多态关联外键 - * @var string - */ - protected $morphKey; - - /** - * 多态字段 - * @var string - */ - protected $morphType; - - /** - * 多态别名 - * @var array - */ - protected $alias = []; - - /** - * 关联名 - * @var string - */ - protected $relation; - - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $morphType 多态字段名 - * @param string $morphKey 外键名 - * @param array $alias 多态别名定义 - * @param string $relation 关联名 - */ - public function __construct(Model $parent, string $morphType, string $morphKey, array $alias = [], string $relation = null) - { - $this->parent = $parent; - $this->morphType = $morphType; - $this->morphKey = $morphKey; - $this->alias = $alias; - $this->relation = $relation; - } - - /** - * 获取当前的关联模型类的实例 - * @access public - * @return Model - */ - public function getModel(): Model - { - $morphType = $this->morphType; - $model = $this->parseModel($this->parent->$morphType); - - return (new $model); - } - - /** - * 延迟获取关联数据 - * @access public - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation(array $subRelation = [], Closure $closure = null) - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - - // 多态模型 - $model = $this->parseModel($this->parent->$morphType); - - // 主键数据 - $pk = $this->parent->$morphKey; - - $relationModel = (new $model)->relation($subRelation)->find($pk); - - if ($relationModel) { - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = '', Query $query = null) - { - return $this->parent; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @param string $joinType JOIN类型 - * @param Query $query Query对象 - * @return Query - */ - public function hasWhere($where = [], $fields = null, string $joinType = '', Query $query = null) - { - throw new Exception('relation not support: hasWhere'); - } - - /** - * 解析模型的完整命名空间 - * @access protected - * @param string $model 模型名(或者完整类名) - * @return string - */ - protected function parseModel(string $model): string - { - if (isset($this->alias[$model])) { - $model = $this->alias[$model]; - } - - if (false === strpos($model, '\\')) { - $path = explode('\\', get_class($this->parent)); - array_pop($path); - array_push($path, Str::studly($model)); - $model = implode('\\', $path); - } - - return $model; - } - - /** - * 设置多态别名 - * @access public - * @param array $alias 别名定义 - * @return $this - */ - public function setAlias(array $alias) - { - $this->alias = $alias; - - return $this; - } - - /** - * 移除关联查询参数 - * @access public - * @return $this - */ - public function removeOption() - { - return $this; - } - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - * @throws Exception - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation, Closure $closure = null, array $cache = []): void - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - $range = []; - - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (!empty($result->$morphKey)) { - $range[$result->$morphType][] = $result->$morphKey; - } - } - - if (!empty($range)) { - - foreach ($range as $key => $val) { - // 多态类型映射 - $model = $this->parseModel($key); - $obj = new $model; - $pk = $obj->getPk(); - $list = $obj->with($subRelation) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->select($val); - $data = []; - - foreach ($list as $k => $vo) { - $data[$vo->$pk] = $vo; - } - - foreach ($resultSet as $result) { - if ($key == $result->$morphType) { - // 关联模型 - if (!isset($data[$result->$morphKey])) { - $relationModel = null; - throw new Exception('relation data not exists :' . $this->model); - } else { - $relationModel = $data[$result->$morphKey]; - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - $result->setRelation($relation, $relationModel); - } - } - } - } - } - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = []): void - { - // 多态类型映射 - $model = $this->parseModel($result->{$this->morphType}); - - $this->eagerlyMorphToOne($model, $relation, $result, $subRelation, $cache); - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @return integer - */ - public function relationCount(Model $result, Closure $closure = null, string $aggregate = 'count', string $field = '*') - {} - - /** - * 多态MorphTo 关联模型预查询 - * @access protected - * @param string $model 关联模型对象 - * @param string $relation 关联名 - * @param Model $result - * @param array $subRelation 子关联 - * @param array $cache 关联缓存 - * @return void - */ - protected function eagerlyMorphToOne(string $model, string $relation, Model $result, array $subRelation = [], array $cache = []): void - { - // 预载入关联查询 支持嵌套预载入 - $pk = $this->parent->{$this->morphKey}; - $data = (new $model)->with($subRelation) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->find($pk); - - if ($data) { - $data->setParent(clone $result); - $data->exists(true); - } - - $result->setRelation($relation, $data ?: null); - } - - /** - * 添加关联数据 - * @access public - * @param Model $model 关联模型对象 - * @param string $type 多态类型 - * @return Model - */ - public function associate(Model $model, string $type = ''): Model - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - $pk = $model->getPk(); - - $this->parent->setAttr($morphKey, $model->$pk); - $this->parent->setAttr($morphType, $type ?: get_class($model)); - $this->parent->save(); - - return $this->parent->setRelation($this->relation, $model); - } - - /** - * 注销关联数据 - * @access public - * @return Model - */ - public function dissociate(): Model - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - - $this->parent->setAttr($morphKey, null); - $this->parent->setAttr($morphType, null); - $this->parent->save(); - - return $this->parent->setRelation($this->relation, null); - } - -} diff --git a/vendor/topthink/think-orm/src/model/relation/OneToOne.php b/vendor/topthink/think-orm/src/model/relation/OneToOne.php deleted file mode 100644 index e3eb48a4..00000000 --- a/vendor/topthink/think-orm/src/model/relation/OneToOne.php +++ /dev/null @@ -1,332 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\BaseQuery as Query; -use think\db\exception\DbException as Exception; -use think\helper\Str; -use think\Model; -use think\model\Relation; - -/** - * 一对一关联基础类 - * @package think\model\relation - */ -abstract class OneToOne extends Relation -{ - /** - * JOIN类型 - * @var string - */ - protected $joinType = 'INNER'; - - /** - * 绑定的关联属性 - * @var array - */ - protected $bindAttr = []; - - /** - * 关联名 - * @var string - */ - protected $relation; - - /** - * 设置join类型 - * @access public - * @param string $type JOIN类型 - * @return $this - */ - public function joinType(string $type) - { - $this->joinType = $type; - return $this; - } - - /** - * 预载入关联查询(JOIN方式) - * @access public - * @param Query $query 查询对象 - * @param string $relation 关联名 - * @param mixed $field 关联字段 - * @param string $joinType JOIN方式 - * @param Closure $closure 闭包条件 - * @param bool $first - * @return void - */ - public function eagerly(Query $query, string $relation, $field = true, string $joinType = '', Closure $closure = null, bool $first = false): void - { - $name = Str::snake(class_basename($this->parent)); - - if ($first) { - $table = $query->getTable(); - $query->table([$table => $name]); - - if ($query->getOptions('field')) { - $masterField = $query->getOptions('field'); - $query->removeOption('field'); - } else { - $masterField = true; - } - - $query->tableField($masterField, $table, $name); - } - - // 预载入封装 - $joinTable = $this->query->getTable(); - $joinAlias = $relation; - $joinType = $joinType ?: $this->joinType; - - $query->via($joinAlias); - - if ($this instanceof BelongsTo) { - $joinOn = $name . '.' . $this->foreignKey . '=' . $joinAlias . '.' . $this->localKey; - } else { - $joinOn = $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey; - } - - if ($closure) { - // 执行闭包查询 - $closure($this->getClosureType($closure)); - - // 使用withField指定获取关联的字段 - if ($this->withField) { - $field = $this->withField; - } - } - - $query->join([$joinTable => $joinAlias], $joinOn, $joinType) - ->tableField($field, $joinTable, $joinAlias, $relation . '__'); - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet - * @param string $relation - * @param array $subRelation - * @param Closure $closure - * @return mixed - */ - abstract protected function eagerlySet(array &$resultSet, string $relation, array $subRelation = [], Closure $closure = null); - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result - * @param string $relation - * @param array $subRelation - * @param Closure $closure - * @return mixed - */ - abstract protected function eagerlyOne(Model $result, string $relation, array $subRelation = [], Closure $closure = null); - - /** - * 预载入关联查询(数据集) - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @param bool $join 是否为JOIN方式 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation = [], Closure $closure = null, array $cache = [], bool $join = false): void - { - if ($join) { - // 模型JOIN关联组装 - foreach ($resultSet as $result) { - $this->match($this->model, $relation, $result); - } - } else { - // IN查询 - $this->eagerlySet($resultSet, $relation, $subRelation, $closure, $cache); - } - } - - /** - * 预载入关联查询(数据) - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param array $subRelation 子关联名 - * @param Closure $closure 闭包 - * @param array $cache 关联缓存 - * @param bool $join 是否为JOIN方式 - * @return void - */ - public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null, array $cache = [], bool $join = false): void - { - if ($join) { - // 模型JOIN关联组装 - $this->match($this->model, $relation, $result); - } else { - // IN查询 - $this->eagerlyOne($result, $relation, $subRelation, $closure, $cache); - } - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 可以使用数组 关联模型对象 - * @param boolean $replace 是否自动识别更新和写入 - * @return Model|false - */ - public function save($data, bool $replace = true) - { - if ($data instanceof Model) { - $data = $data->getData(); - } - - $model = new $this->model; - // 保存关联表数据 - $data[$this->foreignKey] = $this->parent->{$this->localKey}; - - return $model->replace($replace)->save($data) ? $model : false; - } - - /** - * 绑定关联表的属性到父模型属性 - * @access public - * @param array $attr 要绑定的属性列表 - * @return $this - */ - public function bind(array $attr) - { - $this->bindAttr = $attr; - - return $this; - } - - /** - * 获取绑定属性 - * @access public - * @return array - */ - public function getBindAttr(): array - { - return $this->bindAttr; - } - - /** - * 一对一 关联模型预查询拼装 - * @access public - * @param string $model 模型名称 - * @param string $relation 关联名 - * @param Model $result 模型对象实例 - * @return void - */ - protected function match(string $model, string $relation, Model $result): void - { - // 重新组装模型数据 - foreach ($result->getData() as $key => $val) { - if (strpos($key, '__')) { - list($name, $attr) = explode('__', $key, 2); - if ($name == $relation) { - $list[$name][$attr] = $val; - unset($result->$key); - } - } - } - - if (isset($list[$relation])) { - $array = array_unique($list[$relation]); - - if (count($array) == 1 && null === current($array)) { - $relationModel = null; - } else { - $relationModel = new $model($list[$relation]); - $relationModel->setParent(clone $result); - $relationModel->exists(true); - } - - if ($relationModel && !empty($this->bindAttr)) { - $this->bindAttr($relationModel, $result); - } - } else { - $relationModel = null; - } - - $result->setRelation($relation, $relationModel); - } - - /** - * 绑定关联属性到父模型 - * @access protected - * @param Model $model 关联模型对象 - * @param Model $result 父模型对象 - * @return void - * @throws Exception - */ - protected function bindAttr(Model $model, Model $result): void - { - foreach ($this->bindAttr as $key => $attr) { - $key = is_numeric($key) ? $attr : $key; - $value = $result->getOrigin($key); - - if (!is_null($value)) { - throw new Exception('bind attr has exists:' . $key); - } - - $result->setAttr($key, $model ? $model->$attr : null); - } - } - - /** - * 一对一 关联模型预查询(IN方式) - * @access public - * @param array $where 关联预查询条件 - * @param string $key 关联键名 - * @param array $subRelation 子关联 - * @param Closure $closure - * @param array $cache 关联缓存 - * @return array - */ - protected function eagerlyWhere(array $where, string $key, array $subRelation = [], Closure $closure = null, array $cache = []) - { - // 预载入关联查询 支持嵌套预载入 - if ($closure) { - $this->baseQuery = true; - $closure($this->getClosureType($closure)); - } - - if ($this->withField) { - $this->query->field($this->withField); - } - - if ($this->query->getOptions('order')) { - $this->query->group($key); - } - - $list = $this->query - ->where($where) - ->with($subRelation) - ->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null) - ->select(); - - // 组装模型数据 - $data = []; - - foreach ($list as $set) { - if (!isset($data[$set->$key])) { - $data[$set->$key] = $set; - } - } - - return $data; - } - -} diff --git a/vendor/topthink/think-orm/src/paginator/driver/Bootstrap.php b/vendor/topthink/think-orm/src/paginator/driver/Bootstrap.php deleted file mode 100644 index 6d55c394..00000000 --- a/vendor/topthink/think-orm/src/paginator/driver/Bootstrap.php +++ /dev/null @@ -1,209 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\paginator\driver; - -use think\Paginator; - -/** - * Bootstrap 分页驱动 - */ -class Bootstrap extends Paginator -{ - - /** - * 上一页按钮 - * @param string $text - * @return string - */ - protected function getPreviousButton(string $text = "«"): string - { - - if ($this->currentPage() <= 1) { - return $this->getDisabledTextWrapper($text); - } - - $url = $this->url( - $this->currentPage() - 1 - ); - - return $this->getPageLinkWrapper($url, $text); - } - - /** - * 下一页按钮 - * @param string $text - * @return string - */ - protected function getNextButton(string $text = '»'): string - { - if (!$this->hasMore) { - return $this->getDisabledTextWrapper($text); - } - - $url = $this->url($this->currentPage() + 1); - - return $this->getPageLinkWrapper($url, $text); - } - - /** - * 页码按钮 - * @return string - */ - protected function getLinks(): string - { - if ($this->simple) { - return ''; - } - - $block = [ - 'first' => null, - 'slider' => null, - 'last' => null, - ]; - - $side = 3; - $window = $side * 2; - - if ($this->lastPage < $window + 6) { - $block['first'] = $this->getUrlRange(1, $this->lastPage); - } elseif ($this->currentPage <= $window) { - $block['first'] = $this->getUrlRange(1, $window + 2); - $block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage); - } elseif ($this->currentPage > ($this->lastPage - $window)) { - $block['first'] = $this->getUrlRange(1, 2); - $block['last'] = $this->getUrlRange($this->lastPage - ($window + 2), $this->lastPage); - } else { - $block['first'] = $this->getUrlRange(1, 2); - $block['slider'] = $this->getUrlRange($this->currentPage - $side, $this->currentPage + $side); - $block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage); - } - - $html = ''; - - if (is_array($block['first'])) { - $html .= $this->getUrlLinks($block['first']); - } - - if (is_array($block['slider'])) { - $html .= $this->getDots(); - $html .= $this->getUrlLinks($block['slider']); - } - - if (is_array($block['last'])) { - $html .= $this->getDots(); - $html .= $this->getUrlLinks($block['last']); - } - - return $html; - } - - /** - * 渲染分页html - * @return mixed - */ - public function render() - { - if ($this->hasPages()) { - if ($this->simple) { - return sprintf( - '
      %s %s
    ', - $this->getPreviousButton(), - $this->getNextButton() - ); - } else { - return sprintf( - '
      %s %s %s
    ', - $this->getPreviousButton(), - $this->getLinks(), - $this->getNextButton() - ); - } - } - } - - /** - * 生成一个可点击的按钮 - * - * @param string $url - * @param string $page - * @return string - */ - protected function getAvailablePageWrapper(string $url, string $page): string - { - return '
  • ' . $page . '
  • '; - } - - /** - * 生成一个禁用的按钮 - * - * @param string $text - * @return string - */ - protected function getDisabledTextWrapper(string $text): string - { - return '
  • ' . $text . '
  • '; - } - - /** - * 生成一个激活的按钮 - * - * @param string $text - * @return string - */ - protected function getActivePageWrapper(string $text): string - { - return '
  • ' . $text . '
  • '; - } - - /** - * 生成省略号按钮 - * - * @return string - */ - protected function getDots(): string - { - return $this->getDisabledTextWrapper('...'); - } - - /** - * 批量生成页码按钮. - * - * @param array $urls - * @return string - */ - protected function getUrlLinks(array $urls): string - { - $html = ''; - - foreach ($urls as $page => $url) { - $html .= $this->getPageLinkWrapper($url, $page); - } - - return $html; - } - - /** - * 生成普通页码按钮 - * - * @param string $url - * @param string $page - * @return string - */ - protected function getPageLinkWrapper(string $url, string $page): string - { - if ($this->currentPage() == $page) { - return $this->getActivePageWrapper($page); - } - - return $this->getAvailablePageWrapper($url, $page); - } -} diff --git a/vendor/topthink/think-template/.gitignore b/vendor/topthink/think-template/.gitignore deleted file mode 100644 index 485dee64..00000000 --- a/vendor/topthink/think-template/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea diff --git a/vendor/topthink/think-template/LICENSE b/vendor/topthink/think-template/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/vendor/topthink/think-template/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/topthink/think-template/README.md b/vendor/topthink/think-template/README.md deleted file mode 100644 index 1d190646..00000000 --- a/vendor/topthink/think-template/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# ThinkTemplate - -基于XML和标签库的编译型模板引擎 - -## 主要特性 - -- 支持XML标签库和普通标签的混合定义; -- 支持直接使用PHP代码书写; -- 支持文件包含; -- 支持多级标签嵌套; -- 支持布局模板功能; -- 一次编译多次运行,编译和运行效率非常高; -- 模板文件和布局模板更新,自动更新模板缓存; -- 系统变量无需赋值直接输出; -- 支持多维数组的快速输出; -- 支持模板变量的默认值; -- 支持页面代码去除Html空白; -- 支持变量组合调节器和格式化功能; -- 允许定义模板禁用函数和禁用PHP语法; -- 通过标签库方式扩展; - -## 安装 - -~~~php -composer require topthink/think-template -~~~ - -## 用法示例 - - -~~~php - './template/', - 'cache_path' => './runtime/', - 'view_suffix' => 'html', -]; - -$template = new Template($config); -// 模板变量赋值 -$template->assign(['name' => 'think']); -// 读取模板文件渲染输出 -$template->fetch('index'); -// 完整模板文件渲染 -$template->fetch('./template/test.php'); -// 渲染内容输出 -$template->display($content); -~~~ - -支持静态调用 - -~~~ -use think\facade\Template; - -Template::config([ - 'view_path' => './template/', - 'cache_path' => './runtime/', - 'view_suffix' => 'html', -]); -Template::assign(['name' => 'think']); -Template::fetch('index',['name' => 'think']); -Template::display($content,['name' => 'think']); -~~~ - -详细用法参考[开发手册](https://www.kancloud.cn/manual/think-template/content) \ No newline at end of file diff --git a/vendor/topthink/think-template/composer.json b/vendor/topthink/think-template/composer.json deleted file mode 100644 index f4e1205c..00000000 --- a/vendor/topthink/think-template/composer.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "topthink/think-template", - "description": "the php template engine", - "license": "Apache-2.0", - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "require": { - "php": ">=7.1.0", - "psr/simple-cache": "^1.0" - }, - "autoload": { - "psr-4": { - "think\\": "src" - } - } -} \ No newline at end of file diff --git a/vendor/topthink/think-template/src/Template.php b/vendor/topthink/think-template/src/Template.php deleted file mode 100644 index 84d35a52..00000000 --- a/vendor/topthink/think-template/src/Template.php +++ /dev/null @@ -1,1320 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use Exception; -use Psr\SimpleCache\CacheInterface; - -/** - * ThinkPHP分离出来的模板引擎 - * 支持XML标签和普通标签的模板解析 - * 编译型模板引擎 支持动态缓存 - */ -class Template -{ - /** - * 模板变量 - * @var array - */ - protected $data = []; - - /** - * 模板配置参数 - * @var array - */ - protected $config = [ - 'view_path' => '', // 模板路径 - 'view_suffix' => 'html', // 默认模板文件后缀 - 'view_depr' => DIRECTORY_SEPARATOR, - 'cache_path' => '', - 'cache_suffix' => 'php', // 默认模板缓存后缀 - 'tpl_deny_func_list' => 'echo,exit', // 模板引擎禁用函数 - 'tpl_deny_php' => false, // 默认模板引擎是否禁用PHP原生代码 - 'tpl_begin' => '{', // 模板引擎普通标签开始标记 - 'tpl_end' => '}', // 模板引擎普通标签结束标记 - 'strip_space' => false, // 是否去除模板文件里面的html空格与换行 - 'tpl_cache' => true, // 是否开启模板编译缓存,设为false则每次都会重新编译 - 'compile_type' => 'file', // 模板编译类型 - 'cache_prefix' => '', // 模板缓存前缀标识,可以动态改变 - 'cache_time' => 0, // 模板缓存有效期 0 为永久,(以数字为值,单位:秒) - 'layout_on' => false, // 布局模板开关 - 'layout_name' => 'layout', // 布局模板入口文件 - 'layout_item' => '{__CONTENT__}', // 布局模板的内容替换标识 - 'taglib_begin' => '{', // 标签库标签开始标记 - 'taglib_end' => '}', // 标签库标签结束标记 - 'taglib_load' => true, // 是否使用内置标签库之外的其它标签库,默认自动检测 - 'taglib_build_in' => 'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序 - 'taglib_pre_load' => '', // 需要额外加载的标签库(须指定标签库名称),多个以逗号分隔 - 'display_cache' => false, // 模板渲染缓存 - 'cache_id' => '', // 模板缓存ID - 'tpl_replace_string' => [], - 'tpl_var_identify' => 'array', // .语法变量识别,array|object|'', 为空时自动识别 - 'default_filter' => 'htmlentities', // 默认过滤方法 用于普通标签输出 - ]; - - /** - * 保留内容信息 - * @var array - */ - private $literal = []; - - /** - * 扩展解析规则 - * @var array - */ - private $extend = []; - - /** - * 模板包含信息 - * @var array - */ - private $includeFile = []; - - /** - * 模板存储对象 - * @var object - */ - protected $storage; - - /** - * 查询缓存对象 - * @var CacheInterface - */ - protected $cache; - - /** - * 架构函数 - * @access public - * @param array $config - */ - public function __construct(array $config = []) - { - $this->config = array_merge($this->config, $config); - - $this->config['taglib_begin_origin'] = $this->config['taglib_begin']; - $this->config['taglib_end_origin'] = $this->config['taglib_end']; - - $this->config['taglib_begin'] = preg_quote($this->config['taglib_begin'], '/'); - $this->config['taglib_end'] = preg_quote($this->config['taglib_end'], '/'); - $this->config['tpl_begin'] = preg_quote($this->config['tpl_begin'], '/'); - $this->config['tpl_end'] = preg_quote($this->config['tpl_end'], '/'); - - // 初始化模板编译存储器 - $type = $this->config['compile_type'] ? $this->config['compile_type'] : 'File'; - $class = false !== strpos($type, '\\') ? $type : '\\think\\template\\driver\\' . ucwords($type); - - $this->storage = new $class(); - } - - /** - * 模板变量赋值 - * @access public - * @param array $vars 模板变量 - * @return $this - */ - public function assign(array $vars = []) - { - $this->data = array_merge($this->data, $vars); - return $this; - } - - /** - * 模板引擎参数赋值 - * @access public - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - $this->config[$name] = $value; - } - - /** - * 设置缓存对象 - * @access public - * @param CacheInterface $cache 缓存对象 - * @return void - */ - public function setCache(CacheInterface $cache): void - { - $this->cache = $cache; - } - - /** - * 模板引擎配置 - * @access public - * @param array $config - * @return $this - */ - public function config(array $config) - { - $this->config = array_merge($this->config, $config); - return $this; - } - - /** - * 获取模板引擎配置项 - * @access public - * @param string $name - * @return mixed - */ - public function getConfig(string $name) - { - return $this->config[$name] ?? null; - } - - /** - * 模板变量获取 - * @access public - * @param string $name 变量名 - * @return mixed - */ - public function get(string $name = '') - { - if ('' == $name) { - return $this->data; - } - - $data = $this->data; - - foreach (explode('.', $name) as $key => $val) { - if (isset($data[$val])) { - $data = $data[$val]; - } else { - $data = null; - break; - } - } - - return $data; - } - - /** - * 扩展模板解析规则 - * @access public - * @param string $rule 解析规则 - * @param callable $callback 解析规则 - * @return void - */ - public function extend(string $rule, callable $callback = null): void - { - $this->extend[$rule] = $callback; - } - - /** - * 渲染模板文件 - * @access public - * @param string $template 模板文件 - * @param array $vars 模板变量 - * @return void - */ - public function fetch(string $template, array $vars = []): void - { - if ($vars) { - $this->data = array_merge($this->data, $vars); - } - - if (!empty($this->config['cache_id']) && $this->config['display_cache'] && $this->cache) { - // 读取渲染缓存 - if ($this->cache->has($this->config['cache_id'])) { - echo $this->cache->get($this->config['cache_id']); - return; - } - } - - $template = $this->parseTemplateFile($template); - - if ($template) { - $cacheFile = $this->config['cache_path'] . $this->config['cache_prefix'] . md5($this->config['layout_on'] . $this->config['layout_name'] . $template) . '.' . ltrim($this->config['cache_suffix'], '.'); - - if (!$this->checkCache($cacheFile)) { - // 缓存无效 重新模板编译 - $content = file_get_contents($template); - $this->compiler($content, $cacheFile); - } - - // 页面缓存 - ob_start(); - ob_implicit_flush(0); - - // 读取编译存储 - $this->storage->read($cacheFile, $this->data); - - // 获取并清空缓存 - $content = ob_get_clean(); - - if (!empty($this->config['cache_id']) && $this->config['display_cache'] && $this->cache) { - // 缓存页面输出 - $this->cache->set($this->config['cache_id'], $content, $this->config['cache_time']); - } - - echo $content; - } - } - - /** - * 检查编译缓存是否存在 - * @access public - * @param string $cacheId 缓存的id - * @return boolean - */ - public function isCache(string $cacheId): bool - { - if ($cacheId && $this->cache && $this->config['display_cache']) { - // 缓存页面输出 - return $this->cache->has($cacheId); - } - - return false; - } - - /** - * 渲染模板内容 - * @access public - * @param string $content 模板内容 - * @param array $vars 模板变量 - * @return void - */ - public function display(string $content, array $vars = []): void - { - if ($vars) { - $this->data = array_merge($this->data, $vars); - } - - $cacheFile = $this->config['cache_path'] . $this->config['cache_prefix'] . md5($content) . '.' . ltrim($this->config['cache_suffix'], '.'); - - if (!$this->checkCache($cacheFile)) { - // 缓存无效 模板编译 - $this->compiler($content, $cacheFile); - } - - // 读取编译存储 - $this->storage->read($cacheFile, $this->data); - } - - /** - * 设置布局 - * @access public - * @param mixed $name 布局模板名称 false 则关闭布局 - * @param string $replace 布局模板内容替换标识 - * @return $this - */ - public function layout($name, string $replace = '') - { - if (false === $name) { - // 关闭布局 - $this->config['layout_on'] = false; - } else { - // 开启布局 - $this->config['layout_on'] = true; - - // 名称必须为字符串 - if (is_string($name)) { - $this->config['layout_name'] = $name; - } - - if (!empty($replace)) { - $this->config['layout_item'] = $replace; - } - } - - return $this; - } - - /** - * 检查编译缓存是否有效 - * 如果无效则需要重新编译 - * @access private - * @param string $cacheFile 缓存文件名 - * @return bool - */ - private function checkCache(string $cacheFile): bool - { - if (!$this->config['tpl_cache'] || !is_file($cacheFile) || !$handle = @fopen($cacheFile, "r")) { - return false; - } - - // 读取第一行 - preg_match('/\/\*(.+?)\*\//', fgets($handle), $matches); - - if (!isset($matches[1])) { - return false; - } - - $includeFile = unserialize($matches[1]); - - if (!is_array($includeFile)) { - return false; - } - - // 检查模板文件是否有更新 - foreach ($includeFile as $path => $time) { - if (is_file($path) && filemtime($path) > $time) { - // 模板文件如果有更新则缓存需要更新 - return false; - } - } - - // 检查编译存储是否有效 - return $this->storage->check($cacheFile, $this->config['cache_time']); - } - - /** - * 编译模板文件内容 - * @access private - * @param string $content 模板内容 - * @param string $cacheFile 缓存文件名 - * @return void - */ - private function compiler(string &$content, string $cacheFile): void - { - // 判断是否启用布局 - if ($this->config['layout_on']) { - if (false !== strpos($content, '{__NOLAYOUT__}')) { - // 可以单独定义不使用布局 - $content = str_replace('{__NOLAYOUT__}', '', $content); - } else { - // 读取布局模板 - $layoutFile = $this->parseTemplateFile($this->config['layout_name']); - - if ($layoutFile) { - // 替换布局的主体内容 - $content = str_replace($this->config['layout_item'], $content, file_get_contents($layoutFile)); - } - } - } else { - $content = str_replace('{__NOLAYOUT__}', '', $content); - } - - // 模板解析 - $this->parse($content); - - if ($this->config['strip_space']) { - /* 去除html空格与换行 */ - $find = ['~>\s+<~', '~>(\s+\n|\r)~']; - $replace = ['><', '>']; - $content = preg_replace($find, $replace, $content); - } - - // 优化生成的php代码 - $content = preg_replace('/\?>\s*<\?php\s(?!echo\b|\bend)/s', '', $content); - - // 模板过滤输出 - $replace = $this->config['tpl_replace_string']; - $content = str_replace(array_keys($replace), array_values($replace), $content); - - // 添加安全代码及模板引用记录 - $content = 'includeFile) . '*/ ?>' . "\n" . $content; - // 编译存储 - $this->storage->write($cacheFile, $content); - - $this->includeFile = []; - } - - /** - * 模板解析入口 - * 支持普通标签和TagLib解析 支持自定义标签库 - * @access public - * @param string $content 要解析的模板内容 - * @return void - */ - public function parse(string &$content): void - { - // 内容为空不解析 - if (empty($content)) { - return; - } - - // 替换literal标签内容 - $this->parseLiteral($content); - - // 解析继承 - $this->parseExtend($content); - - // 解析布局 - $this->parseLayout($content); - - // 检查include语法 - $this->parseInclude($content); - - // 替换包含文件中literal标签内容 - $this->parseLiteral($content); - - // 检查PHP语法 - $this->parsePhp($content); - - // 获取需要引入的标签库列表 - // 标签库只需要定义一次,允许引入多个一次 - // 一般放在文件的最前面 - // 格式: - // 当TAGLIB_LOAD配置为true时才会进行检测 - if ($this->config['taglib_load']) { - $tagLibs = $this->getIncludeTagLib($content); - - if (!empty($tagLibs)) { - // 对导入的TagLib进行解析 - foreach ($tagLibs as $tagLibName) { - $this->parseTagLib($tagLibName, $content); - } - } - } - - // 预先加载的标签库 无需在每个模板中使用taglib标签加载 但必须使用标签库XML前缀 - if ($this->config['taglib_pre_load']) { - $tagLibs = explode(',', $this->config['taglib_pre_load']); - - foreach ($tagLibs as $tag) { - $this->parseTagLib($tag, $content); - } - } - - // 内置标签库 无需使用taglib标签导入就可以使用 并且不需使用标签库XML前缀 - $tagLibs = explode(',', $this->config['taglib_build_in']); - - foreach ($tagLibs as $tag) { - $this->parseTagLib($tag, $content, true); - } - - // 解析普通模板标签 {$tagName} - $this->parseTag($content); - - // 还原被替换的Literal标签 - $this->parseLiteral($content, true); - } - - /** - * 检查PHP语法 - * @access private - * @param string $content 要解析的模板内容 - * @return void - * @throws Exception - */ - private function parsePhp(string &$content): void - { - // 短标签的情况要将' . "\n", $content); - - // PHP语法检查 - if ($this->config['tpl_deny_php'] && false !== strpos($content, 'getRegex('layout'), $content, $matches)) { - // 替换Layout标签 - $content = str_replace($matches[0], '', $content); - // 解析Layout标签 - $array = $this->parseAttr($matches[0]); - - if (!$this->config['layout_on'] || $this->config['layout_name'] != $array['name']) { - // 读取布局模板 - $layoutFile = $this->parseTemplateFile($array['name']); - - if ($layoutFile) { - $replace = isset($array['replace']) ? $array['replace'] : $this->config['layout_item']; - // 替换布局的主体内容 - $content = str_replace($replace, $content, file_get_contents($layoutFile)); - } - } - } else { - $content = str_replace('{__NOLAYOUT__}', '', $content); - } - } - - /** - * 解析模板中的include标签 - * @access private - * @param string $content 要解析的模板内容 - * @return void - */ - private function parseInclude(string &$content): void - { - $regex = $this->getRegex('include'); - $func = function ($template) use (&$func, &$regex, &$content) { - if (preg_match_all($regex, $template, $matches, PREG_SET_ORDER)) { - foreach ($matches as $match) { - $array = $this->parseAttr($match[0]); - $file = $array['file']; - unset($array['file']); - - // 分析模板文件名并读取内容 - $parseStr = $this->parseTemplateName($file); - - foreach ($array as $k => $v) { - // 以$开头字符串转换成模板变量 - if (0 === strpos($v, '$')) { - $v = $this->get(substr($v, 1)); - } - - $parseStr = str_replace('[' . $k . ']', $v, $parseStr); - } - - $content = str_replace($match[0], $parseStr, $content); - // 再次对包含文件进行模板分析 - $func($parseStr); - } - unset($matches); - } - }; - - // 替换模板中的include标签 - $func($content); - } - - /** - * 解析模板中的extend标签 - * @access private - * @param string $content 要解析的模板内容 - * @return void - */ - private function parseExtend(string &$content): void - { - $regex = $this->getRegex('extend'); - $array = $blocks = $baseBlocks = []; - $extend = ''; - - $func = function ($template) use (&$func, &$regex, &$array, &$extend, &$blocks, &$baseBlocks) { - if (preg_match($regex, $template, $matches)) { - if (!isset($array[$matches['name']])) { - $array[$matches['name']] = 1; - // 读取继承模板 - $extend = $this->parseTemplateName($matches['name']); - - // 递归检查继承 - $func($extend); - - // 取得block标签内容 - $blocks = array_merge($blocks, $this->parseBlock($template)); - - return; - } - } else { - // 取得顶层模板block标签内容 - $baseBlocks = $this->parseBlock($template, true); - - if (empty($extend)) { - // 无extend标签但有block标签的情况 - $extend = $template; - } - } - }; - - $func($content); - - if (!empty($extend)) { - if ($baseBlocks) { - $children = []; - foreach ($baseBlocks as $name => $val) { - $replace = $val['content']; - - if (!empty($children[$name])) { - // 如果包含有子block标签 - foreach ($children[$name] as $key) { - $replace = str_replace($baseBlocks[$key]['begin'] . $baseBlocks[$key]['content'] . $baseBlocks[$key]['end'], $blocks[$key]['content'], $replace); - } - } - - if (isset($blocks[$name])) { - // 带有{__block__}表示与所继承模板的相应标签合并,而不是覆盖 - $replace = str_replace(['{__BLOCK__}', '{__block__}'], $replace, $blocks[$name]['content']); - - if (!empty($val['parent'])) { - // 如果不是最顶层的block标签 - $parent = $val['parent']; - - if (isset($blocks[$parent])) { - $blocks[$parent]['content'] = str_replace($blocks[$name]['begin'] . $blocks[$name]['content'] . $blocks[$name]['end'], $replace, $blocks[$parent]['content']); - } - - $blocks[$name]['content'] = $replace; - $children[$parent][] = $name; - - continue; - } - } elseif (!empty($val['parent'])) { - // 如果子标签没有被继承则用原值 - $children[$val['parent']][] = $name; - $blocks[$name] = $val; - } - - if (!$val['parent']) { - // 替换模板中的顶级block标签 - $extend = str_replace($val['begin'] . $val['content'] . $val['end'], $replace, $extend); - } - } - } - - $content = $extend; - unset($blocks, $baseBlocks); - } - } - - /** - * 替换页面中的literal标签 - * @access private - * @param string $content 模板内容 - * @param boolean $restore 是否为还原 - * @return void - */ - private function parseLiteral(string &$content, bool $restore = false): void - { - $regex = $this->getRegex($restore ? 'restoreliteral' : 'literal'); - - if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) { - if (!$restore) { - $count = count($this->literal); - - // 替换literal标签 - foreach ($matches as $match) { - $this->literal[] = substr($match[0], strlen($match[1]), -strlen($match[2])); - $content = str_replace($match[0], "", $content); - $count++; - } - } else { - // 还原literal标签 - foreach ($matches as $match) { - $content = str_replace($match[0], $this->literal[$match[1]], $content); - } - - // 清空literal记录 - $this->literal = []; - } - - unset($matches); - } - } - - /** - * 获取模板中的block标签 - * @access private - * @param string $content 模板内容 - * @param boolean $sort 是否排序 - * @return array - */ - private function parseBlock(string &$content, bool $sort = false): array - { - $regex = $this->getRegex('block'); - $result = []; - - if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { - $right = $keys = []; - - foreach ($matches as $match) { - if (empty($match['name'][0])) { - if (count($right) > 0) { - $tag = array_pop($right); - $start = $tag['offset'] + strlen($tag['tag']); - $length = $match[0][1] - $start; - - $result[$tag['name']] = [ - 'begin' => $tag['tag'], - 'content' => substr($content, $start, $length), - 'end' => $match[0][0], - 'parent' => count($right) ? end($right)['name'] : '', - ]; - - $keys[$tag['name']] = $match[0][1]; - } - } else { - // 标签头压入栈 - $right[] = [ - 'name' => $match[2][0], - 'offset' => $match[0][1], - 'tag' => $match[0][0], - ]; - } - } - - unset($right, $matches); - - if ($sort) { - // 按block标签结束符在模板中的位置排序 - array_multisort($keys, $result); - } - } - - return $result; - } - - /** - * 搜索模板页面中包含的TagLib库 - * 并返回列表 - * @access private - * @param string $content 模板内容 - * @return array|null - */ - private function getIncludeTagLib(string &$content) - { - // 搜索是否有TagLib标签 - if (preg_match($this->getRegex('taglib'), $content, $matches)) { - // 替换TagLib标签 - $content = str_replace($matches[0], '', $content); - - return explode(',', $matches['name']); - } - } - - /** - * TagLib库解析 - * @access public - * @param string $tagLib 要解析的标签库 - * @param string $content 要解析的模板内容 - * @param boolean $hide 是否隐藏标签库前缀 - * @return void - */ - public function parseTagLib(string $tagLib, string &$content, bool $hide = false): void - { - if (false !== strpos($tagLib, '\\')) { - // 支持指定标签库的命名空间 - $className = $tagLib; - $tagLib = substr($tagLib, strrpos($tagLib, '\\') + 1); - } else { - $className = '\\think\\template\\taglib\\' . ucwords($tagLib); - } - - $tLib = new $className($this); - - $tLib->parseTag($content, $hide ? '' : $tagLib); - } - - /** - * 分析标签属性 - * @access public - * @param string $str 属性字符串 - * @param string $name 不为空时返回指定的属性名 - * @return array - */ - public function parseAttr(string $str, string $name = null): array - { - $regex = '/\s+(?>(?P[\w-]+)\s*)=(?>\s*)([\"\'])(?P(?:(?!\\2).)*)\\2/is'; - $array = []; - - if (preg_match_all($regex, $str, $matches, PREG_SET_ORDER)) { - foreach ($matches as $match) { - $array[$match['name']] = $match['value']; - } - unset($matches); - } - - if (!empty($name) && isset($array[$name])) { - return $array[$name]; - } - - return $array; - } - - /** - * 模板标签解析 - * 格式: {TagName:args [|content] } - * @access private - * @param string $content 要解析的模板内容 - * @return void - */ - private function parseTag(string &$content): void - { - $regex = $this->getRegex('tag'); - - if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) { - foreach ($matches as $match) { - $str = stripslashes($match[1]); - $flag = substr($str, 0, 1); - - switch ($flag) { - case '$': - // 解析模板变量 格式 {$varName} - // 是否带有?号 - if (false !== $pos = strpos($str, '?')) { - $array = preg_split('/([!=]={1,2}|(?<]={0,1})/', substr($str, 0, $pos), 2, PREG_SPLIT_DELIM_CAPTURE); - $name = $array[0]; - - $this->parseVar($name); - //$this->parseVarFunction($name); - - $str = trim(substr($str, $pos + 1)); - $this->parseVar($str); - $first = substr($str, 0, 1); - - if (strpos($name, ')')) { - // $name为对象或是自动识别,或者含有函数 - if (isset($array[1])) { - $this->parseVar($array[2]); - $name .= $array[1] . $array[2]; - } - - switch ($first) { - case '?': - $this->parseVarFunction($name); - $str = ''; - break; - case '=': - $str = ''; - break; - default: - $str = ''; - } - } else { - if (isset($array[1])) { - $express = true; - $this->parseVar($array[2]); - $express = $name . $array[1] . $array[2]; - } else { - $express = false; - } - - if (in_array($first, ['?', '=', ':'])) { - $str = trim(substr($str, 1)); - if ('$' == substr($str, 0, 1)) { - $str = $this->parseVarFunction($str); - } - } - - // $name为数组 - switch ($first) { - case '?': - // {$varname??'xxx'} $varname有定义则输出$varname,否则输出xxx - $str = 'parseVarFunction($name) . ' : ' . $str . '; ?>'; - break; - case '=': - // {$varname?='xxx'} $varname为真时才输出xxx - $str = ''; - break; - case ':': - // {$varname?:'xxx'} $varname为真时输出$varname,否则输出xxx - $str = 'parseVarFunction($name) . ' : ' . $str . '; ?>'; - break; - default: - if (strpos($str, ':')) { - // {$varname ? 'a' : 'b'} $varname为真时输出a,否则输出b - $array = explode(':', $str, 2); - - $array[0] = '$' == substr(trim($array[0]), 0, 1) ? $this->parseVarFunction($array[0]) : $array[0]; - $array[1] = '$' == substr(trim($array[1]), 0, 1) ? $this->parseVarFunction($array[1]) : $array[1]; - - $str = implode(' : ', $array); - } - $str = ''; - } - } - } else { - $this->parseVar($str); - $this->parseVarFunction($str); - $str = ''; - } - break; - case ':': - // 输出某个函数的结果 - $str = substr($str, 1); - $this->parseVar($str); - $str = ''; - break; - case '~': - // 执行某个函数 - $str = substr($str, 1); - $this->parseVar($str); - $str = ''; - break; - case '-': - case '+': - // 输出计算 - $this->parseVar($str); - $str = ''; - break; - case '/': - // 注释标签 - $flag2 = substr($str, 1, 1); - if ('/' == $flag2 || ('*' == $flag2 && substr(rtrim($str), -2) == '*/')) { - $str = ''; - } - break; - default: - // 未识别的标签直接返回 - $str = $this->config['tpl_begin'] . $str . $this->config['tpl_end']; - break; - } - - $content = str_replace($match[0], $str, $content); - } - - unset($matches); - } - } - - /** - * 模板变量解析,支持使用函数 - * 格式: {$varname|function1|function2=arg1,arg2} - * @access public - * @param string $varStr 变量数据 - * @return void - */ - public function parseVar(string &$varStr): void - { - $varStr = trim($varStr); - - if (preg_match_all('/\$[a-zA-Z_](?>\w*)(?:[:\.][0-9a-zA-Z_](?>\w*))+/', $varStr, $matches, PREG_OFFSET_CAPTURE)) { - static $_varParseList = []; - - while ($matches[0]) { - $match = array_pop($matches[0]); - - //如果已经解析过该变量字串,则直接返回变量值 - if (isset($_varParseList[$match[0]])) { - $parseStr = $_varParseList[$match[0]]; - } else { - if (strpos($match[0], '.')) { - $vars = explode('.', $match[0]); - $first = array_shift($vars); - - if (isset($this->extend[$first])) { - $callback = $this->extend[$first]; - $parseStr = $callback($vars); - } elseif ('$Request' == $first) { - // 输出请求变量 - $parseStr = $this->parseRequestVar($vars); - } elseif ('$Think' == $first) { - // 所有以Think.打头的以特殊变量对待 无需模板赋值就可以输出 - $parseStr = $this->parseThinkVar($vars); - } else { - switch ($this->config['tpl_var_identify']) { - case 'array': // 识别为数组 - $parseStr = $first . '[\'' . implode('\'][\'', $vars) . '\']'; - break; - case 'obj': // 识别为对象 - $parseStr = $first . '->' . implode('->', $vars); - break; - default: // 自动判断数组或对象 - $parseStr = '(is_array(' . $first . ')?' . $first . '[\'' . implode('\'][\'', $vars) . '\']:' . $first . '->' . implode('->', $vars) . ')'; - } - } - } else { - $parseStr = str_replace(':', '->', $match[0]); - } - - $_varParseList[$match[0]] = $parseStr; - } - - $varStr = substr_replace($varStr, $parseStr, $match[1], strlen($match[0])); - } - unset($matches); - } - } - - /** - * 对模板中使用了函数的变量进行解析 - * 格式 {$varname|function1|function2=arg1,arg2} - * @access public - * @param string $varStr 变量字符串 - * @param bool $autoescape 自动转义 - * @return string - */ - public function parseVarFunction(string &$varStr, bool $autoescape = true): string - { - if (!$autoescape && false === strpos($varStr, '|')) { - return $varStr; - } elseif ($autoescape && !preg_match('/\|(\s)?raw(\||\s)?/i', $varStr)) { - $varStr .= '|' . $this->config['default_filter']; - } - - static $_varFunctionList = []; - - $_key = md5($varStr); - - //如果已经解析过该变量字串,则直接返回变量值 - if (isset($_varFunctionList[$_key])) { - $varStr = $_varFunctionList[$_key]; - } else { - $varArray = explode('|', $varStr); - - // 取得变量名称 - $name = trim(array_shift($varArray)); - - // 对变量使用函数 - $length = count($varArray); - - // 取得模板禁止使用函数列表 - $template_deny_funs = explode(',', $this->config['tpl_deny_func_list']); - - for ($i = 0; $i < $length; $i++) { - $args = explode('=', $varArray[$i], 2); - - // 模板函数过滤 - $fun = trim($args[0]); - if (in_array($fun, $template_deny_funs)) { - continue; - } - - switch (strtolower($fun)) { - case 'raw': - break; - case 'date': - $name = 'date(' . $args[1] . ',!is_numeric(' . $name . ')? strtotime(' . $name . ') : ' . $name . ')'; - break; - case 'first': - $name = 'current(' . $name . ')'; - break; - case 'last': - $name = 'end(' . $name . ')'; - break; - case 'upper': - $name = 'strtoupper(' . $name . ')'; - break; - case 'lower': - $name = 'strtolower(' . $name . ')'; - break; - case 'format': - $name = 'sprintf(' . $args[1] . ',' . $name . ')'; - break; - case 'default': // 特殊模板函数 - if (false === strpos($name, '(')) { - $name = '(isset(' . $name . ') && (' . $name . ' !== \'\')?' . $name . ':' . $args[1] . ')'; - } else { - $name = '(' . $name . ' ?: ' . $args[1] . ')'; - } - break; - default: // 通用模板函数 - if (isset($args[1])) { - if (strstr($args[1], '###')) { - $args[1] = str_replace('###', $name, $args[1]); - $name = "$fun($args[1])"; - } else { - $name = "$fun($name,$args[1])"; - } - } else { - if (!empty($args[0])) { - $name = "$fun($name)"; - } - } - } - } - - $_varFunctionList[$_key] = $name; - $varStr = $name; - } - return $varStr; - } - - /** - * 请求变量解析 - * 格式 以 $Request. 打头的变量属于请求变量 - * @access public - * @param array $vars 变量数组 - * @return string - */ - public function parseRequestVar(array $vars): string - { - $type = strtoupper(trim(array_shift($vars))); - $param = implode('.', $vars); - - switch ($type) { - case 'SERVER': - $parseStr = '$_SERVER[\'' . $param . '\']'; - break; - case 'GET': - $parseStr = '$_GET[\'' . $param . '\']'; - break; - case 'POST': - $parseStr = '$_POST[\'' . $param . '\']'; - break; - case 'COOKIE': - $parseStr = '$_COOKIE[\'' . $param . '\']'; - break; - case 'SESSION': - $parseStr = '$_SESSION[\'' . $param . '\']'; - break; - case 'ENV': - $parseStr = '$_ENV[\'' . $param . '\']'; - break; - case 'REQUEST': - $parseStr = '$_REQUEST[\'' . $param . '\']'; - break; - default: - $parseStr = '\'\''; - } - - return $parseStr; - } - - /** - * 特殊模板变量解析 - * 格式 以 $Think. 打头的变量属于特殊模板变量 - * @access public - * @param array $vars 变量数组 - * @return string - */ - public function parseThinkVar(array $vars): string - { - $type = strtoupper(trim(array_shift($vars))); - $param = implode('.', $vars); - - switch ($type) { - case 'CONST': - $parseStr = strtoupper($param); - break; - case 'NOW': - $parseStr = "date('Y-m-d g:i a',time())"; - break; - case 'LDELIM': - $parseStr = '\'' . ltrim($this->config['tpl_begin'], '\\') . '\''; - break; - case 'RDELIM': - $parseStr = '\'' . ltrim($this->config['tpl_end'], '\\') . '\''; - break; - default: - $parseStr = defined($type) ? $type : '\'\''; - } - - return $parseStr; - } - - /** - * 分析加载的模板文件并读取内容 支持多个模板文件读取 - * @access private - * @param string $templateName 模板文件名 - * @return string - */ - private function parseTemplateName(string $templateName): string - { - $array = explode(',', $templateName); - $parseStr = ''; - - foreach ($array as $templateName) { - if (empty($templateName)) { - continue; - } - - if (0 === strpos($templateName, '$')) { - //支持加载变量文件名 - $templateName = $this->get(substr($templateName, 1)); - } - - $template = $this->parseTemplateFile($templateName); - - if ($template) { - // 获取模板文件内容 - $parseStr .= file_get_contents($template); - } - } - - return $parseStr; - } - - /** - * 解析模板文件名 - * @access private - * @param string $template 文件名 - * @return string - */ - private function parseTemplateFile(string $template): string - { - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - - if (0 !== strpos($template, '/')) { - $template = str_replace(['/', ':'], $this->config['view_depr'], $template); - } else { - $template = str_replace(['/', ':'], $this->config['view_depr'], substr($template, 1)); - } - - $template = $this->config['view_path'] . $template . '.' . ltrim($this->config['view_suffix'], '.'); - } - - if (is_file($template)) { - // 记录模板文件的更新时间 - $this->includeFile[$template] = filemtime($template); - - return $template; - } - - throw new Exception('template not exists:' . $template); - } - - /** - * 按标签生成正则 - * @access private - * @param string $tagName 标签名 - * @return string - */ - private function getRegex(string $tagName): string - { - $regex = ''; - if ('tag' == $tagName) { - $begin = $this->config['tpl_begin']; - $end = $this->config['tpl_end']; - - if (strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1) { - $regex = $begin . '((?:[\$]{1,2}[a-wA-w_]|[\:\~][\$a-wA-w_]|[+]{2}[\$][a-wA-w_]|[-]{2}[\$][a-wA-w_]|\/[\*\/])(?>[^' . $end . ']*))' . $end; - } else { - $regex = $begin . '((?:[\$]{1,2}[a-wA-w_]|[\:\~][\$a-wA-w_]|[+]{2}[\$][a-wA-w_]|[-]{2}[\$][a-wA-w_]|\/[\*\/])(?>(?:(?!' . $end . ').)*))' . $end; - } - } else { - $begin = $this->config['taglib_begin']; - $end = $this->config['taglib_end']; - $single = strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1 ? true : false; - - switch ($tagName) { - case 'block': - if ($single) { - $regex = $begin . '(?:' . $tagName . '\b\s+(?>(?:(?!name=).)*)\bname=([\'\"])(?P[\$\w\-\/\.]+)\\1(?>[^' . $end . ']*)|\/' . $tagName . ')' . $end; - } else { - $regex = $begin . '(?:' . $tagName . '\b\s+(?>(?:(?!name=).)*)\bname=([\'\"])(?P[\$\w\-\/\.]+)\\1(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end; - } - break; - case 'literal': - if ($single) { - $regex = '(' . $begin . $tagName . '\b(?>[^' . $end . ']*)' . $end . ')'; - $regex .= '(?:(?>[^' . $begin . ']*)(?>(?!' . $begin . '(?>' . $tagName . '\b[^' . $end . ']*|\/' . $tagName . ')' . $end . ')' . $begin . '[^' . $begin . ']*)*)'; - $regex .= '(' . $begin . '\/' . $tagName . $end . ')'; - } else { - $regex = '(' . $begin . $tagName . '\b(?>(?:(?!' . $end . ').)*)' . $end . ')'; - $regex .= '(?:(?>(?:(?!' . $begin . ').)*)(?>(?!' . $begin . '(?>' . $tagName . '\b(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end . ')' . $begin . '(?>(?:(?!' . $begin . ').)*))*)'; - $regex .= '(' . $begin . '\/' . $tagName . $end . ')'; - } - break; - case 'restoreliteral': - $regex = ''; - break; - case 'include': - $name = 'file'; - case 'taglib': - case 'layout': - case 'extend': - if (empty($name)) { - $name = 'name'; - } - if ($single) { - $regex = $begin . $tagName . '\b\s+(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P[\$\w\-\/\.\:@,\\\\]+)\\1(?>[^' . $end . ']*)' . $end; - } else { - $regex = $begin . $tagName . '\b\s+(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P[\$\w\-\/\.\:@,\\\\]+)\\1(?>(?:(?!' . $end . ').)*)' . $end; - } - break; - } - } - - return '/' . $regex . '/is'; - } - - public function __debugInfo() - { - $data = get_object_vars($this); - unset($data['storage']); - - return $data; - } -} diff --git a/vendor/topthink/think-template/src/facade/Template.php b/vendor/topthink/think-template/src/facade/Template.php deleted file mode 100644 index 665a180a..00000000 --- a/vendor/topthink/think-template/src/facade/Template.php +++ /dev/null @@ -1,83 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -if (class_exists('think\Facade')) { - class Facade extends \think\Facade - {} -} else { - class Facade - { - /** - * 始终创建新的对象实例 - * @var bool - */ - protected static $alwaysNewInstance; - - protected static $instance; - - /** - * 获取当前Facade对应类名 - * @access protected - * @return string - */ - protected static function getFacadeClass() - {} - - /** - * 创建Facade实例 - * @static - * @access protected - * @return object - */ - protected static function createFacade() - { - $class = static::getFacadeClass() ?: 'think\Template'; - - if (static::$alwaysNewInstance) { - return new $class(); - } - - if (!self::$instance) { - self::$instance = new $class(); - } - - return self::$instance; - - } - - // 调用实际类的方法 - public static function __callStatic($method, $params) - { - return call_user_func_array([static::createFacade(), $method], $params); - } - } -} - -/** - * @see \think\Template - * @mixin \think\Template - */ -class Template extends Facade -{ - protected static $alwaysNewInstance = true; - - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'think\Template'; - } -} diff --git a/vendor/topthink/think-template/src/template/TagLib.php b/vendor/topthink/think-template/src/template/TagLib.php deleted file mode 100644 index f6c8fbb8..00000000 --- a/vendor/topthink/think-template/src/template/TagLib.php +++ /dev/null @@ -1,349 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\template; - -use Exception; -use think\Template; - -/** - * ThinkPHP标签库TagLib解析基类 - * @category Think - * @package Think - * @subpackage Template - * @author liu21st - */ -class TagLib -{ - - /** - * 标签库定义XML文件 - * @var string - * @access protected - */ - protected $xml = ''; - protected $tags = []; // 标签定义 - /** - * 标签库名称 - * @var string - * @access protected - */ - protected $tagLib = ''; - - /** - * 标签库标签列表 - * @var array - * @access protected - */ - protected $tagList = []; - - /** - * 标签库分析数组 - * @var array - * @access protected - */ - protected $parse = []; - - /** - * 标签库是否有效 - * @var bool - * @access protected - */ - protected $valid = false; - - /** - * 当前模板对象 - * @var object - * @access protected - */ - protected $tpl; - - protected $comparison = [' nheq ' => ' !== ', ' heq ' => ' === ', ' neq ' => ' != ', ' eq ' => ' == ', ' egt ' => ' >= ', ' gt ' => ' > ', ' elt ' => ' <= ', ' lt ' => ' < ']; - - /** - * 架构函数 - * @access public - * @param Template $template 模板引擎对象 - */ - public function __construct(Template $template) - { - $this->tpl = $template; - } - - /** - * 按签标库替换页面中的标签 - * @access public - * @param string $content 模板内容 - * @param string $lib 标签库名 - * @return void - */ - public function parseTag(string &$content, string $lib = ''): void - { - $tags = []; - $lib = $lib ? strtolower($lib) . ':' : ''; - - foreach ($this->tags as $name => $val) { - $close = !isset($val['close']) || $val['close'] ? 1 : 0; - $tags[$close][$lib . $name] = $name; - if (isset($val['alias'])) { - // 别名设置 - $array = (array) $val['alias']; - foreach (explode(',', $array[0]) as $v) { - $tags[$close][$lib . $v] = $name; - } - } - } - - // 闭合标签 - if (!empty($tags[1])) { - $nodes = []; - $regex = $this->getRegex(array_keys($tags[1]), 1); - if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { - $right = []; - foreach ($matches as $match) { - if ('' == $match[1][0]) { - $name = strtolower($match[2][0]); - // 如果有没闭合的标签头则取出最后一个 - if (!empty($right[$name])) { - // $match[0][1]为标签结束符在模板中的位置 - $nodes[$match[0][1]] = [ - 'name' => $name, - 'begin' => array_pop($right[$name]), // 标签开始符 - 'end' => $match[0], // 标签结束符 - ]; - } - } else { - // 标签头压入栈 - $right[strtolower($match[1][0])][] = $match[0]; - } - } - unset($right, $matches); - // 按标签在模板中的位置从后向前排序 - krsort($nodes); - } - - $break = ''; - if ($nodes) { - $beginArray = []; - // 标签替换 从后向前 - foreach ($nodes as $pos => $node) { - // 对应的标签名 - $name = $tags[1][$node['name']]; - $alias = $lib . $name != $node['name'] ? ($lib ? strstr($node['name'], $lib) : $node['name']) : ''; - - // 解析标签属性 - $attrs = $this->parseAttr($node['begin'][0], $name, $alias); - $method = 'tag' . $name; - - // 读取标签库中对应的标签内容 replace[0]用来替换标签头,replace[1]用来替换标签尾 - $replace = explode($break, $this->$method($attrs, $break)); - - if (count($replace) > 1) { - while ($beginArray) { - $begin = end($beginArray); - // 判断当前标签尾的位置是否在栈中最后一个标签头的后面,是则为子标签 - if ($node['end'][1] > $begin['pos']) { - break; - } else { - // 不为子标签时,取出栈中最后一个标签头 - $begin = array_pop($beginArray); - // 替换标签头部 - $content = substr_replace($content, $begin['str'], $begin['pos'], $begin['len']); - } - } - // 替换标签尾部 - $content = substr_replace($content, $replace[1], $node['end'][1], strlen($node['end'][0])); - // 把标签头压入栈 - $beginArray[] = ['pos' => $node['begin'][1], 'len' => strlen($node['begin'][0]), 'str' => $replace[0]]; - } - } - - while ($beginArray) { - $begin = array_pop($beginArray); - // 替换标签头部 - $content = substr_replace($content, $begin['str'], $begin['pos'], $begin['len']); - } - } - } - // 自闭合标签 - if (!empty($tags[0])) { - $regex = $this->getRegex(array_keys($tags[0]), 0); - $content = preg_replace_callback($regex, function ($matches) use (&$tags, &$lib) { - // 对应的标签名 - $name = $tags[0][strtolower($matches[1])]; - $alias = $lib . $name != $matches[1] ? ($lib ? strstr($matches[1], $lib) : $matches[1]) : ''; - // 解析标签属性 - $attrs = $this->parseAttr($matches[0], $name, $alias); - $method = 'tag' . $name; - return $this->$method($attrs, ''); - }, $content); - } - } - - /** - * 按标签生成正则 - * @access public - * @param array|string $tags 标签名 - * @param boolean $close 是否为闭合标签 - * @return string - */ - public function getRegex($tags, bool $close): string - { - $begin = $this->tpl->getConfig('taglib_begin'); - $end = $this->tpl->getConfig('taglib_end'); - $single = strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1 ? true : false; - $tagName = is_array($tags) ? implode('|', $tags) : $tags; - - if ($single) { - if ($close) { - // 如果是闭合标签 - $regex = $begin . '(?:(' . $tagName . ')\b(?>[^' . $end . ']*)|\/(' . $tagName . '))' . $end; - } else { - $regex = $begin . '(' . $tagName . ')\b(?>[^' . $end . ']*)' . $end; - } - } else { - if ($close) { - // 如果是闭合标签 - $regex = $begin . '(?:(' . $tagName . ')\b(?>(?:(?!' . $end . ').)*)|\/(' . $tagName . '))' . $end; - } else { - $regex = $begin . '(' . $tagName . ')\b(?>(?:(?!' . $end . ').)*)' . $end; - } - } - - return '/' . $regex . '/is'; - } - - /** - * 分析标签属性 正则方式 - * @access public - * @param string $str 标签属性字符串 - * @param string $name 标签名 - * @param string $alias 别名 - * @return array - */ - public function parseAttr(string $str, string $name, string $alias = ''): array - { - $regex = '/\s+(?>(?P[\w-]+)\s*)=(?>\s*)([\"\'])(?P(?:(?!\\2).)*)\\2/is'; - $result = []; - - if (preg_match_all($regex, $str, $matches)) { - foreach ($matches['name'] as $key => $val) { - $result[$val] = $matches['value'][$key]; - } - - if (!isset($this->tags[$name])) { - // 检测是否存在别名定义 - foreach ($this->tags as $key => $val) { - if (isset($val['alias'])) { - $array = (array) $val['alias']; - if (in_array($name, explode(',', $array[0]))) { - $tag = $val; - $type = !empty($array[1]) ? $array[1] : 'type'; - $result[$type] = $name; - break; - } - } - } - } else { - $tag = $this->tags[$name]; - // 设置了标签别名 - if (!empty($alias) && isset($tag['alias'])) { - $type = !empty($tag['alias'][1]) ? $tag['alias'][1] : 'type'; - $result[$type] = $alias; - } - } - - if (!empty($tag['must'])) { - $must = explode(',', $tag['must']); - foreach ($must as $name) { - if (!isset($result[$name])) { - throw new Exception('tag attr must:' . $name); - } - } - } - } else { - // 允许直接使用表达式的标签 - if (!empty($this->tags[$name]['expression'])) { - static $_taglibs; - if (!isset($_taglibs[$name])) { - $_taglibs[$name][0] = strlen($this->tpl->getConfig('taglib_begin_origin') . $name); - $_taglibs[$name][1] = strlen($this->tpl->getConfig('taglib_end_origin')); - } - $result['expression'] = substr($str, $_taglibs[$name][0], -$_taglibs[$name][1]); - // 清除自闭合标签尾部/ - $result['expression'] = rtrim($result['expression'], '/'); - $result['expression'] = trim($result['expression']); - } elseif (empty($this->tags[$name]) || !empty($this->tags[$name]['attr'])) { - throw new Exception('tag error:' . $name); - } - } - - return $result; - } - - /** - * 解析条件表达式 - * @access public - * @param string $condition 表达式标签内容 - * @return string - */ - public function parseCondition(string $condition): string - { - if (strpos($condition, ':')) { - $condition = ' ' . substr(strstr($condition, ':'), 1); - } - - $condition = str_ireplace(array_keys($this->comparison), array_values($this->comparison), $condition); - $this->tpl->parseVar($condition); - - return $condition; - } - - /** - * 自动识别构建变量 - * @access public - * @param string $name 变量描述 - * @return string - */ - public function autoBuildVar(string &$name): string - { - $flag = substr($name, 0, 1); - - if (':' == $flag) { - // 以:开头为函数调用,解析前去掉: - $name = substr($name, 1); - } elseif ('$' != $flag && preg_match('/[a-zA-Z_]/', $flag)) { - // XXX: 这句的写法可能还需要改进 - // 常量不需要解析 - if (defined($name)) { - return $name; - } - - // 不以$开头并且也不是常量,自动补上$前缀 - $name = '$' . $name; - } - - $this->tpl->parseVar($name); - $this->tpl->parseVarFunction($name, false); - - return $name; - } - - /** - * 获取标签列表 - * @access public - * @return array - */ - public function getTags(): array - { - return $this->tags; - } -} diff --git a/vendor/topthink/think-template/src/template/driver/File.php b/vendor/topthink/think-template/src/template/driver/File.php deleted file mode 100644 index 510d10a0..00000000 --- a/vendor/topthink/think-template/src/template/driver/File.php +++ /dev/null @@ -1,83 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\template\driver; - -use Exception; - -class File -{ - protected $cacheFile; - - /** - * 写入编译缓存 - * @access public - * @param string $cacheFile 缓存的文件名 - * @param string $content 缓存的内容 - * @return void - */ - public function write(string $cacheFile, string $content): void - { - // 检测模板目录 - $dir = dirname($cacheFile); - - if (!is_dir($dir)) { - mkdir($dir, 0755, true); - } - - // 生成模板缓存文件 - if (false === file_put_contents($cacheFile, $content)) { - throw new Exception('cache write error:' . $cacheFile, 11602); - } - } - - /** - * 读取编译编译 - * @access public - * @param string $cacheFile 缓存的文件名 - * @param array $vars 变量数组 - * @return void - */ - public function read(string $cacheFile, array $vars = []): void - { - $this->cacheFile = $cacheFile; - - if (!empty($vars) && is_array($vars)) { - // 模板阵列变量分解成为独立变量 - extract($vars, EXTR_OVERWRITE); - } - - //载入模版缓存文件 - include $this->cacheFile; - } - - /** - * 检查编译缓存是否有效 - * @access public - * @param string $cacheFile 缓存的文件名 - * @param int $cacheTime 缓存时间 - * @return bool - */ - public function check(string $cacheFile, int $cacheTime): bool - { - // 缓存文件不存在, 直接返回false - if (!file_exists($cacheFile)) { - return false; - } - - if (0 != $cacheTime && time() > filemtime($cacheFile) + $cacheTime) { - // 缓存是否在有效期 - return false; - } - - return true; - } -} diff --git a/vendor/topthink/think-template/src/template/exception/TemplateNotFoundException.php b/vendor/topthink/think-template/src/template/exception/TemplateNotFoundException.php deleted file mode 100644 index dd88b327..00000000 --- a/vendor/topthink/think-template/src/template/exception/TemplateNotFoundException.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\template\exception; - -class TemplateNotFoundException extends \RuntimeException -{ - protected $template; - - public function __construct(string $message, string $template = '') - { - $this->message = $message; - $this->template = $template; - } - - /** - * 获取模板文件 - * @access public - * @return string - */ - public function getTemplate(): string - { - return $this->template; - } -} diff --git a/vendor/topthink/think-template/src/template/taglib/Cx.php b/vendor/topthink/think-template/src/template/taglib/Cx.php deleted file mode 100644 index bccafc1b..00000000 --- a/vendor/topthink/think-template/src/template/taglib/Cx.php +++ /dev/null @@ -1,715 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\template\taglib; - -use think\template\TagLib; - -/** - * CX标签库解析类 - * @category Think - * @package Think - * @subpackage Driver.Taglib - * @author liu21st - */ -class Cx extends Taglib -{ - - // 标签定义 - protected $tags = [ - // 标签定义: attr 属性列表 close 是否闭合(0 或者1 默认1) alias 标签别名 level 嵌套层次 - 'php' => ['attr' => ''], - 'volist' => ['attr' => 'name,id,offset,length,key,mod', 'alias' => 'iterate'], - 'foreach' => ['attr' => 'name,id,item,key,offset,length,mod', 'expression' => true], - 'if' => ['attr' => 'condition', 'expression' => true], - 'elseif' => ['attr' => 'condition', 'close' => 0, 'expression' => true], - 'else' => ['attr' => '', 'close' => 0], - 'switch' => ['attr' => 'name', 'expression' => true], - 'case' => ['attr' => 'value,break', 'expression' => true], - 'default' => ['attr' => '', 'close' => 0], - 'compare' => ['attr' => 'name,value,type', 'alias' => ['eq,equal,notequal,neq,gt,lt,egt,elt,heq,nheq', 'type']], - 'range' => ['attr' => 'name,value,type', 'alias' => ['in,notin,between,notbetween', 'type']], - 'empty' => ['attr' => 'name'], - 'notempty' => ['attr' => 'name'], - 'present' => ['attr' => 'name'], - 'notpresent' => ['attr' => 'name'], - 'defined' => ['attr' => 'name'], - 'notdefined' => ['attr' => 'name'], - 'load' => ['attr' => 'file,href,type,value,basepath', 'close' => 0, 'alias' => ['import,css,js', 'type']], - 'assign' => ['attr' => 'name,value', 'close' => 0], - 'define' => ['attr' => 'name,value', 'close' => 0], - 'for' => ['attr' => 'start,end,name,comparison,step'], - 'url' => ['attr' => 'link,vars,suffix,domain', 'close' => 0, 'expression' => true], - 'function' => ['attr' => 'name,vars,use,call'], - ]; - - /** - * php标签解析 - * 格式: - * {php}echo $name{/php} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagPhp(array $tag, string $content): string - { - $parseStr = ''; - return $parseStr; - } - - /** - * volist标签解析 循环输出数据集 - * 格式: - * {volist name="userList" id="user" empty=""} - * {user.username} - * {user.email} - * {/volist} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagVolist(array $tag, string $content): string - { - $name = $tag['name']; - $id = $tag['id']; - $empty = isset($tag['empty']) ? $tag['empty'] : ''; - $key = !empty($tag['key']) ? $tag['key'] : 'i'; - $mod = isset($tag['mod']) ? $tag['mod'] : '2'; - $offset = !empty($tag['offset']) && is_numeric($tag['offset']) ? intval($tag['offset']) : 0; - $length = !empty($tag['length']) && is_numeric($tag['length']) ? intval($tag['length']) : 'null'; - // 允许使用函数设定数据集 {$vo.name} - $parseStr = 'autoBuildVar($name); - $parseStr .= '$_result=' . $name . ';'; - $name = '$_result'; - } else { - $name = $this->autoBuildVar($name); - } - - $parseStr .= 'if(is_array(' . $name . ') || ' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator): $' . $key . ' = 0;'; - - // 设置了输出数组长度 - if (0 != $offset || 'null' != $length) { - $parseStr .= '$__LIST__ = is_array(' . $name . ') ? array_slice(' . $name . ',' . $offset . ',' . $length . ', true) : ' . $name . '->slice(' . $offset . ',' . $length . ', true); '; - } else { - $parseStr .= ' $__LIST__ = ' . $name . ';'; - } - - $parseStr .= 'if( count($__LIST__)==0 ) : echo "' . $empty . '" ;'; - $parseStr .= 'else: '; - $parseStr .= 'foreach($__LIST__ as $key=>$' . $id . '): '; - $parseStr .= '$mod = ($' . $key . ' % ' . $mod . ' );'; - $parseStr .= '++$' . $key . ';?>'; - $parseStr .= $content; - $parseStr .= ''; - - return $parseStr; - } - - /** - * foreach标签解析 循环输出数据集 - * 格式: - * {foreach name="userList" id="user" key="key" index="i" mod="2" offset="3" length="5" empty=""} - * {user.username} - * {/foreach} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagForeach(array $tag, string $content): string - { - // 直接使用表达式 - if (!empty($tag['expression'])) { - $expression = ltrim(rtrim($tag['expression'], ')'), '('); - $expression = $this->autoBuildVar($expression); - $parseStr = ''; - $parseStr .= $content; - $parseStr .= ''; - return $parseStr; - } - - $name = $tag['name']; - $key = !empty($tag['key']) ? $tag['key'] : 'key'; - $item = !empty($tag['id']) ? $tag['id'] : $tag['item']; - $empty = isset($tag['empty']) ? $tag['empty'] : ''; - $offset = !empty($tag['offset']) && is_numeric($tag['offset']) ? intval($tag['offset']) : 0; - $length = !empty($tag['length']) && is_numeric($tag['length']) ? intval($tag['length']) : 'null'; - - $parseStr = 'autoBuildVar($name); - $parseStr .= $var . '=' . $name . '; '; - $name = $var; - } else { - $name = $this->autoBuildVar($name); - } - - $parseStr .= 'if(is_array(' . $name . ') || ' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator): '; - - // 设置了输出数组长度 - if (0 != $offset || 'null' != $length) { - if (!isset($var)) { - $var = '$_' . uniqid(); - } - $parseStr .= $var . ' = is_array(' . $name . ') ? array_slice(' . $name . ',' . $offset . ',' . $length . ', true) : ' . $name . '->slice(' . $offset . ',' . $length . ', true); '; - } else { - $var = &$name; - } - - $parseStr .= 'if( count(' . $var . ')==0 ) : echo "' . $empty . '" ;'; - $parseStr .= 'else: '; - - // 设置了索引项 - if (isset($tag['index'])) { - $index = $tag['index']; - $parseStr .= '$' . $index . '=0; '; - } - - $parseStr .= 'foreach(' . $var . ' as $' . $key . '=>$' . $item . '): '; - - // 设置了索引项 - if (isset($tag['index'])) { - $index = $tag['index']; - if (isset($tag['mod'])) { - $mod = (int) $tag['mod']; - $parseStr .= '$mod = ($' . $index . ' % ' . $mod . '); '; - } - $parseStr .= '++$' . $index . '; '; - } - - $parseStr .= '?>'; - // 循环体中的内容 - $parseStr .= $content; - $parseStr .= ''; - - return $parseStr; - } - - /** - * if标签解析 - * 格式: - * {if condition=" $a eq 1"} - * {elseif condition="$a eq 2" /} - * {else /} - * {/if} - * 表达式支持 eq neq gt egt lt elt == > >= < <= or and || && - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagIf(array $tag, string $content): string - { - $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition']; - $condition = $this->parseCondition($condition); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * elseif标签解析 - * 格式:见if标签 - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagElseif(array $tag, string $content): string - { - $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition']; - $condition = $this->parseCondition($condition); - $parseStr = ''; - - return $parseStr; - } - - /** - * else标签解析 - * 格式:见if标签 - * @access public - * @param array $tag 标签属性 - * @return string - */ - public function tagElse(array $tag): string - { - $parseStr = ''; - - return $parseStr; - } - - /** - * switch标签解析 - * 格式: - * {switch name="a.name"} - * {case value="1" break="false"}1{/case} - * {case value="2" }2{/case} - * {default /}other - * {/switch} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagSwitch(array $tag, string $content): string - { - $name = !empty($tag['expression']) ? $tag['expression'] : $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * case标签解析 需要配合switch才有效 - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagCase(array $tag, string $content): string - { - $value = isset($tag['expression']) ? $tag['expression'] : $tag['value']; - $flag = substr($value, 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($value); - $value = 'case ' . $value . ':'; - } elseif (strpos($value, '|')) { - $values = explode('|', $value); - $value = ''; - foreach ($values as $val) { - $value .= 'case "' . addslashes($val) . '":'; - } - } else { - $value = 'case "' . $value . '":'; - } - - $parseStr = '' . $content; - $isBreak = isset($tag['break']) ? $tag['break'] : ''; - - if ('' == $isBreak || $isBreak) { - $parseStr .= ''; - } - - return $parseStr; - } - - /** - * default标签解析 需要配合switch才有效 - * 使用: {default /}ddfdf - * @access public - * @param array $tag 标签属性 - * @return string - */ - public function tagDefault(array $tag): string - { - $parseStr = ''; - - return $parseStr; - } - - /** - * compare标签解析 - * 用于值的比较 支持 eq neq gt lt egt elt heq nheq 默认是eq - * 格式: {compare name="" type="eq" value="" }content{/compare} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagCompare(array $tag, string $content): string - { - $name = $tag['name']; - $value = $tag['value']; - $type = isset($tag['type']) ? $tag['type'] : 'eq'; // 比较类型 - $name = $this->autoBuildVar($name); - $flag = substr($value, 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($value); - } else { - $value = '\'' . $value . '\''; - } - - switch ($type) { - case 'equal': - $type = 'eq'; - break; - case 'notequal': - $type = 'neq'; - break; - } - $type = $this->parseCondition(' ' . $type . ' '); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * range标签解析 - * 如果某个变量存在于某个范围 则输出内容 type= in 表示在范围内 否则表示在范围外 - * 格式: {range name="var|function" value="val" type='in|notin' }content{/range} - * example: {range name="a" value="1,2,3" type='in' }content{/range} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagRange(array $tag, string $content): string - { - $name = $tag['name']; - $value = $tag['value']; - $type = isset($tag['type']) ? $tag['type'] : 'in'; // 比较类型 - - $name = $this->autoBuildVar($name); - $flag = substr($value, 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($value); - $str = 'is_array(' . $value . ')?' . $value . ':explode(\',\',' . $value . ')'; - } else { - $value = '"' . $value . '"'; - $str = 'explode(\',\',' . $value . ')'; - } - - if ('between' == $type) { - $parseStr = '= $_RANGE_VAR_[0] && ' . $name . '<= $_RANGE_VAR_[1]):?>' . $content . ''; - } elseif ('notbetween' == $type) { - $parseStr = '$_RANGE_VAR_[1]):?>' . $content . ''; - } else { - $fun = ('in' == $type) ? 'in_array' : '!in_array'; - $parseStr = '' . $content . ''; - } - - return $parseStr; - } - - /** - * present标签解析 - * 如果某个变量已经设置 则输出内容 - * 格式: {present name="" }content{/present} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagPresent(array $tag, string $content): string - { - $name = $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * notpresent标签解析 - * 如果某个变量没有设置,则输出内容 - * 格式: {notpresent name="" }content{/notpresent} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagNotpresent(array $tag, string $content): string - { - $name = $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * empty标签解析 - * 如果某个变量为empty 则输出内容 - * 格式: {empty name="" }content{/empty} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagEmpty(array $tag, string $content): string - { - $name = $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = 'isEmpty())): ?>' . $content . ''; - - return $parseStr; - } - - /** - * notempty标签解析 - * 如果某个变量不为empty 则输出内容 - * 格式: {notempty name="" }content{/notempty} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagNotempty(array $tag, string $content): string - { - $name = $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = 'isEmpty()))): ?>' . $content . ''; - - return $parseStr; - } - - /** - * 判断是否已经定义了该常量 - * {defined name='TXT'}已定义{/defined} - * @access public - * @param array $tag - * @param string $content - * @return string - */ - public function tagDefined(array $tag, string $content): string - { - $name = $tag['name']; - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * 判断是否没有定义了该常量 - * {notdefined name='TXT'}已定义{/notdefined} - * @access public - * @param array $tag - * @param string $content - * @return string - */ - public function tagNotdefined(array $tag, string $content): string - { - $name = $tag['name']; - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * load 标签解析 {load file="/static/js/base.js" /} - * 格式:{load file="/static/css/base.css" /} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagLoad(array $tag, string $content): string - { - $file = isset($tag['file']) ? $tag['file'] : $tag['href']; - $type = isset($tag['type']) ? strtolower($tag['type']) : ''; - - $parseStr = ''; - $endStr = ''; - - // 判断是否存在加载条件 允许使用函数判断(默认为isset) - if (isset($tag['value'])) { - $name = $tag['value']; - $name = $this->autoBuildVar($name); - $name = 'isset(' . $name . ')'; - $parseStr .= ''; - $endStr = ''; - } - - // 文件方式导入 - $array = explode(',', $file); - - foreach ($array as $val) { - $type = strtolower(substr(strrchr($val, '.'), 1)); - switch ($type) { - case 'js': - $parseStr .= ''; - break; - case 'css': - $parseStr .= ''; - break; - case 'php': - $parseStr .= ''; - break; - } - } - - return $parseStr . $endStr; - } - - /** - * assign标签解析 - * 在模板中给某个变量赋值 支持变量赋值 - * 格式: {assign name="" value="" /} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagAssign(array $tag, string $content): string - { - $name = $this->autoBuildVar($tag['name']); - $flag = substr($tag['value'], 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($tag['value']); - } else { - $value = '\'' . $tag['value'] . '\''; - } - - $parseStr = ''; - - return $parseStr; - } - - /** - * define标签解析 - * 在模板中定义常量 支持变量赋值 - * 格式: {define name="" value="" /} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagDefine(array $tag, string $content): string - { - $name = '\'' . $tag['name'] . '\''; - $flag = substr($tag['value'], 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($tag['value']); - } else { - $value = '\'' . $tag['value'] . '\''; - } - - $parseStr = ''; - - return $parseStr; - } - - /** - * for标签解析 - * 格式: - * {for start="" end="" comparison="" step="" name=""} - * content - * {/for} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagFor(array $tag, string $content): string - { - //设置默认值 - $start = 0; - $end = 0; - $step = 1; - $comparison = 'lt'; - $name = 'i'; - $rand = rand(); //添加随机数,防止嵌套变量冲突 - - //获取属性 - foreach ($tag as $key => $value) { - $value = trim($value); - $flag = substr($value, 0, 1); - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($value); - } - - switch ($key) { - case 'start': - $start = $value; - break; - case 'end': - $end = $value; - break; - case 'step': - $step = $value; - break; - case 'comparison': - $comparison = $value; - break; - case 'name': - $name = $value; - break; - } - } - - $parseStr = 'parseCondition('$' . $name . ' ' . $comparison . ' $__FOR_END_' . $rand . '__') . ';$' . $name . '+=' . $step . '){ ?>'; - $parseStr .= $content; - $parseStr .= ''; - - return $parseStr; - } - - /** - * url函数的tag标签 - * 格式:{url link="模块/控制器/方法" vars="参数" suffix="true或者false 是否带有后缀" domain="true或者false 是否携带域名" /} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagUrl(array $tag, string $content): string - { - $url = isset($tag['link']) ? $tag['link'] : ''; - $vars = isset($tag['vars']) ? $tag['vars'] : ''; - $suffix = isset($tag['suffix']) ? $tag['suffix'] : 'true'; - $domain = isset($tag['domain']) ? $tag['domain'] : 'false'; - - return ''; - } - - /** - * function标签解析 匿名函数,可实现递归 - * 使用: - * {function name="func" vars="$data" call="$list" use="&$a,&$b"} - * {if is_array($data)} - * {foreach $data as $val} - * {~func($val) /} - * {/foreach} - * {else /} - * {$data} - * {/if} - * {/function} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagFunction(array $tag, string $content): string - { - $name = !empty($tag['name']) ? $tag['name'] : 'func'; - $vars = !empty($tag['vars']) ? $tag['vars'] : ''; - $call = !empty($tag['call']) ? $tag['call'] : ''; - $use = ['&$' . $name]; - - if (!empty($tag['use'])) { - foreach (explode(',', $tag['use']) as $val) { - $use[] = '&' . ltrim(trim($val), '&'); - } - } - - $parseStr = '' . $content . '' : '?>'; - - return $parseStr; - } -} diff --git a/vendor/topthink/think-view/.gitignore b/vendor/topthink/think-view/.gitignore deleted file mode 100644 index 485dee64..00000000 --- a/vendor/topthink/think-view/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea diff --git a/vendor/topthink/think-view/LICENSE b/vendor/topthink/think-view/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/vendor/topthink/think-view/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/topthink/think-view/README.md b/vendor/topthink/think-view/README.md deleted file mode 100644 index 4e52defd..00000000 --- a/vendor/topthink/think-view/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# think-view - -ThinkPHP6.0 Think-Template模板引擎驱动 - - -## 安装 - -~~~php -composer require topthink/think-view -~~~ - -## 用法示例 - -本扩展不能单独使用,依赖ThinkPHP6.0+ - -首先配置config目录下的template.php配置文件,然后可以按照下面的用法使用。 - -~~~php - -use think\facade\View; - -// 模板变量赋值和渲染输出 -View::assign(['name' => 'think']) - // 输出过滤 - ->filter(function($content){ - return str_replace('search', 'replace', $content); - }) - // 读取模板文件渲染输出 - ->fetch('index'); - - -// 或者使用助手函数 -view('index', ['name' => 'think']); -~~~ - -具体的模板引擎配置请参考think-template库。 \ No newline at end of file diff --git a/vendor/topthink/think-view/composer.json b/vendor/topthink/think-view/composer.json deleted file mode 100644 index f4e6431b..00000000 --- a/vendor/topthink/think-view/composer.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "topthink/think-view", - "description": "thinkphp template driver", - "license": "Apache-2.0", - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "require": { - "php": ">=7.1.0", - "topthink/think-template": "^2.0" - }, - "autoload": { - "psr-4": { - "think\\view\\driver\\": "src" - } - } -} diff --git a/vendor/topthink/think-view/src/Think.php b/vendor/topthink/think-view/src/Think.php deleted file mode 100644 index 02be10f2..00000000 --- a/vendor/topthink/think-view/src/Think.php +++ /dev/null @@ -1,263 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\view\driver; - -use think\App; -use think\helper\Str; -use think\Template; -use think\template\exception\TemplateNotFoundException; - -class Think -{ - // 模板引擎实例 - private $template; - private $app; - - // 模板引擎参数 - protected $config = [ - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 视图目录名 - 'view_dir_name' => 'view', - // 模板起始路径 - 'view_path' => '', - // 模板文件后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 是否开启模板编译缓存,设为false则每次都会重新编译 - 'tpl_cache' => true, - ]; - - public function __construct(App $app, array $config = []) - { - $this->app = $app; - - $this->config = array_merge($this->config, (array) $config); - - if (empty($this->config['cache_path'])) { - $this->config['cache_path'] = $app->getRuntimePath() . 'temp' . DIRECTORY_SEPARATOR; - } - - $this->template = new Template($this->config); - $this->template->setCache($app->cache); - $this->template->extend('$Think', function (array $vars) { - $type = strtoupper(trim(array_shift($vars))); - $param = implode('.', $vars); - - switch ($type) { - case 'CONST': - $parseStr = strtoupper($param); - break; - case 'CONFIG': - $parseStr = 'config(\'' . $param . '\')'; - break; - case 'LANG': - $parseStr = 'lang(\'' . $param . '\')'; - break; - case 'NOW': - $parseStr = "date('Y-m-d g:i a',time())"; - break; - case 'LDELIM': - $parseStr = '\'' . ltrim($this->getConfig('tpl_begin'), '\\') . '\''; - break; - case 'RDELIM': - $parseStr = '\'' . ltrim($this->getConfig('tpl_end'), '\\') . '\''; - break; - default: - $parseStr = defined($type) ? $type : '\'\''; - } - - return $parseStr; - }); - - $this->template->extend('$Request', function (array $vars) { - // 获取Request请求对象参数 - $method = array_shift($vars); - if (!empty($vars)) { - $params = implode('.', $vars); - if ('true' != $params) { - $params = '\'' . $params . '\''; - } - } else { - $params = ''; - } - - return 'app(\'request\')->' . $method . '(' . $params . ')'; - }); - } - - /** - * 检测是否存在模板文件 - * @access public - * @param string $template 模板文件或者模板规则 - * @return bool - */ - public function exists(string $template): bool - { - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - // 获取模板文件名 - $template = $this->parseTemplate($template); - } - - return is_file($template); - } - - /** - * 渲染模板文件 - * @access public - * @param string $template 模板文件 - * @param array $data 模板变量 - * @return void - */ - public function fetch(string $template, array $data = []): void - { - if (empty($this->config['view_path'])) { - $view = $this->config['view_dir_name']; - - if (is_dir($this->app->getAppPath() . $view)) { - $path = $this->app->getAppPath() . $view . DIRECTORY_SEPARATOR; - } else { - $appName = $this->app->http->getName(); - $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . ($appName ? $appName . DIRECTORY_SEPARATOR : ''); - } - - $this->config['view_path'] = $path; - $this->template->view_path = $path; - } - - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - // 获取模板文件名 - $template = $this->parseTemplate($template); - } - - // 模板不存在 抛出异常 - if (!is_file($template)) { - throw new TemplateNotFoundException('template not exists:' . $template, $template); - } - - // 记录视图信息 - $this->app['log'] - ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); - - $this->template->fetch($template, $data); - } - - /** - * 渲染模板内容 - * @access public - * @param string $template 模板内容 - * @param array $data 模板变量 - * @return void - */ - public function display(string $template, array $data = []): void - { - $this->template->display($template, $data); - } - - /** - * 自动定位模板文件 - * @access private - * @param string $template 模板文件规则 - * @return string - */ - private function parseTemplate(string $template): string - { - // 分析模板文件规则 - $request = $this->app['request']; - - // 获取视图根目录 - if (strpos($template, '@')) { - // 跨模块调用 - list($app, $template) = explode('@', $template); - } - - if (isset($app)) { - $view = $this->config['view_dir_name']; - $viewPath = $this->app->getBasePath() . $app . DIRECTORY_SEPARATOR . $view . DIRECTORY_SEPARATOR; - - if (is_dir($viewPath)) { - $path = $viewPath; - } else { - $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . $app . DIRECTORY_SEPARATOR; - } - - $this->template->view_path = $path; - } else { - $path = $this->config['view_path']; - } - - $depr = $this->config['view_depr']; - - if (0 !== strpos($template, '/')) { - $template = str_replace(['/', ':'], $depr, $template); - $controller = $request->controller(); - - if (strpos($controller, '.')) { - $pos = strrpos($controller, '.'); - $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1)); - } else { - $controller = Str::snake($controller); - } - - if ($controller) { - if ('' == $template) { - // 如果模板文件名为空 按照默认模板渲染规则定位 - if (2 == $this->config['auto_rule']) { - $template = $request->action(true); - } elseif (3 == $this->config['auto_rule']) { - $template = $request->action(); - } else { - $template = Str::snake($request->action()); - } - - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; - } elseif (false === strpos($template, $depr)) { - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; - } - } - } else { - $template = str_replace(['/', ':'], $depr, substr($template, 1)); - } - - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); - } - - /** - * 配置模板引擎 - * @access private - * @param array $config 参数 - * @return void - */ - public function config(array $config): void - { - $this->template->config($config); - $this->config = array_merge($this->config, $config); - } - - /** - * 获取模板引擎配置 - * @access public - * @param string $name 参数名 - * @return void - */ - public function getConfig(string $name) - { - return $this->template->getConfig($name); - } - - public function __call($method, $params) - { - return call_user_func_array([$this->template, $method], $params); - } -} diff --git a/vendor/zhongshaofa/easy-admin/.gitignore b/vendor/zhongshaofa/easy-admin/.gitignore deleted file mode 100644 index fae68b08..00000000 --- a/vendor/zhongshaofa/easy-admin/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.history/ -vendor/ -.idea \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/composer.json b/vendor/zhongshaofa/easy-admin/composer.json deleted file mode 100644 index c51d9b0c..00000000 --- a/vendor/zhongshaofa/easy-admin/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "zhongshaofa/easy-admin", - "description": "EasyAdmin工具,https://github.com/zhongshaofa/easyadmin-sdk", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "zhongshaofa", - "email": "2286732552@qq.com" - } - ], - "minimum-stability": "stable", - "require": { - "php": ">=7.1.0", - "doctrine/annotations": "^1.13.1", - "ext-json": "*" - }, - "require-dev": { - "mockery/mockery": "^1.3.0", - "phpunit/phpunit": "^8.5.0" - }, - "autoload": { - "psr-4": { - "EasyAdmin\\": "src", - "MockApp\\": "mock_app", - "Test\\": "tests" - } - }, - "scripts": { - "test": "phpunit --testdox" - } -} diff --git a/vendor/zhongshaofa/easy-admin/composer.lock b/vendor/zhongshaofa/easy-admin/composer.lock deleted file mode 100644 index 3a3234af..00000000 --- a/vendor/zhongshaofa/easy-admin/composer.lock +++ /dev/null @@ -1,2033 +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": "4c0736ad49fd778136c21d4faa8c1406", - "packages": [ - { - "name": "doctrine/annotations", - "version": "1.13.2", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "doctrine/lexer": "1.*", - "ext-tokenizer": "*", - "php": "^7.1 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2021-08-05T19:00:23+00:00" - }, - { - "name": "doctrine/lexer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "time": "2020-05-25T17:44:05+00:00" - }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "time": "2016-08-06T20:24:11+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "type": "library", - "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": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2020-11-10T18:47:58+00:00" - }, - { - "name": "hamcrest/hamcrest-php", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.3|^7.0|^8.0" - }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" - }, - "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "hamcrest" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "This is the PHP port of Hamcrest Matchers", - "keywords": [ - "test" - ], - "time": "2020-07-09T08:09:16+00:00" - }, - { - "name": "mockery/mockery", - "version": "1.3.4", - "source": { - "type": "git", - "url": "https://github.com/mockery/mockery.git", - "reference": "31467aeb3ca3188158613322d66df81cedd86626" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/31467aeb3ca3188158613322d66df81cedd86626", - "reference": "31467aeb3ca3188158613322d66df81cedd86626", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "hamcrest/hamcrest-php": "^2.0.1", - "lib-pcre": ">=7.0", - "php": ">=5.6.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Mockery": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - }, - { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" - } - ], - "description": "Mockery is a simple yet flexible PHP mock object framework", - "homepage": "https://github.com/mockery/mockery", - "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" - ], - "time": "2021-02-24T09:51:00+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.10.2", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "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": "2020-11-13T09:40:50+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "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": "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": "2021-07-20T11:28:43+00:00" - }, - { - "name": "phar-io/version", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.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": "2021-02-23T14:00:09+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.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": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.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" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-09-03T19:13:55+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.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": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-09-17T18:55:26+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.13.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "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": "2021-03-17T13:42:18+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "7.0.15", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "819f92bba8b001d4363065928088de22f25a3a48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", - "reference": "819f92bba8b001d4363065928088de22f25a3a48", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": ">=7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.3 || ^4.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1.3" - }, - "require-dev": { - "phpunit/phpunit": "^8.2.2" - }, - "suggest": { - "ext-xdebug": "^2.7.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.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": "2021-07-26T12:20:09+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "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": "2021-07-19T06:46:01+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": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-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": "2020-11-30T08:20:02+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-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" - ], - "abandoned": true, - "time": "2021-07-26T12:15:06+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "8.5.20", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9deefba183198398a09b927a6ac6bc1feb0b7b70" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9deefba183198398a09b927a6ac6bc1feb0b7b70", - "reference": "9deefba183198398a09b927a6ac6bc1feb0b7b70", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "doctrine/instantiator": "^1.3.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.0", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.2", - "phpspec/prophecy": "^1.10.3", - "phpunit/php-code-coverage": "^7.0.12", - "phpunit/php-file-iterator": "^2.0.4", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.3", - "sebastian/exporter": "^3.1.2", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.5-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": "2021-08-31T06:44:38+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "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": "2020-11-30T08:15:22+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "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" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2020-11-30T08:04:30+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2020-11-30T07:59:04+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-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": "2020-11-30T07:53:42+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2020-11-30T07:47:53+00:00" - }, - { - "name": "sebastian/global-state", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "474fb9edb7ab891665d3bfc6317f42a0a150454b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/474fb9edb7ab891665d3bfc6317f42a0a150454b", - "reference": "474fb9edb7ab891665d3bfc6317f42a0a150454b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^8.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "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": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2020-11-30T07:43:24+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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": "2020-11-30T07:40:27+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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": "2020-11-30T07:37:18+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2020-11-30T07:34:24+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "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": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "abandoned": true, - "time": "2020-11-30T07:30:19+00:00" - }, - { - "name": "sebastian/type", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.2" - }, - "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", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "time": "2020-11-30T07:25:11+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": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.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": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-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": "2021-03-09T10:59:23+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.1.0", - "ext-json": "*" - }, - "platform-dev": [] -} diff --git a/vendor/zhongshaofa/easy-admin/mock_app/BaseController.php b/vendor/zhongshaofa/easy-admin/mock_app/BaseController.php deleted file mode 100644 index fd9a2bae..00000000 --- a/vendor/zhongshaofa/easy-admin/mock_app/BaseController.php +++ /dev/null @@ -1,10 +0,0 @@ -basePath = $basePath; - $this->baseNamespace = $baseNamespace; - return $this; - } - - /** - * 获取所有节点 - * @return array - * @throws \Doctrine\Common\Annotations\AnnotationException - * @throws \ReflectionException - */ - public function getNodelist() - { - list($nodeList, $controllerList) = [[], $this->getControllerList()]; - - if (!empty($controllerList)) { - AnnotationRegistry::registerLoader('class_exists'); - $parser = new DocParser(); - $parser->setIgnoreNotImportedAnnotations(true); - $reader = new AnnotationReader($parser); - - foreach ($controllerList as $controllerFormat => $controller) { - - // 获取类和方法的注释信息 - $reflectionClass = new \ReflectionClass($controller); - $methods = $reflectionClass->getMethods(); - $actionList = []; - - // 遍历读取所有方法的注释的参数信息 - foreach ($methods as $method) { - // 读取NodeAnotation的注解 - $nodeAnnotation = $reader->getMethodAnnotation($method, NodeAnotation::class); - if (!empty($nodeAnnotation) && !empty($nodeAnnotation->title)) { - $actionTitle = !empty($nodeAnnotation) && !empty($nodeAnnotation->title) ? $nodeAnnotation->title : null; - $actionAuth = !empty($nodeAnnotation) && !empty($nodeAnnotation->auth) ? $nodeAnnotation->auth : false; - $actionList[] = [ - 'node' => $controllerFormat . '/' . $method->name, - 'title' => $actionTitle, - 'is_auth' => $actionAuth, - 'type' => 2, - ]; - } - } - - // 方法非空才读取控制器注解 - if (!empty($actionList)) { - // 读取Controller的注解 - $controllerAnnotation = $reader->getClassAnnotation($reflectionClass, ControllerAnnotation::class); - $controllerTitle = !empty($controllerAnnotation) && !empty($controllerAnnotation->title) ? $controllerAnnotation->title : null; - $controllerAuth = !empty($controllerAnnotation) && !empty($controllerAnnotation->auth) ? $controllerAnnotation->auth : false; - $nodeList[] = [ - 'node' => $controllerFormat, - 'title' => $controllerTitle, - 'is_auth' => $controllerAuth, - 'type' => 1, - ]; - $nodeList = array_merge($nodeList, $actionList); - } - - } - } - return $nodeList; - } - - /** - * 获取所有控制器 - * @return array - */ - public function getControllerList() - { - return $this->readControllerFiles($this->basePath); - } - - /** - * 遍历读取控制器文件 - * @param $path - * @return array - */ - protected function readControllerFiles($path) - { - list($list, $temp_list, $dirExplode) = [[], scandir($path), explode($this->basePath, $path)]; - $middleDir = isset($dirExplode[1]) && !empty($dirExplode[1]) ? str_replace('/', '\\', substr($dirExplode[1], 1)) . "\\" : null; - - foreach ($temp_list as $file) { - // 排除根目录和没有开启注解的模块 - if ($file == ".." || $file == ".") { - continue; - } - if (is_dir($path . DIRECTORY_SEPARATOR . $file)) { - // 子文件夹,进行递归 - $childFiles = $this->readControllerFiles($path . DIRECTORY_SEPARATOR . $file); - $list = array_merge($childFiles, $list); - } else { - // 判断是不是控制器 - $fileExplodeArray = explode('.', $file); - if (count($fileExplodeArray) != 2 || end($fileExplodeArray) != 'php') { - continue; - } - // 根目录下的文件 - $className = str_replace('.php', '', $file); - $controllerFormat = str_replace('\\', '.', $middleDir) . CommonTool::humpToLine(lcfirst($className)); - $list[$controllerFormat] = "{$this->baseNamespace}\\{$middleDir}" . $className; - } - } - return $list; - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/console/CliEcho.php b/vendor/zhongshaofa/easy-admin/src/console/CliEcho.php deleted file mode 100644 index 775dac96..00000000 --- a/vendor/zhongshaofa/easy-admin/src/console/CliEcho.php +++ /dev/null @@ -1,167 +0,0 @@ - '0;30', - 'dark_gray' => '1;30', - 'blue' => '0;34', - 'light_blue' => '1;34', - 'green' => '0;32', - 'light_green' => '1;32', - 'cyan' => '0;36', - 'light_cyan' => '1;36', - 'red' => '0;31', - 'light_red' => '1;31', - 'purple' => '0;35', - 'light_purple' => '1;35', - 'brown' => '0;33', - 'yellow' => '1;33', - 'light_gray' => '0;37', - 'white' => '1;37', - ]; - - private static $backgroundColors = [ - 'black' => '40', - 'red' => '41', - 'green' => '42', - 'yellow' => '43', - 'blue' => '44', - 'magenta' => '45', - 'cyan' => '46', - 'light_gray' => '47', - ]; - - public function __construct() - { - // Set up shell colors - $this->foreground_colors['black'] = '0;30'; - $this->foreground_colors['dark_gray'] = '1;30'; - $this->foreground_colors['blue'] = '0;34'; - $this->foreground_colors['light_blue'] = '1;34'; - $this->foreground_colors['green'] = '0;32'; - $this->foreground_colors['light_green'] = '1;32'; - $this->foreground_colors['cyan'] = '0;36'; - $this->foreground_colors['light_cyan'] = '1;36'; - $this->foreground_colors['red'] = '0;31'; - $this->foreground_colors['light_red'] = '1;31'; - $this->foreground_colors['purple'] = '0;35'; - $this->foreground_colors['light_purple'] = '1;35'; - $this->foreground_colors['brown'] = '0;33'; - $this->foreground_colors['yellow'] = '1;33'; - $this->foreground_colors['light_gray'] = '0;37'; - $this->foreground_colors['white'] = '1;37'; - $this->background_colors['black'] = '40'; - $this->background_colors['red'] = '41'; - $this->background_colors['green'] = '42'; - $this->background_colors['yellow'] = '43'; - $this->background_colors['blue'] = '44'; - $this->background_colors['magenta'] = '45'; - $this->background_colors['cyan'] = '46'; - $this->background_colors['light_gray'] = '47'; - } - - // Returns colored string - public function getColoredString($string, $foreground_color = null, $background_color = null, $new_line = false) - { - $colored_string = ''; - // Check if given foreground color found - if (isset($this->foreground_colors[$foreground_color])) { - $colored_string .= "\033[".$this->foreground_colors[$foreground_color].'m'; - } - // Check if given background color found - if (isset($this->background_colors[$background_color])) { - $colored_string .= "\033[".$this->background_colors[$background_color].'m'; - } - // Add string and end coloring - $colored_string .= $string."\033[0m"; - return $new_line ? $colored_string.PHP_EOL : $colored_string; - } - - // Returns all foreground color names - public function getForegroundColors() - { - return array_keys($this->foreground_colors); - } - - // Returns all background color names - public function getBackgroundColors() - { - return array_keys($this->background_colors); - } - - /** - * 获取带颜色的文字. - * - * @param string $string black|dark_gray|blue|light_blue|green|light_green|cyan|light_cyan|red|light_red|purple|brown|yellow|light_gray|white - * @param string|null $foregroundColor 前景颜色 black|red|green|yellow|blue|magenta|cyan|light_gray - * @param string|null $backgroundColor 背景颜色 同$foregroundColor - * - * @return string - */ - public static function initColoredString( - $string, - $foregroundColor = null, - $backgroundColor = null - ) { - $coloredString = ''; - if (isset(static::$foregroundColors[$foregroundColor])) { - $coloredString .= "\033[".static::$foregroundColors[$foregroundColor].'m'; - } - if (isset(static::$backgroundColors[$backgroundColor])) { - $coloredString .= "\033[".static::$backgroundColors[$backgroundColor].'m'; - } - $coloredString .= $string."\033[0m"; - return $coloredString; - } - - /** - * 输出提示信息. - * - * @param $msg - */ - public static function notice($msg) - { - fwrite(STDOUT, self::initColoredString($msg, 'light_gray').PHP_EOL); - } - - /** - * 输出错误信息. - * - * @param $msg - */ - public static function error($msg) - { - fwrite(STDERR, self::initColoredString($msg, 'white','red').PHP_EOL); - } - - /** - * 输出警告信息. - * - * @param $msg - */ - public static function warn($msg) - { - fwrite(STDOUT, self::initColoredString($msg, 'red','yellow').PHP_EOL); - } - - /** - * 输出成功信息. - * - * @param $msg - */ - public static function success($msg) - { - fwrite(STDOUT, self::initColoredString($msg, 'light_cyan').PHP_EOL); - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/BuildCurd.php b/vendor/zhongshaofa/easy-admin/src/curd/BuildCurd.php deleted file mode 100644 index a3506963..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/BuildCurd.php +++ /dev/null @@ -1,1461 +0,0 @@ -tablePrefix = config('database.connections.mysql.prefix'); - $this->dbName = config('database.connections.mysql.database'); - $this->dir = __DIR__; - $this->rootDir = root_path(); - return $this; - } - - /** - * 设置主表 - * @param $table - * @return $this - * @throws TableException - */ - public function setTable($table) - { - $this->table = $table; - try { - - // 获取表列注释 - $colums = Db::query("SHOW FULL COLUMNS FROM {$this->tablePrefix}{$this->table}"); - foreach ($colums as $vo) { - - $colum = [ - 'type' => $vo['Type'], - 'comment' => !empty($vo['Comment']) ? $vo['Comment'] : $vo['Field'], - 'required' => $vo['Null'] == "NO" ? true : false, - 'default' => $vo['Default'], - ]; - - // 格式化列数据 - $this->buildColum($colum); - - $this->tableColumns[$vo['Field']] = $colum; - - if ($vo['Field'] == 'delete_time') { - $this->delete = true; - } - - } - - // 获取表名注释 - $tableSchema = Db::query("SELECT table_name,table_comment FROM information_schema.TABLES WHERE table_schema = 'easyadmin' AND table_name = '{$this->tablePrefix}{$this->table}'"); - $this->tableComment = (isset($tableSchema[0]['table_comment']) && !empty($tableSchema[0]['table_comment'])) ? $tableSchema[0]['table_comment'] : $this->table; - } catch (\Exception $e) { - throw new TableException($e->getMessage()); - } - - // 初始化默认控制器名 - $nodeArray = explode('_', $this->table); - if (count($nodeArray) == 1) { - $this->controllerFilename = ucfirst($nodeArray[0]); - } else { - foreach ($nodeArray as $k => $v) { - if ($k == 0) { - $this->controllerFilename = "{$v}{$this->DS}"; - } else { - $this->controllerFilename .= ucfirst($v); - } - } - } - - // 初始化默认模型名 - $this->modelFilename = ucfirst(CommonTool::lineToHump($this->table)); - - $this->buildViewJsUrl(); - - // 构建数据 - $this->buildStructure(); - - return $this; - } - - /** - * 设置关联表 - * @param $relationTable - * @param $foreignKey - * @param null $primaryKey - * @param null $modelFilename - * @param array $onlyShowFileds - * @param null $bindSelectField - * @return $this - * @throws TableException - */ - public function setRelation($relationTable, $foreignKey, $primaryKey = null, $modelFilename = null, $onlyShowFileds = [], $bindSelectField = null) - { - if (!isset($this->tableColumns[$foreignKey])) { - throw new TableException("主表不存在外键字段:{$foreignKey}"); - } - if (!empty($modelFilename)) { - $modelFilename = str_replace('/', $this->DS, $modelFilename); - } - try { - $colums = Db::query("SHOW FULL COLUMNS FROM {$this->tablePrefix}{$relationTable}"); - $formatColums = []; - $delete = false; - if (!empty($bindSelectField) && !in_array($bindSelectField, array_column($colums, 'Field'))) { - throw new TableException("关联表{$relationTable}不存在该字段: {$bindSelectField}"); - } - foreach ($colums as $vo) { - if (empty($primaryKey) && $vo['Key'] == 'PRI') { - $primaryKey = $vo['Field']; - } - if (!empty($onlyShowFileds) && !in_array($vo['Field'], $onlyShowFileds)) { - continue; - } - $colum = [ - 'type' => $vo['Type'], - 'comment' => $vo['Comment'], - 'default' => $vo['Default'], - ]; - - $this->buildColum($colum); - - $formatColums[$vo['Field']] = $colum; - if ($vo['Field'] == 'delete_time') { - $delete = true; - } - } - - $modelFilename = empty($modelFilename) ? ucfirst(CommonTool::lineToHump($relationTable)) : $modelFilename; - $modelArray = explode($this->DS, $modelFilename); - $modelName = array_pop($modelArray); - - $relation = [ - 'modelFilename' => $modelFilename, - 'modelName' => $modelName, - 'foreignKey' => $foreignKey, - 'primaryKey' => $primaryKey, - 'bindSelectField' => $bindSelectField, - 'delete' => $delete, - 'tableColumns' => $formatColums, - ]; - if (!empty($bindSelectField)) { - $relationArray = explode('\\', $modelFilename); - $this->tableColumns[$foreignKey]['bindSelectField'] = $bindSelectField; - $this->tableColumns[$foreignKey]['bindRelation'] = end($relationArray); - } - $this->relationArray[$relationTable] = $relation; - $this->selectFileds[] = $foreignKey; - } catch (\Exception $e) { - throw new TableException($e->getMessage()); - } - return $this; - } - - /** - * 设置控制器名 - * @param $controllerFilename - * @return $this - */ - public function setControllerFilename($controllerFilename) - { - $this->controllerFilename = str_replace('/', $this->DS, $controllerFilename); - $this->buildViewJsUrl(); - return $this; - } - - /** - * 设置模型名 - * @param $modelFilename - * @return $this - */ - public function setModelFilename($modelFilename) - { - $this->modelFilename = str_replace('/', $this->DS, $modelFilename); - $this->buildViewJsUrl(); - return $this; - } - - /** - * 设置显示字段 - * @param $fields - * @return $this - */ - public function setFields($fields) - { - $this->fields = $fields; - return $this; - } - - /** - * 设置删除模式 - * @param $delete - * @return $this - */ - public function setDelete($delete) - { - $this->delete = $delete; - return $this; - } - - /** - * 设置是否强制替换 - * @param $force - * @return $this - */ - public function setForce($force) - { - $this->force = $force; - return $this; - } - - /** - * 设置复选框字段后缀 - * @param $array - * @return $this - */ - public function setCheckboxFieldSuffix($array) - { - $this->checkboxFieldSuffix = array_merge($this->checkboxFieldSuffix, $array); - return $this; - } - - /** - * 设置单选框字段后缀 - * @param $array - * @return $this - */ - public function setRadioFieldSuffix($array) - { - $this->radioFieldSuffix = array_merge($this->radioFieldSuffix, $array); - return $this; - } - - /** - * 设置单图片字段后缀 - * @param $array - * @return $this - */ - public function setImageFieldSuffix($array) - { - $this->imageFieldSuffix = array_merge($this->imageFieldSuffix, $array); - return $this; - } - - /** - * 设置多图片字段后缀 - * @param $array - * @return $this - */ - public function setImagesFieldSuffix($array) - { - $this->imagesFieldSuffix = array_merge($this->imagesFieldSuffix, $array); - return $this; - } - - /** - * 设置单文件字段后缀 - * @param $array - * @return $this - */ - public function setFileFieldSuffix($array) - { - $this->fileFieldSuffix = array_merge($this->fileFieldSuffix, $array); - return $this; - } - - /** - * 设置多文件字段后缀 - * @param $array - * @return $this - */ - public function setFilesFieldSuffix($array) - { - $this->filesFieldSuffix = array_merge($this->filesFieldSuffix, $array); - return $this; - } - - /** - * 设置时间字段后缀 - * @param $array - * @return $this - */ - public function setDateFieldSuffix($array) - { - $this->dateFieldSuffix = array_merge($this->dateFieldSuffix, $array); - return $this; - } - - /** - * 设置开关字段 - * @param $array - * @return $this - */ - public function setSwitchFields($array) - { - $this->switchFields = array_merge($this->switchFields, $array); - return $this; - } - - /** - * 设置下拉选择字段 - * @param $array - * @return $this - */ - public function setSelectFileds($array) - { - $this->selectFileds = array_merge($this->selectFileds, $array); - return $this; - } - - /** - * 设置排序字段 - * @param $array - * @return $this - */ - public function setSortFields($array) - { - $this->sortFields = array_merge($this->sortFields, $array); - return $this; - } - - /** - * 设置忽略字段 - * @param $array - * @return $this - */ - public function setIgnoreFields($array) - { - $this->ignoreFields = array_merge($this->ignoreFields, $array); - return $this; - } - - /** - * 获取相关的文件 - * @return array - */ - public function getFileList() - { - return $this->fileList; - } - - /** - * 构建基础视图、JS、URL - * @return $this - */ - protected function buildViewJsUrl() - { - $nodeArray = explode($this->DS, $this->controllerFilename); - $formatArray = []; - foreach ($nodeArray as $vo) { - $formatArray[] = CommonTool::humpToLine(lcfirst($vo)); - } - $this->controllerUrl = implode('.', $formatArray); - $this->viewFilename = implode($this->DS, $formatArray); - $this->jsFilename = $this->viewFilename; - - // 控制器命名空间 - $namespaceArray = $nodeArray; - $this->controllerName = array_pop($namespaceArray); - $namespaceSuffix = implode('\\', $namespaceArray); - $this->controllerNamespace = empty($namespaceSuffix) ? "app\admin\controller" : "app\admin\controller\\{$namespaceSuffix}"; - - // 主表模型命名 - $modelArray = explode($this->DS, $this->modelFilename); - - $this->modelName = array_pop($modelArray); - - return $this; - } - - /** - * 构建字段 - * @return $this - */ - protected function buildStructure() - { - foreach ($this->tableColumns as $key => $val) { - - // 排序 - if (in_array($key, ['sort'])) { - $this->sortFields[] = $key; - } - - // 富文本 - if (in_array($key, ['describe', 'content', 'details'])) { - $this->editorFields[] = $key; - } - - } - return $this; - } - - /** - * 构建必填 - * @param $require - * @return string - */ - protected function buildRequiredHtml($require) - { - return $require ? 'lay-verify="required"' : ""; - } - - /** - * 构建初始化字段信息 - * @param $colum - * @return mixed - */ - protected function buildColum(&$colum) - { - - $string = $colum['comment']; - - // 处理定义类型 - preg_match('/{[\s\S]*?}/i', $string, $formTypeMatch); - if (!empty($formTypeMatch) && isset($formTypeMatch[0])) { - $colum['comment'] = str_replace($formTypeMatch[0], '', $colum['comment']); - $formType = trim(str_replace('}', '', str_replace('{', '', $formTypeMatch[0]))); - if (in_array($formType, $this->formTypeArray)) { - $colum['formType'] = $formType; - } - } - - // 处理默认定义 - preg_match('/\([\s\S]*?\)/i', $string, $defineMatch); - if (!empty($formTypeMatch) && isset($defineMatch[0])) { - $colum['comment'] = str_replace($defineMatch[0], '', $colum['comment']); - if (isset($colum['formType']) && in_array($colum['formType'], ['images', 'files', 'select', 'switch', 'radio', 'checkbox', 'date'])) { - $define = str_replace(')', '', str_replace('(', '', $defineMatch[0])); - if (in_array($colum['formType'], ['select', 'switch', 'radio', 'checkbox'])) { - $formatDefine = []; - $explodeArray = explode(',', $define); - foreach ($explodeArray as $vo) { - $voExplodeArray = explode(':', $vo); - if (count($voExplodeArray) == 2) { - $formatDefine[trim($voExplodeArray[0])] = trim($voExplodeArray[1]); - } - } - !empty($formatDefine) && $colum['define'] = $formatDefine; - } else { - $colum['define'] = $define; - } - } - } - - $colum['comment'] = trim($colum['comment']); - - return $colum; - } - - /** - * 构建下拉控制器 - * @param $field - * @return mixed - */ - protected function buildSelectController($field) - { - $field = CommonTool::lineToHump(ucfirst($field)); - $name = "get{$field}List"; - $selectCode = CommonTool::replaceTemplate( - $this->getTemplate("controller{$this->DS}select"), - [ - 'name' => $name, - ]); - return $selectCode; - } - - /** - * 构架下拉模型 - * @param $field - * @param $array - * @return mixed - */ - protected function buildSelectModel($field, $array) - { - $field = CommonTool::lineToHump(ucfirst($field)); - $name = "get{$field}List"; - $values = '['; - foreach ($array as $k => $v) { - $values .= "'{$k}'=>'{$v}',"; - } - $values .= ']'; - $selectCode = CommonTool::replaceTemplate( - $this->getTemplate("model{$this->DS}select"), - [ - 'name' => $name, - 'values' => $values, - ]); - return $selectCode; - } - - /** - * 构架关联下拉模型 - * @param $relation - * @param $filed - * @return mixed - */ - protected function buildRelationSelectModel($relation, $filed) - { - $relationArray = explode('\\', $relation); - $name = end($relationArray); - $name = "get{$name}List"; - $selectCode = CommonTool::replaceTemplate( - $this->getTemplate("model{$this->DS}relationSelect"), - [ - 'name' => $name, - 'relation' => $relation, - 'values' => $filed, - ]); - return $selectCode; - } - - /** - * 构建下拉框视图 - * @param $field - * @param string $select - * @return mixed - */ - protected function buildOptionView($field, $select = '') - { - $field = CommonTool::lineToHump(ucfirst($field)); - $name = "get{$field}List"; - $optionCode = CommonTool::replaceTemplate( - $this->getTemplate("view{$this->DS}module{$this->DS}option"), - [ - 'name' => $name, - 'select' => $select, - ]); - return $optionCode; - } - - /** - * 构建单选框视图 - * @param $field - * @param string $select - * @return mixed - */ - protected function buildRadioView($field, $select = '') - { - $formatField = CommonTool::lineToHump(ucfirst($field)); - $name = "get{$formatField}List"; - $optionCode = CommonTool::replaceTemplate( - $this->getTemplate("view{$this->DS}module{$this->DS}radioInput"), - [ - 'field' => $field, - 'name' => $name, - 'select' => $select, - ]); - return $optionCode; - } - - /** - * 构建多选框视图 - * @param $field - * @param string $select - * @return mixed - */ - protected function buildCheckboxView($field, $select = '') - { - $formatField = CommonTool::lineToHump(ucfirst($field)); - $name = "get{$formatField}List"; - $optionCode = CommonTool::replaceTemplate( - $this->getTemplate("view{$this->DS}module{$this->DS}checkboxInput"), - [ - 'field' => $field, - 'name' => $name, - 'select' => $select, - ]); - return $optionCode; - } - - /** - * 初始化 - * @return $this - */ - public function render() - { - - // 初始化数据 - $this->renderData(); - - // 控制器 - $this->renderController(); - - // 模型 - $this->renderModel(); - - // 视图 - $this->renderView(); - - // JS - $this->renderJs(); - - return $this; - } - - /** - * 初始化数据 - * @return $this - */ - protected function renderData() - { - - // 主表 - foreach ($this->tableColumns as $field => $val) { - - // 过滤字段 - if (in_array($field, $this->ignoreFields)) { - unset($this->tableColumns[$field]); - continue; - } - - // 判断是否已初始化 - if (isset($this->tableColumns[$field]['formType'])) { - continue; - } - - // 判断图片 - if ($this->checkContain($field, $this->imageFieldSuffix)) { - $this->tableColumns[$field]['formType'] = 'image'; - continue; - } - if ($this->checkContain($field, $this->imagesFieldSuffix)) { - $this->tableColumns[$field]['formType'] = 'images'; - continue; - } - - // 判断文件 - if ($this->checkContain($field, $this->fileFieldSuffix)) { - $this->tableColumns[$field]['formType'] = 'file'; - continue; - } - if ($this->checkContain($field, $this->filesFieldSuffix)) { - $this->tableColumns[$field]['formType'] = 'files'; - continue; - } - - // 判断时间 - if ($this->checkContain($field, $this->dateFieldSuffix)) { - $this->tableColumns[$field]['formType'] = 'date'; - continue; - } - - // 判断开关 - if (in_array($field, $this->switchFields)) { - $this->tableColumns[$field]['formType'] = 'switch'; - continue; - } - - // 判断富文本 - if (in_array($field, $this->editorFields)) { - $this->tableColumns[$field]['formType'] = 'editor'; - continue; - } - - // 判断排序 - if (in_array($field, $this->sortFields)) { - $this->tableColumns[$field]['formType'] = 'sort'; - continue; - } - - // 判断下拉选择 - if (in_array($field, $this->selectFileds)) { - $this->tableColumns[$field]['formType'] = 'select'; - continue; - } - - $this->tableColumns[$field]['formType'] = 'text'; - } - - // 关联表 - foreach ($this->relationArray as $table => $tableVal) { - foreach ($tableVal['tableColumns'] as $field => $val) { - - // 过滤字段 - if (in_array($field, $this->ignoreFields)) { - unset($this->relationArray[$table]['tableColumns'][$field]); - continue; - } - - // 判断是否已初始化 - if (isset($this->relationArray[$table]['tableColumns'][$field]['formType'])) { - continue; - } - - // 判断图片 - if ($this->checkContain($field, $this->imageFieldSuffix)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'image'; - continue; - } - if ($this->checkContain($field, $this->imagesFieldSuffix)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'images'; - continue; - } - - // 判断文件 - if ($this->checkContain($field, $this->fileFieldSuffix)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'file'; - continue; - } - if ($this->checkContain($field, $this->filesFieldSuffix)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'files'; - continue; - } - - // 判断时间 - if ($this->checkContain($field, $this->dateFieldSuffix)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'date'; - continue; - } - - // 判断开关 - if (in_array($field, $this->switchFields)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'switch'; - continue; - } - - // 判断富文本 - if (in_array($field, $this->editorFields)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'editor'; - continue; - } - - // 判断排序 - if (in_array($field, $this->sortFields)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'sort'; - continue; - } - - // 判断下拉选择 - if (in_array($field, $this->selectFileds)) { - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'select'; - continue; - } - - $this->relationArray[$table]['tableColumns'][$field]['formType'] = 'text'; - } - } - - return $this; - - } - - /** - * 初始化控制器 - * @return $this - */ - protected function renderController() - { - $controllerFile = "{$this->rootDir}app{$this->DS}admin{$this->DS}controller{$this->DS}{$this->controllerFilename}.php"; - if (empty($this->relationArray)) { - $controllerIndexMethod = ''; - } else { - $relationCode = ''; - foreach ($this->relationArray as $key => $val) { - $relation = CommonTool::lineToHump($key); - $relationCode = "->withJoin('{$relation}', 'LEFT')\r"; - } - $controllerIndexMethod = CommonTool::replaceTemplate( - $this->getTemplate("controller{$this->DS}indexMethod"), - [ - 'relationIndexMethod' => $relationCode, - ]); - } - $selectList = ''; - foreach ($this->relationArray as $relation) { - if (!empty($relation['bindSelectField'])) { - $relationArray = explode('\\', $relation['modelFilename']); - $selectList .= $this->buildSelectController(end($relationArray)); - } - } - foreach ($this->tableColumns as $field => $val) { - if (isset($val['formType']) && in_array($val['formType'], ['select', 'switch', 'radio', 'checkbox']) && isset($val['define'])) { - $selectList .= $this->buildSelectController($field); - } - } - - $modelFilenameExtend = str_replace($this->DS,'\\',$this->modelFilename); - - $controllerValue = CommonTool::replaceTemplate( - $this->getTemplate("controller{$this->DS}controller"), - [ - 'controllerName' => $this->controllerName, - 'controllerNamespace' => $this->controllerNamespace, - 'controllerAnnotation' => $this->tableComment, - 'modelFilename' => "\app\admin\model\\{$modelFilenameExtend}", - 'indexMethod' => $controllerIndexMethod, - 'selectList' => $selectList, - ]); - $this->fileList[$controllerFile] = $controllerValue; - return $this; - } - - /** - * 初始化模型 - * @return $this - */ - protected function renderModel() - { - // 主表模型 - $modelFile = "{$this->rootDir}app{$this->DS}admin{$this->DS}model{$this->DS}{$this->modelFilename}.php"; - if (empty($this->relationArray)) { - $relationList = ''; - } else { - $relationList = ''; - foreach ($this->relationArray as $key => $val) { - $relation = CommonTool::lineToHump($key); - $relationCode = CommonTool::replaceTemplate( - $this->getTemplate("model{$this->DS}relation"), - [ - 'relationMethod' => $relation, - 'relationModel' => "\app\admin\model\\{$val['modelFilename']}", - 'foreignKey' => $val['foreignKey'], - 'primaryKey' => $val['primaryKey'], - ]); - $relationList .= $relationCode; - } - } - - $selectList = ''; - foreach ($this->relationArray as $relation) { - if (!empty($relation['bindSelectField'])) { - $selectList .= $this->buildRelationSelectModel($relation['modelFilename'], $relation['bindSelectField']); - } - } - foreach ($this->tableColumns as $field => $val) { - if (isset($val['formType']) && in_array($val['formType'], ['select', 'switch', 'radio', 'checkbox']) && isset($val['define'])) { - $selectList .= $this->buildSelectModel($field, $val['define']); - } - } - - $extendNamespaceArray = explode($this->DS, $this->modelFilename); - $extendNamespace = null; - if (count($extendNamespaceArray) > 1) { - array_pop($extendNamespaceArray); - $extendNamespace = '\\' . implode('\\', $extendNamespaceArray); - } - - $modelValue = CommonTool::replaceTemplate( - $this->getTemplate("model{$this->DS}model"), - [ - 'modelName' => $this->modelName, - 'modelNamespace' => "app\admin\model{$extendNamespace}", - 'table' => $this->table, - 'deleteTime' => $this->delete ? '"delete_time"' : 'false', - 'relationList' => $relationList, - 'selectList' => $selectList, - ]); - $this->fileList[$modelFile] = $modelValue; - - // 关联模型 - foreach ($this->relationArray as $key => $val) { - $relationModelFile = "{$this->rootDir}app{$this->DS}admin{$this->DS}model{$this->DS}{$val['modelFilename']}.php"; - - // todo 判断关联模型文件是否存在, 存在就不重新生成文件, 防止关联模型文件被覆盖 - $relationModelClass = "\\app\\admin\\model\\{$val['modelFilename']}"; - if (class_exists($relationModelClass) && method_exists(new $relationModelClass, 'getName')) { - $tableName = (new $relationModelClass)->getName(); - if (CommonTool::humpToLine(lcfirst($tableName)) == CommonTool::humpToLine(lcfirst($key))) { - continue; - } - } - - $extendNamespaceArray = explode($this->DS, $val['modelFilename']); - $extendNamespace = null; - if (count($extendNamespaceArray) > 1) { - array_pop($extendNamespaceArray); - $extendNamespace = '\\' . implode('\\', $extendNamespaceArray); - } - - $relationModelValue = CommonTool::replaceTemplate( - $this->getTemplate("model{$this->DS}model"), - [ - 'modelName' => $val['modelName'], - 'modelNamespace' => "app\admin\model{$extendNamespace}", - 'table' => $key, - 'deleteTime' => $val['delete'] ? '"delete_time"' : 'false', - 'relationList' => '', - 'selectList' => '', - ]); - $this->fileList[$relationModelFile] = $relationModelValue; - } - return $this; - } - - /** - * 初始化视图 - * @return $this - */ - protected function renderView() - { - // 列表页面 - $viewIndexFile = "{$this->rootDir}app{$this->DS}admin{$this->DS}view{$this->DS}{$this->viewFilename}{$this->DS}index.html"; - $viewIndexValue = CommonTool::replaceTemplate( - $this->getTemplate("view{$this->DS}index"), - [ - 'controllerUrl' => $this->controllerUrl, - ]); - $this->fileList[$viewIndexFile] = $viewIndexValue; - - // 添加页面 - $viewAddFile = "{$this->rootDir}app{$this->DS}admin{$this->DS}view{$this->DS}{$this->viewFilename}{$this->DS}add.html"; - $addFormList = ''; - foreach ($this->tableColumns as $field => $val) { - - if (in_array($field, ['id', 'create_time'])) { - continue; - } - - $templateFile = "view{$this->DS}module{$this->DS}input"; - $define = ''; - - // 根据formType去获取具体模板 - if ($val['formType'] == 'image') { - $templateFile = "view{$this->DS}module{$this->DS}image"; - } elseif ($val['formType'] == 'images') { - $templateFile = "view{$this->DS}module{$this->DS}images"; - $define = isset($val['define']) ? $val['define'] : '|'; - } elseif ($val['formType'] == 'file') { - $templateFile = "view{$this->DS}module{$this->DS}file"; - } elseif ($val['formType'] == 'files') { - $templateFile = "view{$this->DS}module{$this->DS}files"; - $define = isset($val['define']) ? $val['define'] : '|'; - } elseif ($val['formType'] == 'editor') { - $templateFile = "view{$this->DS}module{$this->DS}editor"; - } elseif ($val['formType'] == 'date') { - $templateFile = "view{$this->DS}module{$this->DS}date"; - if (isset($val['define']) && !empty($val['define'])) { - $define = $val['define']; - } else { - $define = 'datetime'; - } - if (!in_array($define, ['year', 'month', 'date', 'time', 'datetime'])) { - $define = 'datetime'; - } - } elseif ($val['formType'] == 'radio') { - $templateFile = "view{$this->DS}module{$this->DS}radio"; - if (isset($val['define']) && !empty($val['define'])) { - $define = $this->buildRadioView($field, '{in name="k" value="' . $val['default'] . '"}checked=""{/in}'); - } - } elseif ($val['formType'] == 'checkbox') { - $templateFile = "view{$this->DS}module{$this->DS}checkbox"; - if (isset($val['define']) && !empty($val['define'])) { - $define = $this->buildCheckboxView($field, '{in name="k" value="' . $val['default'] . '"}checked=""{/in}'); - } - } elseif ($val['formType'] == 'select') { - $templateFile = "view{$this->DS}module{$this->DS}select"; - if (isset($val['bindRelation'])) { - $define = $this->buildOptionView($val['bindRelation']); - } elseif (isset($val['define']) && !empty($val['define'])) { - $define = $this->buildOptionView($field); - } - } elseif (in_array($field, ['remark']) || $val['formType'] == 'textarea') { - $templateFile = "view{$this->DS}module{$this->DS}textarea"; - } - - $addFormList .= CommonTool::replaceTemplate( - $this->getTemplate($templateFile), - [ - 'comment' => $val['comment'], - 'field' => $field, - 'required' => $this->buildRequiredHtml($val['required']), - 'value' => $val['default'], - 'define' => $define, - ]); - } - $viewAddValue = CommonTool::replaceTemplate( - $this->getTemplate("view{$this->DS}form"), - [ - 'formList' => $addFormList, - ]); - $this->fileList[$viewAddFile] = $viewAddValue; - - - // 编辑页面 - $viewEditFile = "{$this->rootDir}app{$this->DS}admin{$this->DS}view{$this->DS}{$this->viewFilename}{$this->DS}edit.html"; - $editFormList = ''; - foreach ($this->tableColumns as $field => $val) { - - if (in_array($field, ['id', 'create_time'])) { - continue; - } - - $templateFile = "view{$this->DS}module{$this->DS}input"; - - $define = ''; - $value = '{$row.' . $field . '|default=\'\'}'; - - // 根据formType去获取具体模板 - if ($val['formType'] == 'image') { - $templateFile = "view{$this->DS}module{$this->DS}image"; - } elseif ($val['formType'] == 'images') { - $templateFile = "view{$this->DS}module{$this->DS}images"; - } elseif ($val['formType'] == 'file') { - $templateFile = "view{$this->DS}module{$this->DS}file"; - } elseif ($val['formType'] == 'files') { - $templateFile = "view{$this->DS}module{$this->DS}files"; - } elseif ($val['formType'] == 'editor') { - $templateFile = "view{$this->DS}module{$this->DS}editor"; - $value = '{$row.' . $field . '|raw|default=\'\'}'; - } elseif ($val['formType'] == 'date') { - $templateFile = "view{$this->DS}module{$this->DS}date"; - if (isset($val['define']) && !empty($val['define'])) { - $define = $val['define']; - } else { - $define = 'datetime'; - } - if (!in_array($define, ['year', 'month', 'date', 'time', 'datetime'])) { - $define = 'datetime'; - } - } elseif ($val['formType'] == 'radio') { - $templateFile = "view{$this->DS}module{$this->DS}radio"; - if (isset($val['define']) && !empty($val['define'])) { - $define = $this->buildRadioView($field, '{in name="k" value="$row.' . $field . '"}checked=""{/in}'); - } - } elseif ($val['formType'] == 'checkbox') { - $templateFile = "view{$this->DS}module{$this->DS}checkbox"; - if (isset($val['define']) && !empty($val['define'])) { - $define = $this->buildCheckboxView($field, '{in name="k" value="$row.' . $field . '"}checked=""{/in}'); - } - } elseif ($val['formType'] == 'select') { - $templateFile = "view{$this->DS}module{$this->DS}select"; - if (isset($val['bindRelation'])) { - $define = $this->buildOptionView($val['bindRelation'], '{in name="k" value="$row.' . $field . '"}selected=""{/in}'); - } elseif (isset($val['define']) && !empty($val['define'])) { - $define = $this->buildOptionView($field, '{in name="k" value="$row.' . $field . '"}selected=""{/in}'); - } - } elseif (in_array($field, ['remark']) || $val['formType'] == 'textarea') { - $templateFile = "view{$this->DS}module{$this->DS}textarea"; - $value = '{$row.' . $field . '|raw|default=\'\'}'; - } - - $editFormList .= CommonTool::replaceTemplate( - $this->getTemplate($templateFile), - [ - 'comment' => $val['comment'], - 'field' => $field, - 'required' => $this->buildRequiredHtml($val['required']), - 'value' => $value, - 'define' => $define, - ]); - } - $viewEditValue = CommonTool::replaceTemplate( - $this->getTemplate("view{$this->DS}form"), - [ - 'formList' => $editFormList, - ]); - $this->fileList[$viewEditFile] = $viewEditValue; - - return $this; - } - - /** - * 初始化JS - * @return $this - */ - protected function renderJs() - { - $jsFile = "{$this->rootDir}public{$this->DS}static{$this->DS}admin{$this->DS}js{$this->DS}{$this->jsFilename}.js"; - - $indexCols = " {type: 'checkbox'},\r"; - - // 主表字段 - foreach ($this->tableColumns as $field => $val) { - - if ($val['formType'] == 'image') { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.image}"; - } elseif ($val['formType'] == 'images') { - continue; - } elseif ($val['formType'] == 'file') { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.url}"; - } elseif ($val['formType'] == 'files') { - continue; - } elseif ($val['formType'] == 'editor') { - continue; - } elseif (in_array($field, $this->switchFields)) { - if (isset($val['define']) && !empty($val['define'])) { - $values = json_encode($val['define'], JSON_UNESCAPED_UNICODE); - $templateValue = "{field: '{$field}', search: 'select', selectList: {$values}, title: '{$val['comment']}', templet: ea.table.switch}"; - } else { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.switch}"; - } - } elseif (in_array($val['formType'], ['select', 'checkbox', 'radio', 'switch'])) { - if (isset($val['define']) && !empty($val['define'])) { - $values = json_encode($val['define'], JSON_UNESCAPED_UNICODE); - $templateValue = "{field: '{$field}', search: 'select', selectList: {$values}, title: '{$val['comment']}'}"; - } else { - $templateValue = "{field: '{$field}', title: '{$val['comment']}'}"; - } - } elseif (in_array($field, ['remark'])) { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.text}"; - } elseif (in_array($field, $this->sortFields)) { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', edit: 'text'}"; - } else { - $templateValue = "{field: '{$field}', title: '{$val['comment']}'}"; - } - - $indexCols .= $this->formatColsRow("{$templateValue},\r"); - } - - // 关联表 - foreach ($this->relationArray as $table => $tableVal) { - $table = CommonTool::lineToHump($table); - foreach ($tableVal['tableColumns'] as $field => $val) { - if ($val['formType'] == 'image') { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.image}"; - } elseif ($val['formType'] == 'images') { - continue; - } elseif ($val['formType'] == 'file') { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.url}"; - } elseif ($val['formType'] == 'files') { - continue; - } elseif ($val['formType'] == 'editor') { - continue; - } elseif ($val['formType'] == 'select') { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}'}"; - } elseif (in_array($field, ['remark'])) { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.text}"; - } elseif (in_array($field, $this->switchFields)) { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.switch}"; - } elseif (in_array($field, $this->sortFields)) { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', edit: 'text'}"; - } else { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}'}"; - } - - $indexCols .= $this->formatColsRow("{$templateValue},\r"); - } - } - - $indexCols .= $this->formatColsRow("{width: 250, title: '操作', templet: ea.table.tool},\r"); - - $jsValue = CommonTool::replaceTemplate( - $this->getTemplate("static{$this->DS}js"), - [ - 'controllerUrl' => $this->controllerUrl, - 'indexCols' => $indexCols, - ]); - $this->fileList[$jsFile] = $jsValue; - return $this; - } - - /** - * 检测文件 - * @return $this - */ - protected function check() - { - // 是否强制性 - if ($this->force) { - return $this; - } - foreach ($this->fileList as $key => $val) { - if (is_file($key)) { - throw new FileException("文件已存在:{$key}"); - } - } - return $this; - } - - /** - * 开始生成 - * @return array - */ - public function create() - { - $this->check(); - foreach ($this->fileList as $key => $val) { - - // 判断文件夹是否存在,不存在就创建 - $fileArray = explode($this->DS, $key); - array_pop($fileArray); - $fileDir = implode($this->DS, $fileArray); - if (!is_dir($fileDir)) { - mkdir($fileDir, 0775, true); - } - - // 写入 - file_put_contents($key, $val); - } - return array_keys($this->fileList); - } - - /** - * 开始删除 - * @return array - */ - public function delete() - { - $deleteFile = []; - foreach ($this->fileList as $key => $val) { - if (is_file($key)) { - unlink($key); - $deleteFile[] = $key; - } - } - return $deleteFile; - } - - /** - * 检测字段后缀 - * @param $string - * @param $array - * @return bool - */ - protected function checkContain($string, $array) - { - foreach ($array as $vo) { - if (substr($string, 0, strlen($vo)) === $vo) { - return true; - } - } - return false; - } - - /** - * 格式化表单行 - * @param $value - * @return string - */ - protected function formatColsRow($value) - { - return " {$value}"; - } - - /** - * 获取对应的模板信息 - * @param $name - * @return false|string - */ - protected function getTemplate($name) - { - return file_get_contents("{$this->dir}{$this->DS}templates{$this->DS}{$name}.code"); - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/exceptions/CurdException.php b/vendor/zhongshaofa/easy-admin/src/curd/exceptions/CurdException.php deleted file mode 100644 index b9f6abd7..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/exceptions/CurdException.php +++ /dev/null @@ -1,10 +0,0 @@ -model = new {{modelFilename}}(); - {{selectList}} - } - - {{indexMethod}} -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/controller/indexMethod.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/controller/indexMethod.code deleted file mode 100644 index d1a67242..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/controller/indexMethod.code +++ /dev/null @@ -1,31 +0,0 @@ - - /** - * @NodeAnotation(title="列表") - */ - public function index() - { - if ($this->request->isAjax()) { - if (input('selectFields')) { - return $this->selectList(); - } - list($page, $limit, $where) = $this->buildTableParames(); - $count = $this->model - {{relationIndexMethod}} - ->where($where) - ->count(); - $list = $this->model - {{relationIndexMethod}} - ->where($where) - ->page($page, $limit) - ->order($this->sort) - ->select(); - $data = [ - 'code' => 0, - 'msg' => '', - 'count' => $count, - 'data' => $list, - ]; - return json($data); - } - return $this->fetch(); - } \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/controller/select.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/controller/select.code deleted file mode 100644 index ad29a0a4..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/controller/select.code +++ /dev/null @@ -1,2 +0,0 @@ - - $this->assign('{{name}}', $this->model->{{name}}()); diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/model/model.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/model/model.code deleted file mode 100644 index 8194111d..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/model/model.code +++ /dev/null @@ -1,17 +0,0 @@ -belongsTo('{{relationModel}}', '{{foreignKey}}', '{{primaryKey}}'); - } diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/model/relationSelect.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/model/relationSelect.code deleted file mode 100644 index 60a45bf4..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/model/relationSelect.code +++ /dev/null @@ -1,5 +0,0 @@ - - public function {{name}}() - { - return \app\admin\model\{{relation}}::column('{{values}}', 'id'); - } \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/model/select.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/model/select.code deleted file mode 100644 index 847252ea..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/model/select.code +++ /dev/null @@ -1,5 +0,0 @@ - - public function {{name}}() - { - return {{values}}; - } diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/static/js.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/static/js.code deleted file mode 100644 index 588bd387..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/static/js.code +++ /dev/null @@ -1,34 +0,0 @@ -define(["jquery", "easy-admin"], function ($, ea) { - - var init = { - table_elem: '#currentTable', - table_render_id: 'currentTableRenderId', - index_url: '{{controllerUrl}}/index', - add_url: '{{controllerUrl}}/add', - edit_url: '{{controllerUrl}}/edit', - delete_url: '{{controllerUrl}}/delete', - export_url: '{{controllerUrl}}/export', - modify_url: '{{controllerUrl}}/modify', - }; - - var Controller = { - - index: function () { - ea.table.render({ - init: init, - cols: [[ - {{indexCols}} - ]], - }); - - ea.listen(); - }, - add: function () { - ea.listen(); - }, - edit: function () { - ea.listen(); - }, - }; - return Controller; -}); \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/form.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/form.code deleted file mode 100644 index 9e92c33d..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/form.code +++ /dev/null @@ -1,11 +0,0 @@ -
    -
    - {{formList}} -
    -
    - - -
    - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/index.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/index.code deleted file mode 100644 index 2e936eb4..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/index.code +++ /dev/null @@ -1,10 +0,0 @@ -
    -
    - -
    -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/checkbox.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/checkbox.code deleted file mode 100644 index d9f1b1d2..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/checkbox.code +++ /dev/null @@ -1,7 +0,0 @@ - -
    - -
    -{{define}} -
    -
    diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/checkboxInput.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/checkboxInput.code deleted file mode 100644 index 3a3bddf5..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/checkboxInput.code +++ /dev/null @@ -1,3 +0,0 @@ - {foreach ${{name}} as $k=>$v} - - {/foreach} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/date.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/date.code deleted file mode 100644 index 8458b4b5..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/date.code +++ /dev/null @@ -1,7 +0,0 @@ - -
    - -
    - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/editor.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/editor.code deleted file mode 100644 index cbd88dcb..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/editor.code +++ /dev/null @@ -1,7 +0,0 @@ - -
    - -
    - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/file.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/file.code deleted file mode 100644 index ddd903aa..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/file.code +++ /dev/null @@ -1,11 +0,0 @@ - -
    - -
    - - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/files.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/files.code deleted file mode 100644 index fe65d0ea..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/files.code +++ /dev/null @@ -1,11 +0,0 @@ - -
    - -
    - - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/image.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/image.code deleted file mode 100644 index ff6bee1c..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/image.code +++ /dev/null @@ -1,11 +0,0 @@ - -
    - -
    - - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/images.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/images.code deleted file mode 100644 index 58329db5..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/images.code +++ /dev/null @@ -1,11 +0,0 @@ - -
    - -
    - - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/input.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/input.code deleted file mode 100644 index 7656fcd1..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/input.code +++ /dev/null @@ -1,7 +0,0 @@ - -
    - -
    - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/option.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/option.code deleted file mode 100644 index 7593045c..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/option.code +++ /dev/null @@ -1,4 +0,0 @@ - - {foreach ${{name}} as $k=>$v} - - {/foreach} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/radio.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/radio.code deleted file mode 100644 index d9f1b1d2..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/radio.code +++ /dev/null @@ -1,7 +0,0 @@ - -
    - -
    -{{define}} -
    -
    diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/radioInput.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/radioInput.code deleted file mode 100644 index 1a033ecd..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/radioInput.code +++ /dev/null @@ -1,3 +0,0 @@ - {foreach ${{name}} as $k=>$v} - - {/foreach} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/select.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/select.code deleted file mode 100644 index c638a792..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/select.code +++ /dev/null @@ -1,9 +0,0 @@ - -
    - -
    - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/textarea.code b/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/textarea.code deleted file mode 100644 index c7bc9841..00000000 --- a/vendor/zhongshaofa/easy-admin/src/curd/templates/view/module/textarea.code +++ /dev/null @@ -1,7 +0,0 @@ - -
    - -
    - -
    -
    \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/tool/CommonTool.php b/vendor/zhongshaofa/easy-admin/src/tool/CommonTool.php deleted file mode 100644 index 26d52fdc..00000000 --- a/vendor/zhongshaofa/easy-admin/src/tool/CommonTool.php +++ /dev/null @@ -1,108 +0,0 @@ - $val) { - $string = str_replace("{{" . $key . "}}", $val, $string); - } - return $string; - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/FileBase.php b/vendor/zhongshaofa/easy-admin/src/upload/FileBase.php deleted file mode 100644 index b887910d..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/FileBase.php +++ /dev/null @@ -1,130 +0,0 @@ -uploadType = $value; - return $this; - } - - /** - * 设置上传配置 - * @param $value - * @return $this - */ - public function setUploadConfig($value) - { - $this->uploadConfig = $value; - return $this; - } - - /** - * 设置上传配置 - * @param $value - * @return $this - */ - public function setFile($value) - { - $this->file = $value; - return $this; - } - - /** - * 设置保存文件数据表 - * @param $value - * @return $this - */ - public function setTableName($value) - { - $this->tableName = $value; - return $this; - } - - /** - * 保存文件 - */ - public function save() - { - $this->completeFilePath = Filesystem::disk('public')->putFile('upload', $this->file); - $this->completeFileUrl = request()->domain() . '/' . str_replace(DIRECTORY_SEPARATOR, '/', $this->completeFilePath); - } - - /** - * 删除保存在本地的文件 - * @return bool|string - */ - public function rmLocalSave() - { - try { - $rm = unlink($this->completeFilePath); - } catch (\Exception $e) { - return $e->getMessage(); - } - return $rm; - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/Uploadfile.php b/vendor/zhongshaofa/easy-admin/src/upload/Uploadfile.php deleted file mode 100644 index c2cf5446..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/Uploadfile.php +++ /dev/null @@ -1,138 +0,0 @@ -file = $value; - return $this; - } - - /** - * 设置上传文件 - * @param $value - * @return $this - */ - public function setUploadConfig($value) - { - $this->uploadConfig = $value; - return $this; - } - - /** - * 设置上传方式 - * @param $value - * @return $this - */ - public function setUploadType($value) - { - $this->uploadType = $value; - return $this; - } - - /** - * 设置保存数据表 - * @param $value - * @return $this - */ - public function setTableName($value) - { - $this->tableName = $value; - return $this; - } - - /** - * 保存文件 - * @return array|void - */ - public function save() - { - $obj = null; - if ($this->uploadType == 'local') { - $obj = new Local(); - } elseif ($this->uploadType == 'alioss') { - $obj = new Alioss(); - } elseif ($this->uploadType == 'qnoss') { - $obj = new Qnoss(); - } elseif ($this->uploadType == 'txcos') { - $obj = new Txcos(); - } - $save = $obj->setUploadConfig($this->uploadConfig) - ->setUploadType($this->uploadType) - ->setTableName($this->tableName) - ->setFile($this->file) - ->save(); - return $save; - } -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/driver/Alioss.php b/vendor/zhongshaofa/easy-admin/src/upload/driver/Alioss.php deleted file mode 100644 index 9e5da852..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/driver/Alioss.php +++ /dev/null @@ -1,50 +0,0 @@ -uploadConfig) - ->save($this->completeFilePath, $this->completeFilePath); - if ($upload['save'] == true) { - SaveDb::trigger($this->tableName, [ - 'upload_type' => $this->uploadType, - 'original_name' => $this->file->getOriginalName(), - 'mime_type' => $this->file->getOriginalMime(), - 'file_ext' => strtolower($this->file->getOriginalExtension()), - 'url' => $upload['url'], - 'create_time' => time(), - ]); - } - $this->rmLocalSave(); - return $upload; - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/driver/Local.php b/vendor/zhongshaofa/easy-admin/src/upload/driver/Local.php deleted file mode 100644 index 8f759bdd..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/driver/Local.php +++ /dev/null @@ -1,48 +0,0 @@ -tableName, [ - 'upload_type' => $this->uploadType, - 'original_name' => $this->file->getOriginalName(), - 'mime_type' => $this->file->getOriginalMime(), - 'file_ext' => strtolower($this->file->getOriginalExtension()), - 'url' => $this->completeFileUrl, - 'create_time' => time(), - ]); - return [ - 'save' => true, - 'msg' => '上传成功', - 'url' => $this->completeFileUrl, - ]; - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/driver/Qnoss.php b/vendor/zhongshaofa/easy-admin/src/upload/driver/Qnoss.php deleted file mode 100644 index f11b8d90..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/driver/Qnoss.php +++ /dev/null @@ -1,50 +0,0 @@ -uploadConfig) - ->save($this->completeFilePath, $this->completeFilePath); - if ($upload['save'] == true) { - SaveDb::trigger($this->tableName, [ - 'upload_type' => $this->uploadType, - 'original_name' => $this->file->getOriginalName(), - 'mime_type' => $this->file->getOriginalMime(), - 'file_ext' => strtolower($this->file->getOriginalExtension()), - 'url' => $upload['url'], - 'create_time' => time(), - ]); - } - $this->rmLocalSave(); - return $upload; - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/driver/Txcos.php b/vendor/zhongshaofa/easy-admin/src/upload/driver/Txcos.php deleted file mode 100644 index 1568f61d..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/driver/Txcos.php +++ /dev/null @@ -1,50 +0,0 @@ -uploadConfig) - ->save($this->completeFilePath, $this->completeFilePath); - if ($upload['save'] == true) { - SaveDb::trigger($this->tableName, [ - 'upload_type' => $this->uploadType, - 'original_name' => $this->file->getOriginalName(), - 'mime_type' => $this->file->getOriginalMime(), - 'file_ext' => strtolower($this->file->getOriginalExtension()), - 'url' => $upload['url'], - 'create_time' => time(), - ]); - } - $this->rmLocalSave(); - return $upload; - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/driver/alioss/Oss.php b/vendor/zhongshaofa/easy-admin/src/upload/driver/alioss/Oss.php deleted file mode 100644 index aa977e13..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/driver/alioss/Oss.php +++ /dev/null @@ -1,78 +0,0 @@ -accessKeyId = $config['alioss_access_key_id']; - $this->accessKeySecret = $config['alioss_access_key_secret']; - $this->endpoint = $config['alioss_endpoint']; - $this->bucket = $config['alioss_bucket']; - $this->domain = $config['alioss_domain']; - $this->ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint); - return $this; - } - - public static function instance($config) - { - if (is_null(self::$instance)) { - self::$instance = new static($config); - } - return self::$instance; - } - - public function save($objectName,$filePath) - { - try { - $upload = $this->ossClient->uploadFile($this->bucket, $objectName, $filePath); - } catch (OssException $e) { - return [ - 'save' => false, - 'msg' => $e->getMessage(), - ]; - } - if (!isset($upload['info']['url'])) { - return [ - 'save' => false, - 'msg' => '保存失败', - ]; - } - return [ - 'save' => true, - 'msg' => '上传成功', - 'url' => $upload['info']['url'], - ]; - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/driver/qnoss/Oss.php b/vendor/zhongshaofa/easy-admin/src/upload/driver/qnoss/Oss.php deleted file mode 100644 index 2eb8c8d1..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/driver/qnoss/Oss.php +++ /dev/null @@ -1,72 +0,0 @@ -accessKey = $config['qnoss_access_key']; - $this->secretKey = $config['qnoss_secret_key']; - $this->bucket = $config['qnoss_bucket']; - $this->domain = $config['qnoss_domain']; - $this->auth = new Auth($this->accessKey, $this->secretKey); - return $this; - } - - public static function instance($config) - { - if (is_null(self::$instance)) { - self::$instance = new static($config); - } - return self::$instance; - } - - public function save($objectName, $filePath) - { - $token = $this->auth->uploadToken($this->bucket); - $uploadMgr = new UploadManager(); - list($result, $error) = $uploadMgr->putFile($token, $objectName, $filePath); - if ($error !== null) { - return [ - 'save' => false, - 'msg' => '保存失败', - ]; - } else { - return [ - 'save' => true, - 'msg' => '上传成功', - 'url' => $this->domain . '/' . $result['key'], - ]; - } - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/src/upload/driver/txcos/Cos.php b/vendor/zhongshaofa/easy-admin/src/upload/driver/txcos/Cos.php deleted file mode 100644 index 9fcf000a..00000000 Binary files a/vendor/zhongshaofa/easy-admin/src/upload/driver/txcos/Cos.php and /dev/null differ diff --git a/vendor/zhongshaofa/easy-admin/src/upload/interfaces/OssDriver.php b/vendor/zhongshaofa/easy-admin/src/upload/interfaces/OssDriver.php deleted file mode 100644 index 1ab511cd..00000000 --- a/vendor/zhongshaofa/easy-admin/src/upload/interfaces/OssDriver.php +++ /dev/null @@ -1,20 +0,0 @@ -save($data); - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/easy-admin/tests/.gitignore b/vendor/zhongshaofa/easy-admin/tests/.gitignore deleted file mode 100644 index a09c56df..00000000 --- a/vendor/zhongshaofa/easy-admin/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.idea diff --git a/vendor/zhongshaofa/easy-admin/tests/AnnotationTest.php b/vendor/zhongshaofa/easy-admin/tests/AnnotationTest.php deleted file mode 100644 index d0fc46f0..00000000 --- a/vendor/zhongshaofa/easy-admin/tests/AnnotationTest.php +++ /dev/null @@ -1,38 +0,0 @@ -getNodelist(); - - $this->assertNotEmpty($list); - $this->assertIsArray($list); - $this->assertEquals(count($list), 13); - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/thinkphp-log-trace/.gitignore b/vendor/zhongshaofa/thinkphp-log-trace/.gitignore deleted file mode 100644 index fae68b08..00000000 --- a/vendor/zhongshaofa/thinkphp-log-trace/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.history/ -vendor/ -.idea \ No newline at end of file diff --git a/vendor/zhongshaofa/thinkphp-log-trace/composer.json b/vendor/zhongshaofa/thinkphp-log-trace/composer.json deleted file mode 100644 index f72610ef..00000000 --- a/vendor/zhongshaofa/thinkphp-log-trace/composer.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "zhongshaofa/thinkphp-log-trace", - "description": "thinkphp6链路日志组件", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "zhongshaofa", - "email": "2286732552@qq.com" - } - ], - "minimum-stability": "stable", - "require": { - "php": ">=7.1.0", - "ext-json": "*" - }, - "require-dev": { - "topthink/framework": "^6.0.0", - "mockery/mockery": "^1.3.0", - "phpunit/phpunit": "^8.5.0" - }, - "autoload": { - "psr-4": { - "LogTrace\\": "src", - "Test\\": "tests" - } - }, - "scripts": { - "test": "phpunit --testdox" - } -} diff --git a/vendor/zhongshaofa/thinkphp-log-trace/composer.lock b/vendor/zhongshaofa/thinkphp-log-trace/composer.lock deleted file mode 100644 index da1fc85c..00000000 --- a/vendor/zhongshaofa/thinkphp-log-trace/composer.lock +++ /dev/null @@ -1,2727 +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": "106d9c123bd66e684f2a6e7e65fc1408", - "packages": [], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "type": "library", - "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": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2020-11-10T18:47:58+00:00" - }, - { - "name": "hamcrest/hamcrest-php", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.3|^7.0|^8.0" - }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" - }, - "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "hamcrest" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "This is the PHP port of Hamcrest Matchers", - "keywords": [ - "test" - ], - "support": { - "issues": "https://github.com/hamcrest/hamcrest-php/issues", - "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" - }, - "time": "2020-07-09T08:09:16+00:00" - }, - { - "name": "league/flysystem", - "version": "1.1.5", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "18634df356bfd4119fe3d6156bdb990c414c14ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/18634df356bfd4119fe3d6156bdb990c414c14ea", - "reference": "18634df356bfd4119fe3d6156bdb990c414c14ea", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-fileinfo": "*", - "league/mime-type-detection": "^1.3", - "php": "^7.2.5 || ^8.0" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "phpspec/prophecy": "^1.11.1", - "phpunit/phpunit": "^8.5.8" - }, - "suggest": { - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "support": { - "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/1.1.5" - }, - "funding": [ - { - "url": "https://offset.earth/frankdejonge", - "type": "other" - } - ], - "time": "2021-08-17T13:49:42+00:00" - }, - { - "name": "league/flysystem-cached-adapter", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", - "reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/d1925efb2207ac4be3ad0c40b8277175f99ffaff", - "reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "league/flysystem": "~1.0", - "psr/cache": "^1.0.0" - }, - "require-dev": { - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12" - }, - "suggest": { - "ext-phpredis": "Pure C implemented extension for PHP" - }, - "type": "library", - "autoload": { - "psr-4": { - "League\\Flysystem\\Cached\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "frankdejonge", - "email": "info@frenky.net" - } - ], - "description": "An adapter decorator to enable meta-data caching.", - "support": { - "issues": "https://github.com/thephpleague/flysystem-cached-adapter/issues", - "source": "https://github.com/thephpleague/flysystem-cached-adapter/tree/master" - }, - "time": "2020-07-25T15:56:04+00:00" - }, - { - "name": "league/mime-type-detection", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", - "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-fileinfo": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.18", - "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "League\\MimeTypeDetection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frankdejonge.nl" - } - ], - "description": "Mime-type detection for Flysystem", - "support": { - "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0" - }, - "funding": [ - { - "url": "https://github.com/frankdejonge", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/league/flysystem", - "type": "tidelift" - } - ], - "time": "2021-01-18T20:58:21+00:00" - }, - { - "name": "mockery/mockery", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/mockery/mockery.git", - "reference": "d1339f64479af1bee0e82a0413813fe5345a54ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/d1339f64479af1bee0e82a0413813fe5345a54ea", - "reference": "d1339f64479af1bee0e82a0413813fe5345a54ea", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "hamcrest/hamcrest-php": "^2.0.1", - "lib-pcre": ">=7.0", - "php": "^7.3 || ^8.0" - }, - "conflict": { - "phpunit/phpunit": "<8.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-0": { - "Mockery": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - }, - { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" - } - ], - "description": "Mockery is a simple yet flexible PHP mock object framework", - "homepage": "https://github.com/mockery/mockery", - "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" - ], - "support": { - "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.4.3" - }, - "time": "2021-02-24T09:51:49+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.10.2", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "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" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2020-11-13T09:40:50+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "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": "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)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" - }, - "time": "2021-07-20T11:28:43+00:00" - }, - { - "name": "phar-io/version", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.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", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" - }, - "time": "2021-02-23T14:00:09+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.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" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.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" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" - }, - "time": "2020-09-03T19:13:55+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.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": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" - }, - "time": "2020-09-17T18:55:26+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.13.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "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" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" - }, - "time": "2021-03-17T13:42:18+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "7.0.15", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "819f92bba8b001d4363065928088de22f25a3a48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", - "reference": "819f92bba8b001d4363065928088de22f25a3a48", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": ">=7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.3 || ^4.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1.3" - }, - "require-dev": { - "phpunit/phpunit": "^8.2.2" - }, - "suggest": { - "ext-xdebug": "^2.7.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.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" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-07-26T12:20:09+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "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" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-07-19T06:46:01+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": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" - }, - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "2.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-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" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T08:20:02+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", - "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.3 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.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" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "abandoned": true, - "time": "2020-08-04T08:28:15+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "8.5.20", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9deefba183198398a09b927a6ac6bc1feb0b7b70" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9deefba183198398a09b927a6ac6bc1feb0b7b70", - "reference": "9deefba183198398a09b927a6ac6bc1feb0b7b70", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "doctrine/instantiator": "^1.3.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.0", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.2", - "phpspec/prophecy": "^1.10.3", - "phpunit/php-code-coverage": "^7.0.12", - "phpunit/php-file-iterator": "^2.0.4", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.3", - "sebastian/exporter": "^3.1.2", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.5-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" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.20" - }, - "funding": [ - { - "url": "https://phpunit.de/donate.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-08-31T06:44:38+00:00" - }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "support": { - "source": "https://github.com/php-fig/cache/tree/master" - }, - "time": "2016-08-06T20:24:11+00:00" - }, - { - "name": "psr/container", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.2.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" - }, - "time": "2021-03-05T17:36:06+00:00" - }, - { - "name": "psr/log", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, - "time": "2021-05-03T11:20:27+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" - }, - "time": "2017-10-23T01:57:42+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "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/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T08:15:22+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "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" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T08:04:30+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:59:04+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-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" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:53:42+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:47:53+00:00" - }, - { - "name": "sebastian/global-state", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "474fb9edb7ab891665d3bfc6317f42a0a150454b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/474fb9edb7ab891665d3bfc6317f42a0a150454b", - "reference": "474fb9edb7ab891665d3bfc6317f42a0a150454b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^8.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "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": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:43:24+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:40:27+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:37:18+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:34:24+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "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": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "abandoned": true, - "time": "2020-11-30T07:30:19+00:00" - }, - { - "name": "sebastian/type", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.2" - }, - "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", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:25:11+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": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "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", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/master" - }, - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.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", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "topthink/framework", - "version": "v6.0.9", - "source": { - "type": "git", - "url": "https://github.com/top-think/framework.git", - "reference": "0b5fb453f0e533de3af3a1ab6a202510b61be617" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/0b5fb453f0e533de3af3a1ab6a202510b61be617", - "reference": "0b5fb453f0e533de3af3a1ab6a202510b61be617", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-json": "*", - "ext-mbstring": "*", - "league/flysystem": "^1.1.4", - "league/flysystem-cached-adapter": "^1.0", - "php": ">=7.2.5", - "psr/container": "~1.0", - "psr/log": "~1.0", - "psr/simple-cache": "^1.0", - "topthink/think-helper": "^3.1.1", - "topthink/think-orm": "^2.0" - }, - "require-dev": { - "mikey179/vfsstream": "^1.6", - "mockery/mockery": "^1.2", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "autoload": { - "files": [], - "psr-4": { - "think\\": "src/think/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - }, - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "The ThinkPHP Framework.", - "homepage": "http://thinkphp.cn/", - "keywords": [ - "framework", - "orm", - "thinkphp" - ], - "support": { - "issues": "https://github.com/top-think/framework/issues", - "source": "https://github.com/top-think/framework/tree/v6.0.9" - }, - "time": "2021-07-22T03:24:49+00:00" - }, - { - "name": "topthink/think-helper", - "version": "v3.1.5", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-helper.git", - "reference": "f98e3ad44acd27ae85a4d923b1bdfd16c6d8d905" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-helper/zipball/f98e3ad44acd27ae85a4d923b1bdfd16c6d8d905", - "reference": "f98e3ad44acd27ae85a4d923b1bdfd16c6d8d905", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=7.1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "think\\": "src" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "The ThinkPHP6 Helper Package", - "support": { - "issues": "https://github.com/top-think/think-helper/issues", - "source": "https://github.com/top-think/think-helper/tree/v3.1.5" - }, - "time": "2021-06-21T06:17:31+00:00" - }, - { - "name": "topthink/think-orm", - "version": "v2.0.44", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-orm.git", - "reference": "5d3d5c1ebf8bfccf34bacd90edb42989b16ea409" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-orm/zipball/5d3d5c1ebf8bfccf34bacd90edb42989b16ea409", - "reference": "5d3d5c1ebf8bfccf34bacd90edb42989b16ea409", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-json": "*", - "ext-pdo": "*", - "php": ">=7.1.0", - "psr/log": "~1.0", - "psr/simple-cache": "^1.0", - "topthink/think-helper": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7|^8|^9.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "think\\": "src" - }, - "files": [ - "stubs/load_stubs.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "description": "think orm", - "keywords": [ - "database", - "orm" - ], - "support": { - "issues": "https://github.com/top-think/think-orm/issues", - "source": "https://github.com/top-think/think-orm/tree/v2.0.44" - }, - "time": "2021-07-21T02:22:31+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-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" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.1.0", - "ext-json": "*" - }, - "platform-dev": [], - "plugin-api-version": "2.0.0" -} diff --git a/vendor/zhongshaofa/thinkphp-log-trace/src/FileLog.php b/vendor/zhongshaofa/thinkphp-log-trace/src/FileLog.php deleted file mode 100644 index c56ea927..00000000 --- a/vendor/zhongshaofa/thinkphp-log-trace/src/FileLog.php +++ /dev/null @@ -1,76 +0,0 @@ -getMasterLogFile(); - - $path = dirname($destination); - !is_dir($path) && mkdir($path, 0755, true); - - $info = []; - - // 日志信息封装 - $time = \DateTime::createFromFormat('0.u00 U', microtime())->setTimezone(new \DateTimeZone(date_default_timezone_get()))->format($this->config['time_format']); - - foreach ($log as $type => $val) { - $message = []; - foreach ($val as $msg) { - if (!is_string($msg) && !is_array($msg)) { - $msg = var_export($msg, true); - } - - $message[] = $this->config['json'] ? - json_encode(['time' => $time, 'type' => $type, 'msg' => $msg, 'traceId' => TraceId::getTraceId()], $this->config['json_options']) : - sprintf($this->config['format'], $time, $type, $msg); - } - - if (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level'])) { - // 独立记录的日志级别 - $filename = $this->getApartLevelFile($path, $type); - $this->write($message, $filename); - continue; - } - - $info[$type] = $message; - } - - if ($info) { - return $this->write($info, $destination); - } - - return true; - } - - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/thinkphp-log-trace/src/IdCreate.php b/vendor/zhongshaofa/thinkphp-log-trace/src/IdCreate.php deleted file mode 100644 index 34114df7..00000000 --- a/vendor/zhongshaofa/thinkphp-log-trace/src/IdCreate.php +++ /dev/null @@ -1,69 +0,0 @@ -nextId(); - } - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/thinkphp-log-trace/src/SnowFlake.php b/vendor/zhongshaofa/thinkphp-log-trace/src/SnowFlake.php deleted file mode 100644 index 46da6aa4..00000000 --- a/vendor/zhongshaofa/thinkphp-log-trace/src/SnowFlake.php +++ /dev/null @@ -1,112 +0,0 @@ - $this->maxWorkerId || $workerId < 0) { - throw new Exception("worker Id can't be greater than {$this->maxWorkerId} or less than 0"); - } - - if ($datacenterId > $this->maxDatacenterId || $datacenterId < 0) { - throw new Exception("datacenter Id can't be greater than {$this->maxDatacenterId} or less than 0"); - } - - $this->workerId = $workerId; - $this->datacenterId = $datacenterId; - $this->sequence = $sequence; - } - - public function nextId() - { - $timestamp = $this->timeGen(); - - if ($timestamp < $this->lastTimestamp) { - $diffTimestamp = bcsub($this->lastTimestamp, $timestamp); - throw new Exception("Clock moved backwards. Refusing to generate id for {$diffTimestamp} milliseconds"); - } - - if ($this->lastTimestamp == $timestamp) { - $this->sequence = ($this->sequence + 1) & $this->sequenceMask; - - if (0 == $this->sequence) { - $timestamp = $this->tilNextMillis($this->lastTimestamp); - } - } else { - $this->sequence = 0; - } - - $this->lastTimestamp = $timestamp; - - /*$gmpTimestamp = gmp_init($this->leftShift(bcsub($timestamp, self::TWEPOCH), $this->timestampLeftShift)); - $gmpDatacenterId = gmp_init($this->leftShift($this->datacenterId, $this->datacenterIdShift)); - $gmpWorkerId = gmp_init($this->leftShift($this->workerId, $this->workerIdShift)); - $gmpSequence = gmp_init($this->sequence); - return gmp_strval(gmp_or(gmp_or(gmp_or($gmpTimestamp, $gmpDatacenterId), $gmpWorkerId), $gmpSequence));*/ - - return (($timestamp - self::TWEPOCH) << $this->timestampLeftShift) | - ($this->datacenterId << $this->datacenterIdShift) | - ($this->workerId << $this->workerIdShift) | - $this->sequence; - } - - protected function tilNextMillis($lastTimestamp) - { - $timestamp = $this->timeGen(); - while ($timestamp <= $lastTimestamp) { - $timestamp = $this->timeGen(); - } - - return $timestamp; - } - - protected function timeGen() - { - return floor(microtime(true) * 1000); - } - - // 左移 << - protected function leftShift($a, $b) - { - return bcmul($a, bcpow(2, $b)); - } -} \ No newline at end of file diff --git a/vendor/zhongshaofa/thinkphp-log-trace/src/TraceId.php b/vendor/zhongshaofa/thinkphp-log-trace/src/TraceId.php deleted file mode 100644 index 29dc801b..00000000 --- a/vendor/zhongshaofa/thinkphp-log-trace/src/TraceId.php +++ /dev/null @@ -1,54 +0,0 @@ -assertIsInt($id); - } - - public function testCreateBatch() - { - $array = []; - $i = 0; - while ($i < 1000) { - $array[] = IdCreate::createOnlyId(); - $i++; - } - $this->assertNotEmpty($array); - $this->assertEquals(count($array), 1000); - $uniqueArray = array_unique($array); - $this->assertEquals(count($uniqueArray), 1000); - } - - -} \ No newline at end of file diff --git a/vendor/zhongshaofa/thinkphp-log-trace/tests/TraceIdTest.php b/vendor/zhongshaofa/thinkphp-log-trace/tests/TraceIdTest.php deleted file mode 100644 index 06bcdadf..00000000 --- a/vendor/zhongshaofa/thinkphp-log-trace/tests/TraceIdTest.php +++ /dev/null @@ -1,49 +0,0 @@ -assertEquals($traceId1, $traceId2); - } - - public function testTraceIdReset() - { - $traceId1 = TraceId::getTraceId(); - TraceId::reset(); - $traceId2 = TraceId::getTraceId(); - $this->assertNotEquals($traceId1, $traceId2); - } - - public function testTraceIdSet() - { - $definitionID = md5(time()); - TraceId::setTraceId($definitionID); - $traceId = TraceId::getTraceId(); - $this->assertEquals($traceId, $definitionID); - } - -} \ No newline at end of file